Accessing the solver
Model attributes
Pyoframe lets you read and set solver attributes using model.attr.<your-attribute>
. For example, if you'd like to prevent the solver from printing to the console you can do:
Pyoframe support all PyOptInterface attributes and, when using Gurobi, all Gurobi attributes.
>>> m.optimize()
>>> m.attr.TerminationStatus # PyOptInterface attribute (always available)
<TerminationStatusCode.OPTIMAL: 2>
>>> m.attr.Status # Gurobi attribute (only available with Gurobi)
2
Model parameters (Gurobi only)
Gurobi supports model attributes (see above) and model parameters (full list here). You can read or set model parameters with model.params.<your-parameter>
. For example:
Variable and constraint attributes
Similar to above, Pyoframe allows directly accessing the PyOptInterface or the solver's variable and constraint attributes.
If the variable or constraint is dimensioned, the attribute can accept/return a dataframe instead of a constant.