SolutionLoaderBase
(class from pyomo.contrib.solver.solution
)
- class pyomo.contrib.solver.solution.SolutionLoaderBase[source]
Bases:
ABC
Base class for all future SolutionLoader classes.
Intent of this class and its children is to load the solution back into the model.
- __init__()
Methods
__init__
()get_duals
([cons_to_load])Returns a dictionary mapping constraint to dual value.
get_primals
([vars_to_load])Returns a ComponentMap mapping variable to var value.
get_reduced_costs
([vars_to_load])Returns a ComponentMap mapping variable to reduced cost.
load_vars
([vars_to_load])Load the solution of the primal variables into the value attribute of the variables.
Member Documentation
- get_duals(cons_to_load: Sequence[ConstraintData] | None = None) Dict[ConstraintData, float] [source]
Returns a dictionary mapping constraint to dual value.
- abstract get_primals(vars_to_load: Sequence[VarData] | None = None) Mapping[VarData, float] [source]
Returns a ComponentMap mapping variable to var value.
- Parameters:
vars_to_load (list) – A list of the variables whose solution value should be retrieved. If vars_to_load is None, then the values for all variables will be retrieved.
- Returns:
primals – Maps variables to solution values
- Return type:
- get_reduced_costs(vars_to_load: Sequence[VarData] | None = None) Mapping[VarData, float] [source]
Returns a ComponentMap mapping variable to reduced cost.
- Parameters:
vars_to_load (list) – A list of the variables whose reduced cost should be retrieved. If vars_to_load is None, then the reduced costs for all variables will be loaded.
- Returns:
reduced_costs – Maps variables to reduced costs
- Return type:
- load_vars(vars_to_load: Sequence[VarData] | None = None) NoReturn [source]
Load the solution of the primal variables into the value attribute of the variables.
- Parameters:
vars_to_load (list) – The minimum set of variables whose solution should be loaded. If vars_to_load is None, then the solution to all primal variables will be loaded. Even if vars_to_load is specified, the values of other variables may also be loaded depending on the interface.