Decision Tree Regressor Constraint

Module for formulating a sklearn.tree.DecisionTreeRegressor or a sklearn.tree.DecisionTreeClassifier in a PySCIPOpt Model.

pyscipopt_ml.sklearn.add_decision_tree_regressor_constr(scip_model, decision_tree_regressor, input_vars, output_vars=None, unique_naming_prefix='', epsilon=0.0, **kwargs)

Formulate decision_tree_regressor into a SCIP Model.

The formulation predicts the values of output_vars using input_vars according to decision_tree_regressor.

Parameters:
  • scip_model (PySCIPOpt Model) – The SCIP Model where the predictor should be inserted.

  • decision_tree_regressor (sklearn.tree.DecisionTreeRegressor) – The decision tree regressor to insert as predictor.

  • input_vars (list or np.ndarray) – Decision variables used as input for decision tree in model.

  • output_vars (list or np.ndarray, optional) – Decision variables used as output for decision tree in model.

  • unique_naming_prefix (str, optional) – A unique naming prefix that is used before all variable and constraint names. This parameter is important if the SCIP model is later printed to file and many predictors are added to the same SCIP model.

  • epsilon (float, optional) – Small value used to impose strict inequalities for splitting nodes in MIP formulations.

Returns:

Object containing information about what was added to scip_model to formulate decision_tree_regressor

Return type:

DecisionTreeRegressorConstr

Note

See add_predictor_constr for acceptable values for input_vars and output_vars

pyscipopt_ml.sklearn.add_decision_tree_classifier_constr(scip_model, decision_tree_classifier, input_vars, output_vars=None, unique_naming_prefix='', epsilon=0.0, **kwargs)

Formulate decision_tree_classifier into a SCIP Model.

The formulation predicts the values of output_vars using input_vars according to decision_tree_classifier.

Parameters:
  • scip_model (PySCIPOpt Model) – The SCIP Model where the predictor should be inserted.

  • decision_tree_classifier (sklearn.tree.DecisionTreeClassifier) – The decision tree classifier to insert as predictor.

  • input_vars (list or np.ndarray) – Decision variables used as input for decision tree in model.

  • output_vars (list or np.ndarray, optional) – Decision variables used as output for decision tree in model.

  • unique_naming_prefix (str, optional) – A unique naming prefix that is used before all variable and constraint names. This parameter is important if the SCIP model is later printed to file and many predictors are added to the same SCIP model.

  • epsilon (float, optional) – Small value used to impose strict inequalities for splitting nodes in MIP formulations.

Returns:

Object containing information about what was added to scip_model to formulate decision_tree_classifier

Return type:

DecisionTreeClassifierConstr

Note

See add_predictor_constr for acceptable values for input_vars and output_vars

Warning

Although decision trees with multiple outputs are tested they were never used in a non-trivial optimization model. It should be used with care at this point.

class pyscipopt_ml.sklearn.decision_tree.DecisionTreeConstr(scip_model, predictor, input_vars, output_vars=None, unique_naming_prefix='', epsilon=0.0, classification=False, formulation='leafs', **kwargs)

Class to model trained sklearn.tree.DecisionTreeRegressor or trained sklearn.tree.DecisionTreeClassifier with pyscipopt.

Stores the changes to the SCIP Model for representing an instance into it. Inherits from AbstractPredictorConstr..