|
26 | 26 | import numpy as np
|
27 | 27 | import xarray as xr
|
28 | 28 |
|
29 |
| -from calliope import config, exceptions |
| 29 | +from calliope import exceptions |
30 | 30 | from calliope.attrdict import AttrDict
|
31 | 31 | from calliope.backend import helper_functions, parsing
|
32 | 32 | from calliope.exceptions import warn as model_warn
|
33 | 33 | from calliope.io import load_config, to_yaml
|
34 | 34 | from calliope.preprocess.model_math import ORDERED_COMPONENTS_T, CalliopeMath
|
| 35 | +from calliope.schemas import config_schema |
35 | 36 | from calliope.util.schema import MODEL_SCHEMA, extract_from_schema
|
36 | 37 |
|
37 | 38 | if TYPE_CHECKING:
|
@@ -69,7 +70,7 @@ class BackendModelGenerator(ABC):
|
69 | 70 | """Optimisation problem objective name."""
|
70 | 71 |
|
71 | 72 | def __init__(
|
72 |
| - self, inputs: xr.Dataset, math: CalliopeMath, build_config: config.Build |
| 73 | + self, inputs: xr.Dataset, math: CalliopeMath, build_config: config_schema.Build |
73 | 74 | ):
|
74 | 75 | """Abstract base class to build a representation of the optimisation problem.
|
75 | 76 |
|
@@ -617,7 +618,7 @@ def __init__(
|
617 | 618 | self,
|
618 | 619 | inputs: xr.Dataset,
|
619 | 620 | math: CalliopeMath,
|
620 |
| - build_config: config.Build, |
| 621 | + build_config: config_schema.Build, |
621 | 622 | instance: T,
|
622 | 623 | ) -> None:
|
623 | 624 | """Abstract base class to build backend models that interface with solvers.
|
@@ -937,15 +938,17 @@ def has_integer_or_binary_variables(self) -> bool:
|
937 | 938 | """
|
938 | 939 |
|
939 | 940 | @abstractmethod
|
940 |
| - def _solve(self, solve_config: config.Solve, warmstart: bool = False) -> xr.Dataset: |
| 941 | + def _solve( |
| 942 | + self, solve_config: config_schema.Solve, warmstart: bool = False |
| 943 | + ) -> xr.Dataset: |
941 | 944 | """Optimise built model.
|
942 | 945 |
|
943 | 946 | If solution is optimal, interface objects (decision variables, global
|
944 | 947 | expressions, constraints, objective) can be successfully evaluated for their
|
945 | 948 | values at optimality.
|
946 | 949 |
|
947 | 950 | Args:
|
948 |
| - solve_config: (config.Solve): Calliope Solve configuration object. |
| 951 | + solve_config: (config_schema.Solve): Calliope Solve configuration object. |
949 | 952 | warmstart (bool, optional): If True, and the chosen solver is capable of implementing it, an existing
|
950 | 953 | optimal solution will be used to warmstart the next solve run.
|
951 | 954 | Defaults to False.
|
@@ -1139,7 +1142,7 @@ def track_constraints(self, constraints_to_track: list):
|
1139 | 1142 | valid_constraints = shadow_prices.intersection(self.available_constraints)
|
1140 | 1143 | if invalid_constraints:
|
1141 | 1144 | model_warn(
|
1142 |
| - f"Invalid constraints {invalid_constraints} in `config.solve.shadow_prices`. " |
| 1145 | + f"Invalid constraints {invalid_constraints} in `config_schema.solve.shadow_prices`. " |
1143 | 1146 | "Their shadow prices will not be tracked."
|
1144 | 1147 | )
|
1145 | 1148 | # Only actually activate shadow price tracking if at least one valid
|
|
0 commit comments