Questions tagged [cplex-python-api]
The cplex-python-api tag has no usage guidance.
28
questions
2
votes
1
answer
73
views
Can a logical expression be added to the objective function of a model in docplex?
I'm working on an optimization problem using Docplex and wonder if it's possible to incorporate a logical expression into the objective function of my model.
Specifically, I have three variables x, y, ...
3
votes
1
answer
174
views
Dual problem in IBM CPLEX
Im solving n-dimensional Knapsack problem as LP problem.
I noticed that sometimes dual LP problem may be solved much faster than primal.
My test problem contains 500k variables and 50k constraints, ...
2
votes
1
answer
149
views
Updating constraint set rhs in docplex
I am trying to update the rhs of a constraint iteratively under a while loop in docplex, however, it does not work properly. As I analyze the output text file, while some constraints are updated as I ...
3
votes
2
answers
229
views
Modifying and re-optimizing a model using CPLEX Python API
I came across the following functionality that is offered by CPLEX for modifying and re-optimizing a model based on previous computations: https://perso.ensta-paris.fr/~diam/ro/online/cplex/cplex1271/...
4
votes
0
answers
759
views
Google-OR tools vs Pyomo and other commercial Solvers for solving a simple maximum flow problem
I have implemented a Pyomo model for solving maximum flow problem as a subroutine of an algorithm. However, the approach does not scale very well because Pyomo does not provide a very good way to re-...
3
votes
1
answer
183
views
Sensitivity analysis for specific sets of constraints on DoCplex
I am working on DoCplex to run a large model with several variables and constraints. I used the following link from sensitivity analysis in python + Docplex to run the sensitivity analysis. In that ...
2
votes
2
answers
108
views
Using CPLEX academic version with Pyomo on MacOS
I have recently tried to use the CPLEX solver to solve one of my Pyomo models. I first installed the community version that is available:https://pypi.org/project/cplex/ using ...
2
votes
1
answer
250
views
How to do matrix multiplication in docplex in python?
Here's an applicative problem I'm trying to solve. Imagine there is a road that can be classified in 5 states. Can be something from good to bad etc. There are 4 maintenance actions possible. And the ...
1
vote
0
answers
123
views
User callback doing nothing slows down Cplex
I am trying to do something with user callbacks in Cplex using Python API. For instance, I will need a callback that only counts the number of explored nodes.
While testing something I noticed that ...
2
votes
1
answer
45
views
Objective value estimate for branches I create in Cplex
I' implementing custom branching heuristics for Cplex in python. I have a way to choose a (binary) variable to branch on, so use the following code to create two branches from BranchCallback (...
4
votes
0
answers
123
views
2
votes
1
answer
415
views
Getting all active constraints of an LP from Cplex
I was wondering if it is possible to get the active constraints of a linear program from the Python API of Cplex? Or do I have to go through the constraints one by one and check if they bind with ...
-1
votes
1
answer
326
views
How to iterate a parameter set in docplex model?
The parameters are such as in the dataframe above. Can I iterate over this, and solve the model firstly for row 0 and then 1, ... etc.
4
votes
2
answers
1k
views
How can we write a binary variable as a power to a constant number?
Let $x_{i,j}$ be a two-dimensional binary variable.
Is it possible to write $x_{i,j}$ as a power to a number?
For example:
$$1- 0.3^{x_{i,j}} $$
4
votes
0
answers
329
views
CPLEX Python: Current subproblem model in branch and bound
I have an MILP problem and use CPLEX (Python interface). I am working on user heuristics for branching in the branch-and-bound procedure. With HSCallback I managed to get the information about the ...
3
votes
3
answers
2k
views
Python to Excel
Using DOcplex module an optimization problem is solved.
There are many decision variables in the solution, for the validation of the mathematical model I want to check them.
How can I write the ...
1
vote
0
answers
552
views
In DOcplex, how can I get value of variable for objective function before solved?
In terms of python based atypical math model as shown below, which is unlike nonlinear or quadratic form in my opinion, I have difficulty in accessing value of variable before optimization as ...
2
votes
2
answers
330
views
Accessing Lagrange Multipliers in CPLEX
I want to get the lagrange multipliers for an LP problem solution calculated using CPLEX. I am using it via Python.
The problem is an LP problem with continuous variables with a linear objective ...
3
votes
2
answers
153
views
Implementing NLP as QP on docplex
I wanna learn how to solve non-linear programs using the docplex library. according to this link
I should be able to run the model as a QP. But when running the model I got the error: ...
4
votes
1
answer
526
views
Binary variables with multiple indices
I'm new to Cplex and I'm working with the python API. I have a variable $w^t_{iksm}$ and I could just find the binary_var_cube function which only accepts 3 indices. I'm then using this $w$ to define $...
3
votes
1
answer
303
views
How to collect solutions within CPLEX and retrieve them from PYOMO?
I am currently to invoke solvers, CPLEX, in particular.
As I am solving my problem sequentially, i.e., the top-level subproblem results are being used to generate the model of the next subproblem.
To ...
3
votes
2
answers
373
views
GAMS default Solver doesn't use much of my RAM and CPU
I noticed that when I run the solver via the GAMS IDE or Python API I don't use more than ~33% of my RAM. Is there an artificial barrier which I can put up or disable?
2
votes
0
answers
228
views
Node ordering in Graph optimization
I'm solving a network optimization problem which is modeled as a graph $G=(V,E)$. Solving this problem using Pulp and NetworkX in Python and ordering the graph's nodes in a certain order (i.e. (1,2,3,...
3
votes
1
answer
334
views
VRPTW implementation
Does anybody have an example of the vehicle routing problem with time windows (VRPTW), implemented on Python with CPLEX library, AMPL, or MiniZinc? So far I've looked into ...
3
votes
1
answer
330
views
Benders implementation on Cplex is very slow
I'm working on a location problem and I have an issue with the Benders decomposition. I'm using Cplex with Python. I coded a single cut and a multi-cut to compare.
The single-cut implementation takes ...
1
vote
0
answers
87
views
CPLEX keeps restarting in Pyomo
I tried running my model by adding the following settings to CPLEX.
...
3
votes
1
answer
440
views
CPLEX Python API Manual with References
I am currently attempting to code a model using the Python API.
However, the IBM Site seems to not have one that is similar in formating and content depth such as those for C++ or Java (examples and ...
5
votes
1
answer
880
views
CPLEX Python API
I am trying to run the following optimization problem at Python by using the CPLEX API:
$$\min \{x_1 + x_2\ | \ x_1 \geq 3, x_2 \geq 2, 2x_1 + x_2 \geq 9\} $$
I just want to give a matrix of ...