Model
allows you to create a gurobipy.Model
object from nextmv.Options
. This convenience function allows you to set up a Gurobi model using the parameters that are customized through options. Notice that the return type is a gurobipy.Model
.
Consider the following script, which solves a simple knapsack problem.
Run the script with custom options:
Notice how the solver output states which options were customized. Using the nextmv_gurobipy.Model
class has other added benefits, besides the convenience of customizing solver options:
- It instantiates an empty environment.
- It redirects
stdout
tostderr
for logging in Nextmv Cloud. - It loads the license automatically if the
license_path
is given.