java - Gurobi cannot set or print (manually) value of variables -
i'm writing program in java gurobi 6.0.2 , i've trouble management of variables, in particular can't set or print them.
example:
grbenv env = new grbenv(); grbmodel model = new grbmodel(env); grbvar x = model.addvar(0.0, grb.infinity, 0.0, grb.semiint, "x"); x.set(grb.doubleattr.x, 10.0); system.out.println(x.get(grb.doubleattr.x));
netbeans shows message:
exception in thread "main" gurobi.grbexception: error @ grbvar.set @ gurobi.grbvar.set(grbvar.java:141) @ core.optimize.main(optimize.java:29) java result: 1
this problem happens when resolved relaxation model, can't retrive value of variables.
if want set start values variables, cannot use
x.set(grb.doubleattr.x, 10.0);
but have write
x.set(grb.doubleattr.start, 10.0);
getting variable values makes sense after have solved model.
Comments
Post a Comment