How to see each branch and bound node (instance trivially solved) #176
-
|
Hello everyone, model = Model("Example") # model name is optional
x = model.addVar("x", vtype="INTEGER")
y = model.addVar("y", vtype="INTEGER")
model.setObjective(-1*(3*x + 5*y))
model.addCons(x + y <= 10)
model.addCons(2*x + 4*y <= 25)
model.addCons(x <= 8)
model.addCons(2*y <= 10)
model.setPresolve(PY_SCIP_PARAMSETTING.OFF)
model.writeProblem(filename="model1.cip")
model.optimize()
sol = model.getBestSol()
print("x: {}".format(sol[x]))
print("y: {}".format(sol[y]))This code in fact returns the MAX solution to this problem. But now using Ecole I would like to see the steps that are taken in order to get to this result. I have followed the source code and have defined the simple branching class with presolve and separating off, now if i run the following code: for _ in range(1):
observation, action_set, reward_offset, done, info = env.reset("model1.cip")
print(observation, action_set, reward_offset, done, info)
while not done:
observation, action_set, reward, done, info = env.step(action_set[0])The output is only : None None 1.0 True {} Does anyone know how i could actually see the observation, action_set and reward_offset for every node or every x nodes that is being worked on? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
|
Hello @alonsoleal1 , Could you provide some details on what It looks like here, your |
Beta Was this translation helpful? Give feedback.
-
|
Hello @alonsoleal1 , aren't you just missing a print in the while not done loop ?
Best |
Beta Was this translation helpful? Give feedback.
Hello @alonsoleal1 ,
Could you provide some details on what
envis here, i.e. how you constructed it?It looks like here, your
model1.cipgot solved duringenv.reset, so you never go into the inner loopwhile not done.Furthermore, the observation in reset is
Nonebecause if the model is solved duingreset, someobservation_functionsare not able to extract an observation (due to SCIP functions no longer being available) and simply returnNone.