|
|
@ -28,31 +28,12 @@ class Component:
|
|
|
|
solver: "LearningSolver",
|
|
|
|
solver: "LearningSolver",
|
|
|
|
instance: Instance,
|
|
|
|
instance: Instance,
|
|
|
|
model: Any,
|
|
|
|
model: Any,
|
|
|
|
) -> None:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Method called by LearningSolver before the root LP relaxation is solved.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
solver
|
|
|
|
|
|
|
|
The solver calling this method.
|
|
|
|
|
|
|
|
instance
|
|
|
|
|
|
|
|
The instance being solved.
|
|
|
|
|
|
|
|
model
|
|
|
|
|
|
|
|
The concrete optimization model being solved.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def after_solve_lp(
|
|
|
|
|
|
|
|
self,
|
|
|
|
|
|
|
|
solver: "LearningSolver",
|
|
|
|
|
|
|
|
instance: Instance,
|
|
|
|
|
|
|
|
model: Any,
|
|
|
|
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
|
|
|
|
features: Features,
|
|
|
|
training_data: TrainingSample,
|
|
|
|
training_data: TrainingSample,
|
|
|
|
) -> None:
|
|
|
|
) -> None:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Method called by LearningSolver after the root LP relaxation is solved.
|
|
|
|
Method called by LearningSolver before the root LP relaxation is solved.
|
|
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
----------
|
|
|
@ -60,7 +41,7 @@ class Component:
|
|
|
|
The solver calling this method.
|
|
|
|
The solver calling this method.
|
|
|
|
instance: Instance
|
|
|
|
instance: Instance
|
|
|
|
The instance being solved.
|
|
|
|
The instance being solved.
|
|
|
|
model: Any
|
|
|
|
model
|
|
|
|
The concrete optimization model being solved.
|
|
|
|
The concrete optimization model being solved.
|
|
|
|
stats: LearningSolveStats
|
|
|
|
stats: LearningSolveStats
|
|
|
|
A dictionary containing statistics about the solution process, such as
|
|
|
|
A dictionary containing statistics about the solution process, such as
|
|
|
@ -68,6 +49,8 @@ class Component:
|
|
|
|
their own statistics here. For example, PrimalSolutionComponent adds
|
|
|
|
their own statistics here. For example, PrimalSolutionComponent adds
|
|
|
|
statistics regarding the number of predicted variables. All statistics in
|
|
|
|
statistics regarding the number of predicted variables. All statistics in
|
|
|
|
this dictionary are exported to the benchmark CSV file.
|
|
|
|
this dictionary are exported to the benchmark CSV file.
|
|
|
|
|
|
|
|
features: Features
|
|
|
|
|
|
|
|
Features describing the model.
|
|
|
|
training_data: TrainingSample
|
|
|
|
training_data: TrainingSample
|
|
|
|
A dictionary containing data that may be useful for training machine
|
|
|
|
A dictionary containing data that may be useful for training machine
|
|
|
|
learning models and accelerating the solution process. Components are
|
|
|
|
learning models and accelerating the solution process. Components are
|
|
|
@ -77,23 +60,33 @@ class Component:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def after_solve_lp(
|
|
|
|
|
|
|
|
self,
|
|
|
|
|
|
|
|
solver: "LearningSolver",
|
|
|
|
|
|
|
|
instance: Instance,
|
|
|
|
|
|
|
|
model: Any,
|
|
|
|
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
|
|
|
|
features: Features,
|
|
|
|
|
|
|
|
training_data: TrainingSample,
|
|
|
|
|
|
|
|
) -> None:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Method called by LearningSolver after the root LP relaxation is solved.
|
|
|
|
|
|
|
|
See before_solve_lp for a description of the pameters.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def before_solve_mip(
|
|
|
|
def before_solve_mip(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
solver: "LearningSolver",
|
|
|
|
solver: "LearningSolver",
|
|
|
|
instance: Instance,
|
|
|
|
instance: Instance,
|
|
|
|
model: Any,
|
|
|
|
model: Any,
|
|
|
|
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
|
|
|
|
features: Features,
|
|
|
|
|
|
|
|
training_data: TrainingSample,
|
|
|
|
) -> None:
|
|
|
|
) -> None:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Method called by LearningSolver before the MIP is solved.
|
|
|
|
Method called by LearningSolver before the MIP is solved.
|
|
|
|
|
|
|
|
See before_solve_lp for a description of the pameters.
|
|
|
|
Parameters
|
|
|
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
solver
|
|
|
|
|
|
|
|
The solver calling this method.
|
|
|
|
|
|
|
|
instance
|
|
|
|
|
|
|
|
The instance being solved.
|
|
|
|
|
|
|
|
model
|
|
|
|
|
|
|
|
The concrete optimization model being solved.
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
@ -103,31 +96,12 @@ class Component:
|
|
|
|
instance: Instance,
|
|
|
|
instance: Instance,
|
|
|
|
model: Any,
|
|
|
|
model: Any,
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
stats: LearningSolveStats,
|
|
|
|
|
|
|
|
features: Features,
|
|
|
|
training_data: TrainingSample,
|
|
|
|
training_data: TrainingSample,
|
|
|
|
) -> None:
|
|
|
|
) -> None:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Method called by LearningSolver after the MIP is solved.
|
|
|
|
Method called by LearningSolver after the MIP is solved.
|
|
|
|
|
|
|
|
See before_solve_lp for a description of the pameters.
|
|
|
|
Parameters
|
|
|
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
solver: LearningSolver
|
|
|
|
|
|
|
|
The solver calling this method.
|
|
|
|
|
|
|
|
instance: Instance
|
|
|
|
|
|
|
|
The instance being solved.
|
|
|
|
|
|
|
|
model: Any
|
|
|
|
|
|
|
|
The concrete optimization model being solved.
|
|
|
|
|
|
|
|
stats: LearningSolveStats
|
|
|
|
|
|
|
|
A dictionary containing statistics about the solution process, such as
|
|
|
|
|
|
|
|
number of nodes explored and running time. Components are free to add
|
|
|
|
|
|
|
|
their own statistics here. For example, PrimalSolutionComponent adds
|
|
|
|
|
|
|
|
statistics regarding the number of predicted variables. All statistics in
|
|
|
|
|
|
|
|
this dictionary are exported to the benchmark CSV file.
|
|
|
|
|
|
|
|
training_data: TrainingSample
|
|
|
|
|
|
|
|
A dictionary containing data that may be useful for training machine
|
|
|
|
|
|
|
|
learning models and accelerating the solution process. Components are
|
|
|
|
|
|
|
|
free to add their own training data here. For example,
|
|
|
|
|
|
|
|
PrimalSolutionComponent adds the current primal solution. The data must
|
|
|
|
|
|
|
|
be pickable.
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|