Questions tagged [cplex]

CPLEX is a fast commercial linear, quadratic, and mixed-integer optimizer. CPLEX offers a number of pre and post-processing tools allowing the software to substantially reduce the number of variables (columns) and constraints (rows) of a model. It is possible to solve models via an interactive shell, OPL (Optimization Programming Language), or a number of interfaces to programming languages, such as C, C++, Java, C#, Python, and MATLAB.

CPLEX is a commercial mathematical optimizer now owned and sold by IBM. It can solve continuous and mixed-integer optimization problems with linear and convex quadratic constraints and objectives and second-order cone problems. The core solver is written in C, but APIs are available for C, C++, Java, C#, Python, and MATLAB.

User's guide and API reference is available in the following formats:

  • PDF (for V12.1)
  • HTML (for V12.3 and up)

For troubleshooting questions that may involve back-and-forth (including posting attachments), or technical discussions about the algorithms, consider posting your question on the official IBM developerWorks forum instead.

2272 questions
4
votes
1 answer

Building a linear program in Python with Cplex

I'm trying to solve a linear program with large number of variables and constraints. I need to dynamically generate the constraint matrices and build the lp in python. The only tutorial i can find on Cplex for Python is the official one from IBM,…
user3800276
  • 91
  • 1
  • 4
4
votes
2 answers

Weird result of CPLEX "cplexmilp" function in MATLAB

According to my previous question, I want to optimize an objective function using binary integer linear programming (all of variables are binary) as follows: Minimize f = (c1*x1) + (c2*x2) + MAX((c3*x3),(c4*x4)) + (c5*x5) Subject to: some equality…
oMiD
  • 322
  • 4
  • 20
4
votes
3 answers

Force Python to be 32 bit on OS X Lion

I'm trying to use CPLEX within Python on Mac OS 10.7.5. CPLEX appears to only support a 32 bit python. I'm using this in a python shell to check if it's 32 bit: import sys,platform; print platform.architecture()[0], sys.maxsize > 2**32 I've tried…
sciencectn
  • 1,405
  • 1
  • 16
  • 25
4
votes
1 answer

No solution in CPLEX with very small change in inputs

I'm using CPLEX in C++ to solve a hub location problem, a MIP, and I've recently found a very precise set of inputs that CPLEX thinks is infeasible (i.e. CPXMIP_INFEASIBLE) even though the problem is certainly feasible. The problem appears to…
3
votes
1 answer

CPLEX optimization array error in objective function

I am trying to optimize the below problem in CPLEX OPL. I have defined the parameters and decision variables. However, when I try to formulate the objective function and the constraints I seem to encounter a problem as I receive an error in the line…
Willem B
  • 41
  • 6
3
votes
1 answer

How to use cplex or gurobi solver with cvxopt in Python?

I have a very large linear programming problem (over 10,000 equations and 20,000 variables). The optimization problem is even included in a loop and solved many times. As a result, I want to use sparse matrices with an efficient solver to perform…
Zihang
  • 33
  • 4
3
votes
1 answer

CPLEX Java Convex Quadratic Constraint (only PSD if x non-negative)

I have a quadratic problem with the variables e and a, both of which are non-negative. I have a constraint that reads a <= e (1 - a). When transformed, the matrix Q reads [[0,-1][0,0]] which is obviously neither positive nor negative semi-definite…
Layla
  • 125
  • 10
3
votes
1 answer

How do I set the key for using the full version of CPLEX?

I have purchased a cplex subscription and received a key to use, but I can't figure out how to use it, no matter what I try I keep getting the "no key, go purchase cplex here" error. I'm using cplex via docplex in a jupyter notebook running in…
Threore
  • 33
  • 4
3
votes
1 answer

How do you specify for CPLEX to use only one thread in pyomo?

How do you specify for CPLEX to use only one thread in pyomo? CPLEX by default uses up to 32 threads, capped by the number of processors. But how do you specify using pyomo to only use one thread? Assume my code already has the following: import…
JoseOrtiz3
  • 1,785
  • 17
  • 28
3
votes
1 answer

Can't derive dual values from a LP using CPLEX

I am trying to code a Bender's decomposition algorithm using CPLEX. To ensure that I code it correctly, I follow the numerical example from "Decomposition techniques in mathematical programming" by A.J. Conejo et al., p.247. However, my problem can…
3
votes
3 answers

How to set gap tolerance in cplex-python?

I want to set a gap value (GAP) such that the optimization process stops when the current gap will be lower than GAP. I have read the cplex-python documentation and I found that: Model.parameters.mip.tolerances.absmipgap(GAP) but I get the next…
3
votes
1 answer

Writing custom variable selection method using the CPLEX Python API

I want to implement a custom variable selection heuristic for solving an MLP using the CPLEX Python API. Unfortunately, I cannot find any examples or documentation for this. Ist this actually possible using the CPLEX Python API, or do I need to use…
Christopher
  • 277
  • 2
  • 11
3
votes
2 answers

Why am I getting an unallowed character error in Pyomo with CPLEX?

I am trying to use CPLEX with a simple Pyomo example: from pyomo.environ import * model = ConcreteModel() model.x = Var( initialize=-1.2, bounds=(-2, 2) ) model.y = Var( initialize= 1.0, bounds=(-2, 2) ) model.obj = Objective( expr=…
Jim
  • 105
  • 1
  • 7
3
votes
1 answer

Warm starting QP solver in CPLEX

I'm trying to figure out how to warm start the quadratic programming solver(s) for CPLEX. I am specifically interested in warm starting the QP solver for nonconvex quadratic programs terminating at first-order stationary points. I believe the…
ae0709
  • 304
  • 1
  • 10
3
votes
1 answer

Vehicle Routing with Pickup and Dropoffs with MIP

I am trying to solve a Vehicle Routing Problem with multiple pickups and dropoffs with multiple products carried by just one car. After solving this problem I am going to extend to multiple types of cars as well. One special setting is that it has a…
Josh Cho
  • 159
  • 1
  • 13