Hot answers tagged

8 votes
Accepted

CPLEX violating constraints (CPLEX - version 12.10 - C++)

Your problem is that double precision arithmetic is not perfectly accurate. Consequently, CPLEX (and pretty much every other solver) has various tolerance settings for when a double precision value is ...
prubin's user avatar
  • 37.8k
6 votes

Implementing Heuristic Callback in CPLEX C++ API for MILP

Disclaimer: It's been a while since I used Cplex' C++ API. According to your question, you probably rather want to use a generic callback and inject a feasible (heuristic) solution through ...
joni's user avatar
  • 1,477
6 votes

"Re-optimize" feature in Commercial Optimization

CPLEX has an advanced start parameter which dictates how it acts when solve is called on a previously solved/partially solved model. For MIP models with the default setting of the parameter, if you ...
prubin's user avatar
  • 37.8k
5 votes

MIP Model with relaxed integer constraints takes longer to solve than normal model, why?

First, it is risky to draw conclusions with so few data. It could just be luck. Still, there are some possible reasons why setting some variables as integer might be beneficial: It can trigger more ...
fontanf's user avatar
  • 2,495
5 votes
Accepted

Implementing Heuristic Callback in CPLEX C++ API for MILP

As @Joni notes, there is a parameter that controls how much (if any) effort CPLEX spends checking solutions you supply. You can freely mix integer and continuous variables in the call to setSolution, ...
prubin's user avatar
  • 37.8k
4 votes

Accessing Lagrange Multipliers in CPLEX

From the official CPLEX documentation here (CPLEX 20.1): SolutionInterface.get_dual_values() does indeed return the Lagrange/dual values.
Kuifje's user avatar
  • 12.9k
3 votes

Dual problem in IBM CPLEX

If the primal LP problem suffers from degeneracy, I believe dual simplex may be faster. You might try using the barrier method to solve the (primal) LP. In cases where the LP has degeneracy issues, I ...
prubin's user avatar
  • 37.8k
3 votes

Tips for implementing Benders Decomposition in C++?

Recent versions of CPLEX (12.7 or later) have built in support for Benders. You can let CPLEX decide what to put in the master problem and what goes in the subproblems, or you can use annotations to ...
prubin's user avatar
  • 37.8k
3 votes
Accepted

Can a logical expression be added to the objective function of a model in docplex?

We can use a "big M" approach, assuming that you can find a positive constant $M$ such that $\vert y_{jk}-y_{ik} \vert \le M$ for all $k\in K$ and $(i,j)\in V.$ Introduce new binary ...
prubin's user avatar
  • 37.8k
3 votes

Summation of maximization terms in CPLEX

