Questions tagged [docplex]

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.

316 questions
0
votes
1 answer

CPLEX Python for Scheduling Case: How to define the continuous variable and constraint (for loop)?

I have defined the variables and constraints for a scheduling case with CPLEX by using python. I would like to define two continuous variables and add constraints with for loop function. However the error messages as follows. Could anybody give…
0
votes
1 answer

Complex Assigning/Scheduling with CP Optimizer

I've been trying to tackle a problem with CP optimizer, but I'm a little stuck: I have projects with 200-300+ individual tasks with individual upstream and downstream dependencies. The tasks follow a pipeline (so the same type of tasks repeated for…
0
votes
1 answer

May be a bug? Where can I find the meaning of parameter in docplex?

when I want to search the meaning of parameter value in docplex, it seems to go wrong. The following is the code: from docplex.mp.model import Model import cplex model_do = Model() # the following two lines work well ''' the output of first…
0
votes
1 answer

reseting a model in cplex python API

I am using Cplex python API for my optimization problem. I want to run many instances of the problem and each time I want to create a new model with a different set of variables. The problem is that I am getting a warning that says I have used some…
0
votes
0 answers

CPLEX DOcplexException on Mac big sur(M1)

from docplex.mp.model import Model opt_model = Model(name = 'Linear Program') x = opt_model.continuous_var(name = 'x', lb = 0) y = opt_model.continuous_var(name = 'y', lb = 0) c1 = opt_model.add_constraint(x + y >= 8, ctname = 'c1') c2 =…
MD. ABU SAYED
  • 241
  • 2
  • 5
0
votes
2 answers

Python Cplex Ceil() Function

ceil() in the constraint Hello, I am studying a published paper. One of the constraints from this paper(which can be shown in the link) requires the ceil() function. We can use the ceil() function at the OPL but I couldn't find the Python…
0
votes
1 answer

getting DOcplexException: cannot convert to expression: at 0x7f59feda16d0>

Im trying this code m.minimize(30sum(x["Product A",j])+28sum(I["Product B",j])+0.9sum(I["Product A",j])+0.75sum(I["Product B",j])for i in Products) and it keeps giving me DOcplexException: cannot convert to expression:
0
votes
1 answer

CPLEX Binary Variable in Python

I am trying to set up a binary variable for my optimization problem in Python by using the IBM CPLEX. In my objective function, I set up a line which turns on and off depending on the market price in t: mdl.maximize( mdl.sum( (1-b[t]) *…
0
votes
1 answer

Is it possible to view the constraints while using docplex?

I have a quadratic model which I wrote using docplex and when solving it says it is infeasible. When I checked to see if there are any conflicts it returned 0 so I assume there are none but I have no idea what is causing this problem. I want to be…
Anas
  • 29
  • 3
0
votes
1 answer

Relative MIP gap tolerance in docplex module

I solve a multiobjective MIP with the docplex module in Python. As the problem is rather large, I would like to set a relative MIP gap tolerance: parameters.mip.tolerances.mipgap…
orarne
  • 11
  • 2
0
votes
1 answer

Unable to find the same solution on CPLEX and MATLAB for a quadratic program

I'm trying to solve the following quadratic problem with MATLAB (using quadprog function) and CPLEX. The problem is that MATLAB and CPLEX provided feasible solutions but both solutions didn't match. In fact, CPLEX claims that the obtained solution…
0
votes
1 answer

How to express exponential of a variable in docplex?

I need to define a constraint as follows: mdl.add_constraints(p_pg[plan, segment] == np.exp(u_pg[plan, segment] for plan in range(1, p+1) for segment in range(1, g+1)) In this constraint both p_pg and u_pg are variable and are defined as…
0
votes
1 answer

DocPlex giving CpoSolverException when using search phases

I am running a constraint programming model in docplex. When I add the following search phase I get an error in docplex: model.set_parameters({'SearchType': 'DepthFirst', 'Workers': 2, "LogVerbosity": "Verbose"}) p1 = search_phase( …
0
votes
0 answers

Mathematical model to CPLEX

I am trying to convert this mathematical model to CPLEX code. But it is not working. tuple Sortie { int launch; int deliver; int rendez; } {Sortie} Sorties = { | i in N0, j in CC, k in NP:…
Mon Mon
  • 25
  • 5
0
votes
2 answers

docplex.mp.utils.DOcplexException: Expecting sequence of linear constraints, got: docplex.mp.QuadraticConstraint[]

Please pardon my ignorance. I was trying my understanding on Docplex. I produce this code to model optimization equations as shown in the picture below. My main concentration is constraint 2c, I can't figure out the root of the error. from…
Anas
  • 125
  • 13