Skip to content

model

Model(min_or_max, name=None, **kwargs)

Bases: AttrContainerMixin

Represents a mathematical optimization model. Add variables, constraints, and an objective to the model by setting attributes.

Source code in pyoframe/model.py
def __init__(self, min_or_max: Union[ObjSense, ObjSenseValue], name=None, **kwargs):
    super().__init__(**kwargs)
    self._variables: List[Variable] = []
    self._constraints: List[Constraint] = []
    self.sense = ObjSense(min_or_max)
    self._objective: Optional[Objective] = None
    self.var_map = (
        NamedVariableMapper(Variable) if Config.print_uses_variable_names else None
    )
    self.io_mappers: Optional[IOMappers] = None
    self.name = name
    self.solver: Optional[Solver] = None
    self.solver_model: Optional[Any] = None
    self.params = Container()
    self.result: Optional[Result] = None