# 8. Components — MIPLearn 0.3

# 8. Components

## 8.1. miplearn.components.primal.actions

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

  Bases: `miplearn.components.primal.actions.PrimalComponentAction`

  `perform`(model: miplearn.solvers.abstract.AbstractModel, var_names: numpy.ndarray, var_values: numpy.ndarray, stats: Optional[Dict]) → None

class `miplearn.components.primal.actions.``FixVariables`

  Bases: `miplearn.components.primal.actions.PrimalComponentAction`

  `perform`(model: miplearn.solvers.abstract.AbstractModel, var_names: numpy.ndarray, var_values: numpy.ndarray, stats: Optional[Dict]) → None

class `miplearn.components.primal.actions.``PrimalComponentAction`

  Bases: `abc.ABC`

  abstract `perform`(model: miplearn.solvers.abstract.AbstractModel, var_names: numpy.ndarray, var_values: numpy.ndarray, stats: Optional[Dict]) → None

class `miplearn.components.primal.actions.``SetWarmStart`

  Bases: `miplearn.components.primal.actions.PrimalComponentAction`

  `perform`(model: miplearn.solvers.abstract.AbstractModel, var_names: numpy.ndarray, var_values: numpy.ndarray, stats: Optional[Dict]) → None

## 8.2. miplearn.components.primal.expert

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

  Bases: `object`

  `before_mip`(test_h5: str, model: miplearn.solvers.abstract.AbstractModel, stats: Dict[str, Any]) → None
  `fit`(train_h5: List[str]) → None

## 8.3. miplearn.components.primal.indep

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

  Bases: `object`

  `before_mip`(test_h5: str, model: miplearn.solvers.abstract.AbstractModel, stats: Dict[str, Any]) → None
  `fit`(train_h5: List[str]) → None

## 8.4. miplearn.components.primal.joint

class `miplearn.components.primal.joint.``JointVarsPrimalComponent`(clf: Any, extractor: miplearn.extractors.abstract.FeaturesExtractor, action: miplearn.components.primal.actions.PrimalComponentAction )

  Bases: `object`

  `before_mip`(test_h5: str, model: miplearn.solvers.abstract.AbstractModel, stats: Dict[str, Any]) → None
  `fit`(train_h5: List[str]) → None

## 8.5. miplearn.components.primal.mem

class `miplearn.components.primal.mem.``MemorizingPrimalComponent`(clf: Any, extractor: miplearn.extractors.abstract.FeaturesExtractor, constructor: miplearn.components.primal.mem.SolutionConstructor, action: miplearn.components.primal.actions.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: miplearn.solvers.abstract.AbstractModel, stats: Dict[str, Any]) → None
  `fit`(train_h5: List[str]) → None

class `miplearn.components.primal.mem.``MergeTopSolutions`(k: int, thresholds: List[float])

  Bases: `miplearn.components.primal.mem.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: numpy.ndarray, solutions: numpy.ndarray) → numpy.ndarray

class `miplearn.components.primal.mem.``SelectTopSolutions`(k: int)

  Bases: `miplearn.components.primal.mem.SolutionConstructor`

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

  `construct`(y_proba: numpy.ndarray, solutions: numpy.ndarray) → numpy.ndarray

class `miplearn.components.primal.mem.``SolutionConstructor`

  Bases: `abc.ABC`

  abstract `construct`(y_proba: numpy.ndarray, solutions: numpy.ndarray) → numpy.ndarray

7. Collectors & Extractors 9. Solvers