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
How can I use sqrt for a quadratic expression in Docplex?
I have Recently developed a code fo an MIP model in Python. I have used Docplex to optimize that, but I have an error that says: "TypeError: must be real number, not QuadExpr". Could you please tell me how can I calculate the sqrt and help me to fix…

Nasser Tarin
- 3
- 2
0
votes
2 answers
CPO Save Log/Intermediate solutions
I am using the python API of CPO Optimizer. Is there any way to save the log/intermediate highlighted solutions and timestamps to build a chart on the evolution of the optimization?
Thanks in advance!
I haven't found a workaround so far, but…

Javi Pernas
- 5
- 2
0
votes
1 answer
Getting approximate float values for some integer variable in Python
I've recently installed the Docplex optimization package on my Python to solve a problem. Then, I defined some integer and binary variables for the problem. But I've got approximate float values for these variables after running! I will explain more…

Nasser Tarin
- 3
- 2
0
votes
0 answers
Is it easier to rewrite a pyomo model into a Docplex or a Gurobi model?
I've got an optimization problem written in pyomo that I want to translate to Qiskit. The only issue is that Qiskit has the ability to take in Docplex or Gurobi models. My question is this:
Is it easier to rewrite a pyomo model into a Docplex or a…

Ahmad Bennakhi
- 13
- 4
0
votes
0 answers
docplex - get relaxation objective value
I am trying to get the objective value of the relaxation of a MIP model with cocplex. Is there a way to find this value without relaxing the model and solving it an extra time ?
This library might to the job but I can't manage to make it work.

Agathe L
- 1
0
votes
1 answer
Conditional constraints in R
I am solving in R using GLPK a classical optimization problem:
min c*x
s.t. Ax<=b
Where x is my vector of variables, c is a vector of constants, A is the constraints matrix and b is the constraints vector.
Now my professor wants me to add the…

Vimar
- 33
- 5
0
votes
1 answer
writing down a constraint in IBM CPLEX
My question is about writing down a constraint in IBM CPLEX or in any solver.
Imagine you have a graph with N nodes and E edges. Imagine for connecting one node (source node) to another specific node (destination node), you have a set of paths. Each…

Shahrooz Pooryousef
- 107
- 11
0
votes
0 answers
Why add_sos1 method of docplex is taking too long?
I am trying to maximize the absolute distance of binary variables from 0.5 in a relaxed form of a MIP model to push the solution to integer values as much as possible. For that I have linearized the absolute expressions (|0.5-y|) using the…

Vahid
- 1
- 1
0
votes
2 answers
What is this default tolerance value for Binary (as well as other types of) variables in CPLEX?
Elaborating on the question, say the optimal solution has a few binary variables which are assigned to 0's and 1's; in reality when comparing these variables,we will often get their values as slightly higher or lower than what they should be…

S_Banerjee
- 37
- 5
0
votes
0 answers
I am looking for an code for the "Truck-drone vehicle routing problem" solved in the CPLEX OPL or in Python
Here is mathemetical model. enter image description here
Here are the details: depot: 1, truck: 10, capacity is 20, Customers: 50, Customers demand: 30
here is what I have tried so far:
{string} k = ...; // vehicles
{string} i = ...; //…

HnM
- 1
0
votes
1 answer
Compute objective function in CPLEX
I am trying to solve the supplier diversification problem by minimizing the costs.
I basically have a list of pricing for an item from different suppliers. The suppliers are willing to give me some discounts if I order in large quantities.
I am…

M Germanos
- 108
- 5
0
votes
1 answer
CP Optimizer CPLEX - Multiple optimal solutions
I am currently using the Python API of the CP Optimizer of CPLEX to obtain the optimal solution of a scheduling problem. Depending on the instance, there might be multiple equivalent optimal solutions.
I would assume that during the searching…

Paulo Nascimento
- 33
- 4
0
votes
1 answer
Manual Benders Implementation on docplex
I am using a manual Benders implementation for a problem. For that, I need to store certain variables since I need to transfer them to sub or master problems. However, as the size of the problem gets larger, it becomes really slow. I define those…

diabolik
- 55
- 6
0
votes
1 answer
How to retrieve output data as JSON from IBM Watson cloud
I am solving a decision optimization problem using Cplex solver (Docplex) on IBM Watson Cloud. However, I got stuck trying to adapt the output format.
Available documentation provides the following function to include in the main file in order to…

Yasmine
- 1
- 3
0
votes
1 answer
Converting continuous variable dict to binary variables in python docplex
I have defined a continuous variable as follows:
#Define sets
X = [(i, j) for i in range(1, a + 1) for j in range(1, b + 1)]
# Define variables
x = m.continuous_var_dict(X, name="x", lb=0, ub=1)
Is it possible to convert it to binary variable,…

diabolik
- 55
- 6