Hot answers tagged

6

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. Plug your heuristic solution into each of those constraints, and see which are violated. Assuming your heuristic solution really is feasible, those constraints ...


4

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 modified model, transforms that solution back to the original model. I believe that the "unscaled infeasibilities" message means that CPLEX found what ...


4

In Making optimization simple (Python) I gave 2 options: progress listener / MIP info callback get solutions one by one The models: from docplex.mp.model import Model from docplex.mp.progress import * mdl = Model(name='buses') nbbus40 = mdl.integer_var(name='nbBus40') nbbus30 = mdl.integer_var(name='nbBus30') mdl.add_constraint(nbbus40*40 + nbbus30*30 >...


3

kpi syntax example in docplex from docplex.mp.model import Model mdl = Model(name='buses') nbbus40 = mdl.integer_var(name='nbBus40') nbbus30 = mdl.integer_var(name='nbBus30') nbbus=nbbus30+nbbus40 mdl.add_kpi(nbbus,"nbbus") mdl.add_constraint(nbbus40*40 + nbbus30*30 >= 300, 'kids') mdl.minimize(nbbus40*500 + nbbus30*400) mdl.solve(log_output=...


3

Once you solve a docplex model, it creates an internal SolveDetails object that contains the best bound you're looking for. You can access it in two ways: Assuming you've defined your docplex model as model (an instance of the class docplex.mp.model.Model) print(model.get_solve_details().best_bound) Assuming you've stored your model's solution in sol (an ...


3

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 conflict refiner. Of particular interest are the following files: ./examples/src/java/ConflictEx1.java ./examples/src/cpp/iloconflictex1.cpp ./examples/src/python/...


3

As the docplex documentation says: Given an infeasible model, the conflict refiner can identify conflicting constraints and bounds within it. So, consider you have an infeasible model (I'll call my instance model). This is one way to use the conflict refiner. import docplex.mp.conflict_refiner as cr import docplex.mp.model as cpx model = cpx.Model(name='...


3

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 my memory service me well, is the following: Set the MIP integer solution limit to 1 (IntSolLim parameter in Cplex <=12.6). Invoke solve(). Cplex will ...


2

I guess your model is not feasible. Let me use the tiny zoo example: from docplex.mp.model import Model mdl = Model(name='buses') nbbus40 = mdl.integer_var(name='nbBus40') nbbus30 = mdl.integer_var(name='nbBus30') mdl.add_constraint(nbbus40*40 + nbbus30*30 >= 300, 'kids') mdl.minimize(nbbus40*500 + nbbus30*400) mdl.solve(log_output=True,) print("...


2

I am fairly certain that you cannot resume solution from the previous final state after altering the model. This is a known fact with CPLEX, presumably the same with CPOptimizer for essentially the same reason: the final state of the previous solve may not be valid for the modified problem. For instance, if you were to drop constraints and resume, the true ...


2

Assuming you are fine with turning the warnings off, you can change the verbosity level of the data consistency checks that you get from docplex by changing the value of datacheck parameter. You can read more about it in the IBM doc on data consistency. from docplex.mp.model import Model mdl = Model(name='my_model') ... mdl.parameters.read.datacheck = 0 # ...


1

If you really want to ignore them then you can often set the warning output to null (or similar) https://www.ibm.com/docs/en/icos/20.1.0?topic=cm-warning-method-1 From where/how are you calling cplex?


1

Please read the relevant manuals. I am not aware of any such functionality and a search of named parameters in the documentation yields no results either. However this page goes into details how to get the information you want and also documents in an example how to stop it from this callback based on this information using the C Interface.


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