||A generalized container for defining hierarchical models by adding modeling components as attributes.|
||A tuple-style container for objects with category type IBlock|
||A list-style container for objects with category type IBlock|
||A dict-style container for objects with category type IBlock|
A generalized container for defining hierarchical models by adding modeling components as attributes.
>>> import pyomo.kernel as pmo >>> model = pmo.block() >>> model.x = pmo.variable() >>> model.c = pmo.constraint(model.x >= 1) >>> model.o = pmo.objective(model.x)
Returns the set of child object category types stored in this container.
Iterate over the children of this block.
Parameters: ctype – Indicates the category of children to include. The default value indicates that all categories should be included. Returns: iterator of child objects
load_solution(solution, allow_consistent_values_for_fixed_vars=False, comparison_tolerance_for_fixed_vars=1e-05)¶
Load a solution.
- solution – A
pyomo.opt.Solutionobject with a symbol map. Optionally, the solution can be tagged with a default variable value (e.g., 0) that will be applied to those variables in the symbol map that do not have a value in the solution.
- allow_consistent_values_for_fixed_vars – Indicates whether a solution can specify consistent values for variables that are fixed.
- comparison_tolerance_for_fixed_vars – The tolerance used to define whether or not a value in the solution is consistent with the value of a fixed variable.
- solution – A
write(filename, format=None, _solver_capability=None, _called_by_solver=False, **kwds)¶
Write the model to a file, with a given format.
- filename (str) – The name of the file to write.
- format – The file format to use. If this is not specified, the file format will be inferred from the filename suffix.
- **kwds – Additional keyword options passed to the model writer.
A tuple-style container for objects with category type IBlock
A list-style container for objects with category type IBlock