Skip to main content

Questions tagged [cplex-python-api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
125 views

CPLEX 20.1.0.0 and python version 3.10

I am trying to develop in python 3.10, and locally I have cplex 20.1.0.0 installed. It appears to me that the python interface cplex only supports python version 3....
TTY's user avatar
  • 245
2 votes
1 answer
101 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, ...
Nada.S's user avatar
  • 409
3 votes
1 answer
223 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, ...
John's user avatar
  • 131
2 votes
1 answer
211 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 ...
user avatar
3 votes
2 answers
267 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/...
Pia MiA's user avatar
  • 392
4 votes
0 answers
1k 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-...
Pia MiA's user avatar
  • 392
3 votes
1 answer
194 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 ...
Bree's user avatar
  • 115
2 votes
2 answers
202 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 ...
Pia MiA's user avatar
  • 392
2 votes
1 answer
295 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 ...
Meet Saiya's user avatar
1 vote
0 answers
142 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 ...
Elena's user avatar
  • 251
2 votes
1 answer
49 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 (...
Elena's user avatar
  • 251
4 votes
0 answers
148 views

How to invoke a solution pool and access all the solutions in cplex using PYOMO ? this is the structure of my pyomo code

...
Prachi Patki's user avatar
2 votes
1 answer
488 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 ...
Elena's user avatar
  • 251
-1 votes
1 answer
360 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.
GTek's user avatar
  • 307
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}} $$
GTek's user avatar
  • 307
4 votes
0 answers
372 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 ...
Elena's user avatar
  • 251
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 ...
GTek's user avatar
  • 307
1 vote
0 answers
634 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 ...
Nam-kyoung Lee's user avatar
2 votes
2 answers
377 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 ...
Dom's user avatar
  • 129
3 votes
2 answers
167 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: ...
AGH's user avatar
  • 175
4 votes
1 answer
597 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 $...
Sharmi's user avatar
  • 41
3 votes
1 answer
363 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 ...
Mike's user avatar
  • 717
3 votes
2 answers
415 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?
Eddiee's user avatar
  • 533
2 votes
0 answers
238 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,...
Amedeo's user avatar
  • 443
3 votes
1 answer
357 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 ...
AGH's user avatar
  • 175
3 votes
1 answer
366 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 ...
Almufa's user avatar
  • 141
1 vote
0 answers
91 views

CPLEX keeps restarting in Pyomo

I tried running my model by adding the following settings to CPLEX. ...
Mike's user avatar
  • 717
4 votes
1 answer
502 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 ...
Mike's user avatar
  • 717
5 votes
1 answer
948 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 ...
independentvariable's user avatar