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

Find initial feasible solution for all agents

EDIT for a better explanation (I'm sorry). I have a semi-decentralized optimization problem. By semi-decentralized I mean: I have an aggregator that controls the best response for each agent, but those agents have an individual cost function (the…
DP_
  • 87
  • 7
0
votes
2 answers

How to import CSV file in Python API of CPLEX

I would like to import this file http://people.brunel.ac.uk/~mastjjb/jeb/orlib/files/scp61.txt . Does CPLEX support this format in Python? I converted the text file to a CSV file then wrote this code cplex.read("scp61.csv") but I got this…
0
votes
1 answer

Is it possible to specify a specific set of values for a variable in CPLEX?

I am using an integer variable in DOCPLEX using Python API. I know how to give a range of possible values to these variables using upper bound and lower bound, but how to make sure that the variables take values from only a set of integers? For eg.…
Mario
  • 17
  • 3
0
votes
1 answer

How do we delete a batch of constraints in docplex?

I used a list of a constraint numbers or a list of constraint names but this does not work with command m.remove_constraints(). m.add(sumbs[i] <= a[i], "ct_sum_%d" %i) A.append("ct_sum_%d" %i) Then later on when I want to change the model:…
pudu39
  • 15
  • 3
0
votes
1 answer

Error Passing a Linear Expression to a Quadratic Form in DocPlex

I have a cplex/docplex model with an "active risk" term. I believe I'm messing up the mix of Pandas and DocPlex, but I'm worried I'm trying to do something impossible. The term should just be the quadratic form (Target-Optimal) \Sigma…
rhaskett
  • 1,864
  • 3
  • 29
  • 48
0
votes
1 answer

How can I pass the result of the decision variable to another model in Docplex python?

I want to solve the model iteratively and in every iteration, the time is increasing by one period. In every iteration, I solve the model again. So, I wonder if I can assign the first-period result of the decision variable in the first iteration to…
Nari90
  • 23
  • 2
0
votes
2 answers

How to convert a float to a binary variable in docplex?

After creating a model and solving the LP with some specialized cuts, I want to solve the IP version of the problem but changing the type of certain variables. In JAVA this uses the function: IloConversion conversion(IloNumVar var, IloNumVarType…
pudu39
  • 15
  • 3
0
votes
1 answer

Solving multiple CPLEX models in parallel

I have some docplex models that I need to populate solution pools for them at the same time. All the models have a lazy constraint callback. My problem is when I start solving these models at the same time ,by running them on different consoles,…
Sana.Nz
  • 81
  • 11
0
votes
1 answer

Can I use the docplex piecewise function on mdl.sum of variables?

I am trying to use docplex to create a cost function for the longest path problem. As part of the formulation I would like to use the unit step function on a sum of variables contained in my model. Below is my code: top_sort = list(range(0,5)) #…
0
votes
1 answer

print the result in decision binary variables

i have the following code developed in python using the library Docplex to solve an optimal model: import docplex.mp.model as cpx import docplex import cplex import random import pandas as pd C = 10 I = 5 T = 10 R = [[2, 3, 4, 5, 6],[3, 4, 5, 6,…
Henrique Lima
  • 57
  • 1
  • 5
0
votes
2 answers

Size of integers in CPLEX

I tried searching quite a bit but could not find the answer. What is the size of integer variables in CPLEX? Is it 64-bit or is it arbitrary precision based on the bounds?
Samvid Mistry
  • 783
  • 1
  • 8
  • 14
0
votes
1 answer

Assigning var type like GURUBI

I was looking through the documentation of docplex to check if I could find a similar method to the one option used in GURUBI which assigns the var type of the decision variables after they are created. For example, when creating a new set of…
DP_
  • 87
  • 7
0
votes
2 answers

Solution only returning some decision variables

I am building a model with 624 decision variables. They are all continuous and have different lower and upper bounds. My problem is that when I print mdl.solution, the only decision variables that show are the ones with the lower bound -15 (from x48…
DP_
  • 87
  • 7
0
votes
2 answers

How to connect your installed academic initiative of CPLEx with python?

I am using python 3.6 version and CPLEX 12.10 in MAC with Anaconda. How do I access the cplex libraries for python? I have an academic version installed in my MAC and can be used independently in GUI.
0
votes
2 answers

three-index vehicle flow formulation CVRP with docplex and python error

I am trying to code the three-index cvrp with CPLEX and python. I have found numerous codes that implement the two-index formulation but have not been able to find the extended version. Following the github code, I am using the generalized…
user6360
  • 21
  • 5