It sounds like you want to maximize $$\sum_i \sum_j c_{ij} x_{ij}$$ subject to \begin{align} \sum_j x_{ij} &=1 &&\text{for all $i$} \\ x_{ij} &\in\{0,1\} &&\text{for all $i$ ...
RobPratt's user avatar
  • 30.4k
3 votes

How to remove a callback that was previously registered in Julia?

Currently there is no support for removing a callback from a model in JuMP. Your options are: Rebuild the model Set a new callback that does nothing The Julia discourse forum is another platform you ...
Oscar Dowson's user avatar
3 votes

Two-Stage Stochastic Optimization: How to deal with Infeasible scenario while calculating EEV (Expected result of using the EV solution)

A paper here speak of scenarios for EEV that are infeasible. Alternative is to use a complete recourse model, unfix stage 1 variables for the model to adapt. I guess you may experiment by making ...
Sutanu Majumdar's user avatar
3 votes
Accepted

How to get the fractional solution of a node in a MIP model using JuMP package?

In general, JuMP does not support querying the best fractional solution of a branch and bound tree. However, if you are using CPLEX or Gurobi, you can write a solver-specific callback to do what you ...
Oscar Dowson's user avatar
3 votes
Accepted

Non-proprietary (Python friendly) alternatives to Cplex and Gurobi

You can use HiGHS, SCIP and CBC solvers with using PYOMO or other Pyomo supported solvers. Also you can use google or-tools CP solver if you write CP model, google CP solver is very powerfull. PYOMO ...
kur ag's user avatar
  • 795
2 votes
Accepted

Modifying and re-optimizing a model using CPLEX Python API

You can do incremental changes https://github.com/AlexFleischerParis/zoodocplex/blob/master/zooincremental.py ...
Alex Fleischer's user avatar
2 votes
Accepted

Converting continuous variable dict to binary variables in python docplex

If you would like to convert a variable into another type, this can be possible by using ilo.conversation method. This can be invoked on DoCplex by; ...
A.Omidi's user avatar
  • 8,390
2 votes

Which data type is best used when programming an optimization problem in C++?

There is no definitive answer and it depends on: your background the nature / characteristic of your problem the nature / characteristic of your implementation (proof of concept; deployed software) ...
sascha's user avatar
  • 446
2 votes

How to obtain nodes count and nodes left in docplex (using CPLEX 12.20 and Python 3.8)

I think what you want can be seen in the CPLEX log as follows: ...
A.Omidi's user avatar
  • 8,390
2 votes
Accepted

Info callback in CPLEX OPL

I am not aware of if informational callbacks can be invoked directly via OPl-CPLEX the same as the low-level programming language. For more details, you can check ...
A.Omidi's user avatar
  • 8,390
1 vote

Linear Programming faster solver: CPLEX or Gurobi?

I think the performance for different solvers depends on your problems structure. Maybe some of specific problems will lead better performance for that solver. In general, in my opinion, both of them ...
ytsao's user avatar
  • 328
1 vote

Tips for implementing Benders Decomposition in C++?

For example, If your problem is two-stages stochastic programming, then you can separate your problem into master problem and sub-problem by your hands. Then you can use CPLEX to model both stages in ...
ytsao's user avatar
  • 328
1 vote

How to change CPLEX parameters from within CPLEX Studio IDE 22.1.1

I tried using this option in the CPLEX studio OPL-CPLEX 20.1.0. I am not aware of if, it changes in the latest version. To that you need to change ...
A.Omidi's user avatar
  • 8,390
1 vote

Which data type is best used when programming an optimization problem in C++?

I would suggest taking a look at the C++ source code examples that ship with CPLEX Optimization Studio. Then have a look at the documentation for the C++ API, specifically for the optim.concert group. ...
prubin's user avatar
  • 37.8k
1 vote
Accepted

Get objective upper bound in a callback (cplex)

I'll use Java notation, but C++ should be very similar if not the same. There is a method IloCplex.Callback.Context.getDoubleInfo() that takes an enumeration value as argument and returns a double ...
prubin's user avatar
  • 37.8k
1 vote

Cplex seems to terminate early as optimal when starting solution polishing

First of all, I think you have to display the final MIP gap in your terminal, maybe that actually MIP gap is zero. If not, in my opinion, you have to check several experiments. Using MIP solver solve ...
ytsao's user avatar
  • 328
1 vote

Array of string in OPL

.mod {string} cluster=...; string darkstore [cluster][1..4]=...; string demandpoint [cluster][1..4]=...; .dat ...
Alex Fleischer's user avatar
1 vote

"Re-optimize" feature in Commercial Optimization

Probably this link from Gurobi will help. You have to call the optimize() function in gurobi after you change parameters like the rhs of a constraint, add/remove constraints, change bounds of ...
Sutanu Majumdar's user avatar
1 vote

How should I implement Benders Decomposition with annotations in C++ using CPLEX library

I think I just answered this on my blog, but for the record, CPLEX does not (as far as I know) provide access to Benders cuts when the problem is partitioned automatically using annotations. So to ...
prubin's user avatar
  • 37.8k
1 vote

Summation of maximization terms in CPLEX

Wouldn't know exactly in CPLEX but referring to this answer one way is to define $\theta_i$ and binary variables $z \in \{0,1\}^{I\times J}$as $ c_{ij}x_j \le \theta_i \le c_{ij}x_ j + M(1-z_{ij}) \ \ ...
Sutanu Majumdar's user avatar
1 vote

Updating constraint set rhs in docplex

I think the method you pointed out would be as follows: ...
A.Omidi's user avatar
  • 8,390

Only top scored, non community-wiki answers of a minimum length are eligible