maybe a bug in ecole.observation.Pseudocosts? #307
-
when I try to run the example as follows: class ExploreThenStrongBranch:
def __init__(self, expert_probability):
self.expert_probability = expert_probability
self.pseudocosts_function = ecole.observation.Pseudocosts()
self.strong_branching_function = ecole.observation.StrongBranchingScores()
def before_reset(self, model):
self.pseudocosts_function.before_reset(model)
self.strong_branching_function.before_reset(model)
def extract(self, model, done):
probabilities = [1-self.expert_probability, self.expert_probability]
expert_chosen = bool(np.random.choice(np.arange(2), p=probabilities))
if expert_chosen:
return (self.strong_branching_function.extract(model,done), True)
else:
return (self.pseudocosts_function.extract(model,done), False)
scip_parameters = {'separating/maxrounds': 0, 'presolving/maxrestarts': 0,
'limits/time': 100, 'timing/clocktype': 2}
observation_function = { "scores": ExploreThenStrongBranch(expert_probability=0),
"node_observation": ecole.observation.NodeBipartite() }
env = ecole.environment.Branching(observation_function=observation_function,
scip_params=scip_parameters, pseudo_candidates=True)
env.seed(0)
instance_path = 'data/instances/setcover/train_500r_1000c_0.05d/instance_0000.lp'
instance = ecole.scip.Model.from_file(instance_path)
observation, action_set, _, done, _ = env.reset(instance) I find something hard to understand:
so when I run (3) when I set so I'm confused if there's a bug in ecole.observation.Pseudocosts? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
here's my |
Beta Was this translation helpful? Give feedback.
-
Hello @CXCellTrack,
Hope this helps. |
Beta Was this translation helpful? Give feedback.
Hello @CXCellTrack,
I can reproduce that
observation['scores'][0].shape == 994
. Furthermore, we also haveinstance.as_pyscipopt().getNVars() == 1000
andenv.model.as_pyscipopt().getNVars() == 994
.Somwhere in the preprocessing SCIP must realize that some variables can be eliminated (or even are unused).
Ecole get the data from SCIP, but it is true that it can sometimes be surprising.
Yes, we fill in
NaN
when the observation can not be computed for a variable. Here you haveecole.environment.Branching(..., pseudo_candidates=True)
, so I assume that somePseudocosts
can not be computed for pseudo candidates.That must be because
Pseudocosts
cannot be computed for pseudo candidates butS…