9
votes
Constraint programming using solver: how to state the time limit of search?
What Nikaza said, and also: problems of this kind often have a large number of solutions that differ only by trivial permutations/relabellings/reorderings. For example, if one worker is assigned 10 ...
7
votes
Integrating genetic algorithm (or other heuristic methods) with CPLEX
I am aware of two ways of combining a (meta-)heuristic with a solver (like cplex).
1) Warm start: use a heuristic to quickly find a good solution and give it to the solver as a starting solution. ...
7
votes
Python to Excel
A great option is to use the pandas library, and specifically pandas.DataFrame.to_excel is what you need.
I suggest you use one column per variable index, and one line per non zero variable.
Here is ...
6
votes
Constraint programming using solver: how to state the time limit of search?
CPLEX is probably spending 15 hours trying to reduce the optimality gap. This is very common issue in MILP problems.
The way MILPs are solved is commonly to make all integers continuous and solve the ...
6
votes
Docplex : model is infeasible
Short answer: The model is wrong. :-)
Longer answer: After attempting to solve the model and being told it is infeasible, run the conflict refiner to get an set of mutually inconsistent constraints. ...
6
votes
Accepted
Reformulate CPLEX optimization model of Warehouse Product Allocation
This is an instance of the quadratic assignment problem, which is known to be difficult.
You have binary variable $x_{ic}$ to indicate whether article $i$ is assigned to aisle $c$ and binary variable $...
5
votes
When using docplex.cp is it possible to get all feasible solutions?
I am answering my own question because it may help other people.
I could not find a function in docplex able to get all feasible solutions for a ILP problem. For my best knowledge, docplex only has ...
5
votes
DOCPLEX: tips to manipulate data input (binary parameter)
One thing I would personally do is stick to dictionaries as accessing each key is easier and faster (Its complexity is $O(1)$). If you have three collections for your keys, namely your $H$, $C$, and $...
5
votes
Accepted
Binary/integer variables get real values in docplex
All solution values will be floating-point numbers - independent of the variable types. In an optimal or feasible solution, they will simply be close to an integer value, depending on the specified ...
5
votes
Accepted
What is the default weight allocation in solving multi-objective on CPLEX?
Weights are defined by you to tell CPLEX how objectives with the same priorities are blended together. If you don't define weights, by default they are all assumed to be equal to 1.
Let's assume in ...
4
votes
Accepted
Precedence constraints using binary variables - DOCPLEX
After a while, I finally found a way to establish a precedence constraint using binary variables.
It was hard to find examples of precedence constraints that do not use time as a parameter in both ...
4
votes
Accepted
Logical operation on an array in DOCplex
The first argument in logical_and is *args but it's not unpacked in the subroutines inside of ...
4
votes
4
votes
Accepted
CPLEX MILP Report all solutions found
In Making optimization simple (Python) I gave 2 options:
progress listener / MIP info callback
get solutions one by one
The models:
...
4
votes
Accepted
Constraint to handle the machine-configuration's change between initial position and its first occurrence in the process
I think you do need some variable that keeps track of the configuration a machine is in at a given process plan position. This could be a variable $C_{wcj}$ that is $1$ if machine $w$ is in ...
4
votes
Accepted
LP solver CPLEX is 'optimal with unscaled infeasabilities'?
When you turn CPLEX loose on a model, it runs a presolver that does assorted magic tricks that end up with a modified model. It then solves the modified model and, assuming it finds a solution to the ...
4
votes
Accepted
How to retrieve the variable's value in DOCplex
The key is a tuple of strings and not a tuple of numbers.
...
4
votes
4
votes
Python to Excel
I have used openpyxl several times to create or alter excel files. It is quite easy if one is familiar with Python.
With this module you can iterate through your variables and write its value to a ...
4
votes
Accepted
Sensitivity analysis for specific sets of constraints on DoCplex
You can filter the results you get from sensitivity.rhs :
See small example out of the zoo example again:
...
3
votes
How to check infeasibility with conflict refiner (docplex mixed integer programming )?
As the docplex documentation says:
Given an infeasible model, the conflict refiner can identify
conflicting constraints and bounds within it.
So, consider you ...
3
votes
Accepted
Rotated Second-Order Cone Constraints in docplex
For your first question: DOCplex instead is an object-oriented modeling API. It builds either on the CPLEX Python API (for local solves) or on the DOcplexcloud service, for remote solves. It provides ...
3
votes
Accepted
Docplex Error: Model has non-convex objective
The comment by @prubin is spot on.
The V matrix is probably being numerically evaluated as not positive semidefinite by CPLEX. That can easily happen when one ore more eigenvalues are what you call ...
3
votes
Docplex Error: Model has non-convex objective
Cplex can minimize convex quadratic objectives, or maximize concave ones.
For example, minimizing $x^2+y^2$ is OK, but minimizing $x^2 -y^2$ is not.
See this page for more details:
As mentioned in the ...
3
votes
CPLEX MILP Report all solutions found
One solution is to add an Incumbent callback (not sure whether DOCPLEX support this yet, but certainly Java/C++), and log the solution + time stamp within the the callback.
Another solution which, if ...
3
votes
Constraint programming using solver: how to state the time limit of search?
CP Optimizer is doing a search for progressively better solutions. Each time it finds a feasible solution, it restricts the remainder of the search to solutions with better objective values than what ...
3
votes
Accepted
How to display the range of coefficients in docplex log?
even from docplex you can get access to the cplex python API.
See example in SO for sensitivity analysis at https://stackoverflow.com/questions/62475139/sensitivity-analysis-in-docplex
Plus before the ...
3
votes
Could DOcplex.CP recognize that it solves the graph coloring minimization problem?
The automatic search of CP Optimizer does not try to recognize a graph colouring problem. As you notice, fixing the colour of one variable to get rid of some symmetries in the model may help. ...
3
votes
Accepted
How to establish constraint between variables with multiple indexes using CPLEX in Python
Based on a clarification in the comment, you have KeyError and more or less, this is what's happening:
You're looking at an index or key (in your dictionary) that ...
3
votes
Accepted
How to check infeasibility with conflict refiner (docplex mixed integer programming )?
ILOG Cplex 20.1 installation comes with a directory with examples. To use the conflict refiner, you want to consult the manual which includes a list of files that contain examples on how to use the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
docplex × 61python × 27
cplex × 25
mixed-integer-programming × 19
optimization × 12
constraint-programming × 9
cplex-python-api × 8
integer-programming × 6
modeling × 4
cp-optimizer × 4
linear-programming × 3
constraint × 3
scheduling × 3
gurobi × 2
binary-variable × 2
computational-complexity × 2
column-generation × 2
sensitivity-analysis × 2
solver × 1
combinatorial-optimization × 1
linearization × 1
nonlinear-programming × 1
convex-optimization × 1
or-tools × 1
quadratic-programming × 1