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
0 answers

Summatory with variables that have two indexes in PYTHON

I am trying to write something like this (which is a part of a constraint): sum(a in ArcsOut[p.o]) F[a][p] for all p=(o,d) in pairs. My code is : I have a set of nodes: nodes = ["uno","dos","tres","cuatro","cinco","seis"] and its set of all…
0
votes
1 answer

Summatory with Python and how associate sets with vectors

I have a set of nodes: nodes = ["uno","dos","tres","cuatro","cinco","seis"] and its set of all possible pairs pairs = [(i,j) for i in nodes for j in nodes if i!=j] Also, I have a vector of this set of pairs d = [9, 26, 19, 13, 12, 11, 14, 26, 7,…
0
votes
2 answers

Multidimensional decision variable python docplex

To solve my inventory problem I need a three-dimensional decision variable x_{ij}^t I am new to the CPLEX Python API docplex and all I found so far is m = Model(name='inventory_problem') x = m.integer_var_matrix(keys1=all_origins,…
-1
votes
0 answers

How to find all available paths in a graph, not just the shortest ones?

I need to find all positive paths in a graph, but the shortest path algorithm only finds 1 best path. So I have to update the matrix and solve the model again. Is there any way to display all paths when path value is greater than 0. I will also…
Alex
  • 1
-1
votes
1 answer

Python cplex: How do I get the absolute value of a linear expression in an optimization model?

I have a minimize problem and its objective function need to get absolute of a linear equation. But when I run these code, it raise this error TypeError: bad operand type for abs(): 'LinearExpr'. How can I fix this? I searched this error on Internet…
-1
votes
1 answer

Creating and/or logic between constraints DOcplex python

I'm trying to transfer my constraints from Cplex OPT studio to the DOcplex Python. The logic between the constraints is - if 1 of them does not met all the decision variables needs to be 0. In Cplex Studio its look like that: forall(r in risk_list)…
-1
votes
1 answer

Can not solve Assignment Problem Using ILOG CPLEX Optimizer

The Assignment problem is from Google OR-Tools Others framework can solve this problem, even using Excel Solver. But ILOG CPLEX cannot solve this problem. Here is my code in jupyter notebook: import cplex import docplex.mp from docplex.mp.model…
-1
votes
1 answer

Cplex Python Gaps

How can I print the gaps(each iteration) like OPL's engine in Python? I want to keep the gaps like this: Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap 0…
-1
votes
1 answer

Why do i get no attribute in docplex?

I am running an optimization code in docplex but for some reason I get an error: AttributeError: 'NoneType' object has no attribute 'get_value_dict' This error refers to the line: prod_hpp_grid_ts =…
-1
votes
1 answer

How can I take the solution values from first calculation and use it in another calculation in python using docplex

I calculated a machine scheduling problem using docplex in python. I obtained one of the decision variable as: yib solution y_0_1 1 y_1_2 1 y_2_1 1 y_3_1 1 y_4_1 1 Since I wanted to use this values in another calculation I used…
Melissa
  • 9
  • 3
-1
votes
1 answer

docplex issue: TypeError: Cannot use == to test expression equality, try using Python is operator or method equals:

mymodel = Model("OPL_Purchasing_plan"); nr_month= range(0, 12) na_pur_req = [550, 750, 6500, 675, 210, 120, 0, 560, 140, 320, 0, 100] na_average_cost = 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5] for i in nr_month: …
suresh_chinthy
  • 377
  • 2
  • 12
-1
votes
1 answer

Is CPlex Optimization Studio 12.9.0 compatible with Python notebooks for APIs. If yes, which version of Python?

I have installed Cplex (Optimization Studio 12.9.0 - Community Edition) and need to write Python APIs in it. After installing setup.py as per…
-2
votes
1 answer

Duplicate variable name warning in Python

I have developed a code for an optimization problem in Python and defined a binary variable in the model. Then I used the Docplex module to solve the model through the Cplex engine. I've mentioned a part of the code as follows. from docplex.mp.model…
-2
votes
1 answer

Can someone fix my python code & docplex?

I have to do a python code for a project but when i run it, i have a problem with it. I try to fix it but it's always the same problem. It said the same code error... this is my code from docplex.mp.model import…
-2
votes
1 answer

cpleqp equivalent in docplex

We can use cplexqp command to find the minimum of a problem using Cplex in matlab. I am looking for an alternative in docplex. Cplex vs Docplex
1 2 3
21
22