fdabrandao / vpsolver

Arc-flow Vector Packing Solver (VPSolver)
http://vpsolver.fdabrandao.pt
BSD 3-Clause "New" or "Revised" License
99 stars 26 forks source link

Error: free(): double free detected in tcache 2 #8

Open S1LV3RJ1NX opened 2 years ago

S1LV3RJ1NX commented 2 years ago

Hello, I am getting this wierd error stating:

>>> vbpsol...
VPSolver 3.1.3, Copyright (C) 2013-2016, Filipe Brandao
free(): double free detected in tcache 2
/data/prathamesh_home/bin_packing_heuristics/venv/bin/vpsolver_scip.sh: line 186: 2406799 Aborted                 
(core dumped) vbpsol $afg_file $TMP_DIR/vars.sol $vbpsol_opts

Even after optimizers like GUROBI or SCIP state optimal solution found, during vbpsol phase I get this error.

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 148.32
Solving Nodes      : 1
Primal Bound       : +3.00000000000000e+00 (1 solutions)
Dual Bound         : +3.00000000000000e+00
Gap                : 0.00 %

How to fix?

fdabrandao commented 2 years ago

@S1LV3RJ1NX, could you please provide the instance that results in this error?

S1LV3RJ1NX commented 2 years ago

@fdabrandao I am using this in my simulator where the requests are converted to MVP format at runtime. Hence it would be difficult to share the instance. The scenario is I take a batch of requests and fit it into bins, then whatever bin sizes are remaining, I use the next batch of requests to fit into these newly sized bins. It satisfies a certain number of requests, but after some time, it fails and throws the above error.

Things I have checked:

What is the meaning of this error ?

fdabrandao commented 2 years ago

Can you modify the application to display the MVP file before solving so that you can see the one that resulted in the error? This error means that something went wrong while retrieving the solution from the arc-flow graph. Having the MVP instance that caused this would be really important to know what went wrong.

S1LV3RJ1NX commented 2 years ago

Yaa, I totally understand. Hence, I have quickly made a subset of my program that will help you run this. It gives the same error. Please have a look at it. binpacking.zip

S1LV3RJ1NX commented 2 years ago

Hello @fdabrandao, did you find the issue?

fdabrandao commented 2 years ago

@S1LV3RJ1NX, I still haven't found the exact same issue you had yet but I got a different error. One thing I noticed is that you use many bin types for bins of the same size. It makes more sense to group bin types that share the same size and cost.

fdabrandao commented 2 years ago

With the modified script bin_packing_v2.py.zip, I obtained the following solution:

Objective: 3
Solution:
Bins of type 1: 3 bins
1 x [i=1 opt=1, i=2 opt=1, i=4 opt=1, i=5 opt=1, i=6 opt=1, i=7 opt=1, i=8 opt=1, i=9 opt=1, i=10 opt=1, i=11 opt=1, i=12 opt=1, i=13 opt=1, i=14 opt=1, i=15 opt=1, i=16 opt=1, i=17 opt=1, i=18 opt=1, i=19 opt=1, i=20 opt=1, i=25 opt=1, i=26 opt=1, i=27 opt=1, i=28 opt=1, i=31 opt=1, i=32 opt=1, i=35 opt=1, i=36 opt=1, i=37 opt=1, i=40 opt=1, i=42 opt=1]
1 x [i=3 opt=1, i=21 opt=1, i=23 opt=1, i=24 opt=1, i=34 opt=1, i=38 opt=1, i=41 opt=1, i=43 opt=1]
1 x [i=22 opt=1, i=29 opt=1, i=30 opt=1, i=33 opt=1, i=39 opt=1]
Bins of type 2: 0 bins
Bins of type 3: 0 bins
S1LV3RJ1NX commented 2 years ago

@fdabrandao I got the exact bins following your code. I am doing bin packing in a phased manner. Once bins are allocated, the remaining space in the bins form my next bins, but after some time I am getting the following assertion error: nfits >= 0, does it mean at that instant there is no bin that can accommodate the request?

fdabrandao commented 2 years ago

@S1LV3RJ1NX, yes, if you get the assertion error for nfits >= 0 it means that some item could not be allocated anywhere and the problem is known to be infeasible immediately.