Thanks !
I see that even after using this method, the results are not the same. I compared the two LP files and I noticed that when adding new variables to a constraint in the Python API they are usually added at the end of the lhs whereas in docplex they are added at the beginning.
example : using docplex
Psi_1_3_0 + Psi_1_3_1 + Psi_1_3_2 + Psi_1_3_3 - 93 Alpha_4
- 57 Alpha_5 - 35 Alpha_1 - 24 Alpha_3 = 0
using CPLEX Python API
Psi_1_3_0 + Psi_1_3_1 + Psi_1_3_2 + Psi_1_3_3 - 35 Alpha_1
- 24 Alpha_3 - 93 Alpha_4 - 57 Alpha_5 = 0
where alpha_4 and alpha_5 are new variables and were added to that constraint after the creation of that constraint.
Is there a way to add the new variables in CPLEX Python API in the same order as in docplex? thanks
Original Message:
Sent: Tue March 07, 2023 02:43 AM
From: Vincent Beraudier
Subject: Cplex Python API clean before re-optimizing
Here is the method in docplex that you need to copy/paste in your code:
cpx = self._cplex
if cpx._is_MIP():
cpx.MIP_starts.delete()
cpx.presolve.free()
# clear the pool
cpx.solution.pool.delete()
# dummy change
if cpx.variables.get_num() > 0:
cpx.variables.set_lower_bounds(0, cpx.variables.get_lower_bounds(0))
elif cpx.linear_constraints.get_num() > 0:
cpx.linear_constraints.set_senses(0, cpx.linear_constraints.get_senses(0))
else:
pass
------------------------------
Vincent Beraudier
Original Message:
Sent: Mon March 06, 2023 02:49 PM
From: s charaf
Subject: Cplex Python API clean before re-optimizing
I moved from docplex to CPLEX Python API, and I want to know what is the equivalent of the clean_before_solve option in CPLEX Python API. I need this as I want to have the same results again, and I noticed that the dual variables are not the same after model re-optimization.