All Questions
45 questions
0
votes
1
answer
28
views
Docplex use for timeseries based variables
I am trying to model an optimisation problem where each item in a list is essentially power generated at that hour. I am trying to minimise the amount of energy stored while still getting the same ...
0
votes
1
answer
137
views
Using the piecewise function in the objective function of the IBM CPLEX python API
I can't find the piecewise attributes when using Cplex in Python.
I know with docplex this can be done for example:
from docplex.mp.model import Model
mdl = Model(name='')
f=mdl.piecewise()
Is ...
1
vote
1
answer
59
views
How to write the constraint (A + B <= 1) in DOcplex?
I am new to DOcplex. I have two binary decision variables A and B and I wish to write the constraint (A+B <=1). I tried to write the constraint using "+" operator but it does not work.
...
0
votes
1
answer
112
views
Piecewize Python CPlex
This is my optimization problem :
My company sells 2 items A and B, res 20$ and 30$.
If the production of A > 0, then the cost of maintenance is 20
If the production of A > 200, then the cost ...
0
votes
1
answer
177
views
How can I get the Relative/Absolute GAP from LP solution in Python with CPLEX Solver?
I'm solving a problem with PuLP in python and i'm trying to print the gap with solution.MIP.get_mip_relative_gap() but it doesn't work.
Is there a way to get this information?
0
votes
1
answer
173
views
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 ...
0
votes
1
answer
927
views
Print variable defined as dicts in PuLP
I am new to using PuLP in python and I would like to know how I can select a specific variable from my model to print and export to Excel.
I have been guided by some examples where they define the ...
0
votes
1
answer
102
views
Importing cplex linear program file into python
I have written my linear program using cplex IBM studio to .mod file as follows:
int I = ...;
int J = ...;
int ds[1..I]=...;
int maxnint[1..J]=...;
dvar int E[1..I][1..J][1..6];
dvar boolean V[1..I];
...
1
vote
1
answer
138
views
CPLEX solve one problem with many different inputs
I am solving a basic linear programming problem: min c*x, with an A*x = b constraint, using CPLEX with Python (DOCPLEX).
Then I run the above LP for 10k-100k different combinations of b and c (A stays ...
-1
votes
1
answer
190
views
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 ...
0
votes
2
answers
217
views
Python Cplex Ceil() Function
ceil() in the constraint
Hello, I am studying a published paper. One of the constraints from this paper(which can be shown in the link) requires the ceil() function. We can use the ceil() function at ...
0
votes
1
answer
328
views
How to include a function in CPLEX objective function?
I am trying to formulate and solve an optimization problem using IBM CPLEX framework using python API.
My objective function is as follows:
where and are my integer variables. I define the ...
0
votes
1
answer
918
views
How to use nested IF-THEN constraints in DOCPLEX (Python)?
I am modeling the situation I want using python cplex.
While using it, a few questions arose, and these are:
Can I use nested IF-THEN constraints in CPLEX?
First, I could find below how to use the ...
0
votes
2
answers
397
views
How to code subtour constraint in cplex python
I am quite new in python cplex. I tried to model VRP and needed to eliminate subtours for feasible solution, but I cannot do that with the following code:
from docplex.mp.model import Model
import ...
0
votes
1
answer
1k
views
Warm Start in CPLEX Python
I have been trying to implement warm start in CPLEX solver using its Python API to solve a linear programming model. From IBM's official website, I have found the definition of the function and a code ...