add_decision_tree_regressor_constr

gurobi_ml.sklearn.decision_tree_regressor.add_decision_tree_regressor_constr(gp_model, decision_tree_regressor, input_vars, output_vars=None, epsilon=0.0, safety_floor=0.0, **kwargs)

Formulate decision_tree_regressor into gp_model.

The formulation predicts the values of output_vars using input_vars according to decision_tree_regressor. See our User’s Guide for details on the mip formulation used.

Parameters:
  • gp_model (Model) – The gurobipy model where the predictor should be inserted.

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

  • input_vars (mvar_array_like) – Decision variables used as input for decision tree in gp_model.

  • output_vars (mvar_array_like, optional) – Decision variables used as output for decision tree in gp_model.

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

  • safety_floor (float, optional) – Thresholds with absolute value smaller than this will be clamped to this value to avoid numerical issues with Gurobi’s tolerance. To be effective, this value must be larger than Gurobi FeasibilityTol. A smaller value will have no effect. Note that clamping can distort models whose legitimate split thresholds are genuinely small, so this parameter is opt-in (default 0.0, i.e. disabled).

Returns:

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

Return type:

DecisionTreeRegressorConstr

Notes

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.