19
votes
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 (...
19
votes
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 ...
16
votes
Accepted
Python vs. compiled languages in OR research using metaheuristics
Speaking as an occasional reviewer for journals, when I read a paper proposing a new heuristic or metaheuristic my first question is "does it work?", which is independent of the programming ...
13
votes
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):
...
12
votes
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://...
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:
...
9
votes
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 ...
8
votes
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 ...
8
votes
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.
...
7
votes
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 ...
7
votes
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 ...
7
votes
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 ...
7
votes
Python vs. compiled languages in OR research using metaheuristics
I think this is a false dichotomy.
Surely, C++ is the classical language for fast programs (besides FORTRAN, maybe).
But nowadays, Java is very fast as well. Julia is also an option, fast and aimed ...
6
votes
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 ...
6
votes
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 ...
6
votes
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.
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 ...
5
votes
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 ...
5
votes
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:
...
5
votes
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 ...
5
votes
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:
<...
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, ...
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 <...
4
votes
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 ...
4
votes
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].
4
votes
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 ...
4
votes
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 ...
3
votes
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....
3
votes
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 ...
3
votes
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.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
c++ × 52cplex × 15
gurobi × 13
mixed-integer-programming × 11
or-tools × 10
constraint-programming × 9
optimization × 8
benders-decomposition × 6
modeling × 5
linear-programming × 4
python × 4
combinatorial-optimization × 3
callback × 3
scheduling × 2
graphs × 2
metaheuristics × 2
stochastic-programming × 2
column-generation × 2
implementation × 2
parallel-computing × 2
branch-and-price × 2
integer-programming × 1
solver × 1
reference-request × 1
vehicle-routing × 1