LPWriter

(class from pyomo.repn.plugins.lp_writer)

class pyomo.repn.plugins.lp_writer.LPWriter[source]

Bases: object

__init__()[source]

Methods

__init__()

write(model, ostream, **options)

Write a model in LP format.

Attributes

CONFIG

Member Documentation

write(model, ostream, **options)[source]

Write a model in LP format.

Return type:

LPWriterInfo

Parameters:
  • model (ConcreteModel) – The concrete Pyomo model to write out.

  • ostream (io.TextIOBase) – The text output stream where the LP “file” will be written. Could be an opened file or a io.StringIO.

Keyword Arguments:
  • show_section_timing (bool, default=False) – Print timing after writing each section of the LP file

  • skip_trivial_constraints (bool, default=False) – Skip writing constraints whose body is constant

  • file_determinism (InEnum[FileDeterminism], default=<FileDeterminism.ORDERED: 10>) –

    How much effort do we want to put into ensuring the LP file is written deterministically for a Pyomo model:

    • NONE (0) : None

    • ORDERED (10): rely on underlying component ordering (default)

    • SORT_INDICES (20) : sort keys of indexed components

    • SORT_SYMBOLS (30) : sort keys AND sort names (not declaration order)

  • symbolic_solver_labels (bool, default=False) – Export variables and constraints to the LP file using human-readable text names derived from the corresponding Pyomo component names.

  • row_order (optional) – List of constraints in the order that they should appear in the LP file. Unspecified constraints will appear at the end.

  • column_order (optional) – List of variables in the order that they should appear in the LP file. Note that this is only a suggestion, as the LP file format is row- major and the columns are inferred from the order in which variables appear in the objective followed by each constraint.

  • labeler (optional) – Export variables and constraints to the LP file using human-readable text names derived from the corresponding Pyomo component names.

  • output_fixed_variable_bounds (bool, default=False) – DEPRECATED option from LPv1 that has no effect in the LPv2

  • allow_quadratic_objective (bool, default=True) – If True, allow quadratic terms in the model objective

  • allow_quadratic_constraint (bool, default=True) – If True, allow quadratic terms in the model constraints