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

DOCPLEX does not work - CPLEX runtime not found

I am facing an error like below, while I have installed docplex module and am using python 3.7/3.8. Would you please help me? Traceback (most recent call last): File "C:/Users/xxx/PycharmProjects/pythonProject/EPC _LTC.py", line 155, in
mdslt
  • 155
  • 1
  • 10
0
votes
4 answers

Python 3.7 cannot use DOCPLEX

I have coded a mathematical model and want to solve it using DOCPLEX module. My interpreter is Python 3.7. However, after doing a lot of effort, I will face the following error: Traceback (most recent call last): File…
mdslt
  • 155
  • 1
  • 10
0
votes
1 answer

Cplex for Linear Program: Are DOCplex decision variables assumed to be non-negative?

I want to write a simple LP using docplex. Suppose I have three variables: x, y, and z, the constraint is 4x + 9y - 18.7 <= z. I wrote the constraint with the code model.add_constraint(4 * x + 9 * y - 18.7 <= z). Then I set minimize z as my…
Francis
  • 189
  • 1
  • 11
0
votes
1 answer

Printing all constraints using DOcplex

I am actually running a MILP on Python using DOcplex and it is my very first time using it. It is saying that my model which I ran on Lindo is infeasible. Therefore, I am guessing that I erroneously entered my constraints, but I cannot view them. I…
Bree
  • 39
  • 7
0
votes
1 answer

How to express a quadratic objective in Docplex on python

If any one could help ,I can't express the objective function, this is my code: import numpy as np def portfolio_return( weights, returns): return weights.T @ returns def portfolio_vol( weights, covmatrix): return np.sqrt(weights.T @…
Yassine
  • 11
  • 2
0
votes
2 answers

Constraints in DocCplex on Python don't work

I'm trying to solve an optimization problem, but when I insert this constraint it doesn't work: ''' mdl.add_constraints(isinstance(w[i]/5, int) == True for i in range(0,5)) ''' where w is defined as follow : ''' w = mdl.integer_var_list(5,5,30,…
Yassine
  • 11
  • 2
0
votes
1 answer

Populate() Equivalent for MIQP in CPLEX

I'm trying to solve the MWIS problem exactly using CPLEX. When I try the .populate() I get the error that docplex.mp.utils.DOcplexException: Model.populate_solution_pool only for MILP problems, model 'Exact Solution' is a MIQP. Is there a way to…
jolene
  • 373
  • 2
  • 15
0
votes
1 answer

How to use CPLEX Multi-Objective (ObjectiveSense) parameters

I am working on pure LP problem and using Multi-Objective to solve it. When I am using objective with weights: solver1.minimize( A* 1000 + B* 10000 + C* 100 …
0
votes
1 answer

How to stop DoCplex.CP solver after finding each feasible solution?

Dears, Currently, I am using OPL-DoCplex to solve a problem using CP. The basic model was built in OPL then I called it into python by DoCplex. I have the following questions: 1- In the OPL model, there are decision expressions (dexpr) that were not…
0
votes
2 answers

CPU time in docplex - Python

Let us assume that I have created a mathematical model in python and want to solve it using the below code (the docplex library.) start = time.perf_counter() # CPU time calculator of the CPLEX solver # Obj 1 mdl.minimize(obj1) solution =…
mdslt
  • 155
  • 1
  • 10
0
votes
1 answer

Reset the values of variables in docplex - Python

I have a mathematical model ('mdl'), and I want to solve it in an iterative manner using the docplex library in python, like the below simplified example: mdl = Model("LTC") x = mdl.binary_var_dict(set_idx1, name="x") #model defined here for i in…
mdslt
  • 155
  • 1
  • 10
0
votes
2 answers

multiple models in cplex - python

I want to implement the epsilon constraint method, where I need to have multiple models with similar variables and almost identical constraints. I was wondering how I can define a variable (or constraint) that I can use in all models. For example,…
mdslt
  • 155
  • 1
  • 10
0
votes
1 answer

CPLEX - Optimization - Minimize production cost by period: Error: Model is non-convex

I'm trying to create an optimization model using CPLEX. My problem is: I have demand, production capacity (by machine by day), and production cost (by machine by day) to produce the products. Some machines have diferent cost and production capacity…
0
votes
1 answer

Is it possible to evaluate a cumul function at a specific moment in time in CPLEX?

I'm trying to add a minimization criterion of accumulated capacity usage throughout time. The capacity usage is modeled using a cumul function, consisting of a summation of pulse() functions, where each scheduled interval would contribute to the…
Tortidip
  • 3
  • 3
0
votes
2 answers

DOCPLEX MIP warmstart

I am trying to solve a large MIP scheduling problem. Since it will take a long time to solve the problem, I want to run the same model with fewer event point and find its n-th solution. Use that solution as an initial solution/seed for a bigger(more…
Abilash
  • 95
  • 10