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
2
votes
1 answer

ILOG TSP getting null output

I've been learning Cplex Java API by implementing TSP problem. I want to create obj with random weights between 50-1000 as seen below: public static IloLinearNumExpr generateObjs(Integer n, IloCplex cplex) throws IloException{ IloNumVar[][] x =…
2
votes
1 answer

CPLEX: How can I programmatically check whether a user is running the Community Edition or full version?

I'm especially interested in the standard CPLEX Python interface. An obvious approach is to use a try: ... except: ... block and using more than 1000 variables in a program. But I'm hoping for a cleaner approach, more direct approach.
ABDreverhaven
  • 539
  • 1
  • 5
  • 10
2
votes
2 answers

Connecte Excel file to Cplex

I'm to solve an optimization problem using Cplex. In my file.dat I use SheetConnection my_sheet("ExcelFile.xls") to link Excel file to my cplex program, and after that I use SheetRead() to read data from Excel file. But after I run my configuration…
AIA
  • 23
  • 1
  • 5
2
votes
5 answers

What is the obvious advantage of using AMPL?

I am doing a project using CPLEX solver, on Netbeans with Java. We have several optimization problems to solve, I have already solved one of them by coding in Java all the constraints, objective and variables, without using AMPL. However, some…
MysteryGuy
  • 1,091
  • 2
  • 18
  • 43
2
votes
1 answer

Piecewise linear constraint in CPLEX API for MATLAB

I am a (almost) beginner with CPLEX and optimization. I am trying to set up an optimization problem in Matlab using the newly added feature of CPLEX (12.7.1), which enables the definition of piecewise linear (PWL) constraints. However, it is not…
2
votes
1 answer

CPLEX how to get all the different optimal solutions with the same cost

I have a problem solved by Cplex that has at least two different optimal solutions with the same value. How can I get all the different optimal solutions with the same value? Update: it is a linear programming problem
thewoz
  • 499
  • 2
  • 4
  • 23
2
votes
1 answer

pyomo and cplex parallel computing for mixed integer linear programming

I am using pyomo for mixed-integer linear programming model. I call cplex in pyomo to solve the model. The problem I am solving is large, which require parallel computing. Should I set parallel in pyomo or in cplex? In pyomo, I found this syntax,…
Lei
  • 21
  • 1
2
votes
1 answer

cplex presolver without invoking the cplex mip solver

Is it possible to run the cplex presolver to aggregate a problem without invoking the the mip solver? If it is, could you provide an example using the c callable library?
acco93
  • 128
  • 2
  • 11
2
votes
1 answer

CPLEX gap setting with PULP

Anyone know how to set the epgap parameter for CPLEX solver when calling CMD_CPLEX() from PULP (python)? I have tried everything from an options file in the folder to tons of different syntax attempts like: prob.solve(CPLEX_CMD(options = ['epgap =…
2
votes
1 answer

CPLEX Optimization Studio GUI on Mac

I have installed IBM ILOG CPLEX Optimization Studio on my Mac but when I run cplex I do not get the same interface as shown in the demo in IBM web site (https://www.ibm.com/us-en/marketplace/ibm-ilog-cplex/purchase#product-header-top) Attached…
Nile
  • 303
  • 2
  • 11
2
votes
1 answer

LP: postive reduced costs corresponding to positive variables?

I have the next LP problem Maximize 1000 x1 + 500 x2 - 500 x5 - 250 x6 Subject To c1: x1 + x2 - x3 - x4 = 0 c2: - x3 + x5 = 0 c3: - x4 + x6 = 0 With these Bounds 0 <= x1 <= 10 0 <= x2 <= 15 0 <= x5 <= 15 0 <= x6 <= 5 By solving…
2
votes
1 answer

CPLEX library path error in eclipse

I'm using eclipse for java coding I completed the code and it worked well on CPLEX library 12.6(I added library in properties> libraries > add external jars > cplex.jar) I wanted to change the library of CPLEX 12.7, so I removed previous one and…
안규리
  • 65
  • 1
  • 5
2
votes
1 answer

CPLEX giving different OPTIMAL solutions with very different objective values

When running CPLEX on the same ILP problem (exactly the same input file): With MIPEmphasis = 3 I get an objective value of 6.81613e-06 With MIPEmphasis = 4 I get an objective value of 1.03858 In both cases, CPLEX returns an OPTIMAL status. From…
2
votes
2 answers

ImportError: No module named 'cplex' Python on Linux

I am trying to run python scripts on a HPC machine (RedHatEntrepriseServer). CPLEX module is already installed by adminastrators but I still have this error in importing cplex module in python. ImportError: No module named 'cplex' I know it is…
Betty
  • 237
  • 6
  • 16
2
votes
1 answer

Solutions not satisfying some constraints

I wanna solve a simple integer programming problem for scheduling with IBM ILOG CPLEX and my whole code is below. Under specific data, the solution with objective 11,306 is found but some solutions don't satisfy specific constraint, ct2. I wonder…
hepark
  • 21
  • 2