Questions in topic: "cplex"
https://developer.ibm.com/answers/questions/topics/single/197404.html
The latest questions for the topic "cplex"How to write quadratic constraints in python CPLEX
https://developer.ibm.com/answers/questions/508128/how-to-write-quadratic-constraints-in-python-cplex.html
Hi,
I have a MILP model in python and the solver is CPLEX. I wish to convert a single constraint to quadratic and the objective function is still linear. I am not sure how to do this? Can someone help me with this?
ThankspythoncplexMon, 17 Jun 2019 08:22:22 GMTPiaprituHow to load the solution value of decision variables into a second model as data
https://developer.ibm.com/answers/questions/508056/how-to-load-the-solution-value-of-decision-variabl.html
I am trying to do the following using CPLEX with OPL and ILOG Script:
Solve an optimization problem, then transfer the solution value of a decision variable (a one-dimensional array) to a second model (this is where I have trouble) and solve the second model.
In model 1, I have a binary array decision variable w. In model 2, there is a parameter i. Essentially, I would like to do something as "i := w.solutionValue". For the second model, I need to read data from a *.dat-file as well. I tried initializing the parameter i in the *.dat-file and then writing (in a main-block)
data2 = new IloOplDataSource("datfile.dat");
data2.i = w_array;
(w_array is an auxiliary variable that I used to store the w.solutionValue.)
Unfortunately, this gives me the error "cannot add properties to this value, "[a IloOplMain.IloOplDataSource]".
Could you help me with this? What is wrong about my approach and how can I get it running?
Thanks a lot in advance!cplexilogmainSun, 16 Jun 2019 15:26:32 GMTjsaupeNew CPLEX Developer Subscription API doesn't work
https://developer.ibm.com/answers/questions/507757/new-cplex-developer-subscription-api-doesnt-work.html
I have upgraded from the Free-Trial to CPLEX Developer Monthly subscription. Received the new API in an email. But for some reason I cannot connect through the new API. This is the error I get (I work in R):
Creating job
Request failed [403]. Retrying in 1.9 seconds...
Request failed [403]. Retrying in 2.1 seconds...
Error in self$makeRequest("POST", url = url, fail_message = "create job on url", :
Forbidden (HTTP 403). Failed to create job on url https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1//jobs.
Also the DropSolve does not see my new subscription and only sees the Free Trial. So I cannot monitor what's going on.
Am I doing something wrong?cplexdocplexcloudWed, 12 Jun 2019 18:01:43 GMTLinksbridgeSPCCPLEX Error: Control character in string
https://developer.ibm.com/answers/questions/507645/cplex-error-control-character-in-string-1.html
Hi!
Could anyone tell me why CPLEX throws an "Control character in string" error when executing the IloCplex::extract(IloModel) method?
The disturbing point is that this exception is thrown only in a few runs among a series of identical executions.cplexc++Wed, 12 Jun 2019 08:40:01 GMTDani de MonzonCPLEX Error: Control character in string
https://developer.ibm.com/answers/questions/507630/cplex-error-control-character-in-string.html
Hi!
Could anyone tell me why CPLEX throws an "Control character in string" error when executing the IloCplex::extract(IloModel) method?
The disturbing point is that this exception is thrown only in a few runs among a series of identical executions.cplexc++Wed, 12 Jun 2019 08:03:45 GMTDani de MonzonCan I create multiple Model using same constrains using threading in DoCplex-python?
https://developer.ibm.com/answers/questions/506896/can-i-create-multiple-model-using-same-constrains.html
I am working on an optimization problem which can be solved for multiple groups. Groups are user input and I am trying to do the same using threading as it will allow to create same constraints for different group together and solve multiple models simultaneously. I wanted to know if this approach is feasible and if there is similar kind of example available?cplexdocplexclouddocplexMon, 03 Jun 2019 22:55:29 GMTkkaushi4Issues solving problem with CPLEX Goals
https://developer.ibm.com/answers/questions/506703/issues-solving-problem-with-cplex-goals.html
Hi,
I'm programming an user branch&cut with CPLEX Goals for a "false MIP" problem, which replaces the integrality conditions with *user_feasibility* conditions and pruning rules by *user_pruning* ones. However, there are some issues derived from these modifications:
- Although the execution finds incumbents, cplex does not recognize them (and not include them in the log).
- The best bound parameter doesn't move neither with a breadh-first search or a depth-first search.
This method uses a branch&cut scheme over an LP formulation (not arising from a MILP relaxation), so I add one binary variable to trick cplex to let me use goals. The steps of the goal code are:
1. If *user_pruning*, prune.
2. If *user_feasibility*, solution is an incumbent. Update bounds and prune.
3. Select branching cuts *cut_0* and *cut_1*.
4. Create subnodes with parameters *cut_n*, *new_user_pruning* and *user_feasibility*.
Those issues may arise from the misuse of goals. Also, I'm concerned about the transmission of chaning *user_pruning* rules since each goal is executed multiple times (about a dozen at the root node and twice the remaining nodes at some executions).
I would know if there is a way to develop this method with c++ (or any other) using goals or callbacks and, if so, how can I tell cplex what's going on.
Thanks in advance!cplexc++ executable applicationSat, 01 Jun 2019 12:16:15 GMTDani de MonzonCPLEX Benders Decomposition Log File
https://developer.ibm.com/answers/questions/506657/cplex-benders-decomposition-log-file.html
Hello,
I am using CPLEX 12.7.1. built-in AIMMS software to solve a Mixed Integer Linear Programming. I am solving with Benders Decomposition, however, the Log File doesn't show characteristics of Benders Decomposition but Branch and cut.
I would like to know how to see in the Log File, the number of iterations of the Master's Problem and Subproblem, the number of iterations of each MIP, number of cuts, etc.
Thank you.cplexFri, 31 May 2019 18:15:21 GMTCarolf19Get the similar graph for solve progress in Docplex as we have in Cplex?
https://developer.ibm.com/answers/questions/505680/get-the-similar-graph-for-solve-progress-in-docple.html
I am trying to solve MIP using Docplex, though I am getting the results and log_output, but I want to create similar progress graph we get in CPLEX under Statistics Tab. Is there any easier way to do the same in DoCplex as parsing all log_output is a mess?cplexdocplexclouddocplexWed, 22 May 2019 21:51:07 GMTkkaushi4CPLEX Error 1016 (CPXERR_PROMOTION_VERSION), but echo $CPLEX_STUDIO_KEY works fine
https://developer.ibm.com/answers/questions/505642/cplex-error-1016-cpxerr-promotion-version-but-echo.html
Good evening dear developers,
I am a licence holder of cplex 12.8 and bash shows the correct API-Key after echo $CPLEX_STUDIO_KEY but my programm recieves the CPLEX exception 1016 (CPXERR_PROMOTION_VERSION) with following lines:
Checking license ...
fork() failed [error=12]No license found. [0.00 s]
How can I fix this problem? The API-Key is set in $HOME/.bashrc
Thank you!cplexWed, 22 May 2019 15:53:24 GMTcplex_developerHow to modify the felxible job shop example that it can be solved with cplex instead of cp?
https://developer.ibm.com/answers/questions/505534/how-to-modify-the-felxible-job-shop-example-that-i.html
Hello, does anyone has a modified version of the felxible job shop example that uses cplex and not cp? I´m a beginner and would be very thankful if anyone has the code for that. Thank you in advance
using CP;
tuple paramsT{
int nbJobs;
int nbMchs;
};
paramsT Params = ...;
int nbJobs = Params.nbJobs;
int nbMchs = Params.nbMchs;
range Jobs = 1..nbJobs;
range Mchs = 1..nbMchs;
tuple Operation {
int id; // Operation id
int jobId; // Job id
int pos; // Position in job
};
tuple Mode {
int opId; // Operation id
int mch; // Machine
int pt; // Processing time
};
{Operation} Ops = ...;
{Mode} Modes = ...;
// Position of last operation of job j
int jlast[j in Jobs] = max(o in Ops: o.jobId==j) o.pos;
dvar interval ops [Ops];
dvar interval modes[md in Modes] optional size md.pt;
dvar sequence mchs[m in Mchs] in all(md in Modes: md.mch == m) modes[md];
execute {
cp.param.FailLimit = 10000;
}
minimize max(j in Jobs, o in Ops: o.pos==jlast[j]) endOf(ops[o]);
subject to {
forall (j in Jobs, o1 in Ops, o2 in Ops: o1.jobId==j && o2.jobId==j && o2.pos==1+o1.pos)
endBeforeStart(ops[o1],ops[o2]);
forall (o in Ops)
alternative(ops[o], all(md in Modes: md.opId==o.id) modes[md]);
forall (m in Mchs)
noOverlap(mchs[m]);
}
execute {
for (var m in Modes) {
if (modes[m].present)
writeln("Operation " + m.opId + " on machine " + m.mch + " starting at " + modes[m].start);
}
}
tuple solutionT{
int operation;
int machine;
int start;
};
{solutionT} solution = { | m in Modes : startOf(modes[m]) != 0};cplexdocplexcloudoplWed, 22 May 2019 08:52:16 GMTTrichternatorLexicographic optimization with version 12.9
https://developer.ibm.com/answers/questions/505431/lexicographic-optimization-with-version-129.html
Hello,
As the `solve_lexicographic` method is being depreciated, we are in the process of updating our code base by using `set_multi_objective` followed by the `solve` function.
However, we noticed that `solve` is just doing a single pass on the problem (observed via a progress listener). Also the log_output shows a single pass as well.
We observed the same behavior with the multi objective nurse scheduling code shared in your repository of examples.
Could you please advise on how to fix this issue?
Thank you!cplexdocplexclouddocplexoplmultiobjectiveTue, 21 May 2019 15:23:28 GMTAhmet TuysuzogluNon-strict inequalities Python API
https://developer.ibm.com/answers/questions/505047/non-strict-inequalities-python-api-1.html
Hello everybody!
Context of my question: using Cplex Python API (with Python 3.7)
I found this in the description for the "senses" parameter in function add(self, lin_expr=None, senses='', rhs=None, range_values=None, names=None)
"senses must be either a list of single-character strings or a string containing the senses of the linear constraints. Each entry must be one of 'G', 'L', 'E', and 'R', indicating greater-than, less-than, equality, and ranged constraints, respectively."
(The link of this description is available in: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.LinearConstraintInterface-class.html)
I would like to know how I add a less than or equal to inequality, e.g., "x1 + x2 >= 2", something that is possible when I use the Cplex C++ ConCert Technology
Thanks in advance for your time to what probably is a really basic question (although I haven't been able to find the reply in a while)
Best regards,
DiegopythoncplexconstraintFri, 17 May 2019 17:50:50 GMTdiegorossitNon-strict inequalities Python API
https://developer.ibm.com/answers/questions/505041/non-strict-inequalities-python-api.html
Hello everybody!
Context of my question: using Cplex Python API (with Python 3.7)
I found this in the description for the "senses" parameter in function add(self, lin_expr=None, senses='', rhs=None, range_values=None, names=None)
"senses must be either a list of single-character strings or a string containing the senses of the linear constraints. Each entry must be one of 'G', 'L', 'E', and 'R', indicating greater-than, less-than, equality, and ranged constraints, respectively."
(The link of this description is available in: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.LinearConstraintInterface-class.html)
I would like to know how I add a less than or equal to inequality, e.g., "x1 + x2 >= 2", something that is possible when I use the Cplex C++ ConCert Technology
Thanks in advance for your time to what probably is a really basic question (although I haven't been able to find the reply in a while)
Best regards,
DiegopythoncplexconstraintFri, 17 May 2019 16:51:44 GMTdiegorossitHow to make a decision variable dependent on a decision variable?
https://developer.ibm.com/answers/questions/504908/how-to-make-a-decision-variable-dependent-on-a-dec.html
Hi all,
I am making a time dependent VRP model in Cplex.
The following constraint is calculating the traveltime from node i to node j depending on the departure time t at node i. Eta and theta represent the slope and intercept of the traveltimefunction breakpoints. Where t[i][j][k][m] is the decision variable that states at which time the vehicle is leaving from node i to j and in which time period m. and x[i][j][k][m] is a boolean variable telling if the arc is traversed or not.
![alt text][1]
traveltime and departure time are also in the constraints below:
![alt text][2]
written in Cplex as:
forall (i,j in N : i != 0, k in K)
time[k][i] + traveltime[i][j] + s[j] <= time[k][j] + M * (1 - x[i][j][k]); //is a subtour eliminating constraint which also respects the time windows
forall (i in N : i != n+1, k in K)
time[k][i] == sum (j in N : j != 0, m in breakpoints) t[i][j][k][m]; //calculates the departure time for vehicle k from node i
forall (i,j in N, k in K, m in breakpoints)
m.m * x[i][j][k] <= t[i][j][k][m]; //A big M constraint making sure departure time is associated with the correct time zone
forall (i,j in N, k in K, m in breakpoints)
m.mend * x[i][j][k]>= t[i][j][k][m];
![alt text][3]
My questions are:
1. Are tau[i][j] and t[k][i] decision variables? (they are not sets or parameters, because I don't know the values beforehand)
2. How do I model these two variables in Cplex when they are dependent on eachoter?
Help and ideas are much appreciated!
[1]: /answers/storage/temp/28099-screen-shot-2019-05-16-at-161306.png
[2]: /answers/storage/temp/28098-screen-shot-2019-05-16-at-161042.png
[3]: /answers/storage/temp/28102-screen-shot-2019-05-16-at-163859.pngcplexquestionsvariableurgentThu, 16 May 2019 14:50:48 GMTEva2How to get multiple models based on the same environnement ? CPLEX - C++
https://developer.ibm.com/answers/questions/504146/how-to-get-multiple-models-based-on-the-same-envir.html
Hello,
I need to get and resolve several models all based on the same model, here is my code :
...
IloEnv envIdealPoint;
vector<IloModel> modelIdealPointQuadratic;
vector<IloModel> modelIdealPointLinear;
IloNumVarArray varIdealPointQuadratic(envIdealPoint);
IloNumVarArray varIdealPointLinear(envIdealPoint);
void constructBasicIdealPointModel(vector<double>& obj, vector<vector<double> >& A, vector<double>& b, vector<string>& sign, vector<vector<double> >& C, vector<vector<vector<double> > >& M, vector<vector<double> >& CM)
{
for (unsigned int i = 0; i < M.size(); i++)
{
//cout << "i = " << i << endl
IloModel model(envIdealPoint);
IloNumExpr obj(envIdealPoint);
IloRangeArray ct(envIdealPoint);
//cout << "so: " << C[0].size() << endl;
for (int j = 0; j < C[0].size(); j++)
{
//cout << "j= " << j << endl;
stringstream sstm;
sstm << "x" << j;
string result = sstm.str();
//cout << "result= " << result << endl;
varIdealPointQuadratic.add(IloNumVar(envIdealPoint, 0.0, IloInfinity, result.data()));
}
//cout << "after x" << endl;
for (unsigned int j = 0; j < M[i].size(); j++)
{
for (unsigned int k = 0; k < M[i][j].size(); k++)
{
obj += M[i][j][k] * varIdealPointQuadratic[j] * varIdealPointQuadratic[k];
}
}
//cout << "after first obj" << endl;
for (unsigned int j = 0; j < CM[i].size(); j++)
{
obj += CM[i][j] * varIdealPointQuadratic[j];
}
//cout << "after last obj" << endl;
model.add(IloMinimize(envIdealPoint, obj));
for (int k = 0; k < A.size(); k++)
{
IloNumExpr c(envIdealPoint);
for (int j = 0; j < C[0].size(); j++)
{
c += A[k][j] * varIdealPointQuadratic[j];
}
if (sign[k] == "<=")
{
ct.add(c <= b[k]);
}
else if (sign[k] == ">=")
{
ct.add(c >= b[k]);
}
else
{
ct.add(c == b[k]);
}
stringstream sstm;
sstm << "c" << k;
string result = sstm.str();
ct[k].setName(result.data());
}
//cout << "after ct" << endl;
model.add(ct);
modelIdealPointQuadratic.push_back(model);
}
for (unsigned int i = 0; i < C.size(); i++)
{
IloModel model(envIdealPoint);
IloNumExpr obj(envIdealPoint);
IloRangeArray ct(envIdealPoint);
for (int j = 0; j < C[0].size(); j++)
{
stringstream sstm;
sstm << "x" << j;
string result = sstm.str();
varIdealPointLinear.add(IloNumVar(envIdealPoint, 0.0, IloInfinity, result.data()));
}
for (unsigned int j = 0; j < C[i].size(); j++)
{
obj += C[i][j] * varIdealPointLinear[j];
}
model.add(IloMinimize(envIdealPoint, obj));
for (int k = 0; k < A.size(); k++)
{
IloNumExpr c(envIdealPoint);
for (int j = 0; j < C[0].size(); j++)
{
c += A[k][j] * varIdealPointLinear[j];
}
if (sign[k] == "<=")
{
ct.add(c <= b[k]);
}
else if (sign[k] == ">=")
{
ct.add(c >= b[k]);
}
else
{
ct.add(c == b[k]);
}
stringstream sstm;
sstm << "c" << k;
string result = sstm.str();
ct[k].setName(result.data());
}
model.add(ct);
}
}
...
vector<double> approxIdealQuadratic(NoeudQuadratic n, int nbCst, int nbVar, int nbObj)
{
vector<double> idealPoint;
for (unsigned int i = 0; i < nbVar; i++)
{
IloModel model(modelIdealPointQuadratic[i]);
IloRangeArray ct(envIdealPoint);
for (int k = nbCst; k < n.getA().size(); k++)
{
IloNumExpr c(envIdealPoint);
for (int j = 0; j < nbVar; j++)
{
c += n.getA()[k][j] * varIdealPointQuadratic[j];
}
if (n.getSign()[k] == "<=")
{
ct.add(c <= n.getB()[k]);
}
else if (n.getSign()[k] == ">=")
{
ct.add(c >= n.getB()[k]);
}
else
{
ct.add(c == n.getB()[k]);
}
}
model.add(ct);
IloCplex cpx(model);
cpx.setOut(cpx.getEnv().getNullStream());
if (cpx.solve())
{
idealPoint.push_back(cpx.getObjValue());
}
else
{
cout << "No solution" << endl;
}
}
for (unsigned int i = 0; i < nbObj; i++)
{
IloModel model(envIdealPoint);
IloRangeArray ct(envIdealPoint);
for (int k = nbCst; k < n.getA().size(); k++)
{
IloNumExpr c(envIdealPoint);
for (int j = 0; j < nbVar; j++)
{
c += n.getA()[k][j] * varIdealPointLinear[j];
}
if (n.getSign()[k] == "<=")
{
ct.add(c <= n.getB()[k]);
}
else if (n.getSign()[k] == ">=")
{
ct.add(c >= n.getB()[k]);
}
else
{
ct.add(c == n.getB()[k]);
}
}
model.add(ct);
IloCplex cpx(model);
cpx.setOut(cpx.getEnv().getNullStream());
if (cpx.solve())
{
idealPoint.push_back(cpx.getObjValue());
}
else
{
cout << "No solution" << endl;
}
}
return idealPoint;
}
Here i have 2 methods and some global variables. The first method "constructBasicIdealPointModel" create a basic 2 vectors of the same model modelIdealPointQuadratic and modelIdealPointLinear using the same vectors of variables varIdealPointQuadratic and varIdealPointLinear respectively.
The second method try to add other constraints to list of models and resolve it using the same variables and environnement but i get wrong results. I know i do saveral errors using my variables, but i don't have any idea how can i take the result i want.
Note: I must save my two first vectors without change it in the process, because are the base of my models and other constraints are added after that.
Thankscplexc++Thu, 09 May 2019 18:30:16 GMTAmine_ENST[CPLEX] Import .dat file, created with SheetConnection, in Java project
https://developer.ibm.com/answers/questions/504116/cplex-import-dat-file-created-with-sheetconnection.html
Hi,
I have developed a Java project, which uses the oplall. jar library. The entire Java project is composed by:
**OneSheetRead.dat**
SheetConnection sheet("SheetData.xlsx");
caseID from SheetRead(sheet, caseIDString);
costs from SheetRead(sheet, costString);
rhs from SheetRead(sheet, rhsString);
**SimpleModel.mod**
*int caseID = ...;
float costs[1..2] = ...;
float rhs[1..2] = ...;
execute DISPLAY {
writeln("caseID = ", caseID);
}*
**Main Java Class (CustomDataSource.java)**
public class CustomDataSource
{
static public void main(String[] args) throws Exception
{
Logger logger = LoggerFactory.getLogger(CustomDataSource.class);
int status = 127;
try {
IloOplFactory.setDebugMode(true);
IloOplFactory oplF = new IloOplFactory();
IloOplModelSource modelSource = oplF.createOplModelSource("SimpleModel.mod");
IloOplDataSource datFileSource = oplF.createOplDataSource("OneSheetRead.dat");
IloOplErrorHandler errHandler = oplF.createOplErrorHandler(System.out);
IloOplSettings settings = oplF.createOplSettings(errHandler);
IloOplModelDefinition def=oplF.createOplModelDefinition(modelSource,settings);
IloCplex cplex = oplF.createCplex();
IloOplModel opl=oplF.createOplModel(def,cplex);
opl.addDataSource(datFileSource);
//Generate the model
opl.generate();
oplF.end();
status = 0;
}
catch (IloOplException ex)
{
logger.error("### OPL exception: " + ex.getMessage());
ex.printStackTrace();
status = 2;
}
catch (IloException ex)
{
logger.error("### CONCERT exception: " + ex.getMessage());
ex.printStackTrace();
status = 3;
}
catch (Exception ex)
{
logger.error("### UNEXPECTED UNKNOWN ERROR ...");
ex.printStackTrace();
status = 4;
}
}
I need to import both the .mod file and .dat file in Java project. At the moment, I import with success the .mod and .dat files, if the .dat file is only made by data. For example:
**example.dat**
caseID = 6;
However, in the above OneSheetRead.dat file example I need to connect to following Excel sheet:
![alt text][1]
I tried to do it in a Java Class, as shown in CustomDataSource.java, but I get the following error:
![alt text][2]
I need to know, if I can import OneSheetRead.dat file in a Java project by API. Thank you for your availability.
Best regards,
Nicola
[1]: /answers/storage/temp/28023-schermata-2019-05-09-alle-163934.png
[2]: /answers/storage/temp/28024-cattura.pngcloudintegrationcplexThu, 09 May 2019 14:47:40 GMTNicola MincuzziProblem returning infeasible solution after changing binary variables to integer varables
https://developer.ibm.com/answers/questions/503761/problem-returning-infeasible-solution-after-changi.html
We found a case where if we update binary variables to integer variables, problem is becoming infeasible.
I have copied both MPS file (Integer and Binary) in the below drop box link:
https://www.dropbox.com/s/axnbgrx5t8zx3pa/Binary.zip?dl=0cplexdocplexcloudTue, 07 May 2019 12:13:37 GMTAkhileshAirenSet array in Cplex
https://developer.ibm.com/answers/questions/503527/set-array-in-cplex.html
I need to create an array of sets that can be called in the rest of the model.
For example, I want the following:
range C = 1..4;
S[C] = [[1,2,3],[3,4,5]....];
....
for (c in C and k in S[c]])
...
I'm not sure of how to do this.
Any help?cplexarrayssetsSat, 04 May 2019 15:11:04 GMTJames BotesstaticLex on DOcplexcloud
https://developer.ibm.com/answers/questions/503503/staticlex-on-docplexcloud.html
Hi there, , I've been trying to use staticLex in Docplexcloud, but it doesn't work.
I know that in CPLEX 12.9 it Works, does anyone know why?
regardscplexdocplexcloudoplmultiobjectiveFri, 03 May 2019 21:21:28 GMTJorge Rojas Pizarro2 dimensional set with condition
https://developer.ibm.com/answers/questions/503175/2-dimensional-set-with-condition.html
I want to create set A, which is (i,j) but i != j. Any advice?cplexexpressiondropsolveTue, 30 Apr 2019 17:57:43 GMTJames BotesCplex Cannot Extract Expression
https://developer.ibm.com/answers/questions/502971/cplex-cannot-extract-expression-2.html
I keep getting this error with my HVRPTW model. I am not quite sure what the problem is or how to fix it. It only highlights the problem with the one constraint. There are mainly two errors, the one states that CPLEX Cannot Extract Expression and the other that OPL Cannot Extract Expression under the one constraint. After some research, I figured the problem was with the decision variables. Please advice on the problem and how to correct it. Thanks
Here are the decision variables:
dvar boolean x[Vehicles][CustomersAndDepots][CustomersAndDepots];
dvar int w[Vehicles][CustomersAndDepots];
dvar int a[Vehicles][CustomersAndDepots];
and here is the constraint:
forall(i,j in CustomersAndDepots, k in Vehicles)
x[k][i][j]*(a[k][i]+w[k][i]+ServiceTime[i]+Time[i][j]-a[k][i]) == 0 ;cplexexpressiondropsolveMon, 29 Apr 2019 12:31:18 GMTJames BotesCPLEX cannot extract expression
https://developer.ibm.com/answers/questions/502968/cplex-cannot-extract-expression-1.html
I keep getting this error and not sure how to fix it. I realized it has something to do with my decision variables "a" / "w", but still not sure how to change or adapted.
My decision variables are as follows:
dvar boolean x[Vehicles][CustomersAndDepots][CustomersAndDepots]; // 1 if a vehicle drives directly from vertex i to vertex j
dvar int w[Vehicles][CustomersAndDepots];// the waiting time
dvar int a[Vehicles][CustomersAndDepots];// the time a vehicle starts to service a customer
The Objective
maximize sum(k in Vehicles, i in Customers, j in CustomersAndDepots) (x[k][i][j])
+ M1*sum(c in VehiclesType, k in S, i in Customers, j in Customers) (f[c] *x[k][i][j])
+M2*(sum(c in VehiclesType,k in S, i,j in CustomersAndDepots) (al[c]*Distance[i][j]*x[k][i][j]));
The one constraint that seems to be the problem.
subject to {
forall(i,j in CustomersAndDepots, k in Vehicles)
x[k][i][j]*(a[i][k]+w[i][k]+ServiceTime[i]+Time[i][j]-a[j][k]) == 0 ;
Any help will be appreciated.
Thank you.cplexexpressiondropsolveMon, 29 Apr 2019 12:17:03 GMTJames BotesHow to remove multiobjective function from model in CPLEX 12.9?
https://developer.ibm.com/answers/questions/502840/how-to-remove-multiobjective-function-from-model-i.html
I want to use multiobjective optimization feature of CPLEX 12.9, while being able to replace the objective function. This simple Java code works great for ordinary objective functions but throws "UnknownObjectException: CPLEX Error: object is unknown to IloCplex" while trying to remove multiobjective function.
IloCplexMultiCriterionExpr expr = cplex.staticLex(new IloNumExpr[]{
expr1,
expr2,
expr3
});
IloObjective objective = cplex.maximize(expr);
cplex.add(objective);
cplex.solve();
cplex.remove(objective);
I suppose that it is a bug either in the CPLEX itself or in the Concert Technology. I have not found any form for sending bug reports, but maybe someone here could help me with fixing this?cplexmultiobjectiveFri, 26 Apr 2019 14:31:29 GMTegormknHow to get access to earlier versions of CPLEX
https://developer.ibm.com/answers/questions/502778/how-to-get-access-to-earlier-versions-of-cplex.html
I have downloaded the earliest verion of CPLEX (129). However, I'm using a toolbox with Matlab2018b that is only compatible with version 128. Is there any way to get access to earlier version of CPLEX?
In other similar questions people have been pointed to the email: aimember@us.ibm.com, but so far I haven't received any response from that email.cplexFri, 26 Apr 2019 08:51:39 GMTBergthorcplex issue with set partition problem (possible bug)
https://developer.ibm.com/answers/questions/502721/cplex-issue-with-set-partition-problem-possible-bu.html
This message is to report what I believe to be a bug in CPLEX versions 12.8 and 12.9. As part of a research in a theoretical location problem I have to solve two set partition problems (SPP). Both SPP's have the same constraints, but the first model has a subset of the variables of the second model (i.e. the second model has each variable in the first model and some more). Clearly, if the first SPP has a feasible solution, this solution is also feasible for the second SPP.
Now, a description of the issue:
1. I create the models using Concert C++ library. CPLEX 12.8 finds an optimal solution for the first model, but reports infeasibility for the second.
2. I change the names of the variables so I can easily identify the coefficients of the variable in the constraints. The optimal solution of the first model satisfies all of the constraints in equality (as expected in the SPP).
3. I save the first and second model in lp format and solve them using CPLEX 12.8 and 12.9 command line interfaces. The same results are reported (first model, optimality verified. Second model, infeasibility).
4. I manually check if the variables from the optimal solution of the first model are part of the second model (same name according to the convention given in bulletpoint 2). The check passes
5. I use a different IP commercial solver with free academic license to solve the first and second models from its command line interface. In this case, both models are feasible and both provide optimal solutions.
6. I turn the presolve flag to "off" by using setParam(IloCPlex::PreInd,0) and solve both models. Now CPLEX 12.8 provides the optimal solution for both models.
Given that the models have no fractional coefficients neither in the constraints nor in the objective function, I would think that some special presolve trick is responsible to the bug (I do not see that rounding issues may play a factor in a SPP). In any case, if you need any further assistance to track down the issue, please let me know.
Kind regards,
Jordi Pereira
Universidad Adolfo Ibáñez
Jorge.pereira at uai.cl
PS: I provide a dropbox link to two of these models (gzipped): model1.lp.gz: (https://www.dropbox.com/s/05sm3fc1vf66exm/model1.lp.gz?dl=0) model2.lp.gz: (https://www.dropbox.com/s/1xz0fnrz7mim9v6/model2.lp.gz?dl=0)cplexThu, 25 Apr 2019 20:28:02 GMTjordipereiragude