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
1 answer
Python DOcplex how to get end and start value for interval_var
I am trying to model a scheduling task using IBMs DOcplex Python API. The goal is to optimize EV charging schedules and minimize charging costs. However, I am having problems working with the CPO interval variable.
Charging costs are defined by…

can_k
- 31
- 3
0
votes
2 answers
Formulate strict constraints in docplex
I am trying to model the following strict constraint in python with docplex:
mdl.add_constraint(sum(a[i] * mdl.variable[i] for i in range(nrItems)) > b)
but I keep getting the error:
docplex.mp.utils.DOcplexException: Unsupported relational…

Vjola Cl
- 1
0
votes
0 answers
Can not Deploy Cplex Model as WebApp to cloud (Streamlit Share) using IBM CPLEX Academic Initiative
I have built the Cplex Model for scheduling in Python, here I am using IBM CPLEX Academic Initiative. I have also created simple WebApp (With basic UI of uploading data to feed to the model & getting result) for my model using Streamlit, it works…

Gops
- 1
- 1
0
votes
1 answer
Objective function definition for MIP using docplex
import numpy as np
rnd = np.random
rnd.seed(0)
n = 6
t = [i for i in range(1, n)]
V = [0] + [i for i in range(1, n + 1)]
o = 5
operator = [o for o in range(1, o)]
precedence = [[1, 2], [1, 3], [3, 5], [2, 4], [4, 5], [4, 6], [5, 7], [6,…

bihatunkisi
- 3
- 2
0
votes
0 answers
Docplex Interval Variable constrained within a shift
I write a docplex model and I want some tasks to be constrained to start and end within the same shift (half a day, in that specific case).
for t in tasks_list:
task[t] = mdl.interval_var(
start=[0, max],
size=duration[t],
…

Yop
- 23
- 4
0
votes
1 answer
Cplex: how to display this linear program in Cplex
enter image description here
How do i write this constraints in CPLEX (linear-program)?
∑ j∈M until ∑ k=i xaijk ∗ bkj = dai, ∀i ∈ N, ∀a ∈ B ∩ A1; until = min(i + va, n)

Trí Vũ
- 25
- 3
0
votes
0 answers
How to create piecewise linear relationship in DOcplex efficiently?
I am able to create a piecewise-linear relationship with DOCplex. In fact, it is just the plain absolute value function.
Abs = mdl.piecewise(-1, [(0, 0)], 1)
mdl.add_constraint(buy_var[i] + sell_var[i] == Abs(buy_var[i] - sell_var[i]),…

qqzj
- 21
- 1
- 6
0
votes
1 answer
CPLEX/DOCPLEX Run Time Problem on Apple Silicon
I installed CPLEX Studio 22.1 on my Apple Macbook (M2 CPU).
Almost everything seems to be fine:
I can call cplex and cpoptimizer interactives from /Applications/CPLEX_Studio221/cplex/bin/x86-64_osx/cplex and…

P. Kein
- 21
- 7
0
votes
1 answer
How to set up academic version of CPLEX with anaconda in Linux?
I try to set up CPLEX 22.10 for use with anaconda3 (3.9.12) on Ubuntu 22.04 but
> python -m docplex.mp.check_list
always states that
! Cplex promotional version, limited to 1000 variables, 1000 constraints
Note: I have the academic version of…

Mike.K
- 1
- 1
0
votes
1 answer
DOcplex: the dual of the dual is not the same as primal?
I have a very simple primal problem defined like this:
mdl = Model(name='tubs_primal')
aqua = mdl.continuous_var(name='aqua')
hydro = mdl.continuous_var(name='hydro')
typhoon = mdl.continuous_var(name='typhoon')
pump = mdl.add_constraint(aqua +…

qqzj
- 21
- 1
- 6
0
votes
1 answer
How can I add objective for scheduling model to count the present decision variables to be specific value using CPlex Python?
I am working on the scheduling problem where I want to add an objective according to such condition. So is there any way to count the present interval variables (like presence_of()) to apply some condition for an objective? Thanks in advance!

Gops
- 1
- 1
0
votes
0 answers
How to maintain the presence of group of Interval variables in scheduling problem using Cplex Python?
So basically I have a scheduling problem where all tasks (interval variables) are optional and it belongs to different groups. Like as an house building problem, but here I have different tasks (not same at all) for different houses and I want to…

Gops
- 1
- 1
0
votes
0 answers
How to define weights number by using Docplex set_multi_objective
I am working on MILP problem based on 'ucp-panda' example case. I hope to use set_multi_objective to generate Pareto frontier with interation. However, when I am using different weights,
For example
expr = [mdl.cost, mdl.co2]
weights = [0.1,…
0
votes
1 answer
Print the dual model via docplex
I have developed a linear program and implemented it in Python via docplex. I would like to know how one can print the dual model using docplex? I have seen similar posts for other programming languages, but I was unable to find relevant discussions…

mdslt
- 155
- 1
- 10
0
votes
0 answers
DocPlex - Operational Research/Optimization Problem - Support to implement in DOCPLEX - Python
I have been trying to implement an optimization problem in Docplex using Python API. Although I have already done some problems in Docplex I am facing some challenges to do this one.
We have got rho as correlation element's matrix, V is the set of…