save_lpΒΆ

save_lp(model: Model, filename: str | PathLike, allow_constant: bool = True) NoneΒΆ

Save a model to an LP file.

Parameters:
  • model (Model) – Model to write.

  • filename (str | PathLike) – Output file path.

  • allow_constant (bool) – Whether to allow a constant term in the objective function. Defaults to True.

Raises:

RuntimeError – If the model is invalid for the LP format (e.g., contains degree 3 or higher, or has invalid variable names / constraint labels).