Thank you so much Alex for your quick response.
Actually, I had seen that post but I have
really a problem with syntax. For example I have variable like this:
O,P,Per,M are constant values .
char varName[1000];
NumVar3Matrix X(env, P);
for (IloInt i = 0; i < P; i++) {
X[i] = NumVarMatrix(env, M);
for (IloInt j = 0; j < M; j++) {
X[i][j] = IloNumVarArray(env, Per);
for (IloInt k = 0; k < Per; k++) {
X[i][j][k] = IloNumVar(env, 0.0, INFINITY, ILOFLOAT);
X[i][j][k].setName(varName);
}
}
}
and other variable
char varNameS[100];
NumVarMatrix S(env,O);
for (IloInt o = 0; o < O; ++o) {
S[o] = IloNumVarArray(env,Per, 0, 1, ILOINT);
for (IloInt t = 0; t < Per; t++) {
S[o][t].setName(varNameS);
}
}
I have model here
...
...
...
and finally I solve it by :
IloCplex cplex(env);
cplex.extract(model);
cplex.solve()
There is no problem until here, when I want to perform sensitivity analysis for variable X or S ,as in the post , I say
IloNumArray objLB(env);
IloNumArray objUB(env);
cplex.getObjSA(objLB, objUB, X);
and I debug and I receive an error:
Erreur C2664 'void IloCplex::getObjSA(IloNumArray,IloNumArray,const IloIntVarArray) const' : impossible de convertir l'argument 3 de 'NumVar3Matrix' en 'const IloNumVarArray'
What can I correct it to perform SA for those variables ?
Thank you so much
------------------------------
milena kafka
------------------------------
Original Message:
Sent: Wed October 26, 2022 07:43 AM
From: ALEX FLEISCHER
Subject: Sensitivity Analyis for MILP model in C++
Hi,
small example at https://community.ibm.com/community/user/datascience/discussion/question-about-sensitivity-analysis-with-cplex
regards
------------------------------
[Alex] [Fleischer]
[Data and AI Technical Sales]
[IBM]
Original Message:
Sent: Tue October 25, 2022 06:18 AM
From: milena kafka
Subject: Sensitivity Analyis for MILP model in C++
Hello everyone,
I have coded my MILP model in Visual studio c++ and solving it by calling cplex. Now, I would like to perform a sensitivity analysis but I could not understand exact syntax that I need to use. In the documents of cplex I found that :
They are analyzed by methods IloCplex::getBoundSA,
IloCplex::getRHSSA, and IloCplex::getObjSA, respectively.
However, I could not understand how to do that. Is there any obvious example for cplex, as gurobi provided in the following link ?
Thank you so much for all your help in advance
sensitivity_c++.cpp| Gurobi | remove preview |
| | sensitivity_c++.cpp | | Copyright 2022, Gurobi Optimization, LLC // A simple sensitivity analysis example which reads a MIP model from a // file and solves it. Then uses the scenario feature to analyze the impact // w.r.t. the objective function of each binary variable if it is set to // 1-X, where X is its value in the optimal solution. | | View this on Gurobi > |
|
|
------------------------------
milena kafka
------------------------------
#DecisionOptimization