Gurobi code
Question code:
I wanted to get the dual space of variables,
double[] dual=model.get(GRB.DoubleAttr.Pi,model.getConstrs());
Error code: 10005. Unable to retrieve attribute ‘Pi’
The reason is that in gurobi, binary variables and integer variables have no dual space. Change integer to continuous, as follows: