18 votes
Accepted

Difference between lazy callbacks and using lazy constraints directly

Lazy constraints will only be checked when an MIP solution satisfying all other constraints, including integrality, is found. If you provide all your lazy constraints in advance to CPLEX, for ...
Thiago Serra's user avatar
12 votes
Accepted

How can I implement a user-written lazy constraint callback in concert CPLEX with C++?

You have it almost all right, with a few caveats. Let's say I want to implement a Foo Lazy Constraint: ...
Alberto Santini's user avatar
10 votes
Accepted

When does Gurobi add cuts from callback

Assuming you are using more than a single thread, then Gurobi performs all work you code in the callbacks with a single thread. All remaining threads process the branch and bound nodes (without doing ...
Albert Schrotenboer's user avatar
8 votes

When does Gurobi add cuts from callback

While lazy constraints must be added each time a node is expanded at a branch-and-bound tree, a solver is not obligated to add user cuts at any point in time; it chooses when to add user cuts. If ...
Ryan Cory-Wright's user avatar
7 votes
Accepted

Duals in CPLEX generic callback

At the moment (CPLEX 12.10) querying duals in a relaxation context is not supported. You may want to file a request for enhancement for CPLEX to try to get this into one of the next versions. This is ...
Daniel Junglas's user avatar
7 votes
Accepted

Lazy-Constraints for modelling soft-constraints (CPLEX + rejectCandidate semantics)

CPLEX does not memorize rejected solutions. When you call rejectCandidate, CPLEX adds the violated constraint to a pool of lazy constraints, applies it to the current node and re-solves the LP ...
prubin's user avatar
  • 39.1k
6 votes

Implementing Heuristic Callback in CPLEX C++ API for MILP

Disclaimer: It's been a while since I used Cplex' C++ API. According to your question, you probably rather want to use a generic callback and inject a feasible (heuristic) solution through ...
joni's user avatar
  • 1,572
5 votes
Accepted

Implementing Heuristic Callback in CPLEX C++ API for MILP

As @Joni notes, there is a parameter that controls how much (if any) effort CPLEX spends checking solutions you supply. You can freely mix integer and continuous variables in the call to setSolution, ...
prubin's user avatar
  • 39.1k
5 votes

Program can't stop when using callback of usercut in CPLEX to solve a branch-and-cut problem

This question was also asked and answered on a CPLEX forum and on my blog. Update: The gist of the answer is that when you add a cut in a callback, CPLEX updates the node solution to reflect that cut ...
prubin's user avatar
  • 39.1k
5 votes
Accepted

CPLEX allows manually inserted solutions to violate lazy constraints

I think the answers to both questions are yes. The documentation for LazyConstraintCallback.getSolutionSource says the following: "Note that lazy constraint callbacks are not invoked for solutions ...
prubin's user avatar
  • 39.1k
4 votes

How can I implement a user-written lazy constraint callback in concert CPLEX with C++?

I don't have any C++ code using a lazy constraint callback, although I could show you a Java example if you can't find anything better. The basic approach, IIRC, is to create an instance of class <...
prubin's user avatar
  • 39.1k
4 votes
Accepted

How to determine whether the solution is integer feasible in a CPLEX heuristic callback?

Once you have gotten the values (in the node LP solution) for all variables, you can loop through the integer variables, computing the absolute difference between the value and the nearest integer. If ...
prubin's user avatar
  • 39.1k
3 votes

Using callbacks in pyscipopt

You want a custom separator that doesn't actually do anything. Here's an example: ...
Brannon's user avatar
  • 900
3 votes

Reproducing the CPLEX Output

You can get at least some of the information at every node (not just at the nodes where CPLEX decides to print a log entry) by attaching an information callback. See ...
prubin's user avatar
  • 39.1k
3 votes

Custom lazy callback constraints using Google OR-Tools linear solver?

So the routing library does not use a MIP solver to solve TSP/VRP... problems. So the assumptions of lazy callbacks is just false. The question of goal programming is not that clear. You should look ...
Laurent Perron's user avatar
3 votes

Is there any open source solver for MILP that can output the top N best results instead of the global best?

No, i am not aware of such a solver. However sequentially excluding previously optimal results comes with an additional pitfall: If the solver discovered symmetries and did cut them away you also ...
worldsmithhelper's user avatar
2 votes

Implementing benders decomposition using Lazy and User cuts callback of Cplex

First, I don't understand why you extract the master model, set parameters and add the callback repeatedly inside a loop. When using a callback, the plan is to solve the master problem once, adding ...
prubin's user avatar
  • 39.1k
2 votes
Accepted

Info callback in CPLEX OPL

I am not aware of if informational callbacks can be invoked directly via OPl-CPLEX the same as the low-level programming language. For more details, you can check ...
A.Omidi's user avatar
  • 8,882
1 vote

custom branch and bound on cplex or GAMS

It seems BranchCallback function in cplex. I provide the introduction about BranchCallback on the official website and I did a very simple example by using VS C++ as well. Cplex website https://www....
ytsao's user avatar
  • 386

Only top scored, non community-wiki answers of a minimum length are eligible