Solver

The linear programming model used for optimizing rule sets can be described by the following formulation:

\begin{align*} &\text{minimize} \quad &\lambda \sum_{j \in J} c_j w_j + \sum_{i \in I} v_i \\ &\text{subject to} \quad &\sum_{j \in J} \hat{a}_{ij} w_j + v_i \geq 1, &\quad i \in I, \\ &&v_i \geq 0, &\quad i \in I, \\ &&w_j \geq 0, &\quad j \in J, \end{align*}

where

  • \(w_j\) represents the rule weights,

  • \(\lambda \geq 0\) is a hyperparameter used to scale different units in the objective function, emphasizing the trade-off between accuracy and rule costs,

  • \(c_j\) represents the costs associated with each rule, potentially reflecting the complexity or length of the rule for promoting sparsity,

  • \(\hat{a}_{ij}\) is a measure of the classification accuracy of rule \(j\) for sample \(i\), given that the sample is covered by the rule,

  • \(v_i\) is a auxiliary variable standing for \(v_i \geq L(\hat{y}_i(w), y_i)\), where a value of \(v_i = 0\) indicates correct classification.

For detailed information, please refer to our manuscript.

class ruleopt.solver.ORToolsSolver

A solver wrapper class for linear optimization using the Google’s OR-Tools solver.

The solver supports both dense and sparse matrix representations.

This solver can handle large-scale linear programming problems by interfacing with various backend solvers such as CLP, GLOP, and proprietary solvers like Gurobi and CPLEX.

__init__(penalty=1.0, solver_type='GLOP', use_sparse=False)
Parameters:
  • penalty (float, default=1.0) – Penalty parameter for the cost in the objective function.

  • solver_type ({"CLP", "GLOP", "GUROBI_LP", "CPLEX_LP", "XPRESS_LP", "GLPK_LP", "HiGHS"}, default="GLOP") – The type of Linear Programming solver to use.

  • use_sparse (bool, default=False) – Determines whether to use a sparse matrix representation for the optimization problem. Using sparse matrices can significantly reduce memory usage and improve performance for large-scale problems with many zeros in the data.

class ruleopt.solver.GurobiSolver

A solver wrapper class for linear optimization using the Gurobi solver.

The solver supports both dense and sparse matrix representations.

__init__(penalty=1.0, use_sparse=False)
Parameters:
  • penalty (float, default=1.0) – Penalty parameter for the cost in the objective function.

  • use_sparse (bool, default=False) – Determines whether to use a sparse matrix representation for the optimization problem. Using sparse matrices can significantly reduce memory usage and improve performance for large-scale problems with many zeros in the data.

class ruleopt.solver.CPLEXSolver

A solver wrapper class for linear optimization using the CPLEX solver.

The solver supports both dense and sparse matrix representations.

__init__(penalty=1.0, use_sparse=False)
Parameters:
  • penalty (float, default=1.0) – Penalty parameter for the cost in the objective function.

  • use_sparse (bool, default=False) – Determines whether to use a sparse matrix representation for the optimization problem. Using sparse matrices can significantly reduce memory usage and improve performance for large-scale problems with many zeros in the data.