docplex (a.k.a. IBM® Decision Optimization CPLEX® Modeling for Python) is a Python modeling API that provides modules for mathematical programming via CPLEX and constraint programming via CP Optimizer.
Questions tagged [docplex]
316 questions
0
votes
0 answers
ILP problem using docplex CP Optimizer (Nothing to read from local solver process)
I solve my ILP problem using docplex IBM package for Python under CP Optimizer Model. It's working correctly, and I get the target result; however, when I call the Model.solve() many times. i.e., more than 10000 cycles, in the beginning, everything…

labed AbdelJalil
- 15
- 1
- 7
0
votes
1 answer
My cplex script does not work on python with no error
I have been using Cplex and docplex (on python) on my PC for a long time and it was working fine. But lately when I run my script it starts the engine but it sticks at the beginning for a very long time (24 hours maybe) and then it terminates the…

Sana.Nz
- 81
- 11
0
votes
1 answer
Converting docplex expression into string
How can I store the text version of a constraint defined as a docplex.mp.linear.LinearExpr variable into a Python string variable?

Omar Shehab
- 1,004
- 3
- 14
- 26
0
votes
1 answer
Docplex: Building expression to get a value from an array
I have an array defined as follows
A = [
[10,20],
[20,10]
]
Now I want to get the entry at a position (i, j). The thing is, j is a CpoFunctionCall object (where i will be an Int), so is not able to be indexed. Is it possible to have the operation…

Stackd
- 683
- 1
- 6
- 12
0
votes
2 answers
Understanding DoCPLEX Multi Objective
I am working on Pure LP problem with around 3 Million Constraints and I am currently using objective function with different weights. But to improve run time I am hoping to explore DoCPLEX multi- objective import "ObjectiveSense". Before…

Kartik Kaushik
- 19
- 5
0
votes
2 answers
DOcplexException: Expecting linear constraint, got: docplex.mp.LogicalOrExpr
I want to write a conditional constraint using docplex. The constraint is:
if:
y[(i, j,k)] == 1 or y[(j, i,k)] == 1
then:
g[i,j,k]==1
I implemented the code in docplex in this way:
mdl.add(mdl.if_then(mdl.logical_or(y[(i, j,k)] == 1 ,y[(j,…

Sana.Nz
- 81
- 11
0
votes
2 answers
DoCPLEX Solving LP Problem Partially at a time
I am working on Linear Programming Problem with 800K Constraints and the problem takes 20 mins to solve but if I solve the problem for half horizon it just takes 1 min. Is there a way in DoCPLEX where I can solve for partial horizon and then use the…

Kartik Kaushik
- 19
- 5
0
votes
3 answers
MIP Formulation Slow Performance
I am working on a model which is MIP. The model solves very quickly generally, but if I am trying to add IF- THEN constraint to the model the solve time exponentially increases to a point where its not able to get a feasible solution within 2000s. …

Kartik Kaushik
- 19
- 5
0
votes
3 answers
How to implement a new constraint based on two other constraints on CPLEX?
I am very new to Cplex. I have these two constraints (R is the set of numbers in range 20) :
model.add_constraints((model.sum(x[i, j] for j in R2 ) == 2 for i in R),"C1" )
model.add_constraints((x[i, n1-4] ==x[i, n1-2] for i in R…

Ashkan Rezaee
- 11
- 3
0
votes
2 answers
How to asynchronously abort a solve in docplex?
I have 2 simultaneous solves running using docplex and I want to stop one of the solve as soon as the other one finishes. Is there an way to end one solve?

Kartik Kaushik
- 19
- 5
0
votes
1 answer
Obtaining different solutions on solving a cplex model many times
I have an MIP model written with docplex and a solution pool written with cplex. My model has billions of solutions in reality. I need to solve this model several times (10 for example) with a certain populate number (10,000 for example) but I need…

Sana.Nz
- 81
- 11
0
votes
1 answer
DoCPLEX: Kill Solve if one of 2 solves are complete
I am working on DoCplex problem in which I have 2 models. I am using ThreadPoolExecutor() to run the solves parallel. But is it possible to kill one of the solve once one of them is complete?
I am using following code:
def work(slvr):
…

Kartik Kaushik
- 19
- 5
0
votes
1 answer
Implementing Soft rules on CPLEX
I have a model that I need to add a new constriant to it but I want this rule to be implemented "only" if it is possible. Is there a way to implement this with cplex or docplex ?

Sana.Nz
- 81
- 11
0
votes
1 answer
DoCplex MILP problem: Running Benders & Branch and Bound Parallel
I am working on MILP model (In DoCplex) and solver reaches the solution faster with Benders Method sometime and sometimes using Branch & Bound. Is there an easy way to run both solve methods parallel without changing variable names (cloning the…

Kartik Kaushik
- 19
- 5
0
votes
1 answer
Python: Is there a faster way to filter on dataframe in a for loop
I have a for loop over a tuple in python which is index for one dataframe. All the values under the index are then summed over.
Example:
t3 = time()
for row in list_of_index:
a=[]
if row[-1]!='end':
a=df1.loc[row[:7]].to_numpy()
…

Kartik Kaushik
- 19
- 5