Since Mathematical Optimization is a declarative approach in which you describe the properties of a solution to your problem (in contrast to imperative programming), it’s not possible to incorporate black-box functions — such as user-defined functions or those available in popular packages like NumPy or scikit-learn — into optimization models. Instead, you need to explicitly describe the mathematical expressions used to compute the desired output by employing decision variables and constraints.
Nevertheless, Gurobi's programming interfaces allow you to incorporate general constraints into your model. General constraints are used to represent relationships between decision variables that are frequently used by math modelers, such as:
- Absolute value
- Piecewise-linear (PWL) functions
- Univariate non-linear functions, modeled via PWL approximation
- Exponential and logarithmic functions
- Power functions
- Logistic functions
- Trigonometric functions
- \(\max\) and \(\min\)
- Polynomial functions
- \(p\)-norm constraints, including the misnamed L0-norm
- Predicate logic
These could be considered as convenience features, as the modeler could model these relationships using fundamental constraint types instead. However, Gurobi can sometimes exploit information contained in the rest of constraints in the model to build a more efficient formulation than what they might create. Moreover, using Gurobi’s general constraints typically results in simpler code that is easier to read and maintain.
Finally, it's worth mentioning the the Github package Gurobi Machine Learning, an open-source Python project sponsored by Gurobi that allows users to embed directly into Gurobi a trained Machine Learning (ML) model that estimates a real-world system, allowing users to optimize controls on that system.
Comments
0 comments
Please sign in to leave a comment.