# Tag Info

### Python vs C++ performance on Discrete Optimization

If you are using a solver (open-source or commercial) to solve a discrete optimization problem, and if the problem is not trivial or extremely easy, chances are very high that the bulk of the ...
• 28.8k
Accepted

### Linear Optimization Library for C++ with GPU Support

For context: most (if not all) major LP solvers are built on 2 algorithms: the simplex method, and the interior-point method. The simplex method is intrinsically sequential: you're doing a lot of (...
• 3,253
Accepted

### How to implement a custom global constraint in IBM's ILOG CP optimizer

The Graph Coloring example shipped with CP optimizer (file: color.cpp in the examples directory): ...
• 3,046

### CPLEX exceeds time limit issue

It could be that you faced the issue described in this bug report. RS03137: CPLEX MAY IGNORE TIME LIMITS ON HIGHLY SYMMETRIC MODELS ON WHICH A NEW INCUMBENT IS FOUND CLOSE TO THE TIME LIMIT. http://...
• 346
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: ...
• 1,993

### Solving multiple easy ILP instances

in order to increase the throughput you could Not only rely on add and remove in "modifying problems" options but on smaller changes. Try to run the instances in parallel Instead of adding a ...
• 3,337
Accepted

### Precedence Constraint in OR-Tools

What you want is: AddLessOrEqual(LinearExpr(starts[j]).AddConstant(durations[j]), starts[succ[j][s]]) You might also want to take a look at the examples (ending ...
• 1,384

### CPLEX exceeds time limit issue

That may be related to the "presolve" phase of the optimization procedure. In large instances, the time for "presolve" may be too large, that makes the total time larger than the specified time-limit. ...
• 2,034
Accepted

### Specify the sense of a constraint in CPLEX

For specifying constraint direction, look to the various IloRange constructors. You can specify both a lower and upper bound (for constraints of the form $b_0 \le a'x \le b_1$, or use a constructor ...
• 28.8k
Accepted

### Correct way to get a dual extreme ray for an infeasible LP in CPLEX / C++

Can you elaborate a bit on what you mean when you say you are getting "Strange values"? One possible explanation is that if you call getDuals() on a model that ...
• 86
Accepted

### Cumulative Constraint OR-Tools

If you look at OR-Tools: CumulativeConstraint, AddCumulative takes a variable as argument, so if it is constant, create a variable with a fixed domain. It returns ...
• 1,649
Accepted

### Check which constraints are violated (Concert - Cplex Studio 12.10 - C++)

You don't actually need to use the MIP start approach. Fix the upper and lower bounds for all your discrete variables to their values in the heuristic solution, then try to solve the model. Assuming ...
• 28.8k

### How exactly does OptionalIntervalVar work in OR-Tools?

In the Python API there is a pretty good docstring of what an OptionalIntervalVar is: An optional interval variable is a constraint, that is itself used in other constraints like NoOverlap. This ...
• 1,384

### Gurobi with C++

There is a dedicated section about C++ programming with Gurobi in the official documentation. There is also a CMake example in the Gurobi Knowledge Base.
• 1,493
Accepted

### Gurobi C++: adding variables with vector

You can use addTerms() to construct a linear expression in one call. According to the documentation this is the most efficient way: You should avoid using expr = expr + x in a loop. It will lead ...
• 1,493
Accepted

### assigning values to IntVar if and only if BoolVar, else zero [or-tools]

To create an intermediate boolean that is true iff s[j] == t you just have to create 2 constraints: ...
• 1,384

### Parallelization of an existing Adaptive Large Neighbourhood Search Heuristic

Another paradigm to parallelize search heuristics is the Backbone strategy. See for example this paper. The main idea is to run multiple instances of an arbitrary heuristic in parallel, and then ...
• 2,735
Accepted

### Gurobi with C++

On macOS, you can find a Makefile inside /Library/gurobi950/macos_universal2/examples/build to compile all examples. Open the Terminal.app and enter the following: <...
• 1,129

### 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 <...
• 28.8k

### ValidateModel or tools in c++ and proto problems

CpModelProto is a protobuf representation of your model in ortools. You create it by using the CpModelBuilder class (your ...
• 1,384

### C++ code for branch and price

Out of the multiple options, the open-source option is Coin-OR's BCP (Branch-Cut-Price) [github]. SCIP also offers branch-and-price via its GCG (generic branch-cut-and-price) solver [link].
Accepted

### How to make CLion read .lp file and make Gurobi solve that file within CLion?

I'm assuming you have the .lp file. Check the example in the Gurobi webpage lp_c++.cpp, where they show how to create a model based on a .lp file, and optimize it (respectively, lines 23 and 25 in the ...
• 206
Accepted

### How does CPLEX handle objective estimates passed to the makeBranch method?

The answer is basically no. You will find interesting information here related to node evaluation and here related to node selection in the CPLEX B&B. In particular, by setting the parameter Cplex....
• 2,609

### No solution found from n MIP starts

Assuming that your solution is indeed feasible and that your lazy constraints are correctly coded, the most likely explanation is that the order of your variables is inconsistent between your ...
• 11.1k
Accepted

### No solution found from n MIP starts

After hours of internet research and coding debugging, I could finally solve the problem. The problem was on the way that I passed the solution to the Cplex MIP Start. Below follows an example of how ...
Accepted

### How to get an extreme ray of an LP from Gurobi

In order to query the GRB_DoubleAttr_UnbdRay attribute, you need to optimize the problem with the InfUnbdInfo parameter set to 1.
• 3,034

### Solving multiple easy ILP instances

If I recall correctly, adding a constraint on the primal objective function causes degeneracy in the dual LPs, which could account for at least part of the speed decrease you noted. In addition to ...
• 28.8k

### GUROBI Re-optimize a model

The link that @EhsanK posted already covers the question pretty well. In such a case, Gurobi should choose the best suited algorithm on its own. Check out this little example, where I read and ...
• 1,493

### Correct way to get a dual extreme ray for an infeasible LP in CPLEX / C++

Have not used CPLEX, but I've done that in Gurobi. In the latter, you just retrieve the equivalent of dualFarkas() when the primal version of the Benders subproblem you are solving is infeasible.
• 31