12. Components#

12.1. miplearn.components.primal.actions#

class miplearn.components.primal.actions.EnforceProximity(tol: float)#

Bases: PrimalComponentAction

perform(model: AbstractModel, var_names: ndarray, var_values: ndarray, stats: Dict | None) None#
class miplearn.components.primal.actions.FixVariables#

Bases: PrimalComponentAction

perform(model: AbstractModel, var_names: ndarray, var_values: ndarray, stats: Dict | None) None#
class miplearn.components.primal.actions.PrimalComponentAction#

Bases: ABC

abstract perform(model: AbstractModel, var_names: ndarray, var_values: ndarray, stats: Dict | None) None#
class miplearn.components.primal.actions.SetWarmStart#

Bases: PrimalComponentAction

perform(model: AbstractModel, var_names: ndarray, var_values: ndarray, stats: Dict | None) None#

12.2. miplearn.components.primal.expert#

class miplearn.components.primal.expert.ExpertPrimalComponent(action: PrimalComponentAction)#

Bases: object

before_mip(test_h5: str, model: AbstractModel, stats: Dict[str, Any]) None#
fit(train_h5: List[str]) None#

12.3. miplearn.components.primal.indep#

class miplearn.components.primal.indep.IndependentVarsPrimalComponent(base_clf: ~typing.Any, extractor: ~miplearn.extractors.abstract.FeaturesExtractor, action: ~miplearn.components.primal.actions.PrimalComponentAction, clone_fn: ~typing.Callable[[~typing.Any], ~typing.Any] = <function clone>)#

Bases: object

before_mip(test_h5: str, model: AbstractModel, stats: Dict[str, Any]) None#
fit(train_h5: List[str]) None#

12.4. miplearn.components.primal.joint#

class miplearn.components.primal.joint.JointVarsPrimalComponent(clf: Any, extractor: FeaturesExtractor, action: PrimalComponentAction)#

Bases: object

before_mip(test_h5: str, model: AbstractModel, stats: Dict[str, Any]) None#
fit(train_h5: List[str]) None#

12.5. miplearn.components.primal.mem#

class miplearn.components.primal.mem.MemorizingPrimalComponent(clf: Any, extractor: FeaturesExtractor, constructor: SolutionConstructor, action: PrimalComponentAction)#

Bases: object

Component that memorizes all solutions seen during training, then fits a single classifier to predict which of the memorized solutions should be provided to the solver. Optionally combines multiple memorized solutions into a single, partial one.

before_mip(test_h5: str, model: AbstractModel, stats: Dict[str, Any]) None#
fit(train_h5: List[str]) None#
class miplearn.components.primal.mem.MergeTopSolutions(k: int, thresholds: List[float])#

Bases: SolutionConstructor

Warm start construction strategy that first selects the top k solutions, then merges them into a single solution.

To merge the solutions, the strategy first computes the mean optimal value of each decision variable, then: (i) sets the variable to zero if the mean is below thresholds[0]; (ii) sets the variable to one if the mean is above thresholds[1]; (iii) leaves the variable free otherwise.

construct(y_proba: ndarray, solutions: ndarray) ndarray#
class miplearn.components.primal.mem.SelectTopSolutions(k: int)#

Bases: SolutionConstructor

Warm start construction strategy that selects and returns the top k solutions.

construct(y_proba: ndarray, solutions: ndarray) ndarray#
class miplearn.components.primal.mem.SolutionConstructor#

Bases: ABC

abstract construct(y_proba: ndarray, solutions: ndarray) ndarray#