scipopt / scip

SCIP - Solving Constraint Integer Programs
Other
406 stars 67 forks source link

Lazy Constraint Question #120

Closed DouBiBaNi closed 1 day ago

DouBiBaNi commented 5 days ago

Dear support team, When solving a TSP-like problem, we change the optimization objective to max and use lazy callback to deal with the subtour. During the subtour elimination process, CONSCHECK and CONSENFOLP were functioning normally, but CONSENFOLP failed to detect subtours. Eventually, the following information was output:

=========ConsCheck called=======
Find sub tour!
=========ConsCheck called=======
Find sub tour!
=========ConsEnfoLP called=======
* 0.0s|     1 |     0 |    19 |     - |    LP  |   0 |  26 |  29 |  29 |   0 |  1 |   0 |   0 | 8.721000e+04 | 8.721000e+04 |   0.00%| unknown

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 0.05
Solving Nodes      : 1
Primal Bound       : +8.72100000000000e+04 (3 solutions)
Dual Bound         : +8.72100000000000e+04
Gap                : 0.00 %
=========ConsCheck called=======
Find sub tour!
best solution is not feasible in original problem

When setting a fixed subtour in CONSENFOLP, we can add lazy constraints correctly. Why CONSENFOLP can't detect the subtour in lazy callback?

DouBiBaNi commented 1 day ago

In CONSENFOLP function, we using SCIP_SOL* sol = SCIPgetBestSol(scip) to get the best solution. It‘s objective value is larger than that of some solutions previously found, and there are no subtours. Therefore, some lazy constraints are not added.

The solution obtained by SCIPgetBestSol is not the smallest objective function. Why is this the case?

DouBiBaNi commented 1 day ago

In CONSENFOLP function, we using SCIP_SOL* sol = SCIPgetBestSol(scip) to get the best solution. It‘s objective value is larger than that of some solutions previously found, and there are no subtours. Therefore, some lazy constraints are not added.

The solution obtained by SCIPgetBestSol is not the smallest objective function. Why is this the case?

This is in a new case, and we change back the max to min.

DouBiBaNi commented 1 day ago

I know what's going on. Although there is no SCIP_SOL* in this consenfolp, SCIP will get its LP solution by default when calling this, so I should not get its best solution in consenfolp.