cplex

Terminate and retrieve solution in ILOG after a certain time limit

守給你的承諾、 提交于 2019-12-11 03:12:02
问题 I am using ILOG CPLEX from JAVA and I am running an Integer optimisation problem that takes about 3 days to complete the 0.0%. I need to terminate the program after a certain time limit and obtain a solution for whatever the limit left. Can anyone let me know how to do that? Thanks in advance. 回答1: You should run CPLEX with TiLim param: cplex.setParam(IloCplex.DoubleParam.TiLim, your_time_in_seconds) 来源: https://stackoverflow.com/questions/24449622/terminate-and-retrieve-solution-in-ilog

Connecte Excel file to Cplex

江枫思渺然 提交于 2019-12-10 23:59:10
问题 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 I've got the following error: "sheet data not supported on this platform" "Processing failed" I found that reading excel spreadsheet on ILOG CPLEX optimization studio is not supported on Linux Any ideas please? 回答1: I had the same problem. My

cplex for if-else statments

陌路散爱 提交于 2019-12-10 23:35:23
问题 I am new to cplex. In my ilp I have couple of if-else statement. I want to use cplex for solving my problem using java API. I don't know how to formulate if-else in cplex. example: if x>0 then a=1 else if x=0 then a=0 回答1: I don't think that the Java API supports the if/then/else structure, however it is possible to do if/then IloCplex cplex = new IloCplex(); IloNumVar x = cplex.numVar(-100, 100); IloNumVar a = cplex.intVar(0, 1); cplex.ifThen(cplex.ge(x, 100), cplex.eq(a, 1)); cplex.ifThen

Getting the dual formulation in CPLEX concert technology

倾然丶 夕夏残阳落幕 提交于 2019-12-08 03:40:06
问题 I have seen the answer to this similar question but it does not answer my question. Is there any way to get objective function and constraints of the dual formulation directly within your algorithm rather than writing them into a DUA file and then reading them? I know that I can solve the dual formulation by using cplex.setParam(IloCplex::Param::Preprocessing::Dual, 1); But I do not want to solve the dual formulation. I want to access objective function and any constraint of the dual

how to get value of elapsed time after using CPLEX Python API

China☆狼群 提交于 2019-12-07 07:16:31
问题 I'm using CPLEX python API to solve an optimization problem. The model is named DOT. When I run DOT.solve(), many information occur in the python console: Iteration log ... ... Network - Optimal: Objective = 1.6997945303e+01 Network time = 0.48 sec. (91.93 ticks) Iterations = 50424 (8674) ... My question is that is there an easy way to get value of the elapsed time (i.e., 0.48 in my case)? And not just for the network optimizer, but for dual method, barrier method too. I'm very new to python

Getting the dual formulation in CPLEX concert technology

一世执手 提交于 2019-12-06 09:17:21
I have seen the answer to this similar question but it does not answer my question. Is there any way to get objective function and constraints of the dual formulation directly within your algorithm rather than writing them into a DUA file and then reading them? I know that I can solve the dual formulation by using cplex.setParam(IloCplex::Param::Preprocessing::Dual, 1); But I do not want to solve the dual formulation. I want to access objective function and any constraint of the dual formulation so I could modify them as part of my algorithm. I use CPLEX 12.8 (Concert technology, C++ API) and

Compile Cplex in Java in linux

心不动则不痛 提交于 2019-12-06 01:37:09
i'm trying to compile my file.java with an optimization problem with CPLEX notation in a cluster wich use linux (an i'm a windows user) and a used (through and application to send commands) javac file.java and i get errors like : file.java:4: error: package ilog.concert does not exist import ilog.concert.IloException; ^ file.java:5: error: package ilog.concert does not exist import ilog.concert.IloLinearNumExpr; ^ file.java:6: error: package ilog.concert does not exist import ilog.concert.IloNumVar; ^ file.java:7: error: package ilog.concert does not exist import ilog.concert.IloNumVarType; ^

how to get value of elapsed time after using CPLEX Python API

旧巷老猫 提交于 2019-12-05 17:18:51
I'm using CPLEX python API to solve an optimization problem. The model is named DOT. When I run DOT.solve(), many information occur in the python console: Iteration log ... ... Network - Optimal: Objective = 1.6997945303e+01 Network time = 0.48 sec. (91.93 ticks) Iterations = 50424 (8674) ... My question is that is there an easy way to get value of the elapsed time (i.e., 0.48 in my case)? And not just for the network optimizer, but for dual method, barrier method too. I'm very new to python and CPLEX, and I'm very grateful for any help. To get the total solve time (in wall clock time), you

Interpretation of GAP in CPLEX

眉间皱痕 提交于 2019-12-05 02:57:30
问题 This is a part of the engine-log output that I get from a small-scale mixed integer linear optimization problem that I solved in CPLEX 12.7.0 Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap 0 0 280.0338 78 280.0338 72 0 0 428.8558 28 Cuts: 89 137 0 0 429.5221 34 Cuts: 2 142 0 0 429.7745 34 MIRcuts: 2 143 * 0+ 0 460.9166 429.7745 6.76% 0 2 429.7745 34 460.9166 429.8666 143 6.74% Elapsed time = 0.49 sec. (31.07 ticks, tree = 0.01 MB, solutions = 1) * 35 8 integral 0 438

Leapms + cplex解决 混合整数规划问题

被刻印的时光 ゝ 提交于 2019-12-04 07:12:27
Leapms + cplex解决 混合整数规划问题 O、概述 CPleX是一个神秘的求解器, 听说久了就想用, 但是直接用有些困难, 尤其入门困难. 对初学者来说Leapms是一个好的通道. 在Leapms内有一个cplex命令, 直接敲入cplex+回车就可以调用Cplex求解. 然而网上下载的Leapms没有这个功能. 但是这难不倒本尊, 因为leapms可以输出 lp 和 ms 文件, 这可是通用模型接口啊. 通过这个就行了呗. 什么?那里找Leapms? 百度呗。。。。。 一、让Leapms输出MPS文件 1、首先从别处复制一个求解旅行商问题问题的leapms模型, 用记事本存成TSP.leap文件(点下面的view code打开代码). 什么?这个模型怎么理解?看本博客其他文(https://www.cnblogs.com/leapms/p/10058798.html) //The Traveling Salesman Problem min sum{i=1,...,n;j=1,...,n;i<>j}x[i][j]D[i][j] subject to sum{i=1,...,n;i<>j}x[i][j]=1 | j=2,...,n sum{j=1,...,n;i<>j}x[i][j]=1 | i=2,...,n u[1]=0 u[j]>=u[i]+1-n(1-x[i][j