Questions tagged [cplex-python-api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
39 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
50 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 ...
  • 251
2 votes
1 answer
34 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 (...
  • 251
4 votes
0 answers
41 views

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

...
2 votes
1 answer
116 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 ...
  • 251
-1 votes
1 answer
106 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.
  • 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}} $$
  • 307
4 votes
0 answers
138 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 ...
  • 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 ...
  • 307
1 vote
0 answers
244 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
1 answer
201 views

Accessing Lagrange Multipliers in CPLEX

I want to get the lagrange multipliers for a solution from cplex. I am using it via Python. The problem is continuous with a linear objective function and elements of solution vector $x$ are ...
  • 121
3 votes
2 answers
121 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: ...
  • 75
4 votes
1 answer
313 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 $...
  • 41
3 votes
1 answer
193 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 ...
  • 695
3 votes
2 answers
280 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?
  • 543
2 votes
0 answers
149 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,...
  • 443
3 votes
1 answer
249 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 ...
  • 75
3 votes
1 answer
240 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 ...
  • 141
1 vote
0 answers
71 views

CPLEX keeps restarting in Pyomo

I tried running my model by adding the following settings to CPLEX. ...
  • 695
3 votes
1 answer
308 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 ...
  • 695
5 votes
1 answer
708 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 ...