Hi,
no direct way to do that as far as I know.
You could modify the matrix and compute those numbers by comparing.
Let me give you an example:
dvar float+ Gas;
dvar float+ Chloride;
maximize
40 * Gas + 50 * Chloride;
subject to {
ctMaxTotal:
Gas + Chloride <= 50;
ctMaxTotal2:
3 * Gas + 4 * Chloride <= 180;
ctMaxChloride:
Chloride <= 40;
}
tuple SolutionT{
float Gas;
float Chloride;
};
{SolutionT} Solution = {<Gas,Chloride>};
execute{
writeln(Solution);
}
execute
{
var nnz;
writeln("NNZ=",nnz=cplex.getNNZs());
thisOplModel.ctMaxTotal.setCoef(Gas,0);
thisOplModel.ctMaxTotal2.setCoef(Gas,0);
thisOplModel.ctMaxChloride.setCoef(Gas,0);
var nnzGas=nnz-cplex.getNNZs();
thisOplModel.ctMaxTotal.setCoef(Chloride,0);
thisOplModel.ctMaxTotal2.setCoef(Chloride,0);
thisOplModel.ctMaxChloride.setCoef(Chloride,0);
var nnzChloride=nnz-nnzGas-cplex.getNNZs();
writeln("NNZ Gas and Chloride = ",nnzGas," ",nnzChloride);
}
which gives
NNZ=5
NNZ Gas and Chloride = 2 3
regards
#DecisionOptimization#OPLusingCPLEXOptimizer