Can't get Pi (shadow prices) of a continuos model.
回答済みHi,
I have a continuous model (the code is in Java). After optimization, I can get the X attributes, but when I try Pi, I get this error message:
Error code: 10005. Unable to retrieve attribute 'Pi'
The lines of Java code are:
double[] xvals= model.get(GRB.DoubleAttr.Pi, model.getConstrs());
or
GRBConstr[] constrains=model.getConstrs();
double sp = constrains[1].get(GRB.DoubleAttr.Pi);
Again, this is a continuous model. This is how I add the variables:
for(int i=0;i<l.length;i++){
objective[i]=0;
types[i]=GRB.CONTINUOUS;
}
rxnFluxes = model.addVars(l, u, objective, types, null);
model.update();
Thanks for your help,
Ilija
-
- Pi values are only available for convex, continuous problems.
- If you are solving a QCP, there are a couple of extra steps to get your duals. To get the duals of linear constraints, set the QCPDual parameter is set to 1. To get the duals for quadratic constraints, you will want to use QCPi attribute rather than the Pi attribute.
If this doesn't help, can you tell us a bit more about your model and how you are trying to access Pi values?
Gwyneth
0 -
Thanks for your help. That's probably the problem. Most likely my solution is not unique, and I don't get Pis in that case. I will try secondary optimization to make the problem convex.
Thanks,
0
サインインしてコメントを残してください。
コメント
2件のコメント