cplex

how to force succesive variable to be of same value?

北战南征 提交于 2019-12-13 04:35:52
问题 I have a binary variable y[k][t] , where k = 1..3 (machines) and t = 1..10 (time). Variable Y is 1 if machine is active and 0 otherwise. In the optimization if machine 1 is active in period 1 e.g. Y[1][1] = 1 , i want the machine to continue to operate for at least 3 time periods. i.e. Y[1][1] = Y[1][2] = Y[1][3] = Y[1][4] = 1 . I only want the succesive variable for t+1,t+2,t+3 to be same as t if it is active. how can i do that in cplex studio? 回答1: what Erwin wrote about minimum run length

Limits of CPLEX

北城以北 提交于 2019-12-13 03:59:26
问题 We have a problem involving 100K variables in the objective function and 1500 conditions. Does CPLEX support such numbers? If so, what are the limits and performance benchmarks of CPLEX? Regards, Yash 回答1: YES . Quoting a reply from CPLEX developers in this thread, dated in 2010: CPLEX can handle 30 million variables. The more interesting question will be: does your machine have enough memory for that. CPLEX needs to store lower, upper bounds and objective function coefficients as double

OPL Transportation

允我心安 提交于 2019-12-13 03:55:47
问题 I am writing a code for a simple transportation problem in IBM ILOG CPLEX Optimization Studio. Here is the code trans.mod (File) {string} Sources = ...; {string} Destination = ...; float Demand[Destination]= ...; float Output[Sources]= ...; float Shipcost[Sources][Destination]= ...; assert sum(s in Sources) Output[s] == sum(d in Destination) Demand[d]; dvar int Ship[Sources][Destination] in 1..50; minimize sum(s in Sources, d in Destination) Shipcost[s][d]*Ship[s][d]; subject to { forall( s

what is getNodeID() in BranchCallback

岁酱吖の 提交于 2019-12-13 03:55:37
问题 I want to retrieve the value of Node and NodeID in CPLEX through callbacks in c++. I use getNodeid() in BranchCallback but it wasn't true.Because the value of this function is different from the value of NodeID in logfile. 回答1: The value returned by getNodeId() is different from what is displayed in the NodeID column in the log. getNodeId() returns the sequence number of a node. That number is a unique id that is created/set when the node is created. NodeID in the log returns the id of a node

How to check whether the model coded in CPLEX in .NET is the true model?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 01:26:25
问题 I coded an MIP in CPLEX with C#. I declared variables and constraints and added the objective but I cannot get the correct answer. Is there a way to print the model into a string variable or something like in order to check whether I coded correctly the model I had in mind? 回答1: You could try exporting it in CPLEX LP format, that is human readable. I use neither CPLEX nor .NET, but according this website the function you are looking for is: LOG CPLEX .NET Reference Manual Cplex.ExportModel

Docplex vs CPLEX Python API

馋奶兔 提交于 2019-12-12 17:27:27
问题 What is the difference between Docplex and CPLEX Python API? Is any of them faster than the other? 回答1: The CPLEX Python API is a lightweight wrapper around the C API (aka, the C Callable Library). As such, it provides access to nearly all of the functionality CPLEX has to offer. Variables and constraints are identified by their indices in the matrix. docplex is an object oriented modeling API that is numpy/pandas friendly, which may be more natural to work with. The model can be solved

How to change CPLEX parameters in oplrun?

浪尽此生 提交于 2019-12-12 04:57:31
问题 Is there a way to let oplrun take a specific CPLEX parameter, such as CPX_PARAM_LPMETHOD (Linear Programming method). In the reference here, it is called by various names for different languages: C Name: CPX_PARAM_LPMETHOD C++ Name: RootAlg Java Name: RootAlg .NET Name: RootAlg InteractiveOptimizer: lpmethod But there is no reference about the OPL or oplrun. Is it possible to change this parameter in an oplrun session? Or do I have to use these other languages/interfaces? 回答1: in the .mod you

CPLEX - Error in accessing solution C++

感情迁移 提交于 2019-12-12 04:13:31
问题 I have a problem in accessing the solution of a LP problem. This is the output of CPLEX after calling cplex.solve(); CPXPARAM_MIP_Strategy_CallbackReducedLP 0 Found incumbent of value 0.000000 after 0.00 sec. (0.70 ticks) Tried aggregator 1 time. MIP Presolve eliminated 570 rows and 3 columns. MIP Presolve modified 88 coefficients. Reduced MIP has 390 rows, 29291 columns, and 76482 nonzeros. Reduced MIP has 29291 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.06 sec. (49.60

Dual of models by CPLEX

心不动则不痛 提交于 2019-12-12 04:06:41
问题 I have an essential problem. I use Cplex in C++ and I try to implement my optimization programs by it; however, I have an essential problem. I want to find dual of my program. How can I find some constructs in Cplex for C++ that do it? 回答1: I'm not entirely sure if this is what you're asking for, but the presolve dual setting (quoting the documentation): Decides whether CPLEX presolve should pass the primal or dual linear programming problem to the linear programming optimization algorithm.

Working around segmentation faults that occur in parallel due to a non-thread-safe API function

[亡魂溺海] 提交于 2019-12-12 02:58:06
问题 I am currently coding a MEX file in MATLAB to run experiments in parallel using the parfor function in MATLAB 2012a. The MEX file does some very straightforward numerical tasks but relies on the CPLEX 12.4 API from IBM. Although my MEX file works sequentially, I will inevitably receive "random" segmentation fault when I run in in parallel. After sending a stack trace of the segmentation fault to MATLAB, they have suggested that the error originates from the "putenv()" function from the C