I have made a functional mathematical model but I need to get the dual solution as well. I have tried some ways but have not found a way that works for my model.
Here is one of the constraints that I would like to get the dual solution for:
for(int j=1; j <=Data.FlightCount; j++) {
IloLinearNumExpr lhs = cplex.linearNumExpr();
for(int n=1; n <= p; n++) {
lhs.addTerm(m[n][j], x[n]);
}
IloRange con = cplex.addEq(lhs, 1);
con.setName("yourConstraintName(" + j + ")");
}
I have tried to do the following to get the dual but i thought that the "con" should go into the dual command but that is not working, any suggestions?
double[] D = cplex.getDuals(con);
Is it maybe possible to get the reduced cost directly, that is without calculating it from the dual myself?