diff --git a/docs/0.6.4/build/build.svg b/docs/0.6.4/build/build.svg new file mode 100644 index 0000000..9cd2a24 --- /dev/null +++ b/docs/0.6.4/build/build.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + build + build + + + passing + passing + + diff --git a/docs/0.6.4/docs/.buildinfo b/docs/0.6.4/docs/.buildinfo new file mode 100644 index 0000000..905242f --- /dev/null +++ b/docs/0.6.4/docs/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: b06085df235f662c9fc98550be8db68e +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/0.6.4/docs/.doctrees/PackageReference.doctree b/docs/0.6.4/docs/.doctrees/PackageReference.doctree new file mode 100644 index 0000000..85a3493 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/PackageReference.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.data_structures.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.data_structures.doctree new file mode 100644 index 0000000..1016594 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.data_structures.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.doctree new file mode 100644 index 0000000..2db8f79 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.models.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.models.doctree new file mode 100644 index 0000000..7be53ae Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.models.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.admm.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.admm.doctree new file mode 100644 index 0000000..3924add Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.admm.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.doctree new file mode 100644 index 0000000..3ff9a32 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.dmpc.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.doctree new file mode 100644 index 0000000..5da81c0 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.modules.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.core.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.core.doctree new file mode 100644 index 0000000..19e4eb2 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.core.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.doctree new file mode 100644 index 0000000..451e066 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.casadi_.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.doctree new file mode 100644 index 0000000..fdd75e3 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.optimization_backends.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.doctree new file mode 100644 index 0000000..1ac632e Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.plotting.doctree b/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.plotting.doctree new file mode 100644 index 0000000..93cdba5 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/agentlib_mpc.utils.plotting.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.data_structures.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.data_structures.doctree new file mode 100644 index 0000000..39896a9 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.data_structures.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.doctree new file mode 100644 index 0000000..071929c Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.models.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.models.doctree new file mode 100644 index 0000000..39b19dc Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.models.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.InputPrediction.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.InputPrediction.doctree new file mode 100644 index 0000000..7172cea Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.InputPrediction.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.admm.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.admm.doctree new file mode 100644 index 0000000..6d82d01 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.admm.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.doctree new file mode 100644 index 0000000..77d2262 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.dmpc.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.doctree new file mode 100644 index 0000000..2238be5 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.estimation.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.estimation.doctree new file mode 100644 index 0000000..0a3c57f Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.estimation.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.ml_model_training.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.ml_model_training.doctree new file mode 100644 index 0000000..4581fb6 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.modules.ml_model_training.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.core.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.core.doctree new file mode 100644 index 0000000..8f16849 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.core.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.doctree new file mode 100644 index 0000000..02d343f Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.casadi_.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.doctree new file mode 100644 index 0000000..37bc8f3 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.optimization_backends.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.doctree new file mode 100644 index 0000000..5ad5699 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.plotting.doctree b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.plotting.doctree new file mode 100644 index 0000000..c21a958 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/agentlib_mpc.utils.plotting.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/code/modules.doctree b/docs/0.6.4/docs/.doctrees/code/modules.doctree new file mode 100644 index 0000000..9c4dd9d Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/code/modules.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/environment.pickle b/docs/0.6.4/docs/.doctrees/environment.pickle new file mode 100644 index 0000000..e255ca6 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/environment.pickle differ diff --git a/docs/0.6.4/docs/.doctrees/index.doctree b/docs/0.6.4/docs/.doctrees/index.doctree new file mode 100644 index 0000000..641391c Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/index.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/installation.doctree b/docs/0.6.4/docs/.doctrees/installation.doctree new file mode 100644 index 0000000..4f6aa76 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/installation.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/modules.doctree b/docs/0.6.4/docs/.doctrees/modules.doctree new file mode 100644 index 0000000..23cc656 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/modules.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/tutorials/ADMM.doctree b/docs/0.6.4/docs/.doctrees/tutorials/ADMM.doctree new file mode 100644 index 0000000..5efff90 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/tutorials/ADMM.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/tutorials/MPC.doctree b/docs/0.6.4/docs/.doctrees/tutorials/MPC.doctree new file mode 100644 index 0000000..99c5146 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/tutorials/MPC.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/tutorials/Trajectories.doctree b/docs/0.6.4/docs/.doctrees/tutorials/Trajectories.doctree new file mode 100644 index 0000000..4f4e533 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/tutorials/Trajectories.doctree differ diff --git a/docs/0.6.4/docs/.doctrees/tutorials/tutorial.doctree b/docs/0.6.4/docs/.doctrees/tutorials/tutorial.doctree new file mode 100644 index 0000000..65a04d4 Binary files /dev/null and b/docs/0.6.4/docs/.doctrees/tutorials/tutorial.doctree differ diff --git a/docs/0.6.4/docs/.nojekyll b/docs/0.6.4/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/0.6.4/docs/PackageReference.html b/docs/0.6.4/docs/PackageReference.html new file mode 100644 index 0000000..b826e6c --- /dev/null +++ b/docs/0.6.4/docs/PackageReference.html @@ -0,0 +1,164 @@ + + + + + + + + + Package Reference — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/admm_datatypes.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/admm_datatypes.html new file mode 100644 index 0000000..b3e7dfb --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/admm_datatypes.html @@ -0,0 +1,466 @@ + + + + + + + + agentlib_mpc.data_structures.admm_datatypes — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.admm_datatypes

+import dataclasses
+from typing import List, Dict, Iterable, Tuple
+from itertools import chain
+
+import numpy as np
+
+import agentlib as al
+import orjson
+from agentlib.core.module import BaseModuleConfigClass
+
+import agentlib_mpc.data_structures.coordinator_datatypes as cdt
+from agentlib_mpc.data_structures import mpc_datamodels
+
+############################## Uncoordinated ADMM ##################################
+
+ADMM_PREFIX = "admm"
+MULTIPLIER_PREFIX = ADMM_PREFIX + "_lambda"
+LOCAL_PREFIX = ADMM_PREFIX + "_coupling"
+MEAN_PREFIX = ADMM_PREFIX + "_coupling_mean"
+LAG_PREFIX = ADMM_PREFIX + "_lag"
+EXCHANGE_MULTIPLIER_PREFIX = ADMM_PREFIX + "_exchange_lambda"
+EXCHANGE_LOCAL_PREFIX = ADMM_PREFIX + "_exchange"
+EXCHANGE_MEAN_PREFIX = ADMM_PREFIX + "_exchange_mean"
+
+
+
[docs]@dataclasses.dataclass +class CouplingEntry: + """Holds naming conventions for different optimizatin variables / parameters + associated with a coupling variable in consensus ADMM.""" + + name: str + + @property + def local(self): + return f"{LOCAL_PREFIX}_{self.name}" + + @property + def mean(self): + return f"{MEAN_PREFIX}_{self.name}" + + @property + def multiplier(self): + return f"{MULTIPLIER_PREFIX}_{self.name}" + + @property + def lagged(self): + return f"{LAG_PREFIX}_{self.name}" + +
[docs] def admm_variables(self): + return [self.local, self.mean, self.multiplier, self.lagged]
+ + +
[docs]@dataclasses.dataclass +class ExchangeEntry: + """Holds naming conventions for different optimizatin variables / parameters + associated with a coupling variable in exchange ADMM.""" + + name: str + + @property + def local(self): + return f"{EXCHANGE_LOCAL_PREFIX}_{self.name}" + + @property + def mean_diff(self): + return f"{EXCHANGE_MEAN_PREFIX}_{self.name}" + + @property + def multiplier(self): + return f"{EXCHANGE_MULTIPLIER_PREFIX}_{self.name}" + + @property + def lagged(self): + return f"{LAG_PREFIX}_{self.name}" + +
[docs] def admm_variables(self): + return [self.local, self.mean_diff, self.multiplier, self.lagged]
+ + +
[docs]@dataclasses.dataclass +class VariableReference(mpc_datamodels.FullVariableReference): + """Holds info about all variables of an MPC and their role in the optimization + problem.""" + + couplings: list[CouplingEntry] = dataclasses.field(default_factory=list) + exchange: list[ExchangeEntry] = dataclasses.field(default_factory=list) + +
[docs] @classmethod + def from_config(cls, config: BaseModuleConfigClass): + """Creates an instance from a pydantic values dict which includes lists of + AgentVariables with the keys corresponding to 'states', 'inputs', etc..""" + var_ref: cls = super().from_config(config) + var_ref.couplings = [CouplingEntry(name=c.name) for c in config.couplings] + var_ref.exchange = [ExchangeEntry(name=c.name) for c in config.exchange] + return var_ref
+ +
[docs] def all_variables(self) -> List[str]: + """Returns a list of all variables registered in the var_ref""" + full_dict = self.__dict__.copy() + couplings: List[CouplingEntry] = full_dict.pop("couplings") + exchange: List[CouplingEntry] = full_dict.pop("exchange") + coup_vars = [] + for coup in couplings + exchange: + coup_vars.append(coup.name) + original_vars = list(chain.from_iterable(full_dict.values())) + return original_vars + coup_vars
+ + def __contains__(self, item): + return item in set(self.all_variables())
+ + +
[docs]def coupling_alias(alias: str) -> str: + """Naming convention for local variables to send and receive.""" + return f"{LOCAL_PREFIX}_{alias}"
+ + +
[docs]def exchange_alias(alias: str) -> str: + """Naming convention for local exchange variables to send and receive.""" + return f"{EXCHANGE_LOCAL_PREFIX}_{alias}"
+ + +############################## Coordinated ADMM ################################## + +# ALIASES +ADMM_COMMUNICATION = "admm_communication" +ADMM_SIGNUP_REQUEST = "admm_signup_request" + + +glob_params: List[str] = ["penalty_factor", "prediction_horizon", "time_step"] + +PENALTY_FACTOR = "penalty_factor" + + +
[docs]@dataclasses.dataclass +class AgentDictEntry(cdt.AgentDictEntry): + """Holds participating coupling variables (consensus and exchange) of a single + agent in ADMM. Used in the coordinator.""" + + coup_vars: List[str] = dataclasses.field(default_factory=lambda: []) + exchange_vars: List[str] = dataclasses.field(default_factory=lambda: [])
+ + +
[docs]@dataclasses.dataclass +class ADMMParameters: + """Collection of parameters which have to be shared across all agents in ADMM.""" + + penalty_factor: float + prediction_horizon: int + time_step: float
+ + +
[docs]@dataclasses.dataclass +class ADMMParticipation: + """Helper class to organize ADMM participants.""" + + source: al.Source + ready: bool = False + participating: bool = False
+ + +
[docs]@dataclasses.dataclass +class CouplingVariable: + """Holds information about a phy""" + + local_trajectories: Dict[al.Source, list] = dataclasses.field(default_factory=dict) + mean_trajectory: list = dataclasses.field(default_factory=lambda: [0]) + delta_mean: np.ndarray = dataclasses.field(default_factory=lambda: np.array([0])) + primal_residual: np.ndarray = dataclasses.field( + default_factory=lambda: np.array([0]) + ) + + def _relevant_sources(self, sources: Iterable[al.Source]) -> set: + if sources is None: + sources = self.local_trajectories.keys() + else: + # the remaining sources are only agents that have this variable + sources = set(self.local_trajectories.keys()).intersection(sources) + return sources + + @property + def participants(self): + """Returns all agent sources that are registered to this coupling.""" + return list(self.local_trajectories.keys()) + +
[docs] def flat_locals(self, sources: Iterable[al.Source] = None) -> list[float]: + """ + Returns the flattened array of all local variables and their multipliers. + + Args: + sources: list of sources that should be included in the update. + By default, all are included. + + Returns: + flat lists of local variables and multipliers (locals, multipliers) + """ + sources = self._relevant_sources(sources) + if not sources: + return [] + local_vars = list(chain([self.local_trajectories[ls] for ls in sources])) + return local_vars
+ +
[docs] def get_residual(self, rho: float) -> Tuple[np.ndarray, np.ndarray]: + """ + Returns the primal and dual residual of the last iteration as a tuple + of flattened Arrays. + Args: + rho: + + Returns: + (primal residual, dual residual) + """ + primal_residual = self.primal_residual.flatten() + dual_residual = (rho * self.delta_mean).flatten() + return primal_residual, dual_residual
+ + +
[docs]@dataclasses.dataclass +class ConsensusVariable(CouplingVariable): + multipliers: Dict[al.Source, list] = dataclasses.field(default_factory=lambda: {}) + +
[docs] def update_mean_trajectory(self, sources: Iterable[al.Source] = None): + """ + Calculates a new mean of this variable. + + Args: + sources: List of sources that should be included in the update. + If none is given, use all variables. + """ + sources = self._relevant_sources(sources) + if not sources: + return + lists = [self.local_trajectories[ls] for ls in sources] + arr = np.array(lists) + mean = np.mean(arr, axis=0) + self.delta_mean = self.mean_trajectory - mean # for residual + self.mean_trajectory = list(mean)
+ +
[docs] def update_multipliers(self, rho: float, sources: Iterable[al.Source] = None): + """ + Performs the multiplier update. + + Args: + rho: penalty parameter + sources: list of sources that should be included in the update. + By default, all are included. + + Returns: + + """ + sources = self._relevant_sources(sources) + if not sources: + return + + # create arrays for all trajectories and multipliers + traj_list = [self.local_trajectories[ls] for ls in sources] + mul_list = [self.multipliers[ls] for ls in sources] + trajectories = np.array(traj_list) + multipliers = np.array(mul_list) + mean = np.array(self.mean_trajectory) + + # perform the update + self.primal_residual = mean - trajectories + new_multipliers = multipliers - rho * self.primal_residual + + # cast the updated multipliers back to their sources + for i, src in enumerate(sources): + self.multipliers[src] = new_multipliers[i, :].tolist()
+ +
[docs] def flat_multipliers(self, sources: Iterable[al.Source] = None) -> list[float]: + sources = self._relevant_sources(sources) + if not sources: + return [] + return list(chain([self.multipliers[ls] for ls in sources]))
+ +
[docs] def shift_values_by_one(self, horizon: int): + """Shifts the trajectories""" + mean_traj = self.mean_trajectory + shift_by = int(len(mean_traj) / horizon) + self.mean_trajectory = mean_traj[shift_by:] + mean_traj[-shift_by:] + mul_dict = self.multipliers + for key, mul in mul_dict.items(): + mul_dict[key] = mul[shift_by:] + mul[-shift_by:]
+ + +
[docs]@dataclasses.dataclass +class ExchangeVariable(CouplingVariable): + diff_trajectories: Dict[al.Source, list[float]] = dataclasses.field( + default_factory=dict + ) + multiplier: list[float] = dataclasses.field(default_factory=list) + +
[docs] def update_diff_trajectories(self, sources: Iterable[al.Source] = None): + """ + Calculates a new mean of this variable. + + Args: + sources: List of sources that should be included in the update. + If none is given, use all variables. + """ + sources = self._relevant_sources(sources) + if not sources: + return + lists = [self.local_trajectories[ls] for ls in sources] + arr = np.array(lists) + mean = np.mean(arr, axis=0) + self.delta_mean = self.mean_trajectory - mean # for residual + self.mean_trajectory = list(mean) + for src in sources: + self.diff_trajectories[src] = list(self.local_trajectories[src] - mean)
+ +
[docs] def update_multiplier(self, rho: float): + """ + Performs the multiplier update. + + Args: + rho: penalty parameter + + Returns: + + """ + + # perform the update + self.primal_residual = np.array(self.mean_trajectory) + self.multiplier = list(self.multiplier + rho * self.primal_residual)
+ +
[docs] def shift_values_by_one(self, horizon: int): + """Shifts the trajectories""" + shift_by = int(len(self.multiplier) / horizon) + self.multiplier = self.multiplier[shift_by:] + self.multiplier[-shift_by:] + for key, diff in self.diff_trajectories.items(): + self.diff_trajectories[key] = diff[shift_by:] + diff[-shift_by:]
+ + +
[docs]@dataclasses.dataclass +class StructuredValue: + """Base Class to specify the structure of an AgentVariable Value. It will + be efficiently sent and deserialized.""" + +
[docs] def to_json(self) -> str: + """Serialize self to json bytes, can be used by the communicator.""" + return orjson.dumps( + self, option=orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_SERIALIZE_DATACLASS + ).decode()
+ +
[docs] @classmethod + def from_json(cls, data: str): + return cls(**orjson.loads(data))
+ + +
[docs]@dataclasses.dataclass +class CoordinatorToAgent(StructuredValue): + target: str + mean_trajectory: Dict[str, list] + multiplier: Dict[str, list] + mean_diff_trajectory: Dict[str, list] + exchange_multiplier: Dict[str, list] + penalty_parameter: float
+ + +
[docs]@dataclasses.dataclass +class AgentToCoordinator(StructuredValue): + local_trajectory: Dict[str, np.ndarray] + local_exchange_trajectory: Dict[str, np.ndarray]
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/casadi_utils.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/casadi_utils.html new file mode 100644 index 0000000..558f113 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/casadi_utils.html @@ -0,0 +1,472 @@ + + + + + + + + agentlib_mpc.data_structures.casadi_utils — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.casadi_utils

+"""Stores all sorts of Dataclasses, Enums or Factories to help with the
+CasadiBackend."""
+
+import os
+import random
+import subprocess
+from contextlib import contextmanager
+from dataclasses import dataclass, field
+from logging import Logger
+from pathlib import Path
+from typing import Union, List, NamedTuple, Literal
+
+import casadi as ca
+from enum import Enum
+
+from pydantic import ConfigDict, Field, BaseModel
+
+from agentlib_mpc.data_structures import mpc_datamodels
+
+
+CaFuncInputs = Union[ca.MX, ca.SX, ca.Sparsity, ca.DM, float, int]
+DiscreteVars = List[bool]
+GUESS_PREFIX = "guess_"
+LB_PREFIX = "lb_"
+UB_PREFIX = "ub_"
+
+# Casadi Matrices specifying the input of all different types
+# of optimization parameters. Matrices consist of different variable rows
+# and have a column for each time step in the discretization.
+# There are separate matrices for each input type (as defined in the
+# System), and also for the upper and lower boundaries of variables
+# respectively.
+# Example:
+# {"x": [[1, 2], [0, 2]],
+# "lb_x": [[0, 0], [0, 0]],
+# "ub_x": [[0, 0], [0, 0]],
+# "d": [[2, 1], [1, 1]]
+# }
+MPCInputs = dict[str, ca.DM]
+
+
+
[docs]class DiscretizationMethod(str, Enum): + collocation = "collocation" + multiple_shooting = "multiple_shooting"
+ + +
[docs]class CollocationMethod(str, Enum): + radau = "radau" + legendre = "legendre"
+ + +
[docs]class Solvers(str, Enum): + ipopt = "ipopt" + qpoases = "qpoases" + sqpmethod = "sqpmethod" + gurobi = "gurobi" + bonmin = "bonmin" + fatrop = "fatrop" + proxqp = "proxqp" + osqp = "osqp"
+ + +
[docs]class Integrators(str, Enum): + cvodes = "cvodes" + rk = "rk" # runge-kutta + euler = "euler"
+ + +
[docs]class CasadiDiscretizationOptions(mpc_datamodels.DiscretizationOptions): + model_config = ConfigDict(extra="forbid") + + method: DiscretizationMethod = DiscretizationMethod.collocation + collocation_order: int = Field(default=3, ge=1, le=9) + collocation_method: CollocationMethod = CollocationMethod.legendre + integrator: Integrators = Integrators.cvodes
+ + +
[docs]class SolverOptions(BaseModel): + name: Solvers = "ipopt" + options: dict = Field(default={}) + model_config = ConfigDict(extra="forbid")
+ + +
[docs]@dataclass +class OptParMXContainer: + """Stores the necessary MX variables created during discretization for + OptimizationParameters.""" + + var: List[ca.MX] = field(default_factory=list) # res format + grid: List[float] = field(default_factory=list) # res format, mpc inputs
+ + +
[docs]@dataclass +class OptVarMXContainer(OptParMXContainer): + """Stores the necessary MX variables created during discretization for + OptimizationVariables.""" + + lb: List[ca.MX] = field(default_factory=list) # res format + ub: List[ca.MX] = field(default_factory=list) # res format + guess: List[ca.MX] = field(default_factory=list) # res format + opt: ca.DM = None # mpc inputs
+ + +
[docs]@dataclass +class Constraint: + function: ca.MX + lb: ca.MX + ub: ca.MX
+ + +
[docs]class ModelConstraint(NamedTuple): + lb: CaFuncInputs + function: ca.MX + ub: CaFuncInputs
+ + +
[docs]@dataclass +class SolverFactory: + """Creates a solver given an NLP and an options construct.""" + + do_jit: bool + bat_file: Path = None + name: str = None + options: SolverOptions = field(default_factory=SolverOptions) + logger: Logger = None + +
[docs] def create_solver( + self, + nlp: Union[dict, str], + discrete: DiscreteVars = None, + equalities: list[bool] = None, + ) -> ca.Function: + options = self.options.options + solver_name = self.options.name.casefold() + + if solver_name == Solvers.ipopt: + return self._create_ipopt_solver(nlp=nlp, options=options) + if solver_name == Solvers.fatrop: + return self._create_fatrop_solver( + nlp=nlp, options=options, equalities=equalities + ) + if solver_name == Solvers.sqpmethod: + return self._create_sqpmethod_solver(nlp=nlp, options=options) + if solver_name == Solvers.qpoases: + return self._create_qpoases_solver(nlp=nlp, options=options) + if solver_name == Solvers.proxqp: + return self._create_proxqp_solver(nlp=nlp, options=options) + if solver_name == Solvers.osqp: + return self._create_osqp_solver(nlp=nlp, options=options) + if solver_name == Solvers.gurobi: + return self._create_gurobi_solver( + nlp=nlp, options=options, discrete=discrete + ) + if solver_name == Solvers.bonmin: + return self._create_bonmin_solver( + nlp=nlp, options=options, discrete=discrete + ) + raise ValueError( + f'Solver "{solver_name}" not recognized. Currently ' + f"supported: {[s.value for s in Solvers]}" + )
+ + def _create_fatrop_solver(self, nlp: dict, options: dict, equalities: list[bool]): + # equality = [True for _ in range(nlp["g"].shape[0])] + + default_opts = { + "verbose": False, + "print_time": False, + "record_time": True, + "expand": True, + "structure_detection": "auto", + "equality": equalities, + "fatrop": { + "max_iter": 100, + "tol": 1e-4, + # "mu_init": 1e-2, + "print_level": 0, + }, + } + default_solver_opts = options.pop("fatrop", {}) + opts = {**default_opts, **options} + opts["fatrop"].update(default_solver_opts) + if self.do_jit: + opts["expand"] = False # compiled code is better not expanded + solver = self.make_casadi_nlp(nlp, "fatrop", opts, "nlp") + if not self.do_jit: + return solver + nlp = compile_solver(bat_file=self.bat_file, optimizer=solver, name=self.name) + return self.make_casadi_nlp(nlp, "fatrop", opts, "nlp") + + def _create_ipopt_solver(self, nlp: dict, options: dict): + default_opts = { + "verbose": False, + "print_time": False, + "record_time": True, + "expand": True, + "ipopt": { + # "mu_init": 1e-2, + "max_iter": 100, + "tol": 1e-4, + "acceptable_tol": 0.1, + "acceptable_constr_viol_tol": 1, + "acceptable_iter": 5, + "acceptable_compl_inf_tol": 1, + "print_level": 0, + }, + } + ipopt_ = options.pop("ipopt", {}) + opts = {**default_opts, **options} + opts["ipopt"].update(ipopt_) + if self.do_jit: + opts["expand"] = False # compiled code is better not expanded + solver = self.make_casadi_nlp(nlp, "ipopt", opts, "nlp") + if not self.do_jit: + return solver + nlp = compile_solver(bat_file=self.bat_file, optimizer=solver, name=self.name) + return self.make_casadi_nlp(nlp, "ipopt", opts, "nlp") + + def _create_sqpmethod_solver(self, nlp: dict, options: dict): + default_opts = { + "qpsol": "osqp", + "qpsol_options": {"error_on_fail": False}, + "print_iteration": False, + "print_status": False, + "print_header": False, + "print_time": False, + "max_iter": 20, + "tol_du": 0.01, + "tol_pr": 0.0001, + } + opts = {**default_opts, **options} + return ca.nlpsol("mpc", "sqpmethod", nlp, opts) + + def _create_qpoases_solver(self, nlp: dict, options: dict): + default_opts = { + "verbose": False, + "print_time": False, + "record_time": True, + "printLevel": "low", + } + opts = {**default_opts, **options} + return ca.qpsol("mpc", "qpoases", nlp, opts) + + def _create_proxqp_solver(self, nlp: dict, options: dict): + default_opts = { + "verbose": False, + "print_time": False, + "record_time": True, + "proxqp": {"max_iter": 200, "eps_abs": 1e-4, "backend": "sparse"}, + } + opts = {**default_opts, **options} + return ca.qpsol("mpc", "proxqp", nlp, opts) + + def _create_osqp_solver(self, nlp: dict, options: dict): + default_opts = { + "verbose": False, + "print_time": False, + "record_time": True, + "osqp": {"max_iter": 200, "eps_abs": 1e-4, "verbose": False}, + } + opts = {**default_opts, **options} + return ca.qpsol("mpc", "osqp", nlp, opts) + + def _create_gurobi_solver( + self, nlp: dict, options: dict, discrete: DiscreteVars = None + ): + default_opts = {} + opts = {**default_opts, **options, "discrete": discrete} + return ca.qpsol("mpc", "gurobi", nlp, opts) + + def _create_bonmin_solver( + self, nlp: dict, options: dict, discrete: DiscreteVars = None + ): + default_opts = { + "bonmin.bb_log_level": 0, + "bonmin.bb_log_interval": 1000, + "bonmin.nlp_log_level": 0, + } + opts = {**default_opts, **options, "discrete": discrete} + return ca.nlpsol("mpc", "bonmin", nlp, opts) + +
[docs] def make_casadi_nlp( + self, + problem: Union[dict, str], + solver: str, + opts: dict, + problem_type: Literal["nlp", "qp"] = "nlp", + ): + ca_sol = ca.nlpsol if problem_type == "nlp" else ca.qpsol + try: + solver = ca_sol("mpc", solver, problem, opts) + except RuntimeError: + solver = ca_sol("mpc", solver, problem, {**opts, "expand": False}) + if not self.do_jit: + self.logger.info( + "Tried setting up nlp with 'expand'=True, but your problem " + "formulation contains non-expandable elements (e.g. using cvodes " + "as integrator, or interpolation tables.)" + ) + return solver
+ + +
[docs]@contextmanager +def temporary_directory(path): + old_pwd = os.getcwd() + os.chdir(path) + try: + yield + finally: + os.chdir(old_pwd)
+ + +
[docs]def compile_solver(bat_file: Path, name: str, optimizer: ca.Function) -> str: + """ + Code-generates an ipopt solver and compiles it. + Currently, only works on Windows! Requires a batch file that knows + how to setup Visual Studio command line and compiles the source code. + + Returns: + The Path to the .dll file for the compiled solver. + + Raises: + TypeError + FileNotFoundError + RuntimeError + """ + if not name: + name = f"nlp_{random.randint(10, 1000)}" + + base_name = name + file_name = f"{name}.c" + file = Path(file_name) + i = 0 + + # "build_batch_bat": "D:/ses-tsp/masterarbeit-miocp/02_Work/agentlib_mpc_9_approximate_miocp/examples/prod_cons_nmpc/solver_lib/compile_nlp.bat", + + c_dir = Path(Path(bat_file).parent, "code_gen") + c_dir.mkdir(exist_ok=True) + batch = str(Path(bat_file).absolute()) + + with temporary_directory(c_dir): + while file.exists(): + name = f"{base_name}_{i}" + file_name = f"{name}.c" + file = Path(file_name) + i = i + 1 + + with temporary_directory(c_dir): + optimizer.generate_dependencies(file_name) + + try: + with temporary_directory(c_dir): + ret = subprocess.call([batch, file_name]) + except TypeError as e: + # no batch file was provided + raise TypeError( + "You need to provide a batch file to " + "compile the solver in the backend config." + ) from e + except FileNotFoundError as e: + # provided batch file does not exist + raise FileNotFoundError from e + if ret != 0: + raise RuntimeError( + "The provided batch file did not exit properly, please " + "check it properly compiles the provided file." + ) + solver_dll = Path(c_dir).joinpath(f"{name}.dll").absolute() + return str(solver_dll)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/coordinator_datatypes.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/coordinator_datatypes.html new file mode 100644 index 0000000..bd0f232 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/coordinator_datatypes.html @@ -0,0 +1,192 @@ + + + + + + + + agentlib_mpc.data_structures.coordinator_datatypes — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.coordinator_datatypes

+import dataclasses
+from dataclasses import dataclass, asdict
+from enum import Enum
+
+import numpy as np
+
+from agentlib.core import Source
+
+# Parameter names
+PREDICTION_HORIZON = "prediction_horizon"
+TIME_STEP = "time_step"
+
+
+# Communication names / aliases
+REGISTRATION = "registration"
+REGISTRATION_C2A = "registration_coordinator_to_agent"
+REGISTRATION_A2C = "registration_agent_to_coordinator"
+START_ITERATION = "startIteration"
+START_ITERATION_C2A = "startIteration_coordinator_to_agent"
+START_ITERATION_A2C = "startIteration_agent_to_coordinator"
+OPTIMIZATION = "optimization"
+OPTIMIZATION_C2A = "optimization_coordinator_to_agent"
+OPTIMIZATION_A2C = "optimization_agent_to_coordinator"
+
+
+
[docs]class CoordinatorStatus(str, Enum): + """Enum used to keep track of the status of a DMPC-Coordinator.""" + + sleeping = "sleeping" + init_iterations = "init_iterations" + optimization = "optimization" + updating = "updating"
+ + +
[docs]class AgentStatus(str, Enum): + """Enum used within a DMPC-Coordinator to keep track of the statuses of its + participating agents.""" + + pending = "pending" # agent is not yet fully registered + standby = "standby" # agent is fully registered but not initialized for opt + ready = "ready" # agent is ready to start a local optimization + busy = "busy" # agent is performing task
+ + +
[docs]@dataclass +class OptimizationData: + """ + Contains specific variables (or time series) of the agent + """ + + x: np.array = dataclasses.field(default_factory=lambda: np.array([])) + u: np.array = dataclasses.field(default_factory=lambda: np.array([])) + +
[docs] def to_dict(self) -> dict: + inst_dict = asdict(self) + for key, val in inst_dict.items(): + if isinstance(val, np.ndarray): + inst_dict[key] = np.array2string(val) + return inst_dict
+ +
[docs] @classmethod + def from_dict(cls, data: dict): + for key, val in data.items(): + try: + data[key] = np.frombuffer(val) + except (ValueError, TypeError): + pass + return cls(**data)
+ + +
[docs]@dataclass +class RegistrationMessage: + """Dataclass structuring the communication during registration between a + participating agent and the coordinator in DMPC.""" + + status: AgentStatus = None + opts: dict = None + agent_id: str = None + coupling: list = None
+ + +# EXECUTION +
[docs]@dataclass +class AgentDictEntry: + """Dataclass holding the status of a participating agent in DMPC.""" + + name: str + optimization_data = OptimizationData() + status: AgentStatus = AgentStatus.pending
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/interpolation.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/interpolation.html new file mode 100644 index 0000000..e1e8a2b --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/interpolation.html @@ -0,0 +1,130 @@ + + + + + + + + agentlib_mpc.data_structures.interpolation — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.interpolation

+from enum import Enum
+
+a = 1
+
+
+
[docs]class InterpolationMethods(str, Enum): + linear = "linear" + previous = "previous" + no_interpolation = "no_interpolation" + spline3 = "spline3" + + # this interpolation method is a custom implementation, intended for the case where + # the source data is sampled finer that the target data. It takes the average of + # all points between two adjacent time steps on the target grid. + # Example: + # source_grid: [0, 10, 20, 30, 40, 50, 60] + # source_data: [a, b, c, d, e, f, g] + # target_grid: [15, 35, 55] + # Will yield: [(c+d)/2, (e+f)/2, (e+f)/2] + # The last value is always duplicated, to get a lenght consistent with other + # interpolation methods + # This is intended for the case, where the target data is input for an intgration + # / prediction between two points. + mean_over_interval = "mean_over_interval"
+ + +c = 2 +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/ml_model_datatypes.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/ml_model_datatypes.html new file mode 100644 index 0000000..6dc4b1b --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/ml_model_datatypes.html @@ -0,0 +1,255 @@ + + + + + + + + agentlib_mpc.data_structures.ml_model_datatypes — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.ml_model_datatypes

+import dataclasses
+from pathlib import Path
+from typing import Literal
+
+import keras.callbacks
+import pandas as pd
+import pydantic
+from enum import Enum
+from agentlib.core.errors import ConfigurationError
+from pydantic import BaseModel
+from pydantic_core.core_schema import FieldValidationInfo
+
+
+
[docs]class OutputType(str, Enum): + absolute = "absolute" + difference = "difference"
+ + +
[docs]class Feature(BaseModel): + name: str + lag: int = 1
+ + +
[docs]class OutputFeature(Feature): + output_type: OutputType = pydantic.Field( + description="What kind of output this is. If 'absolute' an forward pass of the" + " MLModel will yield the absolute value of the featuer at the next time" + " step. If it is 'difference', the difference to the last time step" + " will be generated, so it has to be added again." + ) + recursive: bool = pydantic.Field( + default=True, + description="If the output feature is recursive, it will also be used as an " + "input for the model. This is useful for mpc, where we want to " + "model the evolution of states based on their previous value. If " + "false, can be used to model algebraic relationships. Default is " + "true.", + ) + +
[docs] @pydantic.field_validator("recursive") + @classmethod + def non_recursive_features_have_to_be_absolute( + cls, recursive, info: FieldValidationInfo + ): + output_type = info.data["output_type"] + if not recursive and output_type == "difference": + raise ConfigurationError( + f"Output Feature {info.data['name']} was specified as a non-recursive feature" + f" for which the differenc in output should be learned. This " + f"combination is not allowed. Please set 'output_type' to " + f"'absolute' for non-recursive features." + ) + return recursive
+ + +
[docs]@dataclasses.dataclass +class TrainingData: + """Stores the data which is used to train a model.""" + + training_inputs: pd.DataFrame + training_outputs: pd.DataFrame + validation_inputs: pd.DataFrame + validation_outputs: pd.DataFrame + test_inputs: pd.DataFrame + test_outputs: pd.DataFrame + +
[docs] def save(self, path: Path): + """Saves three csv files in the path location. The csv files contain the test, + training and validation data""" + training = pd.concat( + [self.training_inputs, self.training_outputs], + keys=["inputs", "outputs"], + axis=1, + ) + validation = pd.concat( + [self.validation_inputs, self.validation_outputs], + keys=["inputs", "outputs"], + axis=1, + ) + test = pd.concat( + [self.test_inputs, self.test_outputs], + keys=["inputs", "outputs"], + axis=1, + ) + full = pd.concat( + [training, validation, test], keys=["training", "validation", "test"] + ) + full.sort_index(inplace=True) + path.mkdir(parents=True, exist_ok=True) + full.to_csv(Path(path, "train_test_val_data.csv"))
+ +
[docs] @classmethod + def load(cls, path: Path): + full = pd.read_csv(path, header=[0, 1], index_col=[0, 1]) + return cls( + training_inputs=full.loc["training"]["inputs"], + test_inputs=full.loc["test"]["inputs"], + validation_inputs=full.loc["validation"]["inputs"], + training_outputs=full.loc["training"]["outputs"], + test_outputs=full.loc["test"]["outputs"], + validation_outputs=full.loc["validation"]["outputs"], + )
+ + +Activation = Literal[ + "relu", + "sigmoid", + "softmax", + "softplus", + "softsign", + "tanh", + "selu", + "elu", + "exponential", +] + + +
[docs]def column_order( + inputs: dict[str, Feature], outputs: dict[str, OutputFeature] +) -> list[str]: + """Defines the order of the columns in which Training data should be passed to + keras, and saved for the Serialization.""" + ordered: list[str] = [] + for name, feat in inputs.items(): + for i in range(feat.lag): + ordered.append(name_with_lag(name, i)) + for name, feat in outputs.items(): + if not feat.recursive: + continue + for i in range(feat.lag): + ordered.append(name_with_lag(name, i)) + return ordered
+ + +
[docs]def name_with_lag(name: str, lag: int) -> str: + if lag == 0: + return name + return f"{name}_{lag}"
+ + +
[docs]class EarlyStoppingCallback(pydantic.BaseModel): + patience: int = (1000,) + verbose: Literal[0, 1] = 0 + restore_best_weights: bool = True + activate: bool = False + +
[docs] def callback(self): + return keras.callbacks.EarlyStopping( + patience=self.patience, + verbose=self.verbose, + restore_best_weights=self.restore_best_weights, + )
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/mpc_datamodels.html b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/mpc_datamodels.html new file mode 100644 index 0000000..e2ea3f6 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/data_structures/mpc_datamodels.html @@ -0,0 +1,254 @@ + + + + + + + + agentlib_mpc.data_structures.mpc_datamodels — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.data_structures.mpc_datamodels

+import dataclasses
+from pathlib import Path
+from typing import List, Union, TypeVar, Protocol, Sequence, Iterable
+from itertools import chain
+
+import attrs
+import numpy as np
+import pandas as pd
+import pydantic
+from enum import Enum, auto
+from agentlib.core import AgentVariable
+from agentlib.core.module import BaseModuleConfigClass
+
+from agentlib_mpc.data_structures.interpolation import InterpolationMethods
+from pydantic import ConfigDict
+
+
+
[docs]class InitStatus(str, Enum): + """Keep track of the readyness status of the MPC.""" + + pre_module_init = auto() + during_update = auto() + ready = auto()
+ + +
[docs]class DiscretizationOptions(pydantic.BaseModel): + """Class defining the options to discretize an MPC. Can be extended for different + optimization implementations.""" + + model_config = ConfigDict(extra="allow") + + time_step: float = pydantic.Field( + default=60, + ge=0, + description="Time step of the MPC.", + ) + prediction_horizon: int = pydantic.Field( + default=5, + ge=0, + description="Prediction horizon of the MPC.", + )
+ + +
[docs]class Results(Protocol): + df: pd.DataFrame + + def __getitem__(self, item: str) -> Sequence[float]: ...
+ + +
[docs]@dataclasses.dataclass +class BaseVariableReference: +
[docs] def all_variables(self) -> List[str]: + """Returns a list of all variables registered in the var_ref""" + return list(chain.from_iterable(self.__dict__.values()))
+ +
[docs] @classmethod + def from_config(cls, config: BaseModuleConfigClass): + """Creates an instance from a pydantic values dict which includes lists of + AgentVariables with the keys corresponding to 'states', 'inputs', etc..""" + + def names_list(ls: List[AgentVariable]): + return [item.name for item in ls] + + field_names = set(f.name for f in dataclasses.fields(cls)) + variables = { + k: names_list(v) for k, v in config.__dict__.items() if k in field_names + } + return cls(**variables)
+ + def __contains__(self, item): + all_variables = set(chain.from_iterable(self.__dict__.values())) + return item in all_variables
+ +VariableReferenceT = TypeVar("VariableReferenceT", bound=BaseVariableReference) + + +
[docs]@dataclasses.dataclass +class VariableReference(BaseVariableReference): + states: List[str] = dataclasses.field(default_factory=list) + controls: List[str] = dataclasses.field(default_factory=list) + inputs: List[str] = dataclasses.field(default_factory=list) + parameters: List[str] = dataclasses.field(default_factory=list) + outputs: List[str] = dataclasses.field(default_factory=list)
+ + +
[docs]def r_del_u_convention(name: str) -> str: + """Turns the name of a control variable into its weight via convention""" + return f"r_del_u_{name}"
+ + +
[docs]@dataclasses.dataclass +class FullVariableReference(VariableReference): + @property + def r_del_u(self) -> List[str]: + return [r_del_u_convention(cont) for cont in self.controls]
+ + +
[docs]@dataclasses.dataclass +class MINLPVariableReference(VariableReference): + binary_controls: List[str] = dataclasses.field(default_factory=list)
+ + +
[docs]@dataclasses.dataclass +class MHEVariableReference(BaseVariableReference): + states: List[str] = dataclasses.field(default_factory=list) + measured_states: List[str] = dataclasses.field(default_factory=list) + weights_states: List[str] = dataclasses.field(default_factory=list) + estimated_inputs: List[str] = dataclasses.field(default_factory=list) + estimated_parameters: List[str] = dataclasses.field(default_factory=list) + known_inputs: List[str] = dataclasses.field(default_factory=list) + known_parameters: List[str] = dataclasses.field(default_factory=list) + outputs: List[str] = dataclasses.field(default_factory=list) + +
[docs] def all_variables(self) -> Iterable[str]: + """Returns a list of all variables registered in the var_ref which the MHE can + get from the config with get()""" + return ( + set(super().all_variables()) + - set(self.measured_states) + - set(self.weights_states) + )
+ + +
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class MPCVariable(AgentVariable): + """AgentVariable used to define input variables of MPC.""" + + interpolation_method: InterpolationMethods = attrs.field( + default=InterpolationMethods.linear, + metadata={ + "description": "Defines which method is used for interpolation of " + "boundaries or values for this variable. Default is linear.", + "title": "Interpolation Method", + }, + )
+ + +MPCVariables = List[MPCVariable] + + +
[docs]def stats_path(path: Union[Path, str]) -> Path: + res_file = Path(path) + return Path(res_file.parent, "stats_" + res_file.name)
+ + +
[docs]def cia_relaxed_results_path(path: Union[Path, str]) -> Path: + res_file = Path(path) + return Path(res_file.parent, "relaxed_" + res_file.name)
+ + +MPCValue = Union[int, float, list[Union[int, float]], pd.Series, np.ndarray] +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_ml_model.html b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_ml_model.html new file mode 100644 index 0000000..583988d --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_ml_model.html @@ -0,0 +1,750 @@ + + + + + + + + agentlib_mpc.models.casadi_ml_model — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.models.casadi_ml_model

+"""Holds the classes for CasADi variables and the CasADi model."""
+
+import itertools
+import logging
+from itertools import chain
+from pathlib import Path
+from typing import Dict, Union, List, Iterable, TypeVar, Any, Optional
+
+from agentlib import AgentVariable
+import pandas as pd
+from agentlib.core.errors import ConfigurationError
+from pydantic_core.core_schema import ValidatorFunctionWrapHandler
+import casadi as ca
+from pydantic import (
+    field_validator,
+    FieldValidationInfo,
+    model_validator,
+    Field,
+)
+
+from agentlib_mpc.data_structures import ml_model_datatypes
+from agentlib_mpc.data_structures.ml_model_datatypes import OutputType, name_with_lag
+
+from agentlib_mpc.models.casadi_predictor import CasadiPredictor
+from agentlib_mpc.models.casadi_model import (
+    CasadiModel,
+    CasadiModelConfig,
+    CasadiState,
+    CasadiOutput,
+    CasadiTypes,
+)
+from agentlib_mpc.models.serialized_ml_model import (
+    SerializedMLModel,
+)
+from agentlib_mpc.utils.sampling import sample
+
+logger = logging.getLogger(__name__)
+CASADI_VERSION = float(ca.__version__[:3])
+
+
+T = TypeVar("T")
+
+
+
[docs]def compute_dupes(collection: Iterable[T]) -> list[T]: + """Computes the duplicate elements in a collection""" + dupes = [] + seen = set() + for element in collection: + if element in seen: + dupes.append(element) + else: + seen.add(element) + return dupes
+ + +# todo +""" +2. Algebraic ML-Equations will consider the continuous evaluation of States during integration +""" + + +
[docs]class CasadiMLModelConfig(CasadiModelConfig): + ml_model_sources: list[Union[SerializedMLModel, Path]] = [] + dt: Union[float, int] = Field( + default=1, title="time increment", validate_default=True + ) + +
[docs] @field_validator("ml_model_sources", mode="before") + @classmethod + def check_or_load_models(cls, ml_model_sources, info: FieldValidationInfo): + # load all ANNs that are paths + for i, ml_model_src in enumerate(ml_model_sources): + if isinstance(ml_model_src, SerializedMLModel): + continue + serialized = SerializedMLModel.load_serialized_model(ml_model_src) + assert_recursive_outputs_are_states(serialized, info.data["outputs"]) + ml_model_sources[i] = serialized + + ml_model_sources: list[SerializedMLModel] + # check that all MLModels have the same time step + time_steps = {s_ml_model.dt for s_ml_model in ml_model_sources} + if len(time_steps) > 1: + raise ConfigurationError( + f"Provided MLModel's need to have the same 'dt'. Provided dt are" + f" {time_steps}" + ) + + # Check that model config and provided .json files match and there are no dupes + all_outputs = list( + chain.from_iterable( + [ml_model.output.keys() for ml_model in ml_model_sources] + ) + ) + all_inputs = list( + chain.from_iterable( + [ml_model.input.keys() for ml_model in ml_model_sources] + ) + ) + output_names = [var.name for var in info.data["states"] + info.data["outputs"]] + input_names = [var.name for var in info.data["inputs"] + info.data["states"]] + + output_dupes = compute_dupes(all_outputs) + if output_dupes: + raise ConfigurationError( + f"The MLModel's that were provided define the same output multiple times." + f" Duplicates are: {output_dupes}" + ) + + inputs_in_ml_model_but_not_config = set(all_inputs) - set(input_names) + outputs_in_ml_model_but_not_config = set(all_outputs) - set(output_names) + + if inputs_in_ml_model_but_not_config: + raise ConfigurationError( + f"Inputs specified by MLModels do not appear in model: " + f"{inputs_in_ml_model_but_not_config}" + ) + if outputs_in_ml_model_but_not_config: + raise ConfigurationError( + f"Outputs specified by MLModels do not appear in model states / outputs: " + f"{outputs_in_ml_model_but_not_config}" + ) + + return ml_model_sources
+ +
[docs] @model_validator(mode="wrap") + @classmethod + def check_dt(cls, values, handler: ValidatorFunctionWrapHandler): + validated: cls = handler(values) + ml_model_dt = validated.ml_model_sources[0].dt + model_dt = validated.dt + if model_dt != ml_model_dt: + logger.warning( + f"Time step (dt) of model and supplied MLModels does not match. Setting " + f"the model time step to {ml_model_dt}." + ) + validated.dt = ml_model_dt + return validated
+ + +
[docs]def assert_recursive_outputs_are_states( + serialized: SerializedMLModel, outputs: dict[str, AgentVariable] +): + """Raises a ConfigurationError if there are recursive ML-models for outputs.""" + for out_name, out_feat in serialized.output.items(): + if out_name in outputs and out_feat.recursive: + raise ConfigurationError( + f"Provided ML-model defines recursive output {out_name}, however in the" + f" model config it is listed under 'outputs'. A recursive model output" + f" can only be associated with a 'state'." + )
+ + +
[docs]class CasadiMLModel(CasadiModel): + """ + This class is created to handle one or multiple ML models + used to predict the states. Compared to previous version, it is now + only dependent on the trained models which provides information about the lags + with the serialized_ML_Models. This way, there is no need to define the lags + again in the model class + """ + + config_type: CasadiMLModelConfig + config: CasadiMLModelConfig + + def __init__(self, **kwargs): + # state variables used and predicted by the MLModel + + super().__init__(**kwargs) + # register ARX models + ml_model_dict, casadi_ml_model_dict = self.register_ml_models() + self.ml_model_dict: Dict[str, SerializedMLModel] = ml_model_dict + self.casadi_ml_model_dict: Dict[str, CasadiPredictor] = casadi_ml_model_dict + + # Register lagged variables + lags_dict, max_lag = self._create_lags_dict() + self.lags_dict: dict[str, int] = lags_dict + self.max_lag: int = max_lag + self.lags_mx_store: dict[str, ca.MX] = self._create_lags_mx_variables() + self._fill_algebraic_equations_with_bb_output() + + self.past_values = self._create_past_values() + + # construct a stage function for optimization and simulation + self.sim_step = self._make_unified_predict_function() + +
[docs] def setup_system(self): + return 0
+ +
[docs] def update_ml_models(self, *ml_models: SerializedMLModel, time: float): + """Updates the internal MLModels with the passed MLModels. + + Warning: This function does not fully check, if the result makes sense! + Consider the following case: + You have two ml_models with outputs out1 in ml_model1, and out2 and out3 in ml_model2. + You call this function with an ml_model3 that defines out2. + This function would replace ml_model2 with ml_model3, leaving the out3 undefined, causing + an error in subequent functions. Try to make sure you specify all outputs when + supplying ml_models, that make parts of other ml_models obsolete. + """ + new_outputs = set( + chain.from_iterable([ml_model.output.keys() for ml_model in ml_models]) + ) + ml_models_to_keep = [] + for ml_model in self.config.ml_model_sources: + # if the outputs of the currently active ml_models are not part of the new ml_models + # we just got, we keep them + if set(ml_model.output) - new_outputs: + ml_models_to_keep.append(ml_model) + self.config.ml_model_sources = ml_models_to_keep + list(ml_models) + + self.lags_dict, self.max_lag = self._create_lags_dict() + self._update_past_values(time) + self.ml_model_dict, self.casadi_ml_model_dict = self.register_ml_models() + self.sim_step = self._make_unified_predict_function() + self._assert_outputs_are_defined()
+ + def _update_past_values(self, time: float): + """Generates new columns and deletes old ones in the time series data, when the + MLModels are updated.""" + new_columns = set(self.lags_dict) + old_columns = set(self.past_values.columns) + + columns_to_remove = old_columns - new_columns + columns_to_add = new_columns - old_columns + + self.past_values.drop(columns_to_remove, inplace=True) + index = [time - self.dt * lag for lag in range(self.max_lag)] + index.reverse() + for col in columns_to_add: + value = self.get(col).value + for time in index: + self.past_values.loc[(time, col)] = value + + def _create_past_values(self) -> pd.DataFrame: + """Creates a collection which saves a history of the model's variables that + are required in the lags. Must be executed after _create_lags_dict""" + last_values = pd.DataFrame(columns=self.lags_dict) + index = [-self.config.dt * lag for lag in range(self.max_lag)] + index.reverse() + values = [self.get(var_name).value for var_name in self.lags_dict] + for time in index: + last_values.loc[time] = values + return last_values + + def _create_lags_dict(self) -> tuple[dict[str, int], int]: + """Creates a dictionary which holds the maximum lag of each variable""" + lags_dict = {} + for ml_model in self.config.ml_model_sources: + in_out = ml_model.input | ml_model.output + for input_name, feature in in_out.items(): + current_lag = lags_dict.setdefault(input_name, 1) + if feature.lag > current_lag: + lags_dict[input_name] = feature.lag + max_lag = max(lags_dict.values()) + return lags_dict, max_lag + + def _create_lags_mx_variables(self) -> dict[str, ca.MX]: + """Creates symbolic CasADi MX variables for all the required lags.""" + lags_mx_dict = {} + for var_name, max_lag_of_var in self.lags_dict.items(): + for lag in range(1, max_lag_of_var): + l_name = name_with_lag(var_name, lag) + lags_mx_dict[l_name] = ca.MX.sym(l_name) + return lags_mx_dict + +
[docs] def set_with_timestamp(self, name: str, value: Any, timestamp: float): + if name in self.past_values.columns: + self.past_values.loc[(timestamp, name)] = value + self.set(name, value)
+ + def _fixed_during_integration( + self, bb_results: Optional[dict[str, ca.MX]] = None + ) -> dict[str, ca.MX]: + """Returns all variable names with their corresponding CasADi MX variable that + are fixed during integration. + Uses a heuristic to approximate blackbox defined states during integration. + Currently, the heuristic is to use the arithmetic middle between the start and + the end of the integration. + If the bb_results are not available, the value at the beginning is used + + Args: + bb_results: The results of the evaluation of the blackbox functions + """ + all_inputs = self._all_inputs() + exclude = [v.name for v in self.differentials + self.outputs] + # take the mean of start/finish values of variables that have already been + # integrated by a discrete blackbox function + if bb_results: + for bb_name, bb_res_mx in bb_results.items(): + all_inputs[bb_name] = (all_inputs[bb_name] + bb_res_mx) / 2 + return {name: sym for name, sym in all_inputs.items() if name not in exclude} + + def _make_integrator(self, ignore_algebraics: bool = False) -> ca.Function: + """Creates an integrator for the white-box equations in the model. The + integrator takes the stacked white box differential states (in order of + self.differentials), and the stacked (parameters, inputs, mL_model_states) in that + order as the second argument. + + Args: + ignore_algebraics: if True, algebraic equations will not be added + (default False) + + """ + if CASADI_VERSION < 3.6: + args = ({"t0": 0, "tf": self.dt},) + else: + args = (0, self.dt, {}) + # the ml_model outputs cannot be changed during integration, so they are a + # parameter here + integration_params = self._fixed_during_integration() + par = ca.vertcat(*integration_params.values()) + + # if we have no differentials and no algebraics, this function should do nothing + if (not self.differentials) and (ignore_algebraics or not self.outputs): + return ca.Function("empty", [[], par], [[], []], ["x0", "p"], ["xf", "zf"]) + + x = ca.vertcat(*[sta.sym for sta in self.differentials]) + # if we have a pure ode, we can use an ode solver which is more efficient + if self.differentials and (ignore_algebraics or not self.outputs): + ode = { + "x": x, + "p": par, + "ode": self.system, + } + return ca.integrator("system", "cvodes", ode, *args) + + # if we have a dae or only algebraic equations, we use a dae solver + dae = { + "x": x, + "p": par, + "ode": self.system, + "z": ca.vertcat(*[var.sym for var in self.outputs]), + "alg": ca.vertcat(*self.output_equations), + } + # if there are no differential values, we create a dummy to make integrator + # callable + if not self.differentials: + dae.update({"x": ca.MX.sym("dummy", 1), "ode": 0}) + + try: + return ca.integrator("system", "idas", dae, *args) + except RuntimeError as e: + free_vars = e.args[0].split("since", 1)[1] + raise ConfigurationError( + "Could not create model, since some equations are not defined. Please" + " check that all states are either defined by an equation, or by a " + f"black box model. Currently undefined are: {free_vars}" + ) from e + +
[docs] def initialize(self, **ignored): + """ + Prepare the black- and white-box models for CasADi backend optimization and + simulation + """ + # load blackbox models + pass
+ +
[docs] def register_ml_models( + self, + ) -> tuple[dict[str, SerializedMLModel], dict[str, CasadiPredictor]]: + """ + Loads a serialized MLModel and find the output states of the MLModel + Divides the differential states of the model into states determined by white-box + model (self._differentials) and by black-box model (self._differentials_network) + """ + + # map all outputs to their respective MLModel + output_to_ml_model = {} + ml_model_sources_dict = { + tuple(ml_model.output.keys()): ml_model + for ml_model in self.config.ml_model_sources + } + ml_model_dict: Dict[str, SerializedMLModel] = {} + + for output in self.config.outputs + self.config.states: + for serialized_output_names, ml_model in ml_model_sources_dict.items(): + if output.name in serialized_output_names: + output_to_ml_model[ + output.name + ] = CasadiPredictor.from_serialized_model(ml_model) + ml_model_dict[output.name] = ml_model + casadi_ml_model_dict: Dict[str, CasadiPredictor] = output_to_ml_model + return ml_model_dict, casadi_ml_model_dict
+ + def _fill_algebraic_equations_with_bb_output(self): + """Fills empty algebraic equations with the function defined by the + corresponding black box model.""" + for variable_name, serialized_ml_model in self.ml_model_dict.items(): + # recursive features are more like an ode, they don't represent outputs + if serialized_ml_model.output[variable_name].recursive: + continue + if self.get(variable_name).alg is not None: + raise RuntimeError("") + inputs = ml_model_datatypes.column_order( + inputs=serialized_ml_model.input, outputs=serialized_ml_model.output + ) + input_mx = ca.vertcat(*(self._get_lagged_symbolic(name) for name in inputs)) + index = list(serialized_ml_model.output).index(variable_name) + alg = self.casadi_ml_model_dict[variable_name].predict(input_mx)[index] + self.get(variable_name).alg = alg + + def _evaluate_bb_models_symbolically( + self, bb_inputs_mx: dict[str, ca.MX] + ) -> dict[str, ca.MX]: + """ + Returns the CasADi MX-Expressions that result from evaluating all black-box + models symbolically. + Args: + bb_inputs_mx: Dictionary containing the variable names and symbolic MX + Expressions of all variables, that are used as an input for the black-box + models. The MX have the dimension of the corresponding maximum lag of said + variable (Maximum in regard, where multiple black-box models use the same + input but with different lag). + + Returns: + Two dictionaries: + - The first one contains all black-box outputs of the model with their + respective symbolic variable. + - The second one contains the same outputs, with an MX-Expression that + defines the evaluation of the black-box model + """ + + bb_result_mx: dict[str, ca.MX] = {} + # inputs from all MLModels of the black-box model are considered + for output_name, serialized_ml_model in self.ml_model_dict.items(): + if not serialized_ml_model.output[output_name].recursive: + # non-recursive outputs are handled as algebraic equations in the + # integrator for simulation, or as constraints in MPC, so we skip them + continue + + # for every input variable of the MLModel, create a CasAdi symbolic + casadi_ml_model = self.casadi_ml_model_dict[output_name] + columns_ordered = ml_model_datatypes.column_order( + inputs=serialized_ml_model.input, outputs=serialized_ml_model.output + ) + # todo tanja: here, we need to lookup what the user specified for the ANN as input, instead of the original mx variable + ca_nn_input = ca.vertcat(*[bb_inputs_mx[name] for name in columns_ordered]) + + # predict the result with current MLModel and add the result to the stage function + output_index = list(serialized_ml_model.output).index(output_name) + result = casadi_ml_model.predict(ca_nn_input)[output_index] + if ( + serialized_ml_model.output[output_name].output_type + == OutputType.difference + ): + result = result + bb_inputs_mx[output_name][0] + + bb_result_mx[output_name] = result + return bb_result_mx + +
[docs] def make_predict_function_for_mpc(self) -> ca.Function: + """Creates a prediction step function which is suitable for MPC with multiple + shooting.""" + return self._make_unified_predict_function(ignore_algebraics=True)
+ + def _get_lagged_symbolic(self, name: str): + """Returns the symbolic ca.MX of a variable, regardless if it is lagged or not.""" + try: + return self.get(name).sym + except ValueError: + return self.lags_mx_store[name] + + def _black_box_inputs(self) -> dict[str, ca.MX]: + """Creates a dictionary with names for all inputs of the black box functions + and their corresponding symbolic CasADi-variable.""" + bb_inputs: dict[str, ca.MX] = {} + for name, lag in self.lags_dict.items(): + for i in range(0, lag): + l_name = name_with_lag(name, i) + bb_inputs[l_name] = self._get_lagged_symbolic(l_name) + return bb_inputs + + def _all_inputs(self) -> dict[str, ca.MX]: + """Creates a dictionary with names for all inputs of the full step function and + their corresponding symbolic CasADi-variable.""" + all_variables = {var.name: var.sym for var in self.variables} + all_variables.update(self._black_box_inputs()) + return all_variables + + def _make_unified_predict_function( + self, ignore_algebraics: bool = False + ) -> ca.Function: + """ + This function creates a predict function which combines all available MLModels, + their inputs and gives a unified output. + The constructed stage-function takes the MLModel-variables with their maximum lag as + input and gives the result of the MLModel as output + + Args: + ignore_algebraics: When True, algebraic equations will be ignored and no + idas solver is created. Useful for MPC, where equations can be added as + constraints and the performance of idas is undesirable + """ + # initiate in- and output dicts for constructing the stage function + + # create symbolic casadi variables for all inputs used in the MLModel. Each variable + # has the length of its maximum lag, i.e. if two MLModels use the variable var1, + # one with lag 3 and one with 2, we create a symbolic variable with length 3 + + bb_inputs = self._black_box_inputs() + all_variables = self._all_inputs() + # evaluate the black box models + bb_result_mx = self._evaluate_bb_models_symbolically(bb_inputs) + wb_inputs = self._fixed_during_integration(bb_result_mx) + + # prepare functions that order the integrator inputs and outputs when supplied + # with keywords names + differentials_dict = {var.name: var.sym for var in self.differentials} + if not ignore_algebraics: + alg_dict = {var.name: var.sym for var in self.outputs} + else: + alg_dict = {} + stacked_alg = ca.vertcat(*[mx for mx in alg_dict.values()]) + diff_states = ca.vertcat(*[mx for mx in differentials_dict.values()]) + names_to_stacked_x = ca.Function( + "names_to_stacked_x", + list(differentials_dict.values()), + [diff_states], + list(differentials_dict), + ["x0"], + ) + stacked_x_to_names = ca.Function( + "stacked_x_to_names", + [diff_states], + list(differentials_dict.values()), + ["x0"], + list(differentials_dict), + ) + stacked_z_to_names = ca.Function( + "stacked_z_to_names", + [stacked_alg], + list(alg_dict.values()), + ["algs"], + list(alg_dict), + ) + + # perform symbolic evaluation of the white box equations + if differentials_dict: + int_x0_in = names_to_stacked_x(*differentials_dict.values()) + else: + # have to handle case where differentials are empty separately because + # CasADi will return a dict instead of an MX if the input is empty. + int_x0_in = ca.DM([]) + + int_p_in = ca.vertcat(*wb_inputs.values()) + integrator = self._make_integrator(ignore_algebraics=ignore_algebraics) + int_result = integrator(x0=int_x0_in, p=int_p_in) + x_names = stacked_x_to_names(x0=int_result["xf"]) + z_names = stacked_z_to_names(algs=int_result["zf"]) + + opts = {"allow_duplicate_io_names": True} if CASADI_VERSION >= 3.6 else {} + return ca.Function( + "full_step", + list(all_variables.values()), + list(x_names.values()) + + list(z_names.values()) + + list(bb_result_mx.values()), + list(all_variables), + list(x_names) + list(z_names) + list(bb_result_mx), + opts, + ) + +
[docs] def do_step(self, *, t_start, t_sample=None): + """ + Simulates a time step of the simulation model. In CasADi MLModel model, both black- + and white-box models can be used in the simulation to be combined into a grey-box + """ + + if t_sample: + ... + assert t_sample == self.dt + + ml_model_input = self.get_ml_model_values(t_start) + full_input = { + var.name: var.value for var in self.variables if var.value is not None + } + full_input.update(ml_model_input) + + result = self.sim_step(**full_input) + end_time = t_start + self.dt + for var_name, value in result.items(): + self.set_with_timestamp(var_name, value, end_time)
+ +
[docs] def get_ml_model_values(self, time: float): + """ + gets the inputs values with the correct lags or all MLModels + """ + ml_model_inputs: dict[str, list[float]] = {} + for inp, lag in self.lags_dict.items(): + if lag == 1: + continue + target_grid = [-self.dt * t for t in range(1, lag)] + target_grid.reverse() + history = self.past_values[inp].dropna() + res = sample(history, target_grid, current=time) + for i, val in enumerate(res): + ml_model_inputs[name_with_lag(inp, i + 1)] = val + + return ml_model_inputs
+ + @property + def bb_states(self) -> List[CasadiState]: + """List of all CasadiStates with an associated black box equation.""" + return [var for var in self.states if var.name in self.ml_model_dict] + + @property + def bb_outputs(self) -> List[CasadiOutput]: + """List of all CasadiStates with an associated black box equation.""" + return [var for var in self.outputs if var.name in self.ml_model_dict] + + @property + def auxiliaries(self) -> List[CasadiState]: + """List of all CasadiStates without an associated equation. Common + uses for this are slack variables that appear in cost functions and + constraints of optimization models.""" + return [var for var in self.states if self._is_auxiliary(var)] + + def _is_auxiliary(self, var: CasadiState): + """Checks whether a state does not have any function associated with it and + belongs to auxiliary variables""" + if var.ode is not None: + return False + if var.name in self.ml_model_dict: + return False + return True + + def _assert_outputs_are_defined(self): + """Raises an Error, if the output variables are not defined with an equation""" + all_bb_outputs = [ + list(ml_model.output) for ml_model in self.config.ml_model_sources + ] + all_bb_outputs_flat = set(itertools.chain.from_iterable(all_bb_outputs)) + + for out in self.outputs: + if out.alg is None and out.name not in all_bb_outputs_flat: + raise ValueError( + f"Output '{out.name}' was not initialized with an " + f"equation, nor is it specified by the provied blackbox models. " + f"Please sure you specify '{out.name}.alg' in 'setup_system()' or " + f"include a model in 'ml_model_sources'." + ) + if out.alg is not None and out.name in all_bb_outputs: + raise ValueError( + f"Output '{out.name}' is overspecified, as it has an algebraic " + f"equation defined in setup_system(), but also in a provided " + f"blackbox model. " + )
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_model.html b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_model.html new file mode 100644 index 0000000..ee3baea --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_model.html @@ -0,0 +1,587 @@ + + + + + + + + agentlib_mpc.models.casadi_model — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.models.casadi_model

+"""Holds the classes for CasADi variables and the CasADi model."""
+
+import json
+import logging
+import abc
+from itertools import chain
+
+from typing import List, Union, Tuple, Optional
+
+import attrs
+import pandas as pd
+from pydantic import Field, PrivateAttr, ConfigDict
+import casadi as ca
+import numpy as np
+
+from agentlib.core import Model, ModelConfig
+from agentlib.core.datamodels import (
+    ModelVariable,
+    Variability,
+    Causality,
+)
+from agentlib_mpc.data_structures.casadi_utils import ModelConstraint
+
+CasadiTypes = Union[ca.MX, ca.SX, ca.DM, ca.Sparsity]
+
+logger = logging.getLogger(__name__)
+ca_func_inputs = Union[ca.MX, ca.SX, ca.Sparsity, ca.DM]
+ca_all_inputs = Union[ca_func_inputs, np.float64, float]
+ca_constraint = Tuple[ca_all_inputs, ca_func_inputs, ca_all_inputs]
+ca_constraints = List[Tuple[ca_all_inputs, ca_func_inputs, ca_all_inputs]]
+
+
+
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class CasadiVariable(ModelVariable): + """Base Class for variables used in Casadi Models for simulation and + optimization. Implements the standard arithmetic operations, + so CasadiVariables can be used in equations. + Attributes: + sym: The symbolic CasADi variable used to define ode's and + optimization problems. + """ + + _sym: CasadiTypes = attrs.field(default=None, alias="_sym") + + def __attrs_post_init__(self): + self._sym = self.create_sym() + +
[docs] def create_sym(self) -> ca.MX: + """Ensures a symbolic MX variable is created with each CasadiVariable + instance, and that its dimensions are consistent.""" + if self.value is not None: + if isinstance(self.value, (float, int)): + shape = (1, 1) + else: + shape = np.array(self.value).shape + if len(shape) == 1: + shape = (shape[0], 1) + else: + shape = (1, 1) + sym = ca.MX.sym(self.name, shape[0], shape[1]) + return sym
+ + @property + def sym(self) -> ca.MX: + return self._sym + + def __add__(self, other): + return self._sym + other + + def __radd__(self, other): + return other + self._sym + + def __sub__(self, other): + return self._sym - other + + def __rsub__(self, other): + return other - self._sym + + def __mul__(self, other): + return self._sym * other + + def __rmul__(self, other): + return other * self._sym + + def __truediv__(self, other): + return self._sym / other + + def __rtruediv__(self, other): + return other / self._sym + + def __pow__(self, power, modulo=None): + return self._sym**power + + def __rpow__(self, other): + return other**self._sym + + def __abs__(self): + return ca.fabs(self._sym) + + def __matmul__(self, other): + return self._sym @ other.sym + + def __neg__(self): + return -self._sym + + def __eq__(self, other): + try: + return self.sym == other.sym + except AttributeError: + return False + + def __le__(self, other): + try: + return self.sym <= other.sym + except AttributeError as e: + raise TypeError( + "Cannot compare a CasadiVariable to a Non-CasadiVariable" + ) from e + + def __lt__(self, other): + try: + return self.sym < other.sym + except AttributeError as e: + raise TypeError( + "Cannot compare a CasadiVariable to a Non-CasadiVariable" + ) from e + + def __ne__(self, other): + try: + return self.sym != other.sym + except AttributeError: + return True + + def __ge__(self, other): + try: + return self.sym >= other.sym + except AttributeError as e: + raise TypeError( + "Cannot compare a CasadiVariable to a Non-CasadiVariable" + ) from e + + def __gt__(self, other): + try: + return self.sym > other.sym + except AttributeError as e: + raise TypeError( + "Cannot compare a CasadiVariable to a Non-CasadiVariable" + ) from e
+ + +
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class CasadiParameter(CasadiVariable): + """ + Class that stores various attributes of parameters. + """ + + def __attrs_post_init__(self): + super().__attrs_post_init__() + self.causality: Causality = Causality.parameter + self.variability: Variability = Variability.tunable
+ + +
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class CasadiState(CasadiVariable): + """ + Class that stores various attributes of CasADi differential variables. + """ + + _ode: Optional[CasadiTypes] = attrs.field(default=None, alias="_ode") + + def __attrs_post_init__(self): + super().__attrs_post_init__() + self.causality: Causality = Causality.local + self.variability: Variability = Variability.continuous + + @property + def alg(self) -> CasadiTypes: + raise AttributeError( + "Casadi States should not have .alg assignments. If you wish to provide " + "algebraic relationships to states, add them in the constraints." + ) + return -1 + + @alg.setter + def alg(self, equation: Union[CasadiTypes, CasadiVariable]): + raise AttributeError( + "Casadi States should not have .alg assignments. Consider the following: \n" + " 1. If you need equality constraints in your MPC, please add them in the " + "constraints. \n" + " 2. If you use this to bundle an expression, consider using a regular " + "Python variable. \n" + " 3. Implicit algebraic equations are currently not supported." + ) + + @property + def ode(self) -> CasadiTypes: + return self._ode + + @ode.setter + def ode(self, equation: Union[CasadiTypes, CasadiVariable]): + self._ode = get_symbolic(equation) + +
[docs] def json(self, indent: int = 2, **kwargs): + data = self.dict(**kwargs) + if isinstance(self.value, pd.Series): + data["value"] = self.value.to_dict() + data.pop("_ode") + data.pop("_alg") + json.dumps(data, indent=indent)
+ + +
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class CasadiInput(CasadiVariable): + """ + Class that stores various attributes of control variables. + """ + + def __attrs_post_init__(self): + super().__attrs_post_init__() + self.causality: Causality = Causality.input + self.variability: Variability = Variability.continuous + + @property + def alg(self) -> CasadiTypes: + raise AttributeError( + "Casadi Inputs should not have .alg assignments. If you wish to provide " + "algebraic relationships to states, add them in the constraints." + ) + return -1 + + @alg.setter + def alg(self, equation: Union[CasadiTypes, CasadiVariable]): + raise ValueError( + "Cannot assign algebraic equations to inputs. If this is for an MPC, " + "try defining a constraint instead." + )
+ + +
[docs]@attrs.define(slots=True, weakref_slot=False, kw_only=True) +class CasadiOutput(CasadiVariable): + """ + Class that stores various attributes of control variables. + """ + + _alg: CasadiTypes = attrs.field(default=None, alias="_alg") + + def __attrs_post_init__(self): + super().__attrs_post_init__() + self.causality: Causality = Causality.output + self.variability: Variability = Variability.continuous + + @property + def alg(self) -> CasadiTypes: + return self._alg + + @alg.setter + def alg(self, equation: Union[CasadiTypes, CasadiVariable]): + if isinstance(equation, CasadiVariable): + # Converts CasadiVariables to their symbolic variable. Useful in case + # CasadiVariables are assigned in equations as is, i.e. their math methods + # are not called. + self._alg = equation.sym + else: + self._alg = equation + +
[docs] def json(self, **kwargs): + data = self.dict(**kwargs) + if isinstance(self.value, pd.Series): + data["value"] = self.value.to_dict() + data.pop("_alg") + json.dumps(data)
+ + +
[docs]class CasadiModelConfig(ModelConfig): + system: CasadiTypes = None + cost_function: CasadiTypes = None + + inputs: List[CasadiInput] = Field(default=list()) + outputs: List[CasadiOutput] = Field(default=list()) + states: List[CasadiState] = Field(default=list()) + parameters: List[CasadiParameter] = Field(default=list()) + model_config = ConfigDict(validate_assignment=True, extra="forbid") + _types: dict[str, type] = PrivateAttr( + default={ + "inputs": CasadiInput, + "outputs": CasadiOutput, + "states": CasadiState, + "parameters": CasadiParameter, + } + )
+ + +
[docs]class CasadiModel(Model): + """Base Class for CasADi models. To implement your own model, inherit + from this class, specify the variables (inputs, outputs, states, + parameters and override the setup_system() method.""" + + config: CasadiModelConfig + + def __init__(self, **kwargs): + # Initializes the config + super().__init__(**kwargs) + + self.constraints = [] # constraint functions + # read constraints, assign ode's and return cost function + self.cost_func = self.setup_system() + self._assert_outputs_are_defined() + + # save system equations as a single casadi vector + system = ca.vertcat(*[sta.ode for sta in self.differentials]) + # prevents errors in case system is empty + self.system = ca.reshape(system, system.shape[0], 1) + self.integrator = None # set in intitialize + self.initialize() + + def _assert_outputs_are_defined(self): + """Raises an Error, if the output variables are not defined with an equation""" + for out in self.outputs: + if out.alg is None: + raise ValueError( + f"Output '{out.name}' was not initialized with an equation. Make " + f"sure you specify '{out.name}.alg' in 'setup_system()'." + ) + +
[docs] def do_step(self, *, t_start, t_sample=None): + if t_sample is None: + t_sample = self.dt + pars = self.get_input_values() + t_sim = 0 + if self.differentials: + x0 = self.get_differential_values() + curr_x = x0 + while t_sim < t_sample: + result = self.integrator(x0=curr_x, p=pars) + t_sim += self.dt + curr_x = result["xf"] + self.set_differential_values(np.array(result["xf"]).flatten()) + else: + result = self.integrator(p=pars) + if self.outputs: + self.set_output_values(np.array(result["zf"]).flatten())
+ + def _make_integrator(self) -> ca.Function: + """Creates the integrator to be used in do_step(). The integrator takes the + current state and input values as input and returns the state values and + algebraic values at the end of the interval.""" + opts = {"t0": 0, "tf": self.dt} + par = ca.vertcat( + *[inp.sym for inp in chain.from_iterable([self.inputs, self.parameters])] + ) + x = ca.vertcat(*[sta.sym for sta in self.differentials]) + z = ca.vertcat(*[var.sym for var in self.outputs]) + algebraic_equations = ca.vertcat(*self.output_equations) + + if not algebraic_equations.shape[0] and self.differentials: + # case of pure ode + ode = {"x": x, "p": par, "ode": self.system} + integrator = ca.integrator("system", "cvodes", ode, opts) + elif algebraic_equations.shape[0] and self.differentials: + # mixed dae + dae = { + "x": x, + "p": par, + "ode": self.system, + "z": z, + "alg": algebraic_equations, + } + integrator = ca.integrator("system", "idas", dae, opts) + + else: + # only algebraic equations + dae = { + "x": ca.MX.sym("dummy", 1), + "p": par, + "ode": 0, + "z": z, + "alg": algebraic_equations, + } + integrator_ = ca.integrator("system", "idas", dae, opts) + integrator = ca.Function( + "system", [par], [integrator_(x0=0, p=par)["zf"]], ["p"], ["zf"] + ) + return integrator + +
[docs] def initialize(self, **ignored): + """ + Initializes Casadi model. Creates the integrator to be used in + do_step(). The integrator takes the current state and input values as + input and returns the state values at the end of the interval and the + value of the cost function integrated over the interval. + """ + self.integrator = self._make_integrator()
+ +
[docs] def get_constraints(self) -> List[ModelConstraint]: + """List of constraints of the form (lower, function, upper).""" + base_constraints = [ + ModelConstraint(lb * 1, func * 1, ub * 1) + for lb, func, ub in self.constraints + ] + equality_constraints = [ + ModelConstraint(0, alg, 0) for alg in self.output_equations + ] + return base_constraints + equality_constraints
+ + @property + def inputs(self) -> list[CasadiInput]: + """Get all model inputs as a list""" + return list(self._inputs.values()) + + @property + def outputs(self) -> list[CasadiOutput]: + """Get all model outputs as a list""" + return list(self._outputs.values()) + + @property + def states(self) -> list[CasadiState]: + """Get all model states as a list""" + return list(self._states.values()) + + @property + def parameters(self) -> list[CasadiParameter]: + """Get all model parameters as a list""" + return list(self._parameters.values()) + + @property + def output_equations(self) -> List[CasadiTypes]: + """List of algebraic equations RHS in the form + 0 = z - g(x, z, p, ... )""" + return [alg_var - alg_var.alg for alg_var in self.outputs] + + @property + def differentials(self) -> List[CasadiState]: + """List of all CasadiStates with an associated differential equation.""" + return [var for var in self.states if var.ode is not None] + + @property + def auxiliaries(self) -> List[CasadiState]: + """List of all CasadiStates without an associated equation. Common + uses for this are slack variables that appear in cost functions and + constraints of optimization models.""" + return [var for var in self.states if var.ode is None] + +
[docs] @abc.abstractmethod + def setup_system(self): + raise NotImplementedError( + "The ode is defined by the actual models " "inheriting from this class." + )
+ +
[docs] def get_input_values(self): + return ca.vertcat( + *[inp.value for inp in chain.from_iterable([self.inputs, self.parameters])] + )
+ +
[docs] def get_differential_values(self): + return ca.vertcat(*[sta.value for sta in self.differentials])
+ +
[docs] def set_differential_values(self, values: Union[List, np.ndarray]): + """Sets the values for all differential variables. Provided values list MUST + match the order in which differentials are saved, there is no check.""" + for state, value in zip(self.differentials, values): + self._states[state.name].value = value
+ +
[docs] def set_output_values(self, values: Union[List, np.ndarray]): + """Sets the values for all outputs. Provided values list MUST match the order + in which outputs are saved, there is no check.""" + for var, value in zip(self.outputs, values): + self._outputs[var.name].value = value
+ +
[docs] def get(self, name: str) -> CasadiVariable: + return super().get(name)
+ + def __setattr__(self, key, value): + super().__setattr__(key, value)
+ # todo + + +
[docs]def get_symbolic(equation): + if isinstance(equation, CasadiVariable): + # Converts CasadiVariables to their symbolic variable. Useful in case + # CasadiVariables are assigned in equations as is, i.e. their math methods + # are not called. + return equation.sym + else: + return equation
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_predictor.html b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_predictor.html new file mode 100644 index 0000000..4f37c38 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/models/casadi_predictor.html @@ -0,0 +1,593 @@ + + + + + + + + agentlib_mpc.models.casadi_predictor — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.models.casadi_predictor

+import abc
+
+import casadi as ca
+import numpy as np
+
+from enum import Enum
+from keras import layers
+
+from typing import Union, TYPE_CHECKING
+
+from agentlib_mpc.models.serialized_ml_model import (
+    SerializedMLModel,
+    SerializedLinReg,
+    SerializedGPR,
+    SerializedANN,
+    MLModels,
+)
+
+if TYPE_CHECKING:
+    from keras import Sequential
+    from agentlib_mpc.models.serialized_ml_model import CustomGPR
+    from sklearn.linear_model import LinearRegression
+
+
+
[docs]class CasadiPredictor(abc.ABC): + """ + Protocol for generic Casadi implementation of various ML-Model-based predictors. + + Attributes: + serialized_model: Serialized model which will be translated to a casadi model. + predictor_model: Predictor model from other libraries, which are translated to + casadi syntax. + sym_input: Symbolical input of predictor. Has the necessary shape of the input. + prediction_function: Symbolical casadi prediction function of the given model. + """ + +
[docs] class Config: + arbitrary_types_allowed = True
+ + def __init__(self, serialized_model: SerializedMLModel) -> None: + """Initialize Predictor class.""" + self.serialized_model: SerializedMLModel = serialized_model + self.predictor_model: Union[Sequential, CustomGPR, LinearRegression] = ( + serialized_model.deserialize() + ) + self.sym_input: ca.MX = self._get_sym_input() + self.prediction_function: ca.Function = self._build_prediction_function() + +
[docs] @classmethod + def from_serialized_model(cls, serialized_model: SerializedMLModel): + """Initialize sub predictor class.""" + model_type = serialized_model.model_type + # todo return type[cls] + return casadi_predictors[model_type](serialized_model)
+ + @property + @abc.abstractmethod + def input_shape(self) -> tuple[int, int]: + """Input shape of Predictor.""" + pass + + @property + def output_shape(self) -> tuple[int, int]: + """Output shape of Predictor.""" + return 1, len(self.serialized_model.output) + + def _get_sym_input(self): + """Returns symbolical input object in the required shape.""" + return ca.MX.sym("input", 1, self.input_shape[1]) + + @abc.abstractmethod + def _build_prediction_function(self) -> ca.Function: + """Build the prediction function with casadi and a symbolic input.""" + pass + +
[docs] def predict(self, x: Union[np.ndarray, ca.MX]) -> Union[ca.DM, ca.MX]: + """ + Evaluate prediction function with input data. + Args: + x: input data. + Returns: + results of evaluation of prediction function with input data. + """ + return self.prediction_function(x)
+ + +
[docs]class CasadiLinReg(CasadiPredictor): + """ + Generic Casadi implementation of scikit-learn LinerRegression. + """ + + def __init__(self, serialized_model: SerializedLinReg) -> None: + """ + Initializes CasadiLinReg predictor. + Args: + serialized_model: SerializedLinReg object. + """ + super().__init__(serialized_model) + + @property + def input_shape(self) -> tuple[int, int]: + """Input shape of Predictor.""" + return 1, self.predictor_model.coef_.shape[1] + + def _build_prediction_function(self) -> ca.Function: + """Build the prediction function with casadi and a symbolic input.""" + intercept = self.predictor_model.intercept_ + coef = self.predictor_model.coef_ + function = intercept + ca.mtimes(self.sym_input, coef.T) + return ca.Function("forward", [self.sym_input], [function])
+ + +
[docs]class CasadiGPR(CasadiPredictor): + """ + Generic implementation of scikit-learn Gaussian Process Regressor. + """ + + def __init__(self, serialized_model: SerializedGPR) -> None: + super().__init__(serialized_model) + + @property + def input_shape(self) -> tuple[int, int]: + """Input shape of Predictor.""" + return 1, self.predictor_model.X_train_.shape[1] + + def _build_prediction_function(self) -> ca.Function: + """Build the prediction function with casadi and a symbolic input.""" + normalize = self.predictor_model.data_handling.normalize + scale = self.predictor_model.data_handling.scale + alpha = self.predictor_model.alpha_ + if normalize: + normalized_inp = self._normalize(self.sym_input) + k_star = self._kernel(normalized_inp) + else: + k_star = self._kernel(self.sym_input) + f_mean = ca.mtimes(k_star.T, alpha) * scale + return ca.Function("forward", [self.sym_input], [f_mean]) + + def _kernel( + self, + x_test: ca.MX, + ) -> ca.MX: + """ + Calculates the kernel with regard to mpc and testing data. + If x_train is None the internal mpc data is used. + + shape(x_test) = (n_samples, n_features) + shape(x_train) = (n_samples, n_features) + """ + + square_distance = self._square_distance(x_test) + length_scale = self.predictor_model.kernel_.k1.k2.length_scale + constant_value = self.predictor_model.kernel_.k1.k1.constant_value + return np.exp((-square_distance / (2 * length_scale**2))) * constant_value + + def _square_distance(self, inp: ca.MX): + """ + Calculates the square distance from x_train to x_test. + + shape(x_test) = (n_test_samples, n_features) + shape(x_train) = (n_train_samples, n_features) + """ + + x_train = self.predictor_model.X_train_ + + self._check_shapes(inp, x_train) + + a = ca.sum2(inp**2) + + b = ca.np.sum(x_train**2, axis=1, dtype=float).reshape(-1, 1) + + c = -2 * ca.mtimes(x_train, inp.T) + + return a + b + c + + def _normalize(self, x: ca.MX): + mean = self.predictor_model.data_handling.mean + std = self.predictor_model.data_handling.std + + if mean is None and std is not None: + raise ValueError("Mean and std are not valid.") + + return (x - ca.DM(mean).T) / ca.DM(std).T + + def _check_shapes(self, x_test: Union[ca.MX, np.ndarray], x_train: np.ndarray): + if x_test.shape[1] != x_train.shape[1]: + raise ValueError( + f"The shape of x_test {x_test.shape}[1] and x_train {x_train.shape}[1] must match." + )
+ + +################################### +### ANN ### +################################### + + +
[docs]class ANNLayerTypes(str, Enum): + DENSE = "dense" + FLATTEN = "flatten" + BATCHNORMALIZATION = "batch_normalization" + LSTM = "lstm" + RESCALING = "rescaling"
+ + +
[docs]class Layer: + """ + Single layer of an artificial neural network. + """ + + def __init__(self, layer: layers.Layer): + self.config = layer.get_config() + + # name + if "name" in self.config: + self.name = self.config["name"] + + # units + if "units" in self.config: + self.units = self.config["units"] + + # activation function + if "activation" in self.config: + self.activation = self.get_activation(layer.get_config()["activation"]) + + # input / output shape + self.input_shape = layer.input.shape[1:] + self.output_shape = layer.output.shape[1:] + + # update the dimensions to two dimensions + self.update_dimensions() + + # symbolic input layer + self.input_layer = ca.MX.sym( + "input_layer", self.input_shape[0], self.input_shape[1] + ) + + def __str__(self): + ret = "" + + if hasattr(self, "units"): + ret += f"\tunits:\t\t\t\t{self.units}\n" + if hasattr(self, "activation"): + ret += f"\tactivation:\t\t\t{self.activation.__str__()}\n" + if hasattr(self, "recurrent_activation"): + ret += f"\trec_activation:\t\t{self.recurrent_activation.__str__()}\n" + ret += f"\tinput_shape:\t\t{self.input_shape}\n" + ret += f"\toutput_shape:\t\t{self.output_shape}\n" + + return ret + +
[docs] def update_dimensions(self): + """ + CasADi does only work with two dimensional arrays. So the dimensions must be updated. + """ + + if len(self.input_shape) == 1: + self.input_shape = (1, self.input_shape[0]) + elif len(self.input_shape) == 2: + self.input_shape = (self.input_shape[0], self.input_shape[1]) + else: + raise ValueError("Please check input dimensions.") + + if len(self.output_shape) == 1: + self.output_shape = (1, self.output_shape[0]) + elif len(self.output_shape) == 2: + self.output_shape = (self.output_shape[0], self.output_shape[1]) + else: + raise ValueError("Please check output dimensions.")
+ +
[docs] @staticmethod + def get_activation(function: str): + blank = ca.MX.sym("blank") + + if function == "sigmoid": + return ca.Function(function, [blank], [1 / (1 + ca.exp(-blank))]) + + if function == "tanh": + return ca.Function(function, [blank], [ca.tanh(blank)]) + + elif function == "relu": + return ca.Function(function, [blank], [ca.fmax(0, blank)]) + + elif function == "softplus": + return ca.Function(function, [blank], [ca.log(1 + ca.exp(blank))]) + + elif function == "gaussian": + return ca.Function(function, [blank], [ca.exp(-(blank**2))]) + + elif function == "linear": + return ca.Function(function, [blank], [blank]) + + else: + ValueError(f"Unknown activation function:{function}")
+ + +
[docs]class Dense(Layer): + """ + Fully connected layer. + """ + + def __init__(self, layer: layers.Dense): + super().__init__(layer) + + # weights and biases + self.weights, self.biases = layer.get_weights() + self.biases = self.biases.reshape(1, self.biases.shape[0]) + + # check input dimension + if self.input_shape[1] != self.weights.shape[0]: + raise ValueError( + f"Please check the input dimensions of this layer. Layer with error: {self.name}" + ) + +
[docs] def forward(self, input): + # return forward pass + return self.activation(input @ self.weights + self.biases)
+ + +
[docs]class Flatten(Layer): +
[docs] def forward(self, input): + # flattens the input + f = input[0, :] + for row in range(1, input.shape[0]): + f = ca.horzcat(f, input[row, :]) + + return f
+ + +
[docs]class BatchNormalization(Layer): + """ + Batch Normalizing layer. Make sure the axis setting is set to two. + """ + + def __init__(self, layer: layers.BatchNormalization): + super(BatchNormalization, self).__init__(layer) + + # weights and biases + self.gamma = ca.np.vstack([layer.get_weights()[0]] * self.input_shape[0]) + self.beta = ca.np.vstack([layer.get_weights()[1]] * self.input_shape[0]) + self.mean = ca.np.vstack([layer.get_weights()[2]] * self.input_shape[0]) + self.var = ca.np.vstack([layer.get_weights()[3]] * self.input_shape[0]) + self.epsilon = layer.get_config()["epsilon"] + + # check Dimensions + if self.input_shape != self.gamma.shape: + axis = self.config["axis"][0] + raise ValueError(f"Dimension mismatch. Normalized axis: {axis}") + + # symbolic input layer + self.input_layer = ca.MX.sym( + "input_layer", self.input_shape[0], self.input_shape[1] + ) + +
[docs] def forward(self, input): + # forward pass + f = (input - self.mean) / ( + ca.sqrt(self.var + self.epsilon) + ) * self.gamma + self.beta + + return f
+ + +
[docs]class LSTM(Layer): + """ + Long Short Term Memory cell. + """ + + def __init__(self, layer: layers.LSTM): + super(LSTM, self).__init__(layer) + + # recurrent activation + self.recurrent_activation = self.get_activation( + layer.get_config()["recurrent_activation"] + ) + + # load weights and biases + W = layer.get_weights()[0] + U = layer.get_weights()[1] + b = layer.get_weights()[2] + + # weights (kernel) + self.W_i = W[:, : self.units] + self.W_f = W[:, self.units : self.units * 2] + self.W_c = W[:, self.units * 2 : self.units * 3] + self.W_o = W[:, self.units * 3 :] + + # weights (recurrent kernel) + self.U_i = U[:, : self.units] + self.U_f = U[:, self.units : self.units * 2] + self.U_c = U[:, self.units * 2 : self.units * 3] + self.U_o = U[:, self.units * 3 :] + + # biases + self.b_i = ca.np.expand_dims(b[: self.units], axis=0) + self.b_f = ca.np.expand_dims(b[self.units : self.units * 2], axis=0) + self.b_c = ca.np.expand_dims(b[self.units * 2 : self.units * 3], axis=0) + self.b_o = ca.np.expand_dims(b[self.units * 3 :], axis=0) + + # initial memory and output + self.h_0 = ca.np.zeros((1, self.units)) + self.c_0 = ca.np.zeros((1, self.units)) + +
[docs] def forward(self, input): + # check input shape + if input.shape != self.input_shape: + raise ValueError("Dimension mismatch!") + + # initial + c = self.c_0 + h = self.h_0 + + # number of time steps + steps = self.input_shape[0] + + # forward pass + for i in range(steps): + # input for the current step + x = input[i, :] + + # calculate memory(c) and output(h) + c, h = self.step(x, c, h) + + # here the output has to be transposed, because of the dense layer implementation + return h
+ +
[docs] def step(self, x_t, c_prev, h_prev): + # gates + i_t = self.recurrent_activation(x_t @ self.W_i + h_prev @ self.U_i + self.b_i) + f_t = self.recurrent_activation(x_t @ self.W_f + h_prev @ self.U_f + self.b_f) + o_t = self.recurrent_activation(x_t @ self.W_o + h_prev @ self.U_o + self.b_o) + c_t = self.activation(x_t @ self.W_c + h_prev @ self.U_c + self.b_c) + + # memory and output + c_next = f_t * c_prev + i_t * c_t + h_next = o_t * self.activation(c_next) + + return c_next, h_next
+ + +
[docs]class CasadiANN(CasadiPredictor): + """ + Generic implementations of sequential Keras models in CasADi. + """ + + def __init__(self, serialized_model: SerializedANN): + """ + Supported layers: + - Dense (Fully connected layer) + - Flatten (Reduces the input dimension to 1) + - BatchNormalizing (Normalization) + - LSTM (Recurrent Cell) + - Rescaling + Args: + serialized_model: SerializedANN Model. + """ + super().__init__(serialized_model) + + @property + def input_shape(self) -> tuple[int, int]: + """Input shape of Predictor.""" + return 1, self.predictor_model.input_shape[1] + + def _build_prediction_function(self) -> ca.Function: + """Build the prediction function with casadi and a symbolic input.""" + keras_layers = [layer for layer in self.predictor_model.layers] + casadi_layers = [] + for keras_layer in keras_layers: + name = keras_layer.get_config()["name"] + for layer_type in ANNLayerTypes: + if layer_type.value in name: + casadi_layers.append(ann_layer_types[layer_type.value](keras_layer)) + continue + function = self.sym_input + for casadi_layer in casadi_layers: + function = casadi_layer.forward(function) + return ca.Function("forward", [self.sym_input], [function])
+ + +ann_layer_types = { + ANNLayerTypes.DENSE: Dense, + ANNLayerTypes.FLATTEN: Flatten, + ANNLayerTypes.BATCHNORMALIZATION: BatchNormalization, + ANNLayerTypes.LSTM: LSTM, +} + +casadi_predictors = { + MLModels.ANN: CasadiANN, + MLModels.GPR: CasadiGPR, + MLModels.LINREG: CasadiLinReg, +} +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/models/serialized_ml_model.html b/docs/0.6.4/docs/_modules/agentlib_mpc/models/serialized_ml_model.html new file mode 100644 index 0000000..681fff6 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/models/serialized_ml_model.html @@ -0,0 +1,778 @@ + + + + + + + + agentlib_mpc.models.serialized_ml_model — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.models.serialized_ml_model

+import abc
+import json
+import logging
+import subprocess
+
+import numpy as np
+
+from enum import Enum
+from copy import deepcopy
+from keras import Sequential
+from pathlib import Path
+from pydantic import ConfigDict, Field, BaseModel
+from sklearn.gaussian_process import GaussianProcessRegressor
+from sklearn.gaussian_process.kernels import ConstantKernel, WhiteKernel, RBF
+from sklearn.linear_model import LinearRegression
+from typing import Union, Optional
+
+from agentlib_mpc.data_structures.ml_model_datatypes import OutputFeature, Feature
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]def get_git_revision_short_hash() -> str: + return ( + subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) + .decode("ascii") + .strip() + )
+ + +
[docs]class MLModels(str, Enum): + ANN = "ANN" + GPR = "GPR" + LINREG = "LinReg"
+ + +
[docs]class SerializedMLModel(BaseModel, abc.ABC): + dt: Union[float, int] = Field( + title="dt", + description="The length of time step of one prediction of Model in seconds.", + ) + input: dict[str, Feature] = Field( + default=None, + title="input", + description="Model input variables with their lag order.", + ) + output: dict[str, OutputFeature] = Field( + default=None, + title="output", + description="Model output variables (which are automatically also inputs, as " + "we need them recursively in MPC.) with their lag order.", + ) + agentlib_mpc_hash: str = Field( + default_factory=get_git_revision_short_hash, + description="The commit hash of the agentlib_mpc version this was created with.", + ) + training_info: Optional[dict] = Field( + default=None, + title="Training Info", + description="Config of Trainer class with all the meta data used for training of the Model.", + ) + model_type: MLModels + model_config = ConfigDict(protected_namespaces=()) + +
[docs] @classmethod + @abc.abstractmethod + def serialize( + cls, + model: Union[Sequential, GaussianProcessRegressor, LinearRegression], + dt: Union[float, int], + input: dict[str, Feature], + output: dict[str, OutputFeature], + training_info: Optional[dict] = None, + ): + """ + Args: + model: Machine Learning Model. + dt: The length of time step of one prediction of Model in seconds. + input: Model input variables with their lag order. + output: Model output variables (which are automatically also inputs, as + we need them recursively in MPC.) with their lag order. + training_info: Config of Trainer Class, which trained the Model. + Returns: + SerializedMLModel version of the passed ML Model. + """ + pass
+ +
[docs] @abc.abstractmethod + def deserialize(self): + """ + Deserializes SerializedMLModel object and returns a specific Machine Learning Model object. + Returns: + MLModel: Machine Learning Model. + """ + pass
+ +
[docs] def save_serialized_model(self, path: Path): + """ + Saves MLModel object as json string. + Args: + path: relative/absolute path which determines where the json will be saved. + """ + path.parent.mkdir(parents=True, exist_ok=True) + with open(path, "w") as f: + f.write(self.model_dump_json()) + + # with open(path, "w") as json_file: + # json_file.write(self.model_dump_json()) + # Displays the file path under which the json file has been saved. + logger.info(f"Model has been saved under the following path: {path}")
+ +
[docs] @classmethod + def load_serialized_model_from_file(cls, path: Path): + """ + Loads SerializedMLModel object from a json file and creates a new specific Machine Learning Model object + which is returned. + + Args: + path: relative/absolute path which determines which json file will be loaded. + Returns: + SerializedMLModel object with data from json file. + """ + with open(path, "r") as json_file: + model_data = json.load(json_file) + return cls.load_serialized_model_from_dict(model_data)
+ +
[docs] @classmethod + def load_serialized_model_from_string(cls, json_string: str): + """ + Loads SerializedMLModel object from a json string and creates a new specific Machine Learning Model object + which is returned. + + Args: + json_string: json string which will be loaded. + Returns: + SerializedMLModel object with data from json file. + """ + model_data = json.loads(json_string) + return cls.load_serialized_model_from_dict(model_data)
+ +
[docs] @classmethod + def load_serialized_model_from_dict(cls, model_data: dict): + """ + Loads SerializedMLModel object from a dict and creates a new specific Machine Learning Model object + which is returned. + + Args: + json_string: json string which will be loaded. + Returns: + SerializedMLModel object with data from json file. + """ + model_type = model_data["model_type"] + return serialized_models[model_type](**model_data)
+ +
[docs] @classmethod + def load_serialized_model(cls, model_data: Union[dict, str, Path]): + """Loads the ML model from a source""" + if isinstance(model_data, dict): + return cls.load_serialized_model_from_dict(model_data) + if isinstance(model_data, (str, Path)): + if Path(model_data).exists(): + return cls.load_serialized_model_from_file(model_data) + return cls.load_serialized_model_from_string(model_data)
+ + +
[docs]class SerializedANN(SerializedMLModel): + """ + Contains Keras ANN in serialized form and offers functions to transform + Keras Sequential ANNs to SerializedANN objects (from_ANN) and vice versa (deserialize). + + attributes: + structure: architecture/structure of ANN saved as json string. + weights: weights and biases of all layers saved as lists of np.ndarrays. + """ + + weights: list[list] = Field( + default=None, + title="weights", + description="The weights of the ANN.", + ) + structure: str = Field( + default=None, + title="structure", + description="The structure of the ANN as json string.", + ) + model_config = ConfigDict(arbitrary_types_allowed=True) + model_type: MLModels = MLModels.ANN + +
[docs] @classmethod + def serialize( + cls, + model: Sequential, + dt: Union[float, int], + input: dict[str, Feature], + output: dict[str, OutputFeature], + training_info: Optional[dict] = None, + ): + """Serializes Keras Sequential ANN and returns SerializedANN object""" + structure = model.to_json() + weights = [] + for layer in model.layers: + weight_l = layer.get_weights() + for idx in range(len(weight_l)): + weight_l[idx] = weight_l[idx].tolist() + weights.append(weight_l) + + return cls( + structure=structure, + weights=weights, + dt=dt, + input=input, + output=output, + trainer_config=training_info, + )
+ +
[docs] def deserialize(self) -> Sequential: + """Deserializes SerializedANN object and returns a Keras Sequential ANN.""" + from keras import models + + ann = models.model_from_json(self.structure) + layer_weights = [] + for layer in self.weights: + l_weight = [] + layer_weights.append(l_weight) + for matrix in layer: + l_weight.append(np.asarray(matrix)) + + for i, layer in enumerate(ann.layers): + layer.set_weights(layer_weights[i]) + return ann
+ +
[docs] def to_dict(self) -> dict: + """Transforms self to a dictionary and the numpy arrays to lists, so they can + be serialized.""" + ann_dict = deepcopy(self.__dict__) + for layer in ann_dict["weights"]: + for idx in range(0, len(layer)): + layer[idx] = layer[idx].tolist() + return ann_dict
+ + +
[docs]class GPRDataHandlingParameters(BaseModel): + normalize: bool = Field( + default=False, + title="normalize", + description="Boolean which defines whether the input data will be normalized or not.", + ) + scale: float = Field( + default=1.0, + title="scale", + description="Number by which the y vector is divided before training and multiplied after evaluation.", + ) + mean: Optional[list] = Field( + default=None, + title="mean", + description="Mean values of input data for normalization. None if normalize equals to False.", + ) + std: Optional[list] = Field( + default=None, + title="standard deviation", + description="Standard deviation of input data for normalization. None if normalize equals to False.", + )
+ + +
[docs]class CustomGPR(GaussianProcessRegressor): + """ + Extends scikit-learn GaussianProcessRegressor with normalizing and scaling option + by adding the attribute data_handling, customizing the predict function accordingly + and adding a normalize function. + """ + + def __init__( + self, + kernel=None, + *, + alpha=1e-10, + optimizer="fmin_l_bfgs_b", + n_restarts_optimizer=0, + normalize_y=False, + copy_X_train=True, + random_state=None, + data_handling=GPRDataHandlingParameters(), + ): + super().__init__( + kernel=kernel, + alpha=alpha, + optimizer=optimizer, + n_restarts_optimizer=n_restarts_optimizer, + normalize_y=normalize_y, + copy_X_train=copy_X_train, + random_state=random_state, + ) + self.data_handling: GPRDataHandlingParameters = data_handling + +
[docs] def predict(self, X, return_std=False, return_cov=False): + """ + Overwrite predict method of GaussianProcessRegressor to include normalization. + """ + if self.data_handling.normalize: + X = self._normalize(X) + return super().predict(X, return_std, return_cov)
+ + def _normalize(self, x: np.ndarray): + mean = self.data_handling.mean + std = self.data_handling.std + + if mean is None and std is not None: + raise ValueError("Mean and std are not valid.") + + return (x - mean) / std
+ + +
[docs]class GPRKernelParameters(BaseModel): + constant_value: float = Field( + default=1.0, + title="constant value", + description="The constant value which defines the covariance: k(x_1, x_2) = constant_value.", + ) + constant_value_bounds: Union[tuple, str] = Field( + default=(1e-5, 1e5), + title="constant value bounds", + description="The lower and upper bound on constant_value. If set to “fixed”, " + "constant_value cannot be changed during hyperparameter tuning.", + ) + length_scale: Union[float, list] = Field( + default=1.0, + title="length_scale", + description="The length scale of the kernel. If a float, an isotropic kernel " + "is used. If an array, an anisotropic kernel is used where each " + "dimension of l defines the length-scale of the respective feature " + "dimension.", + ) + length_scale_bounds: Union[tuple, str] = Field( + default=(1e-5, 1e5), + title="length_scale_bounds", + description="The lower and upper bound on ‘length_scale’. If set to “fixed”, " + "‘length_scale’ cannot be changed during hyperparameter tuning.", + ) + noise_level: float = Field( + default=1.0, + title="noise level", + description="Parameter controlling the noise level (variance).", + ) + noise_level_bounds: Union[tuple, str] = Field( + default=(1e-5, 1e5), + title="noise level bounds", + description="The lower and upper bound on ‘noise_level’. If set to “fixed”, " + "‘noise_level’ cannot be changed during hyperparameter tuning.", + ) + theta: list = Field( + title="theta", + description="Returns the (flattened, log-transformed) non-fixed gpr_parameters.", + ) + model_config = ConfigDict(arbitrary_types_allowed=True) + +
[docs] @classmethod + def from_model(cls, model: CustomGPR) -> "GPRKernelParameters": + return cls( + constant_value=model.kernel_.k1.k1.constant_value, + constant_value_bounds=model.kernel_.k1.k1.constant_value_bounds, + length_scale=model.kernel_.k1.k2.length_scale, + length_scale_bounds=model.kernel_.k1.k2.length_scale_bounds, + noise_level=model.kernel_.k2.noise_level, + noise_level_bounds=model.kernel_.k2.noise_level_bounds, + theta=model.kernel_.theta.tolist(), + )
+ + +
[docs]class GPRParameters(BaseModel): + alpha: Union[float, list] = Field( + default=1e-10, + title="alpha", + description="Value added to the diagonal of the kernel matrix during fitting. " + "This can prevent a potential numerical issue during fitting, by " + "ensuring that the calculated values form a positive definite matrix. " + "It can also be interpreted as the variance of additional Gaussian " + "measurement noise on the training observations. Note that this is " + "different from using a WhiteKernel. If an array is passed, it must " + "have the same number of entries as the data used for fitting and is " + "used as datapoint-dependent noise level. Allowing to specify the " + "noise level directly as a parameter is mainly for convenience and " + "for consistency with Ridge.", + ) + L: list = Field( + title="L", + description="Lower-triangular Cholesky decomposition of the kernel in X_train.", + ) + X_train: list = Field( + title="X_train", + description="Feature vectors or other representations of training data (also " + "required for prediction).", + ) + y_train: list = Field( + title="y_train", + description="Target values in training data (also required for prediction).", + ) + n_features_in: int = Field( + title="number of input features", + description="Number of features seen during fit.", + ) + log_marginal_likelihood_value: float = Field( + title="log marginal likelihood value", + description="The log-marginal-likelihood of self.kernel_.theta.", + ) + model_config = ConfigDict(arbitrary_types_allowed=True) + +
[docs] @classmethod + def from_model(cls, model: CustomGPR) -> "GPRParameters": + return cls( + alpha=model.alpha_.tolist(), + L=model.L_.tolist(), + X_train=model.X_train_.tolist(), + y_train=model.y_train_.tolist(), + n_features_in=model.n_features_in_, + log_marginal_likelihood_value=model.log_marginal_likelihood_value_, + )
+ + +
[docs]class SerializedGPR(SerializedMLModel): + """ + Contains scikit-learn GaussianProcessRegressor and its Kernel and provides functions to transform + these to SerializedGPR objects and vice versa. + + Attributes: + + """ + + data_handling: GPRDataHandlingParameters = Field( + default=None, + title="data_handling", + description="Information about data handling for GPR.", + ) + kernel_parameters: GPRKernelParameters = Field( + default=None, + title="kernel parameters", + description="Parameters of kernel of the fitted GPR.", + ) + gpr_parameters: GPRParameters = Field( + default=None, + title="gpr_parameters", + description=" GPR parameters of GPR and its Kernel and Data of fitted GPR.", + ) + model_config = ConfigDict(arbitrary_types_allowed=True) + model_type: MLModels = MLModels.GPR + +
[docs] @classmethod + def serialize( + cls, + model: CustomGPR, + dt: Union[float, int], + input: dict[str, Feature], + output: dict[str, OutputFeature], + training_info: Optional[dict] = None, + ): + """ + + Args: + model: GaussianProcessRegressor from ScikitLearn. + dt: The length of time step of one prediction of GPR in seconds. + input: GPR input variables with their lag order. + output: GPR output variables (which are automatically also inputs, as + we need them recursively in MPC.) with their lag order. + training_info: Config of Trainer Class, which trained the Model. + + Returns: + SerializedGPR version of the passed GPR. + """ + if not all( + hasattr(model, attr) + for attr in ["kernel_", "alpha_", "L_", "X_train_", "y_train_"] + ): + raise ValueError( + "To serialize a GPR, a fitted GPR must be passed, " + "but an unfitted GPR has been passed here." + ) + kernel_parameters = GPRKernelParameters.from_model(model) + gpr_parameters = GPRParameters.from_model(model) + return cls( + dt=dt, + input=input, + output=output, + data_handling=model.data_handling, + kernel_parameters=kernel_parameters, + gpr_parameters=gpr_parameters, + trainer_config=training_info, + )
+ +
[docs] def deserialize(self) -> CustomGPR: + """ + Deserializes SerializedGPR object and returns a scikit learn GaussionProcessRegressor. + Returns: + gpr_fitted: GPR version of the SerializedGPR + """ + # Create unfitted GPR with standard Kernel and standard Parameters and Hyperparameters. + kernel = ConstantKernel() * RBF() + WhiteKernel() + gpr_unfitted = CustomGPR( + kernel=kernel, + copy_X_train=False, + ) + # make basic fit for GPR + gpr_fitted = self._basic_fit(gpr=gpr_unfitted) + # update kernel parameters + gpr_fitted.kernel_.k1.k1.constant_value = self.kernel_parameters.constant_value + gpr_fitted.kernel_.k1.k1.constant_value_bounds = ( + self.kernel_parameters.constant_value_bounds + ) + gpr_fitted.kernel_.k1.k2.length_scale = self.kernel_parameters.length_scale + gpr_fitted.kernel_.k1.k2.length_scale_bounds = ( + self.kernel_parameters.length_scale_bounds + ) + gpr_fitted.kernel_.k2.noise_level = self.kernel_parameters.noise_level + gpr_fitted.kernel_.k2.noise_level_bounds = ( + self.kernel_parameters.noise_level_bounds + ) + gpr_fitted.kernel_.theta = np.array(self.kernel_parameters.theta) + # update gpr_parameters + gpr_fitted.L_ = np.array(self.gpr_parameters.L) + gpr_fitted.X_train_ = np.array(self.gpr_parameters.X_train) + gpr_fitted.y_train_ = np.array(self.gpr_parameters.y_train) + gpr_fitted.alpha_ = np.array(self.gpr_parameters.alpha) + gpr_fitted.n_features_in_ = np.array(self.gpr_parameters.n_features_in) + gpr_fitted.log_marginal_likelihood_value_ = np.array( + self.gpr_parameters.log_marginal_likelihood_value + ) + # update data handling + gpr_fitted.data_handling.normalize = self.data_handling.normalize + gpr_fitted.data_handling.scale = self.data_handling.scale + if self.data_handling.mean: + gpr_fitted.data_handling.mean = np.array(self.data_handling.mean) + if self.data_handling.std: + gpr_fitted.data_handling.std = np.array(self.data_handling.std) + return gpr_fitted
+ + def _basic_fit(self, gpr: GaussianProcessRegressor): + """ + Runs an easy fit to be able to populate with kernel_parameters and gpr_parameters + afterward and therefore really fit it. + Args: + gpr: Unfitted GPR to fit + Returns: + gpr: fitted GPR + """ + x = np.ones((1, len(self.input))) + y = np.ones((1, len(self.output))) + gpr.fit( + X=x, + y=y, + ) + return gpr
+ + +
[docs]class LinRegParameters(BaseModel): + coef: list = Field( + title="coefficients", + description="Estimated coefficients for the linear regression problem. If multiple targets are passed during the fit (y 2D), this is a 2D array of shape (n_targets, n_features), while if only one target is passed, this is a 1D array of length n_features.", + ) + intercept: Union[float, list] = Field( + title="intercept", + description="Independent term in the linear model. Set to 0.0 if fit_intercept = False.", + ) + n_features_in: int = Field( + title="number of input features", + description="Number of features seen during fit.", + ) + rank: int = Field( + title="rank", + description="Rank of matrix X. Only available when X is dense.", + ) + singular: list = Field( + title="singular", + description="Singular values of X. Only available when X is dense.", + )
+ + +
[docs]class SerializedLinReg(SerializedMLModel): + """ + Contains scikit-learn LinearRegression and provides functions to transform + these to SerializedLinReg objects and vice versa. + + Attributes: + + """ + + parameters: LinRegParameters = Field( + title="parameters", + description="Parameters of kernel of the fitted linear model.", + ) + model_config = ConfigDict(arbitrary_types_allowed=True) + model_type: MLModels = MLModels.LINREG + +
[docs] @classmethod + def serialize( + cls, + model: LinearRegression, + dt: Union[float, int], + input: dict[str, Feature], + output: dict[str, OutputFeature], + training_info: Optional[dict] = None, + ): + """ + + Args: + model: LinearRegression from ScikitLearn. + dt: The length of time step of one prediction of LinReg in seconds. + input: LinReg input variables with their lag order. + output: LinReg output variables (which are automatically also inputs, as " + "we need them recursively in MPC.) with their lag order. + training_info: Config of Trainer Class, which trained the Model. + + Returns: + SerializedLinReg version of the passed linear model. + """ + if not all( + hasattr(model, attr) + for attr in ["coef_", "intercept_", "n_features_in_", "rank_", "singular_"] + ): + raise ValueError( + "To serialize a GPR, a fitted GPR must be passed, " + "but an unfitted GPR has been passed here." + ) + parameters = { + "coef": model.coef_.tolist(), + "intercept": model.intercept_.tolist(), + "n_features_in": model.n_features_in_, + "rank": model.rank_, + "singular": model.singular_.tolist(), + } + parameters = LinRegParameters(**parameters) + return cls( + dt=dt, + input=input, + output=output, + parameters=parameters, + trainer_config=training_info, + )
+ +
[docs] def deserialize(self) -> LinearRegression: + """ + Deserializes SerializedLinReg object and returns a LinearRegression object of scikit-learn. + Returns: + linear_model_fitted: LinearRegression version of the SerializedLinReg + """ + linear_model_unfitted = LinearRegression() + linear_model_fitted = self._basic_fit(linear_model=linear_model_unfitted) + # update parameters + linear_model_fitted.coef_ = np.array(self.parameters.coef) + linear_model_fitted.intercept_ = np.array(self.parameters.intercept) + linear_model_fitted.n_features_in_ = self.parameters.n_features_in + linear_model_fitted.rank_ = self.parameters.rank + linear_model_fitted.singular_ = np.array(self.parameters.singular) + return linear_model_fitted
+ + def _basic_fit(self, linear_model: LinearRegression): + """ + Runs an easy fit to be able to populate with parameters and gpr_parameters + afterward and therefore really fit it. + Args: + linear_model: Unfitted linear model to fit. + Returns: + linear_model: fitted linear model. + """ + x = np.ones((1, len(self.input))) + y = np.ones((1, len(self.output))) + linear_model.fit( + X=x, + y=y, + ) + return linear_model
+ + +serialized_models = { + MLModels.ANN: SerializedANN, + MLModels.GPR: SerializedGPR, + MLModels.LINREG: SerializedLinReg, +} +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules.html new file mode 100644 index 0000000..b3a80cf --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules.html @@ -0,0 +1,172 @@ + + + + + + + + agentlib_mpc.modules — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules

+"""
+This package contains all modules for the
+distributed model predictive control using multi agent systems.
+
+It contains classes for local optimization and global coordination.
+"""
+
+import importlib
+
+
+
[docs]class ModuleImport: + def __init__(self, module_path: str, class_name: str): + self.module_path = module_path + self.class_name = class_name + +
[docs] def import_class(self): + module = importlib.import_module(self.module_path) + return getattr(module, self.class_name)
+ + +MODULE_TYPES = { + "data_source": ModuleImport( + module_path="agentlib_mpc.modules.data_source", class_name="DataSource" + ), + "mpc_basic": ModuleImport( + module_path="agentlib_mpc.modules.mpc", class_name="BaseMPC" + ), + "mpc": ModuleImport(module_path="agentlib_mpc.modules.mpc_full", class_name="MPC"), + "minlp_mpc": ModuleImport( + module_path="agentlib_mpc.modules.minlp_mpc", class_name="MINLPMPC" + ), + "admm": ModuleImport( + module_path="agentlib_mpc.modules.dmpc.admm.admm", class_name="ADMM" + ), + "admm_local": ModuleImport( + module_path="agentlib_mpc.modules.dmpc.admm.admm", class_name="LocalADMM" + ), + "admm_coordinated": ModuleImport( + module_path="agentlib_mpc.modules.dmpc.admm.admm_coordinated", + class_name="CoordinatedADMM", + ), + "admm_coordinator": ModuleImport( + module_path="agentlib_mpc.modules.dmpc.admm.admm_coordinator", + class_name="ADMMCoordinator", + ), + "ann_trainer": ModuleImport( + module_path="agentlib_mpc.modules.ml_model_training.ml_model_trainer", + class_name="ANNTrainer", + ), + "gpr_trainer": ModuleImport( + module_path="agentlib_mpc.modules.ml_model_training.ml_model_trainer", + class_name="GPRTrainer", + ), + "linreg_trainer": ModuleImport( + module_path="agentlib_mpc.modules.ml_model_training.ml_model_trainer", + class_name="LinRegTrainer", + ), + "ann_simulator": ModuleImport( + module_path="agentlib_mpc.modules.ann_simulator", + class_name="MLModelSimulator", + ), + "set_point_generator": ModuleImport( + module_path="agentlib_mpc.modules.ml_model_training.setpoint_generator", + class_name="SetPointGenerator", + ), + "mhe": ModuleImport( + module_path="agentlib_mpc.modules.estimation.mhe", class_name="MHE" + ), +} +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/InputPrediction/try_predictor.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/InputPrediction/try_predictor.html new file mode 100644 index 0000000..37b2899 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/InputPrediction/try_predictor.html @@ -0,0 +1,194 @@ + + + + + + + + agentlib_mpc.modules.InputPrediction.try_predictor — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.InputPrediction.try_predictor

+import pandas as pd
+import pydantic
+from agentlib.core import AgentVariables, AgentVariable
+from agentlib.modules.utils.try_sensor import TRYSensorConfig, TRYSensor
+
+
+
[docs]class TRYPredictorConfig(TRYSensorConfig): + prediction_length: int = pydantic.Field( + default=24, description="prediction length in hours" + ) + + predictions: AgentVariables = [ + AgentVariable( + name="T_oda_prediction", + unit="K", + description="Air temperature 2m over ground [K]", + ), + AgentVariable( + name="pressure_prediction", + unit="hPa", + description="Air pressure in standard height [hPa]", + ), + AgentVariable( + name="wind_direction_prediction", + unit="°", + description="Wind direction 10 m above gorund " "[Grad] {0..360;999}", + ), + AgentVariable( + name="wind_speed_prediction", + unit="m/s", + description="Wind speed 10 m above ground [m/s]", + ), + AgentVariable( + name="coverage_prediction", unit="eighth", description="[eighth] {0..8;9}" + ), + AgentVariable( + name="absolute_humidity_prediction", unit="g/kg", description="[g/kg]" + ), + AgentVariable( + name="relative_humidity_prediction", + unit="%", + description="Relative humidity 2 m above ground " "[%] {1..100}", + ), + AgentVariable( + name="beam_direct_prediction", + unit="W/m^2", + description="Direct beam of sun (hor. plane) " + "[W/m^2] downwards: positive", + ), + AgentVariable( + name="beam_diffuse_prediction", + unit="/m^2", + description="Diffuse beam of sun (hor. plane) " + "[W/m^2] downwards: positive", + ), + AgentVariable( + name="beam_atm_prediction", + unit="/m^2", + description="Beam of atmospheric heat (hor. plane) " + "[W/m^2] downwards: positive", + ), + AgentVariable( + name="beam_terr_prediction", + unit="/m^2", + description="Beam of terrestrial heat " "[W/m^2] upwards: negative", + ), + ]
+ + +
[docs]class TRYPredictor(TRYSensor): + config: TRYPredictorConfig + _data: pd.DataFrame + +
[docs] def process(self): + while True: + self.send_prediction() + self.send_measurement() + yield self.env.timeout(self.t_sample)
+ +
[docs] def send_prediction(self): + start_loc = self._data.index.get_loc(self.env.now, method="pad") + start_time = self._data.index[start_loc] + end_time = start_time + self.config.prediction_length * 3600 + for measurement_name, measurement_data in self._data.iteritems(): + self.set(measurement_name, measurement_data.loc[start_time:end_time])
+ +
[docs] def send_measurement(self): + data = self.get_data_now() + for key, val in data.items(): + self.set(name=key, value=val)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/data_source.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/data_source.html new file mode 100644 index 0000000..b58c5d3 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/data_source.html @@ -0,0 +1,307 @@ + + + + + + + + agentlib_mpc.modules.data_source — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.data_source

+from pathlib import Path
+
+import pandas as pd
+import numpy as np
+import logging
+from pydantic import Field, field_validator, FilePath
+from typing import List, Optional, Union
+from datetime import datetime, timedelta
+
+from agentlib.core import BaseModule, BaseModuleConfig, AgentVariable
+from agentlib import Environment, Agent
+from agentlib_mpc.data_structures.interpolation import InterpolationMethods
+
+
+
[docs]class DataSourceConfig(BaseModuleConfig): + data: Union[pd.DataFrame, FilePath] = Field( + title="data", + default=pd.DataFrame(), + description="Data that should be communicated during execution." + "Index should be either numeric or Datetime, numeric values are interpreted as seconds.", + validate_default=True, + ) + columns: Optional[List[str]] = Field( + title="columns", + default=None, + description="Optional list of columns of data frame that should be sent." + "If ommited, all datapoint in frame are sent.", + ) + t_sample: Union[float, int] = Field( + title="t_sample", + default=1, + description="Sample time of data source. Default is 1 s.", + ) + data_offset: Optional[Union[pd.Timedelta, float]] = Field( + title="data_offset", + default=0, + description="Offset will be subtracted from index.", + ) + interpolation_method: Optional[InterpolationMethods] = Field( + title="interpolation_method", + default=InterpolationMethods.previous, + description="Interpolation method used for resampling of data." + "Only 'linear' and 'previous' are allowed.", + ) + +
[docs] @field_validator("data") + @classmethod + def check_data(cls, data): + """Makes sure data is a data frame, and loads it if required.""" + if isinstance(data, (str, Path)) and Path(data).is_file(): + data = pd.read_csv(data, engine="python", index_col=0) + if not isinstance(data, pd.DataFrame): + raise ValueError( + f"Data {data} is not a valid DataFrame or the path is not found." + ) + if data.empty: + raise ValueError("Dataframe 'data' is empty.") + return data
+ +
[docs] @field_validator("interpolation_method") + @classmethod + def check_interpolation_method(cls, interpolation_method): + if interpolation_method not in { + InterpolationMethods.linear, + InterpolationMethods.previous, + }: + raise ValueError( + "Only 'linear' and 'previous' are allowed interpolation methods." + ) + return interpolation_method
+ + +
[docs]class DataSource(BaseModule): + config: DataSourceConfig + + def __init__(self, config: dict, agent: Agent): + super().__init__(config=config, agent=agent) + data = self.config.data + data = self.transform_index(data) + + # Filter columns if specified + if self.config.columns: + columns_to_keep = [ + col for col in self.config.columns if col in data.columns + ] + if not columns_to_keep: + raise ValueError("None of the specified columns exist in the dataframe") + data = data[columns_to_keep] + + if data.empty: + raise ValueError("Resulting dataframe is empty after processing") + +
[docs] def transform_index(self, data: pd.DataFrame) -> pd.DataFrame: + """Handles the index and ensures it is numeric, with correct offset""" + offset = self.config.data_offset + # Convert offset to seconds if it's a Timedelta + if isinstance(offset, pd.Timedelta): + offset = offset.total_seconds() + # Handle different index types + if isinstance(data.index, pd.DatetimeIndex): + data.index = (data.index - data.index[0]).total_seconds() + else: + # Try to convert to numeric if it's a string + try: + data.index = pd.to_numeric(data.index) + data.index = data.index - data.index[0] + except ValueError: + # If conversion to numeric fails, try to convert to datetune + try: + data.index = pd.to_datetime(data.index) + data.index = (data.index - data.index[0]).total_seconds() + except ValueError: + raise ValueError("Unable to convert index to numeric format") + + data.index = data.index.astype(float) - offset + return data
+ + def _get_data_at_time( + self, + timestamp: float, + interpolation_method: InterpolationMethods = InterpolationMethods.previous, + ) -> pd.Series: + df = self.config.data + after = df[df.index >= timestamp].first_valid_index() + before = df[df.index <= timestamp].last_valid_index() + if after is None: + self.logger.warning( + f"The timestamp {timestamp} is after the range of the data." + ) + return df.iloc[-1] + if before is None: + self.logger.warning( + f"The timestamp {timestamp} is before the range of the data." + ) + return df.iloc[0] + if before == after: + return df.loc[before] + # Extract the two points + df_surrounding = df.loc[[before, after]] + if interpolation_method == InterpolationMethods.linear: + return ( + df_surrounding.reindex(df_surrounding.index.union([timestamp])) + .interpolate(method="index") + .loc[timestamp] + ) + elif interpolation_method == InterpolationMethods.previous: + return df_surrounding.iloc[0] + else: + self.logger.warning( + f"Interpolation method {interpolation_method} not supported." + ) + return df_surrounding.iloc[0] + +
[docs] def process(self): + """Write the current data values into data_broker every t_sample""" + while True: + current_data = self._get_data_at_time( + self.env.now, self.config.interpolation_method + ) + for index, value in current_data.items(): + self.logger.debug( + f"At {self.env.now}: Sending variable {index} with value {value} to data broker." + ) + variable = AgentVariable(name=index, value=value, shared=True) + self.agent.data_broker.send_variable(variable, copy=False) + yield self.env.timeout(self.config.t_sample)
+ +
[docs] def register_callbacks(self): + """Don't do anything as this module is not event-triggered"""
+ + +if __name__ == "__main__": + logging.basicConfig(level=logging.DEBUG) + date_today = datetime.now() + time = range(5) + time = pd.date_range(date_today, date_today + timedelta(minutes=5), freq="min") + data1 = np.random.randint(1, high=100, size=len(time)) / 10 + data2 = np.random.randint(1, high=100, size=len(time)) / 10 + df = pd.DataFrame({"index": time, "col1": data1, "col2": data2}) + df.set_index("index", inplace=True) + print("Dataframe:") + df.to_csv("example_df.csv") + print(df) + agent_config = { + "id": "my_agent_id", + "modules": [ + { + "module_id": "My_Data_Source", + "type": "agentlib_mpc.data_source", + "data": "example_df.csv", + # "data_offset": pd.Timedelta("1min"), + # "data_offset": 60, + "interpolation_method": InterpolationMethods.linear, + "columns": ["col1", "col2"], + } + ], + } + + logging.basicConfig(level=logging.INFO) + environment_config = {"rt": False, "factor": 1} + env = Environment(config=environment_config) + agent_ = Agent(config=agent_config, env=env) + env.run(65) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc.html new file mode 100644 index 0000000..1a21ee7 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc.html @@ -0,0 +1,119 @@ + + + + + + + + agentlib_mpc.modules.dmpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc

+from agentlib_mpc.modules.mpc_full import MPC, MPCConfig
+
+
+
[docs]class DistributedMPCConfig(MPCConfig): + """ + Base config class with common configurations + """
+ + +
[docs]class DistributedMPC(MPC): + """Base class which defines common interfaces among all + distributed mpc approaches (either optimization based, + game theory based or some other).""" + + config: DistributedMPCConfig
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm.html new file mode 100644 index 0000000..6d30c5e --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm.html @@ -0,0 +1,1038 @@ + + + + + + + + agentlib_mpc.modules.dmpc.admm.admm — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc.admm.admm

+"""Holds functionality for ADMM modules."""
+
+import time
+import threading
+from typing import List, Dict, Tuple, Iterable, Optional, TypeVar, Union
+import queue
+from enum import Enum, auto
+
+import numpy as np
+import pandas as pd
+from agentlib.core.errors import ConfigurationError
+from pydantic import field_validator, Field
+
+from agentlib.core import (
+    Source,
+    AgentVariable,
+)
+
+from agentlib_mpc.data_structures.mpc_datamodels import MPCVariable
+from agentlib_mpc.modules.dmpc import DistributedMPC, DistributedMPCConfig
+from agentlib_mpc.optimization_backends.backend import ADMMBackend
+from agentlib.utils.validators import convert_to_list
+from agentlib_mpc.data_structures import mpc_datamodels
+import agentlib_mpc.data_structures.admm_datatypes as adt
+from agentlib_mpc.data_structures.mpc_datamodels import Results
+
+
+# noinspection PyArgumentList
+
[docs]class ModuleStatus(Enum): + not_started = auto() + syncing = auto() + at_registration = auto() + optimizing = auto() + updating = auto() + waiting_for_other_agents = auto() + sleeping = auto()
+ + +# noinspection PyArgumentList +
[docs]class ParticipantStatus(Enum): + not_participating = auto() + available = auto() + confirmed = auto() + not_available = auto()
+ + +
[docs]class ADMMParticipation: + """Holds data for the status of a shared variable of another system.""" + + def __init__(self, variable): + self.variable: AgentVariable = variable + self.status: ParticipantStatus = ParticipantStatus.not_participating + # no more than two messages should stack + self.received: queue.Queue = queue.Queue(maxsize=5) + +
[docs] def empty_memory(self): + while True: + try: + self.received.get_nowait() + except queue.Empty: + break
+ +
[docs] def de_register(self): + self.status = ParticipantStatus.not_participating + self.empty_memory()
+ + +
[docs]class ADMMConfig(DistributedMPCConfig): + couplings: List[mpc_datamodels.MPCVariable] = [] + exchange: List[mpc_datamodels.MPCVariable] = [] + + penalty_factor: float = Field( + default=10, + ge=0, + description="Penalty factor of the ADMM algorithm. Should be equal for all " + "agents.", + ) + iteration_timeout: float = Field( + default=20, + ge=0, + description="Maximum computation + waiting time for one iteration.", + ) + registration_period: float = Field( + default=2, + ge=0, + description="Time spent on registration before each optimization", + ) + max_iterations: float = Field( + default=20, + ge=0, + description="Maximum number of ADMM iterations before termination of control " + "step.", + ) + +
[docs] @field_validator( + "exchange", "couplings", "parameters", "inputs", "outputs", "controls", "states" + ) + @classmethod + def check_prefixes_of_variables(cls, variables: list[AgentVariable]): + """Ensures no user provided variable is named with the reserved ADMM prefix.""" + conf_err = ConfigurationError( + f"Do not use variables that start with " + f"'{adt.ADMM_PREFIX}' in an ADMM config." + ) + for var in variables: + if var.name.startswith(adt.ADMM_PREFIX): + raise conf_err + return variables
+ + +ADMMConfigT = TypeVar("ADMMConfigT", bound=ADMMConfig) + + +
[docs]class ADMM(DistributedMPC): + """ + This class represents a module participating in a fully decentralized + Consensus-ADMM optimization for distributed MPC. + Agents autonomously send the values of their coupling variables, register + other participants and perform update steps. + """ + + config: ADMMConfig + var_ref: adt.VariableReference + + def __init__(self, config: dict, agent): + self.var_qu = queue.Queue() + self.start_step = threading.Event() + self._status: ModuleStatus = ModuleStatus.syncing + self._registered_participants = {} + self._admm_variables: dict[str, AgentVariable] = {} + super().__init__(config=config, agent=agent) + +
[docs] def collect_couplings_for_optimization(self): + """Collects updated AgentVariables only of the coupling variables.""" + coup_vars = {} + for coup in self.var_ref.couplings + self.var_ref.exchange: + coup_vars.update( + {v: self._admm_variables[v] for v in coup.admm_variables()} + ) + coup_vars["penalty_factor"] = self.penalty_factor_var + return coup_vars
+ +
[docs] def process(self): + # this thread will perform the optimization whenever start_step is set + thread = threading.Thread( + target=self._admm_loop, daemon=True, name=f"admm_loop_{self.agent.id}" + ) + thread.start() + self.agent.register_thread(thread=thread) + + self._status: ModuleStatus = ModuleStatus.syncing + yield self._sync_start() + self.logger.info("Starting periodic execution of admm algorithm") + + while True: + self.start_step.set() + yield self.env.timeout(self.config.time_step)
+ + def _sync_start(self): + """Waits until time is a multiple of the time step.""" + time_step = self.config.time_step + delta = time_step - (time.time() % time_step) + wait_time = delta + self.logger.info("Waiting %s s to sync admm algorithm", wait_time) + return self.env.timeout(wait_time) + + def _admm_loop(self): + """Triggers the optimization whenever self.start_step is set.""" + while True: + self._status: ModuleStatus = ModuleStatus.sleeping + self.start_step.wait() + self.start_step.clear() + self.admm_step() + if self.start_step.isSet(): + self.logger.error( + "%s: Start of ADMM round was requested before " + "last one finished. Waiting until next " + "cycle." + ) + self.start_step.clear() + +
[docs] def admm_step(self): + """Performs an entire ADMM optimization.""" + + self._perform_registration() + + # get optimization inputs + self._set_mean_coupling_values() + opt_inputs = self.collect_variables_for_optimization() + self.pre_computation_hook() + + # reset termination criteria + start_iterations = self.env.time + admm_iter = 0 + + # start the ADMM iteration loop + while True: + start_opt = time.time() + + # Solve local optimization + result = self._solve_local_optimization( + opt_inputs=opt_inputs, + current_iteration=admm_iter, + start_time=start_iterations, + ) + + # admm coordination step + self.send_coupling_values(result) + self._status = ModuleStatus.waiting_for_other_agents + self._receive_variables(start=start_opt) + self._status = ModuleStatus.updating + self._set_mean_coupling_values() + self.update_lambda() + self.reset_participants_ready() + + # check termination + admm_iter += 1 + if self._check_termination(admm_iter, start_iterations): + break + + self.deregister_all_participants() + self.set_actuation(result)
+ + def _solve_local_optimization( + self, + opt_inputs: Dict[str, AgentVariable], + current_iteration: int, + start_time: float, + ) -> Results: + """ + Performs the local optimization and returns the result. + Args: + opt_inputs: dict with AgentVariables that stay constant between + optimizations + current_iteration: current iteration number + start_time: environment time at start of ADMM algorithm + + Returns: + DataFrame of all optimization variables. + """ + updated_couplings = self.collect_couplings_for_optimization() + opt_inputs.update(updated_couplings) + self.logger.info("Solving local optimization #%s.", current_iteration) + self._status: ModuleStatus = ModuleStatus.optimizing + result = self.optimization_backend.solve(start_time, opt_inputs) + self.logger.info("Solved local optimization #%s.", current_iteration) + return result + + def _perform_registration(self): + """Registers participants in current round""" + self._status: ModuleStatus = ModuleStatus.at_registration + self.logger.info("Start registration of round at %s.", self.env.now) + + # shift initial values for multipliers and coupling outputs + self._shift_and_send_coupling_outputs() + self._shift_multipliers() + + # accept registrations within a fixed time (handled by callbacks) + time.sleep(self.config.registration_period) + self._status: ModuleStatus = ModuleStatus.updating + self.logger.info("%s: Finished registration of round") + + def _check_termination(self, admm_iter: int, start_iteration: float) -> bool: + """ + + Args: + admm_iter: current iteration number + start_iteration: environment time at which current optimization + began + + Returns: + True, if the algorithm should be terminated, + False, if it should continue + """ + self.logger.debug("Finished iteration no. %s.", admm_iter) + + # check wait_on_start_iterations + available_runtime = self.config.time_step - self.config.registration_period + if self.env.now - start_iteration > available_runtime: + self.logger.warning( + "ADMM did not converge within the specified sampling time " + "of %ss. Terminating current control step.", + self.config.time_step, + ) + return True + + # check maximum iterations + if admm_iter >= self.config.max_iterations: + self.logger.warning( + "ADMM did not converge within the maximum iteration number " + "of %s. Terminating current control step.", + self.config.max_iterations, + ) + return True + + return False + + def _receive_variables(self, start): + """Wait until all coupling variables arrive from the other systems.""" + + timeout = self.config.iteration_timeout + remaining_time = max(timeout - (time.time() - start), 0) + for participant in self.all_coupling_statuses(): + if participant.status == ParticipantStatus.not_participating: + continue + try: + var = participant.received.get(timeout=remaining_time) + participant.variable = var + participant.status = ParticipantStatus.confirmed + except queue.Empty: + participant.de_register() + source = participant.variable.source + coup = participant.variable.alias + self.logger.info( + "De-registered participant %s from " + "coupling %s as it was too slow.", + source, + coup, + ) + + remaining_time = max(timeout - (time.time() - start), 0) + +
[docs] def all_coupling_statuses(self) -> Iterable[ADMMParticipation]: + """Gives and iterator of all ADMMParticipation that are registered.""" + for coup_participants in self.registered_participants.values(): + for participant in coup_participants.values(): + yield participant
+ + def _shift(self, sequence: List[float], grid: List[float]) -> List[float]: + """ + Shifts the sequence forward by one sampling time. + Args: + sequence: Sequence of variable values. + grid: Timestamps belonging to the sequence starting from 0. + + Returns: + The shifted list with the last values duplicated. + """ + # get index of first grid point greater self.ts + index = next(x[0] for x in enumerate(grid) if x[1] >= self.config.time_step) + shifted = sequence[index:] + sequence[-index:] + return shifted + + def _shift_multipliers(self): + """Shifts lagrange multipliers by one sampling interval. If a scalar + is given, expands to the correct length.""" + for coup in self.cons_and_exchange: + grid = self.optimization_backend.coupling_grid + var = self._admm_variables[coup.multiplier] + val = var.value + if len(val) == 1: + val = val * len(grid) + val = self._shift(sequence=val, grid=grid) + self._admm_variables[var.name].value = val + + def _shift_and_send_coupling_outputs(self): + """Shifts global coupling variables by one sampling interval. If a + scalar is given, expands to the correct length. + Sets the values as output to the data_broker, sending them.""" + + self.logger.info("Sending initial coupling outputs ...") + for coupling in self.cons_and_exchange: + grid = self.optimization_backend.coupling_grid + length = len(grid) + + # shift output variable + var = self._admm_variables[coupling.local] + val = var.value + + # expand lists that were _finished_discretization with a scalar + if len(val) == 1: + val = val * length + val = self._shift(sequence=val, grid=grid) + + self.send_coupling_variable(var.name, val) + +
[docs] def assert_mpc_variables_are_in_model(self): + unassigned_model = super().assert_mpc_variables_are_in_model() + + for coup in self.config.couplings + self.config.exchange: + if coup.name in unassigned_model["inputs"]: + unassigned_model["inputs"] = self.assert_subset( + [coup.name], unassigned_model["inputs"], "Couplings" + ) + elif coup.name in unassigned_model["outputs"]: + unassigned_model["outputs"] = self.assert_subset( + [coup.name], unassigned_model["outputs"], "Couplings" + ) + elif coup.name in unassigned_model["states"]: + unassigned_model["states"] = self.assert_subset( + [coup.name], unassigned_model["states"], "Couplings" + ) + return unassigned_model
+ + @property + def registered_participants(self) -> Dict[str, Dict[str, ADMMParticipation]]: + """Dictionary containing all other agents this agent shares variables with. + Ordered in a two-layer form, with variables at the first layer and + agents at the second layer. Contains ADMMParticipation objects at + the base layer. + + Examples: + self.registered_participants = + {'coupling_var_1': {'src_of_agent1': status_1, + 'src_of_agent2': status_2, + 'src_of_agent3': status_3} + 'coupling_var_1': {'src_of_agent3': status_a, + 'src_of_agent2': status_b, + 'src_of_agent4': status_c} + } + here, <status> refers to an ADMMParticipation object. + """ + return self._registered_participants + + @registered_participants.setter + def registered_participants(self, reg_par: Dict): + self._registered_participants = reg_par + + @property + def cons_and_exchange(self) -> List[Union[adt.ExchangeEntry, adt.CouplingEntry]]: + return self.var_ref.exchange + self.var_ref.couplings + +
[docs] def reset_participants_ready(self): + """Sets the ready status of all participating agents to False.""" + for coup_participants in self.registered_participants.values(): + for participant in coup_participants.values(): + if participant.received.qsize(): + participant.status = ParticipantStatus.available + else: + participant.status = ParticipantStatus.not_available
+ +
[docs] def deregister_all_participants(self): + """Sets the participating status of all participating agents to + False.""" + self.logger.info("De-registering all participants for next round.") + for coup_participants in self.registered_participants.values(): + for participant in coup_participants.values(): + participant.de_register()
+ +
[docs] def participant_callback(self, variable: AgentVariable): + """Puts received variables in the correct queue, depending on + registration status of this agent.""" + if variable.source.agent_id != self.agent.id: + self.receive_participant(variable)
+ +
[docs] def receive_participant(self, variable: AgentVariable): + """Set the participation to true for the given coupling input.""" + # Create copy just in case + reg_par_of_coupling = self.registered_participants[variable.alias].copy() + + # add variables that were seen the first time + if variable.source not in reg_par_of_coupling: + self.logger.info( + "Initially registered variable '%s' from '%s'.", + variable.alias, + variable.source, + ) + reg_par_of_coupling[variable.source] = ADMMParticipation(variable=variable) + neighbor: ADMMParticipation = reg_par_of_coupling[variable.source] + + # perform registration at start of round + if self._status == ModuleStatus.at_registration: + self.logger.debug( + "Registered variable '%s' from '%s' for this round.", + variable.alias, + variable.source, + ) + neighbor.empty_memory() + neighbor.status = ParticipantStatus.not_available + neighbor.variable = variable + + # confirm new trajectory during admm iterations + if self._status in ( + ModuleStatus.waiting_for_other_agents, + ModuleStatus.optimizing, + ModuleStatus.updating, + ): + try: + neighbor.received.put_nowait(variable) + neighbor.status = ParticipantStatus.available + self.logger.debug( + "Received variable '%s' from '%s' and set to " "ready: 'True'.", + variable.alias, + variable.source, + ) + except queue.Full: + # status.de_register() + source = neighbor.variable.source + coup = neighbor.variable.alias + self.logger.error( + "De-registered participant %s from coupling %s as it " + "sends messages too quickly.", + source, + coup, + ) + if neighbor.received.qsize() > 2: + self.logger.error(f"Queue is too full {neighbor.received.qsize()}") + neighbor.variable = variable + + # Set the altered copy again + self.registered_participants[variable.alias] = reg_par_of_coupling
+ +
[docs] def get_participants_values(self, coupling_alias: str) -> List[pd.Series]: + """Get the values of all agents for a coupling variable.""" + values = [] + for participant in self.registered_participants[coupling_alias].values(): + if participant.status == ParticipantStatus.confirmed: + values.append(participant.variable.value) + if not values: + self.logger.warning("Did not get participants values for this round") + return values
+ +
[docs] def send_coupling_values(self, solution: Results): + """ + Sets the coupling outputs to the data_broker, which automatically sends them. + + Args: + solution: Output dictionary from optimization_backend.solve(). + """ + self.logger.info("Sending optimal values to other agents.") + for coup in self.cons_and_exchange: + self.send_coupling_variable(coup.local, list(solution[coup.name]))
+ + def _set_mean_coupling_values(self): + """Computes the current global value of a coupling variable and saves + it in the data_broker.""" + for coupling in self.var_ref.couplings: + # Get own coupling variable version + own_coup_var = self._admm_variables[coupling.local] + own_coup_value = own_coup_var.value + coup_alias = own_coup_var.alias + + # Get variables values: + other_coup_values = self.get_participants_values(coup_alias) + + # Add own value + other_coup_values.append(own_coup_value) + + # Build mean over all values + other_coup_values = np.array(other_coup_values) + mean_coup_value = list(np.mean(other_coup_values, axis=0)) + self._admm_variables[coupling.mean].value = mean_coup_value + self.logger.debug( + "Updated mean_%s = %s", own_coup_var.name, mean_coup_value + ) + + for exchange in self.var_ref.exchange: + own_exchange_var = self._admm_variables[exchange.local] + own_exchange_value = own_exchange_var.value + exchange_alias = own_exchange_var.alias + + # Get variables values: + other_coup_values = self.get_participants_values(exchange_alias) + + # Add own value + other_coup_values.append(own_exchange_value) + + # Build mean over all values + other_coup_values = np.array(other_coup_values) + mean_coup_value = np.mean(other_coup_values, axis=0) + mean_diff = list(own_exchange_value - mean_coup_value) + + self._admm_variables[exchange.mean_diff].value = mean_diff + self.logger.debug( + "Updated mean_%s = %s", own_exchange_var.name, mean_coup_value + ) + + def _solve_local_optimization_debug( + self, + opt_inputs: Dict[str, AgentVariable], + current_iteration: int, + start_time: float, + ) -> pd.DataFrame: + """ + USED FOR DEBUGGING, SKIPS CASADI + Performs the local optimization and returns the result. + Args: + opt_inputs: dict with AgentVariables that stay constant between + optimizations + current_iteration: current iteration number + start_time: environment time at start of ADMM algorithm + + Returns: + DataFrame of all optimization variables. + """ + updated_couplings = self.collect_couplings_for_optimization() + opt_inputs.update(updated_couplings) + self.logger.info("Solving local optimization #%s.", current_iteration) + self._status: ModuleStatus = ModuleStatus.optimizing + grid = self.optimization_backend.coupling_grid + result = {} + for coup in self.config.couplings + self.config.controls + self.config.states: + result[coup.name] = [coup.value] * len(grid) + result = pd.DataFrame(result) + self.logger.info("Solved local optimization #%s.", current_iteration) + self.logger.debug( + "Coupling variable #%s.", list(result[self.config.couplings[0].name]) + ) + return result + +
[docs] def send_coupling_variable(self, name: str, value: mpc_datamodels.MPCValue): + """Sends an admm coupling variable through the data_broker and sets its + value locally""" + var = self._admm_variables[name] + var.value = value + self.agent.data_broker.send_variable(var)
+ +
[docs] def update_lambda(self): + """ + Performs the update of the lagrange multipliers. + lambda^k+1 := lambda^k - rho*(z-x_i) + """ + self.logger.info("Updating lambda variables for all couplings") + for coupling in self.var_ref.couplings: + # Get current lambda value: + coup_name = coupling.name + lambda_coupling = self._admm_variables[coupling.multiplier].value + lambda_coupling = np.array(lambda_coupling) + self.logger.debug("Updating lambda_%s = %s", coup_name, lambda_coupling) + + own_coup_value = self._admm_variables[coupling.local].value + own_coup_value = np.array(own_coup_value) + mean_coup_value = self._admm_variables[coupling.mean].value + mean_coup_value = np.array(mean_coup_value) + + # Calc update + updated_value = lambda_coupling - self.config.penalty_factor * ( + mean_coup_value - own_coup_value + ) + updated_value = updated_value.tolist() + # Set value to data_broker + self._admm_variables[coupling.multiplier].value = updated_value + self.logger.info("Updated lambda_%s = %s", coupling.name, updated_value) + + for exchange in self.var_ref.exchange: + # Get current lambda value: + lambda_coupling = self._admm_variables[exchange.multiplier].value + lambda_coupling = np.array(lambda_coupling) + self.logger.debug("Updating lambda_%s = %s", exchange.name, lambda_coupling) + + own_coup_value = np.array(self._admm_variables[exchange.local].value) + diff_coup_value = np.array(self._admm_variables[exchange.mean_diff].value) + + # Calc update + updated_value = lambda_coupling - self.config.penalty_factor * ( + diff_coup_value - own_coup_value + ) + updated_value = updated_value.tolist() + # Set value to data_broker + self._admm_variables[exchange.multiplier].value = updated_value + self.logger.info("Updated lambda_%s = %s", exchange.name, updated_value)
+ +
[docs] def get_results(self) -> Optional[pd.DataFrame]: + """Read the results that were saved from the optimization backend and + returns them as Dataframe. + + Returns: + (results, stats) tuple of Dataframes. + """ + results_file = self.optimization_backend.config.results_file + if results_file is None: + self.logger.info("No results were saved .") + return None + try: + results, stats = self.read_results_file(results_file) + return results + except FileNotFoundError: + self.logger.error("ADMM results file %s was not found.", results_file) + return None
+ + @property + def penalty_factor_var(self) -> MPCVariable: + return MPCVariable(name="penalty_factor", value=self.config.penalty_factor) + + def _setup_var_ref(self) -> adt.VariableReference: + # Extend var_ref with coupling variables + return adt.VariableReference.from_config(self.config) + + def _setup_optimization_backend(self) -> ADMMBackend: + self._admm_variables = self._create_couplings() + return super()._setup_optimization_backend() + + def _create_couplings(self) -> dict[str, MPCVariable]: + """Map coupling variables based on already setup model""" + # Check if coupling even exist + + # Map couplings: + _couplings = [] + # and generate new variables for admm: + _admm_variables: dict[str, MPCVariable] = {} + for coupling in self.config.couplings: + coupling.source = Source(agent_id=self.agent.id) + coupling.shared = True + _couplings.append(coupling) + + # Create two new variables for each coupling: + # 1. lambda variables in both cases. + include = {"unit": coupling.unit, "description": coupling.description} + coupling_entry = adt.CouplingEntry(name=coupling.name) + alias = adt.coupling_alias(coupling.alias) + _admm_variables[coupling_entry.multiplier] = MPCVariable( + name=coupling_entry.multiplier, + value=[0], + type="list", + source=Source(module_id=self.id), + **include, + ) + _admm_variables[coupling_entry.local] = MPCVariable( + name=coupling_entry.local, + value=convert_to_list(coupling.value), + alias=alias, + type="list", + source=Source(agent_id=self.agent.id), + shared=True, + **include, + ) + _admm_variables[coupling_entry.mean] = MPCVariable( + name=coupling_entry.mean, + type="list", + source=Source(module_id=self.id), + **include, + ) + lag_val = coupling.value or np.nan_to_num( + (coupling.ub + coupling.lb) / 2, posinf=1000, neginf=1000 + ) + _admm_variables[coupling_entry.lagged] = MPCVariable( + name=coupling_entry.lagged, + value=lag_val, + source=Source(module_id=self.id), + **include, + ) + + # add callback to receive this value + broker_funcs = [ + self.agent.data_broker.deregister_callback, + self.agent.data_broker.register_callback, + ] + + for broker_func in broker_funcs: + broker_func( + alias=alias, + source=None, + callback=self.participant_callback, + ) + self.registered_participants.update({alias: {}}) + + # Exchange variables + _exchange_vars = [] + # and generate new variables for admm: + for exchange_var in self.config.exchange: + exchange_var.source = Source(agent_id=self.agent.id) + exchange_var.shared = True + _exchange_vars.append(exchange_var) + + # Create two new variables for each coupling: + # 1. lambda variables in both cases. + include = { + "unit": exchange_var.unit, + "description": exchange_var.description, + } + + exchange_entry = adt.ExchangeEntry(name=exchange_var.name) + alias = adt.exchange_alias(exchange_var.alias) + _admm_variables[exchange_entry.multiplier] = MPCVariable( + name=exchange_entry.multiplier, + value=[0], + type="list", + source=Source(module_id=self.id), + **include, + ) + _admm_variables[exchange_entry.local] = MPCVariable( + name=exchange_entry.local, + value=convert_to_list(exchange_var.value), + alias=alias, + type="list", + source=Source(agent_id=self.agent.id), + shared=True, + **include, + ) + _admm_variables[exchange_entry.mean_diff] = MPCVariable( + name=exchange_entry.mean_diff, + type="list", + source=Source(module_id=self.id), + **include, + ) + lag_val = exchange_var.value or np.nan_to_num( + (exchange_var.ub + exchange_var.lb) / 2, posinf=1000, neginf=1000 + ) + _admm_variables[exchange_entry.lagged] = MPCVariable( + name=exchange_entry.lagged, + value=lag_val, + source=Source(module_id=self.id), + **include, + ) + + # add callback to receive this value + broker_funcs = [ + self.agent.data_broker.deregister_callback, + self.agent.data_broker.register_callback, + ] + + for broker_func in broker_funcs: + broker_func( + alias=alias, + source=None, + callback=self.participant_callback, + ) + self.registered_participants.update({alias: {}}) + return _admm_variables + +
[docs] def collect_variables_for_optimization( + self, var_ref: mpc_datamodels.VariableReference = None + ) -> dict[str, AgentVariable]: + """Gets all variables noted in the var ref and puts them in a flat + dictionary.""" + if var_ref is None: + var_ref = self.var_ref + + # config variables + variables = {v: self.get(v) for v in var_ref.all_variables()} + for coup_entry in var_ref.exchange + var_ref.couplings: + lagged_admm_var = coup_entry.lagged + original_name = coup_entry.name + variable = self.get(original_name) + if original_name in self.history: + past_values = self.history[original_name] + variable = MPCVariable( + name=lagged_admm_var, value=pd.Series(past_values) + ) + variables[lagged_admm_var] = variable + + # history variables + for hist_var in self._lags_dict_seconds: + past_values = self.history[hist_var] + if not past_values: + # if the history of a variable is empty, fallback to the scalar value + continue + + # create copy to not mess up scalar value of original variable in case + # fallback is needed + updated_var = variables[hist_var].copy( + update={"value": pd.Series(past_values)} + ) + variables[hist_var] = updated_var + + return {**variables, **self._internal_variables}
+ + +
[docs]class LocalADMMConfig(ADMMConfig): + sync_delay: float = 0.001 + registration_delay: float = 0.1
+ + +
[docs]class LocalADMM(ADMM): + config: LocalADMMConfig + + @property + def sync_delay(self) -> float: + """Timeout value used to sync local admm processes. Should be very + small.""" + return self.config.sync_delay + + @property + def registration_delay(self) -> float: + """Timeout value used to wait one on registration. Waits in real time + (time.sleep)""" + return self.config.registration_delay + +
[docs] def process(self): + first_registration = True + while True: + start_round = self.env.time + + # Register participants in current round + self.logger.info("Start registration of round at %s.", self.env.now) + self._status = ModuleStatus.at_registration + yield self.env.timeout(self.sync_delay) + + # shift initial values for multipliers and coupling outputs + self._shift_and_send_coupling_outputs() + self._shift_multipliers() + self.pre_computation_hook() + yield self.env.timeout(self.sync_delay) + self._status = ModuleStatus.optimizing + self.logger.info("Finished registration of round") + yield self.env.timeout(self.sync_delay) + + if first_registration: + time.sleep(self.registration_delay) + first_registration = False + + # get optimization inputs + self._set_mean_coupling_values() + opt_inputs = self.collect_variables_for_optimization() + # reset termination criteria + start_iterations = self.env.time + admm_iter = 0 + + # start the ADMM iteration loop + while True: + # Solve local optimization + start_opt = time.time() + updated_couplings = self.collect_couplings_for_optimization() + opt_inputs.update(updated_couplings) + self.logger.info("Solving local optimization #%s.", admm_iter) + self._status = ModuleStatus.optimizing + result = self.optimization_backend.solve(start_iterations, opt_inputs) + self.logger.info("Solved local optimization #%s.", admm_iter) + + # admm coordination step + yield self.env.timeout(self.sync_delay) + self.send_coupling_values(result) + yield self.env.timeout(self.sync_delay) + self._status = ModuleStatus.waiting_for_other_agents + self._receive_variables(start=start_opt) + yield self.env.timeout(self.sync_delay) + self._status = ModuleStatus.updating + self._set_mean_coupling_values() + self.update_lambda() + self.reset_participants_ready() + yield self.env.timeout(self.sync_delay) + + # check termination + admm_iter += 1 + if self._check_termination(admm_iter, start_iterations): + break + + self.deregister_all_participants() + self.set_actuation(result) + self._status = ModuleStatus.sleeping + + time_spent_on_sync_delay = self.env.time - start_round + yield self.env.timeout(self.config.time_step - time_spent_on_sync_delay)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinated.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinated.html new file mode 100644 index 0000000..98e65ec --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinated.html @@ -0,0 +1,340 @@ + + + + + + + + agentlib_mpc.modules.dmpc.admm.admm_coordinated — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc.admm.admm_coordinated

+"""Module implementing the coordinated ADMM module, which works together
+with a coordinator."""
+
+from collections import namedtuple
+from typing import Dict, Optional, List
+import pandas as pd
+import pydantic
+
+from agentlib_mpc.data_structures.mpc_datamodels import MPCVariable
+from .admm import ADMM, ADMMConfig
+from agentlib_mpc.modules.dmpc.employee import MiniEmployee, MiniEmployeeConfig
+from agentlib.utils.validators import convert_to_list
+import agentlib_mpc.data_structures.coordinator_datatypes as cdt
+import agentlib_mpc.data_structures.admm_datatypes as adt
+from agentlib.core import AgentVariable, Agent
+
+
+coupInput = namedtuple("coup_input", ["mean", "lam"])
+
+
+
[docs]class CoordinatedADMMConfig(MiniEmployeeConfig, ADMMConfig): + shared_variable_fields: list[str] = MiniEmployeeConfig.default( + "shared_variable_fields" + ) + ADMMConfig.default("shared_variable_fields") + +
[docs] @pydantic.field_validator("couplings", "exchange") + def couplings_should_have_values(cls, value: List[AgentVariable]): + """Asserts that couplings and exchange have values, as they are needed for + initial guess.""" + for var in value: + if var.value is None: + raise ValueError( + "Couplings and Exchange Variables should have a value, as it is " + "required for the initial guess." + ) + return value
+ + +
[docs]class CoordinatedADMM(MiniEmployee, ADMM): + """ + Module to implement an ADMM agent, which is guided by a coordinator. + Only optimizes based on callbacks. + """ + + config: CoordinatedADMMConfig + + def __init__(self, *, config: dict, agent: Agent): + self._initial_setup = True # flag to check that we don't compile ipopt twice + super().__init__(config=config, agent=agent) + self._optimization_inputs: Dict[str, AgentVariable] = {} + self._create_coupling_alias_to_name_mapping() + self._result: Optional[pd.DataFrame] = None + +
[docs] def process(self): + # send registration request to coordinator + timeout = self.config.registration_interval + + while True: + if not self._registered_coordinator: + guesses, ex_guess = self._initial_coupling_values() + answer = adt.AgentToCoordinator( + local_trajectory=guesses, local_exchange_trajectory=ex_guess + ) + self.set(cdt.REGISTRATION_A2C, answer.to_json()) + yield self.env.timeout(timeout)
+ +
[docs] def registration_callback(self, variable: AgentVariable): + """callback for registration""" + if self._registered_coordinator: + # ignore if registration has already been done + return + + self.logger.debug( + f"receiving {variable.name}={variable.value} from {variable.source}" + ) + # global parameters to define optimisation problem + value = cdt.RegistrationMessage(**variable.value) + if not value.agent_id == self.source.agent_id: + return + options = adt.ADMMParameters(**value.opts) + self._set_admm_parameters(options=options) + guesses, ex_guess = self._initial_coupling_values() + answer = adt.AgentToCoordinator( + local_trajectory=guesses, local_exchange_trajectory=ex_guess + ) + + self._registered_coordinator = variable.source + self.set(cdt.REGISTRATION_A2C, answer.to_json())
+ + def _after_config_update(self): + # use some hacks to set jit false for the first time this function is called + if ( + self.config.optimization_backend.get("do_jit", False) + and self._initial_setup + ): + do_jit = True + self.config.optimization_backend["do_jit"] = False + else: + do_jit = False + super()._after_config_update() + if self._initial_setup: + self.config.optimization_backend["do_jit"] = do_jit + self._initial_setup = False + +
[docs] def get_new_measurement(self): + """ + Retrieve new measurement from relevant sensors + Returns: + + """ + opt_inputs = self.collect_variables_for_optimization() + opt_inputs[adt.PENALTY_FACTOR] = self.penalty_factor_var + self._optimization_inputs = opt_inputs
+ + def _create_coupling_alias_to_name_mapping(self): + """ + creates a mapping of alias to the variable names for multiplier and + global mean that the optimization backend recognizes + Returns: + + """ + alias_to_input_names = {} + for coupling in self.var_ref.couplings: + coup_variable = self.get(coupling.name) + coup_in = coupInput(mean=coupling.mean, lam=coupling.multiplier) + alias_to_input_names[coup_variable.alias] = coup_in + for coupling in self.var_ref.exchange: + coup_variable = self.get(coupling.name) + coup_in = coupInput(mean=coupling.mean_diff, lam=coupling.multiplier) + alias_to_input_names[coup_variable.alias] = coup_in + self._alias_to_input_names = alias_to_input_names + +
[docs] def optimize(self, variable: AgentVariable): + """ + Performs the optimization given the mean trajectories and multipliers from the + coordinator. + Replies with the local optimal trajectories. + Returns: + + """ + # unpack message + updates = adt.CoordinatorToAgent.from_json(variable.value) + if not updates.target == self.source.agent_id: + return + self.logger.debug("Received update from Coordinator.") + + # load mpc inputs and current coupling inputs of this iteration + opt_inputs = self._optimization_inputs.copy() + + # add the coupling inputs of this iteration to the other mpc inputs + for alias, multiplier in updates.multiplier.items(): + coup_in = self._alias_to_input_names[alias] + opt_inputs[coup_in.lam] = MPCVariable(name=coup_in.lam, value=multiplier) + opt_inputs[coup_in.mean] = MPCVariable( + name=coup_in.mean, value=updates.mean_trajectory[alias] + ) + for alias, multiplier in updates.exchange_multiplier.items(): + coup_in = self._alias_to_input_names[alias] + opt_inputs[coup_in.lam] = MPCVariable(name=coup_in.lam, value=multiplier) + opt_inputs[coup_in.mean] = MPCVariable( + name=coup_in.mean, value=updates.mean_diff_trajectory[alias] + ) + + opt_inputs[adt.PENALTY_FACTOR].value = updates.penalty_parameter + # perform optimization + self._result = self.optimization_backend.solve( + now=self._start_optimization_at, current_vars=opt_inputs + ) + + # send optimizationData back to coordinator to signal finished + # optimization. Select only trajectory where index is at least zero, to not + # send lags + cons_traj = {} + exchange_traj = {} + for coup in self.config.couplings: + cons_traj[coup.alias] = self._result[ + coup.name + ] # we can serialize numpy now, maybe make this easier + for exchange in self.config.exchange: + exchange_traj[exchange.alias] = self._result[exchange.name] + + opt_return = adt.AgentToCoordinator( + local_trajectory=cons_traj, local_exchange_trajectory=exchange_traj + ) + self.logger.debug("Sent optimal solution.") + self.set(name=cdt.OPTIMIZATION_A2C, value=opt_return.to_json())
+ + def _finish_optimization(self): + """ + Finalize an iteration. Usually, this includes setting the actuation. + Returns: + + """ + # this check catches the case, where the agent was not alive / registered at + # the start of the round and thus did not participate and has no result + # Since the finish-signal of the coordinator is broadcast, it will trigger this + # function even if the agent did not participate in the optimization before + if self._result is not None: + self.set_actuation(self._result) + self._result = None + + def _set_admm_parameters(self, options: adt.ADMMParameters): + """Sets new admm parameters, re-initializes the optimization problem + and returns an initial guess of the coupling variables.""" + + # update the config with new parameters + new_config_dict = self.config.model_dump() + new_config_dict.update( + { + adt.PENALTY_FACTOR: options.penalty_factor, + cdt.TIME_STEP: options.time_step, + cdt.PREDICTION_HORIZON: options.prediction_horizon, + } + ) + self.config = new_config_dict + self.logger.info("%s: Reinitialized optimization problem.", self.agent.id) + + def _initial_coupling_values(self) -> tuple[Dict[str, list], Dict[str, list]]: + """Gets the initial coupling values with correct trajectory length.""" + grid_len = len(self.optimization_backend.coupling_grid) + guesses = {} + exchange_guesses = {} + for var in self.config.couplings: + val = convert_to_list(var.value) + # this overrides more precise guesses, but is more stable + guesses[var.alias] = [val[0]] * grid_len + for var in self.config.exchange: + val = convert_to_list(var.value) + exchange_guesses[var.alias] = [val[0]] * grid_len + return guesses, exchange_guesses + +
[docs] def init_iteration_callback(self, variable: AgentVariable): + """Callback that answers the coordinators init_iteration flag.""" + if self._registered_coordinator: + super().init_iteration_callback(variable)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinator.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinator.html new file mode 100644 index 0000000..a6eb793 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/admm/admm_coordinator.html @@ -0,0 +1,781 @@ + + + + + + + + agentlib_mpc.modules.dmpc.admm.admm_coordinator — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc.admm.admm_coordinator

+"""
+Defines classes that coordinate an ADMM process.
+"""
+
+import os
+import time
+from ast import literal_eval
+from pathlib import Path
+from typing import Dict, List, Optional
+import queue
+import logging
+from dataclasses import asdict
+import threading
+import math
+
+from pydantic import field_validator, Field
+import numpy as np
+import pandas as pd
+
+from agentlib.core.agent import Agent
+from agentlib.core.datamodels import AgentVariable, Source
+from pydantic_core.core_schema import FieldValidationInfo
+
+from agentlib_mpc.data_structures import coordinator_datatypes as cdt
+from agentlib_mpc.modules.dmpc.coordinator import Coordinator, CoordinatorConfig
+import agentlib_mpc.data_structures.admm_datatypes as adt
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class ADMMCoordinatorConfig(CoordinatorConfig): + """Hold the config for ADMMCoordinator""" + + penalty_factor: float = Field( + title="penalty_factor", + default=10, + description="Penalty factor of the ADMM algorithm. Should be equal " + "for all agents.", + ) + wait_time_on_start_iters: float = Field( + title="wait_on_start_iterations", + default=0.1, + description="wait_on_start_iterations", + ) + registration_period: float = Field( + title="registration_period", + default=5, + description="Time spent on registration before each optimization", + ) + admm_iter_max: int = Field( + title="admm_iter_max", + default=20, + description="Maximum number of ADMM iterations before termination of control " + "step.", + ) + time_step: float = Field( + title="time_step", + default=600, # seconds + description="Sampling interval of between two control steps. Will be used in " + "the discretization for MPC.", + ) + sampling_time: Optional[float] = Field( + default=None, # seconds + description="Sampling interval for control steps. If None, will be the same as" + " time step. Does not affect the discretization of the MPC, " + "only the interval with which there will be optimization steps.", + validate_default=True, + ) + prediction_horizon: int = Field( + title="prediction_horizon", + default=10, + description="Prediction horizon of participating agents.", + ) + abs_tol: float = Field( + title="abs_tol", + default=1e-3, + description="Absolute stopping criterion.", + ) + rel_tol: float = Field( + title="rel_tol", + default=1e-3, + description="Relative stopping criterion.", + ) + primal_tol: float = Field( + default=1e-3, + description="Absolute primal stopping criterion.", + ) + dual_tol: float = Field( + default=1e-3, + description="Absolute dual stopping criterion.", + ) + use_relative_tolerances: bool = Field( + default=True, + description="If True, use abs_tol and rel_tol, if False us prim_tol and " + "dual_tol.", + ) + penalty_change_threshold: float = Field( + default=-1, + description="When the primal residual is x times higher, vary the penalty " + "parameter and vice versa.", + ) + penalty_change_factor: float = Field( + default=2, # seconds + description="Factor to vary the penalty parameter with.", + ) + save_solve_stats: bool = Field( + default=False, + description="When True, saves the solve stats to a file.", + ) + solve_stats_file: str = Field( + default="admm_stats.csv", # seconds + description="File name for the solve stats.", + ) + save_iter_interval: int = Field( + default=1000, + ) + +
[docs] @field_validator("solve_stats_file") + @classmethod + def solve_stats_file_is_csv(cls, file: str): + assert file.endswith(".csv") + return file
+ +
[docs] @field_validator("sampling_time") + @classmethod + def default_sampling_time(cls, samp_time, info: FieldValidationInfo): + if samp_time is None: + samp_time = info.data["time_step"] + return samp_time
+ + +
[docs]class ADMMCoordinator(Coordinator): + config: ADMMCoordinatorConfig + + def __init__(self, *, config: dict, agent: Agent): + if agent.env.config.rt: + self.process = self._realtime_process + self.registration_callback = self._real_time_registration_callback + else: + self.process = self._fast_process + self.registration_callback = self._sequential_registration_callback + + super().__init__(config=config, agent=agent) + self._coupling_variables: Dict[str, adt.ConsensusVariable] = {} + self._exchange_variables: Dict[str, adt.ExchangeVariable] = {} + self._agents_to_register = queue.Queue() + self.agent_dict: Dict[str, adt.AgentDictEntry] = {} + self._registration_queue: queue.Queue = queue.Queue() + self._registration_lock: threading.Lock = threading.Lock() + self.penalty_parameter = self.config.penalty_factor + self._iteration_stats: pd.DataFrame = pd.DataFrame( + columns=["primal_residual", "dual_residual"] + ) + self._primal_residuals_tracker: List[float] = [] + self._dual_residuals_tracker: List[float] = [] + self._penalty_tracker: List[float] = [] + self._performance_tracker: List[float] = [] + self.start_algorithm_at: float = 0 + self._performance_counter: float = time.perf_counter() + + def _realtime_process(self): + """Starts a thread to run next to the environment (to prevent a long blocking + process). Periodically informs the thread of the next optimization.""" + self._start_algorithm = threading.Event() + + thread_proc = threading.Thread( + target=self._realtime_process_thread, + name=f"{self.source}_ProcessThread", + daemon=True, + ) + thread_proc.start() + self.agent.register_thread(thread=thread_proc) + + thread_reg = threading.Thread( + target=self._handle_registrations, + name=f"{self.source}_RegistrationThread", + daemon=True, + ) + thread_reg.start() + self.agent.register_thread(thread=thread_reg) + + while True: + self._start_algorithm.set() + yield self.env.timeout(self.config.sampling_time) + + def _realtime_process_thread(self): + while True: + self._status = cdt.CoordinatorStatus.sleeping + self._start_algorithm.wait() + self._start_algorithm.clear() + with self._registration_lock: + self._realtime_step() + if self._start_algorithm.isSet(): + self.logger.error( + "%s: Start of ADMM round was requested before " + "last one finished. Skipping cycle." + ) + self._start_algorithm.clear() + + def _realtime_step(self): + # ------------------ + # start iteration + # ------------------ + self.status = cdt.CoordinatorStatus.init_iterations + self.start_algorithm_at = self.env.time + self._performance_counter = time.perf_counter() + # maybe this will hold information instead of "True" + self.set(cdt.START_ITERATION_C2A, True) + # check for all_finished here + time.sleep(self.config.wait_time_on_start_iters) + if not list(self._agents_with_status(status=cdt.AgentStatus.ready)): + self.logger.info(f"No Agents available at time {self.env.now}.") + return # if no agents registered return early + self._update_mean_coupling_variables() + self._shift_coupling_variables() + # ------------------ + # iteration loop + # ------------------ + admm_iter = 0 + for admm_iter in range(1, self.config.admm_iter_max + 1): + # ------------------ + # optimization + # ------------------ + # send + self.status = cdt.CoordinatorStatus.optimization + # set all agents to busy + self.trigger_optimizations() + + # check for all finished here + self._wait_for_ready() + + # ------------------ + # perform update steps + # ------------------ + self.status = cdt.CoordinatorStatus.updating + self._update_mean_coupling_variables() + self._update_multipliers() + # ------------------ + # check convergence + # ------------------ + converged = self._check_convergence(admm_iter) + if converged: + self.logger.info("Converged within %s iterations. ", admm_iter) + break + else: + self.logger.warning( + "Did not converge within the maximum number of iterations " "%s. ", + self.config.admm_iter_max, + ) + self._wrap_up_algorithm(iterations=admm_iter) + self.set(cdt.START_ITERATION_C2A, False) # this signals the finish + + def _wait_non_rt(self): + """Returns a triggered event. Cedes control to the simpy event queue for a + short moment. This is required in fast-as-possible simulations, to allow + other agents to react via callbacks.""" + return self.env.timeout(0.001) + + def _fast_process(self): + """Process function for use in fast-as-possible simulations. Regularly yields + control back to the environment, to allow the callbacks to run.""" + yield self._wait_non_rt() + + while True: + # ------------------ + # start iteration + # ------------------ + self.status = cdt.CoordinatorStatus.init_iterations + self.start_algorithm_at = self.env.time + self._performance_counter = time.perf_counter() + self.set(cdt.START_ITERATION_C2A, True) + yield self._wait_non_rt() + if not list(self._agents_with_status(status=cdt.AgentStatus.ready)): + self.logger.info(f"No Agents available at time {self.env.now}.") + communication_time = self.env.time - self.start_algorithm_at + yield self.env.timeout(self.config.sampling_time - communication_time) + continue # if no agents registered return early + self._update_mean_coupling_variables() + self._shift_coupling_variables() + # ------------------ + # iteration loop + # ------------------ + admm_iter = 0 + for admm_iter in range(1, self.config.admm_iter_max + 1): + # ------------------ + # optimization + # ------------------ + # send + self.status = cdt.CoordinatorStatus.optimization + # set all agents to busy + self.trigger_optimizations() + yield self._wait_non_rt() + + # check for all finished here + self._wait_for_ready() + + # ------------------ + # perform update steps + # ------------------ + self.status = cdt.CoordinatorStatus.updating + self._update_mean_coupling_variables() + self._update_multipliers() + # ------------------ + # check convergence + # ------------------ + converged = self._check_convergence(admm_iter) + if converged: + self.logger.info("Converged within %s iterations. ", admm_iter) + break + else: + self.logger.warning( + "Did not converge within the maximum number of iterations " "%s. ", + self.config.admm_iter_max, + ) + self._wrap_up_algorithm(iterations=admm_iter) + self.set(cdt.START_ITERATION_C2A, False) # this signals the finish + self.status = cdt.CoordinatorStatus.sleeping + time_spent_on_communication = self.env.time - self.start_algorithm_at + yield self.env.timeout( + self.config.sampling_time - time_spent_on_communication + ) + + def _update_mean_coupling_variables(self): + """Calculates a new mean of the coupling variables.""" + + active_agents = self._agents_with_status(cdt.AgentStatus.ready) + for variable in self._coupling_variables.values(): + variable.update_mean_trajectory(sources=active_agents) + for variable in self._exchange_variables.values(): + variable.update_diff_trajectories(sources=active_agents) + + def _shift_coupling_variables(self): + """""" + for variable in self._coupling_variables.values(): + variable.shift_values_by_one(horizon=self.config.prediction_horizon) + for variable in self._exchange_variables.values(): + variable.shift_values_by_one(horizon=self.config.prediction_horizon) + + def _update_multipliers(self): + """Performs the multiplier update for the coupling variables.""" + rho = self.penalty_parameter + active_agents = self._agents_with_status(cdt.AgentStatus.ready) + for variable in self._coupling_variables.values(): + variable.update_multipliers(rho=rho, sources=active_agents) + for variable in self._exchange_variables.values(): + variable.update_multiplier(rho=rho) + + def _agents_with_status(self, status: cdt.AgentStatus) -> List[Source]: + """Returns an iterator with all agents sources that are currently on + this status.""" + active_agents = [s for (s, a) in self.agent_dict.items() if a.status == status] + return active_agents + + def _check_convergence(self, iteration) -> bool: + """ + Checks the convergence of the algorithm. Returns True if yes, + False if no. + Returns: + Tuple of (converged, primal residual norm, dual residual norm) + + """ + primal_residuals = [] + dual_residuals = [] + active_agents = self._agents_with_status(cdt.AgentStatus.ready) + flat_locals = [] + flat_means = [] + flat_multipliers = [] + + for var in self._coupling_variables.values(): + prim, dual = var.get_residual(rho=self.penalty_parameter) + primal_residuals.extend(prim) + dual_residuals.extend(dual) + locs = var.flat_locals(sources=active_agents) + muls = var.flat_multipliers(active_agents) + flat_locals.extend(locs) + flat_multipliers.extend(muls) + flat_means.extend(var.mean_trajectory) + + for var in self._exchange_variables.values(): + prim, dual = var.get_residual(rho=self.penalty_parameter) + primal_residuals.extend(prim) + dual_residuals.extend(dual) + locs = var.flat_locals(sources=active_agents) + muls = var.multiplier + flat_locals.extend(locs) + flat_multipliers.extend(muls) + flat_means.extend(var.mean_trajectory) + + # primal_residual = np.concatenate(primal_residuals) + # dual_residual = np.concatenate(dual_residuals) + + # compute residuals + prim_norm = np.linalg.norm(primal_residuals) + dual_norm = np.linalg.norm(dual_residuals) + + self._vary_penalty_parameter(primal_residual=prim_norm, dual_residual=dual_norm) + self._penalty_tracker.append(self.penalty_parameter) + self._primal_residuals_tracker.append(prim_norm) + self._dual_residuals_tracker.append(dual_norm) + self._performance_tracker.append( + time.perf_counter() - self._performance_counter + ) + + self.logger.debug( + "Finished iteration %s . \n Primal residual: %s \n Dual residual: " "%s", + iteration, + prim_norm, + dual_norm, + ) + if iteration % self.config.save_iter_interval == 0: + self._save_stats(iterations=iteration) + + if self.config.use_relative_tolerances: + # scaling factors for relative criterion + primal_scaling = max( + np.linalg.norm(flat_locals), + np.linalg.norm(flat_means), # Ax # Bz + ) + dual_scaling = np.linalg.norm(flat_multipliers) + # compute tolerances for this iteration + sqrt_p = math.sqrt(len(flat_multipliers)) + sqrt_n = math.sqrt(len(flat_locals)) # not actually n, but best we can do + eps_pri = ( + sqrt_p * self.config.abs_tol + self.config.rel_tol * primal_scaling + ) + eps_dual = sqrt_n * self.config.abs_tol + self.config.rel_tol * dual_scaling + converged = prim_norm < eps_pri and dual_norm < eps_dual + else: + converged = ( + prim_norm < self.config.primal_tol and dual_norm < self.config.dual_tol + ) + + if converged: + return True + return False + + def _save_stats(self, iterations: int) -> None: + """ + Args: + iterations: Which iteration of the ADMM algorithm are we when this function + is called? + """ + section_length = len(self._penalty_tracker) + section_start = iterations - section_length + index = [ + (self.start_algorithm_at, i + section_start) for i in range(section_length) + ] + + path = Path(self.config.solve_stats_file) + header = not path.is_file() + stats = pd.DataFrame( + { + "primal_residual": self._primal_residuals_tracker, + "dual_residual": self._dual_residuals_tracker, + "penalty_parameter": self._penalty_tracker, + "wall_time": self._performance_tracker, + }, + index=index, + ) + self._penalty_tracker = [] + self._dual_residuals_tracker = [] + self._primal_residuals_tracker = [] + self._performance_tracker = [] + path.parent.mkdir(exist_ok=True, parents=True) + stats.to_csv(path_or_buf=path, header=header, mode="a") + + def _vary_penalty_parameter(self, primal_residual: float, dual_residual: float): + """Determines a new value for the penalty parameter based on residuals.""" + mu = self.config.penalty_change_threshold + tau = self.config.penalty_change_factor + + if mu <= 1: + # do not perform varying penalty method if the threshold is set below 1 + return + + if primal_residual > mu * dual_residual: + self.penalty_parameter = self.penalty_parameter * tau + elif dual_residual > mu * primal_residual: + self.penalty_parameter = self.penalty_parameter / tau + +
[docs] def trigger_optimizations(self): + """ + Triggers the optimization for all agents with status ready. + Returns: + + """ + + # create an iterator for all agents which are ready for this round + active_agents: [str, adt.AgentDictEntry] = ( + (s, a) + for (s, a) in self.agent_dict.items() + if a.status == cdt.AgentStatus.ready + ) + + # aggregate and send trajectories per agent + for source, agent in active_agents: + # collect mean and multiplier per coupling variable + mean_trajectories = {} + multipliers = {} + for alias in agent.coup_vars: + coup_var = self._coupling_variables[alias] + mean_trajectories[alias] = coup_var.mean_trajectory + multipliers[alias] = coup_var.multipliers[source] + diff_trajectories = {} + multiplier = {} + for alias in agent.exchange_vars: + coup_var = self._exchange_variables[alias] + diff_trajectories[alias] = coup_var.diff_trajectories[source] + multiplier[alias] = coup_var.multiplier + + # package all coupling inputs needed for an agent + coordi_to_agent = adt.CoordinatorToAgent( + mean_trajectory=mean_trajectories, + multiplier=multipliers, + exchange_multiplier=multiplier, + mean_diff_trajectory=diff_trajectories, + target=source.agent_id, + penalty_parameter=self.penalty_parameter, + ) + + self.logger.debug("Sending to %s with source %s", agent.name, source) + self.logger.debug("Set %s to busy.", agent.name) + + # send values + agent.status = cdt.AgentStatus.busy + self.set(cdt.OPTIMIZATION_C2A, coordi_to_agent.to_json())
+ +
[docs] def register_agent(self, variable: AgentVariable): + """Registers the agent, after it sent its initial guess with correct + vector length.""" + value = adt.AgentToCoordinator.from_json(variable.value) + src = variable.source + ag_dict_entry = self.agent_dict[variable.source] + + # loop over coupling variables of this agent + for alias, traj in value.local_trajectory.items(): + coup_var = self._coupling_variables.setdefault( + alias, adt.ConsensusVariable() + ) + + # initialize Lagrange-Multipliers and local solution + coup_var.multipliers[src] = [0] * len(traj) + coup_var.local_trajectories[src] = traj + ag_dict_entry.coup_vars.append(alias) + + # loop over coupling variables of this agent + for alias, traj in value.local_exchange_trajectory.items(): + coup_var = self._exchange_variables.setdefault( + alias, adt.ExchangeVariable() + ) + + # initialize Lagrange-Multipliers and local solution + coup_var.multiplier = [0] * len(traj) + coup_var.local_trajectories[src] = traj + ag_dict_entry.exchange_vars.append(alias) + + # set agent from pending to standby + ag_dict_entry.status = cdt.AgentStatus.standby + self.logger.info( + f"Coordinator successfully registered agent {variable.source}." + )
+ +
[docs] def optim_results_callback(self, variable: AgentVariable): + """ + Saves the results of a local optimization. + Args: + variable: + + Returns: + + """ + local_result = adt.AgentToCoordinator.from_json(variable.value) + source = variable.source + for alias, trajectory in local_result.local_trajectory.items(): + coup_var = self._coupling_variables[alias] + coup_var.local_trajectories[source] = trajectory + for alias, trajectory in local_result.local_exchange_trajectory.items(): + coup_var = self._exchange_variables[alias] + coup_var.local_trajectories[source] = trajectory + + self.agent_dict[variable.source].status = cdt.AgentStatus.ready + self.received_variable.set()
+ + def _send_parameters_to_agent(self, variable: AgentVariable): + """Sends an agent the global parameters after a signup request.""" + admm_parameters = adt.ADMMParameters( + prediction_horizon=self.config.prediction_horizon, + time_step=self.config.time_step, + penalty_factor=self.config.penalty_factor, + ) + + message = cdt.RegistrationMessage( + agent_id=variable.source.agent_id, opts=asdict(admm_parameters) + ) + self.set(cdt.REGISTRATION_C2A, asdict(message)) + +
[docs] def registration_callback(self, variable: AgentVariable): + self.logger.debug(f"receiving {variable.name} from {variable.source}") + if not (variable.source in self.agent_dict): + self.agent_dict[variable.source] = adt.AgentDictEntry( + name=variable.source, + status=cdt.AgentStatus.pending, + ) + self._send_parameters_to_agent(variable) + self.logger.info( + f"Coordinator got request agent {variable.source} and set to " + f"'pending'." + ) + return + # complete registration of pending agents + if self.agent_dict[variable.source].status is cdt.AgentStatus.pending: + self.register_agent(variable=variable)
+ + def _sequential_registration_callback(self, variable: AgentVariable): + """Handles the registration for sequential i.e. local coordinators. Variables + are handled immediately.""" + self.logger.debug(f"receiving {variable.name} from {variable.source}") + self._initial_registration(variable) + + def _real_time_registration_callback(self, variable: AgentVariable): + """Handles the registration for realtime coordinators. Variables are put in a + queue and a thread registers them when it is safe to do so.""" + self.logger.debug(f"receiving {variable.name} from {variable.source}") + self._registration_queue.put(variable) + + def _initial_registration(self, variable: AgentVariable): + """Handles initial registration of a variable. If it is unknown, add it to + the agent_dict and send it the global parameters. If it is sending its + confirmation with initial trajectories, + refer to the actual registration function.""" + if not (variable.source in self.agent_dict): + self.agent_dict[variable.source] = adt.AgentDictEntry( + name=variable.source, + status=cdt.AgentStatus.pending, + ) + self._send_parameters_to_agent(variable) + self.logger.info( + f"Coordinator got request agent {variable.source} and set to " + f"'pending'." + ) + + # complete registration of pending agents + elif self.agent_dict[variable.source].status is cdt.AgentStatus.pending: + self.register_agent(variable=variable) + + def _handle_registrations(self): + """Performs registration tasks while the algorithm is on standby.""" + + while True: + # add new agent to dict and send them global parameters + variable = self._registration_queue.get() + + with self._registration_lock: + self._initial_registration(variable) + + def _wrap_up_algorithm(self, iterations): + self._save_stats(iterations=iterations) + self.penalty_parameter = self.config.penalty_factor + +
[docs] def get_results(self) -> pd.DataFrame: + """Reads the results on iteration data if they were saved.""" + results_file = self.config.solve_stats_file + try: + df = pd.read_csv(results_file, index_col=0, header=0) + new_ind = [literal_eval(i) for i in df.index] + df.index = pd.MultiIndex.from_tuples(new_ind) + return df + except FileNotFoundError: + self.logger.error("Results file %s was not found.", results_file) + return pd.DataFrame()
+ +
[docs] def cleanup_results(self): + results_file = self.config.solve_stats_file + if not results_file: + return + os.remove(results_file)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/coordinator.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/coordinator.html new file mode 100644 index 0000000..474f3cb --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/coordinator.html @@ -0,0 +1,374 @@ + + + + + + + + agentlib_mpc.modules.dmpc.coordinator — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc.coordinator

+import logging
+import time
+from dataclasses import asdict
+from typing import Dict
+import threading
+
+from pydantic import Field
+
+from agentlib.core import (
+    BaseModule,
+    BaseModuleConfig,
+    AgentVariable,
+    Agent,
+    Source,
+    AgentVariables,
+)
+from agentlib_mpc.data_structures.coordinator_datatypes import (
+    AgentStatus,
+    RegistrationMessage,
+)
+import agentlib_mpc.data_structures.coordinator_datatypes as cdt
+
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class CoordinatorConfig(BaseModuleConfig): + maxIter: int = Field(default=10, description="Maximum number of iterations") + time_out_non_responders: float = Field( + default=1, description="Maximum wait time for subsystems in seconds" + ) + messages_in: AgentVariables = [ + AgentVariable(name=cdt.REGISTRATION_A2C), + AgentVariable(name=cdt.START_ITERATION_A2C), + AgentVariable(name=cdt.OPTIMIZATION_A2C), + ] + messages_out: AgentVariables = [ + AgentVariable(name=cdt.REGISTRATION_C2A), + AgentVariable(name=cdt.START_ITERATION_C2A), + AgentVariable(name=cdt.OPTIMIZATION_C2A), + ] + shared_variable_fields: list[str] = ["messages_out"]
+ + +
[docs]class Coordinator(BaseModule): + """Class implementing the base coordination for distributed MPC""" + + config: CoordinatorConfig + + def __init__(self, *, config: dict, agent: Agent): + super().__init__(config=config, agent=agent) + self.agent_dict: Dict[Source, cdt.AgentDictEntry] = {} + self.status: cdt.CoordinatorStatus = cdt.CoordinatorStatus.sleeping + self.received_variable = threading.Event() + +
[docs] def process(self): + yield self.env.timeout(0.01) + + while True: + # ------------------ + # start iteration + # ------------------ + self.status = cdt.CoordinatorStatus.init_iterations + # maybe this will hold information instead of "True" + self.set(cdt.START_ITERATION_C2A, True) + # check for all_finished here + time.sleep(1) + # ------------------ + # iteration loop + # ------------------ + for iI in range(self.config.maxIter): + # ------------------ + # optimization + # ------------------ + # send + self.status = cdt.CoordinatorStatus.optimization + # set all agents to busy + self.trigger_optimizations() + + # check for all finished here + self._wait_for_ready() + + # receive + ... + # ------------------ + # perform update steps + # ------------------ + self.status = cdt.CoordinatorStatus.updating + ... + # ------------------ + # check convergence + # ------------------ + ... + + yield self.env.timeout(1)
+ +
[docs] def trigger_optimizations(self): + """ + Triggers the optimization for all agents with status ready. + Returns: + + """ + send = self.agent.data_broker.send_variable + for source, agent in self.agent_dict.items(): + if agent.status == cdt.AgentStatus.ready: + value = agent.optimization_data.to_dict() + self.logger.debug("Sending to %s with source %s", agent.name, source) + self.logger.debug("Set %s to busy.", agent.name) + agent.status = cdt.AgentStatus.busy + message = AgentVariable( + name=cdt.OPTIMIZATION_C2A, + source=source, + value=value, + ) + send(message)
+ +
[docs] def register_callbacks(self): + self.agent.data_broker.register_callback( + alias=cdt.REGISTRATION_A2C, + source=None, + callback=self.registration_callback, + ) + self.agent.data_broker.register_callback( + alias=cdt.START_ITERATION_A2C, + source=None, + callback=self.init_iteration_callback, + ) + self.agent.data_broker.register_callback( + alias=cdt.OPTIMIZATION_A2C, + source=None, + callback=self.optim_results_callback, + )
+ +
[docs] def optim_results_callback(self, variable: AgentVariable): + """ + Saves the results of a local optimization. + Args: + variable: + + Returns: + + """ + + entry = self.agent_dict[variable.source] + entry.optimization_data = cdt.OptimizationData.from_dict(variable.value) + self.agent_dict[variable.source].status = cdt.AgentStatus.ready + self.received_variable.set()
+ +
[docs] def init_iteration_callback(self, variable: AgentVariable): + """ + Processes and Agents InitIteration confirmation. + Args: + variable: + + Returns: + + """ + if not self.status == cdt.CoordinatorStatus.init_iterations: + # maybe set AgentStatus to something meaningful + self.logger.error("Agent did not respond in time!") + return + + if variable.value is not True: + # did not receive acknowledgement + return + + try: + ag_dict_entry = self.agent_dict[variable.source] + except KeyError: + # likely did not finish registration of an agent yet, but the agent + # already has its end registered and responds to the init_iterations. + # Let it wait one round. + return + + self.logger.debug( + "Received 'StartIteration' confirmation from %s", variable.source + ) + if ag_dict_entry.status != cdt.AgentStatus.standby: + # if the status is not standby, the agent might still be in registration + # phase, or something else occurred + return + ag_dict_entry.status = cdt.AgentStatus.ready + self.received_variable.set()
+ + @property + def all_finished(self): + """ + + Returns: + True, if there are no busy agents, else False + + """ + for src, ag_entry in self.agent_dict.items(): + if ag_entry.status is cdt.AgentStatus.busy: + return False + return True + +
[docs] def registration_callback(self, variable: AgentVariable): + self.logger.info( + f"receiving {variable.name}={variable.value} from {variable.source}" + ) + # use information in message to set up coordinator + + if not (variable.source in self.agent_dict): # add agent to dict + entry = cdt.AgentDictEntry( + name=variable.source, + status=AgentStatus.pending, + ) + self.agent_dict[variable.source] = entry + OptimOpts = {"Nhor": 10, "dt": 60} + message = RegistrationMessage( + agent_id=variable.source.agent_id, opts=OptimOpts + ) + self.set(cdt.REGISTRATION_C2A, asdict(message)) # {"source" : + # variable.source, "status" : True, "opts" : OptimOpts} + self.logger.info( + f"Coordinator got request agent {variable.source} and set to " + f"'pending'." + ) + else: # process ready-flag + message = RegistrationMessage(**variable.value) + if message.status == AgentStatus.standby: + self.agent_dict[variable.source].status = AgentStatus.standby # + # change from + # pending to ready + self.logger.info( + f"Coordinator successfully registered agent {variable.source}." + ) + else: + self.agent_dict.pop(variable.source) # delete agent from dict
+ + def _wait_for_ready( + self, + ): + """Wait until all coupling variables arrive from the other systems.""" + + self.received_variable.clear() + self.logger.info("Start waiting for agents to finish computation.") + while True: + # check exit conditions + if self.all_finished: + count = 0 + for ag in self.agent_dict.values(): + if ag.status == cdt.AgentStatus.ready: + count += 1 + self.logger.info("Got variables from all (%s) agents.", count) + break + + # wait until a new item is put in the queue + + if self.received_variable.wait(timeout=self.config.time_out_non_responders): + self.received_variable.clear() + else: + self._deregister_slow_participants() + break + + def _deregister_slow_participants(self): + """Sets all agents that are still busy to standby, so they won't be + waited on again.""" + for agent in self.agent_dict.values(): + if agent.status == cdt.AgentStatus.busy: + agent.status = cdt.AgentStatus.standby + self.logger.info( + "De-registered agent %s as it was too slow.", agent.name + )
+ + +if __name__ == "__main__": + pass +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/employee.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/employee.html new file mode 100644 index 0000000..2c7ae4a --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/dmpc/employee.html @@ -0,0 +1,284 @@ + + + + + + + + agentlib_mpc.modules.dmpc.employee — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.dmpc.employee

+import logging
+from dataclasses import asdict
+import abc
+
+from pydantic import Field
+
+from agentlib.core import (
+    BaseModule,
+    BaseModuleConfig,
+    AgentVariable,
+    Agent,
+    AgentVariables,
+)
+from agentlib.core.datamodels import Source
+from agentlib_mpc.data_structures.coordinator_datatypes import RegistrationMessage
+import agentlib_mpc.data_structures.coordinator_datatypes as cdt
+
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class MiniEmployeeConfig(BaseModuleConfig): + request_frequency: float = Field( + default=1, description="Wait time between signup_requests" + ) + coordinator: Source = Field(description="Define the agents coordinator") + messages_in: AgentVariables = [ + AgentVariable(name=cdt.REGISTRATION_C2A), + AgentVariable(name=cdt.START_ITERATION_C2A), + AgentVariable(name=cdt.OPTIMIZATION_C2A), + ] + messages_out: AgentVariables = [ + AgentVariable(name=cdt.REGISTRATION_A2C), + AgentVariable(name=cdt.START_ITERATION_A2C), + AgentVariable(name=cdt.OPTIMIZATION_A2C), + ] + registration_interval: float = Field( + default=10, + ge=0, + description="Interval in seconds after which a registration attempt is made.", + ) + shared_variable_fields: list[str] = ["messages_out"]
+ + +
[docs]class MiniEmployee(BaseModule): + config: MiniEmployeeConfig + + def __init__(self, *, config: dict, agent: Agent): + super().__init__(config=config, agent=agent) + self._registered_coordinator: Source = None + self._start_optimization_at: float = 0 + +
[docs] def process(self): + # send registration request to coordinator + timeout = self.config.registration_interval + while True: + if not self._registered_coordinator: + self.set(cdt.REGISTRATION_A2C, True) + yield self.env.timeout(timeout)
+ +
[docs] def register_callbacks(self): + # callback used for registration process + coordinator_agent = Source(agent_id=self.config.coordinator.agent_id) + self.agent.data_broker.register_callback( + alias=cdt.REGISTRATION_C2A, + source=coordinator_agent, + callback=self.registration_callback, + ) + # + # call back for iteration start ( + self.agent.data_broker.register_callback( + alias=cdt.START_ITERATION_C2A, + source=coordinator_agent, + callback=self.init_iteration_callback, + ) + # + # call back for optimization ( + self.agent.data_broker.register_callback( + alias=cdt.OPTIMIZATION_C2A, + source=coordinator_agent, + callback=self.optimize, + )
+ +
[docs] def pre_computation_hook(self): + """ + This method is called in every computation step before the optimization starts. + Overwrite this method in a derived subclass if you want to take some actions each time before the optimal control problem is solved. + """ + pass
+ +
[docs] def init_iteration_callback(self, variable: AgentVariable): + """ + Callback that processes the coordinators 'startIteration' flag. + Args: + variable: + + """ + # value is True on start + if variable.value: + self._start_optimization_at = self.env.time + # new measurement + self.get_new_measurement() + # shift trajectories + self.shift_trajectories() + # custom function which can be overloaded to do stuff before a step + self.pre_computation_hook() + + self.set(cdt.START_ITERATION_A2C, True) + self.logger.debug("Sent 'StartIteration' True.") + + # value is False on convergence/iteration limit + else: + self._finish_optimization()
+ +
[docs] def get_new_measurement(self): + """ + Retrieve new measurement from relevant sensors + Returns: + + """ + ...
+ # raise NotImplementedError + + # return self.collect_variables_for_optimization() + + @abc.abstractmethod + def _finish_optimization(self): + """ + Finalize an iteration. Usually, this includes setting the actuation. + Returns: + + """ + +
[docs] @abc.abstractmethod + def optimize(self, variable: AgentVariable): + """ + Performs the optimization given the information from the coordinator. + Replies with local information. + Returns: + + """ + variables = cdt.OptimizationData.from_dict(variable.value) + + # perform optimization + # send optimizationData back to coordinator to signal finished + # optimization + + value = variables.to_dict() + self.logger.debug("Sent optimal solution.") + self.set(name=cdt.OPTIMIZATION_A2C, value=value)
+ +
[docs] def shift_trajectories(self): + """ + Shifts algorithm specific trajectories. + Returns: + + """ + ...
+ # raise NotImplementedError + +
[docs] @abc.abstractmethod + def registration_callback(self, variable: AgentVariable): + """callback for registration""" + self.logger.info( + f"receiving {variable.name}={variable.value} from {variable.source}" + ) + # global parameters to define optimisation problem + value = RegistrationMessage(**variable.value) + + # Decide if message from coordinator is for this agent + if not (value.agent_id == self.source.agent_id): + return + + self.OptimOpts = value.opts + status = True + answer = RegistrationMessage(status=cdt.AgentStatus.standby) + self._registered_coordinator = variable.source + if status: + self.set("registrationOut", asdict(answer))
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/estimation/mhe.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/estimation/mhe.html new file mode 100644 index 0000000..293b5cb --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/estimation/mhe.html @@ -0,0 +1,435 @@ + + + + + + + + agentlib_mpc.modules.estimation.mhe — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.estimation.mhe

+import os
+from typing import Dict, Optional, Tuple
+
+import pandas as pd
+import pydantic
+from agentlib.core import (
+    BaseModuleConfig,
+    BaseModule,
+    Agent,
+    AgentVariable,
+    Source,
+)
+from agentlib.core.errors import ConfigurationError
+from pydantic import Field
+
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.data_structures.mpc_datamodels import Results
+from agentlib_mpc.modules.mpc import create_optimization_backend
+from agentlib_mpc.optimization_backends.backend import (
+    OptimizationBackendT,
+)
+from agentlib_mpc.utils.analysis import load_mpc, load_mpc_stats
+
+AG_VAR_DICT = dict[str, AgentVariable]
+
+
+
[docs]class MHEConfig(BaseModuleConfig): + """ + Pydantic data model for MPC configuration parser + """ + + optimization_backend: dict + time_step: float = Field( + default=60, + ge=0, + description="Time step of the MHE.", + ) + horizon: int = Field( + default=5, + ge=0, + description="Estimation horizon of the MHE.", + ) + known_parameters: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of known parameters of the MHE. They are " + "constant over the horizon. Parameters not listed " + "here will have their default from the model file.", + ) + estimated_parameters: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of unknown parameters of the MHE. They are " + "constant over the horizon and will be estimated.", + ) + known_inputs: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of known input variables of the MHE. Includes " + "controls, disturbances, setpoints, dynamic constraint boundaries etc.", + ) + estimated_inputs: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of unknown input variables of the MHE. Includes " + "mainly disturbances.", + ) # AgentVariables for the initial condition of states to be optimized + states: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of all differential states of the MHE.", + ) + state_weights: dict[str, float] = Field( + title="State Weights", + default={}, + description="Mapping of state names to their weight in the MHE problem. If " + "you are certain with your measurement, chose a high value. If " + "you dont have a measurement / do not trust it, choose 0. Default " + "is 0.", + ) + shared_variable_fields: list[str] = [] + +
[docs] @classmethod + @pydantic.field_validator("state_weights") + def state_weights_are_in_states( + cls, state_weights: dict, info: pydantic.ValidationInfo + ): + state_names = {s.name for s in info.data["states"]} + state_weight_names = set(state_weights) + + missing_names = state_weight_names - state_names + if missing_names: + raise ValueError( + f"The following states defined in state weights do not exist in the " + f"states: {', '.join(missing_names)}" + ) + return state_weights
+ + +
[docs]class MHE(BaseModule): + """ + A moving horizon estimator. + """ + + config_type = MHEConfig + config: MHEConfig + var_ref: mpc_datamodels.MHEVariableReference + + def __init__(self, config: dict, agent: Agent): + """ + Constructor for model predictive controller (MPC). + Args: + config: name of the module + agent: agent the module belongs to + Configs: + outputs (object): + inputs (object): + ts: time step in s + n (int): prediction horizon + nc (int): control horizon (default prediction horizon) + """ + super().__init__(config=config, agent=agent) + + measured_states, weights_states = self._create_auxiliary_variables() + self.measured_states: AG_VAR_DICT = measured_states + self.weights_states: AG_VAR_DICT = weights_states + + # creates a reference of variables, which have to be kept track of in a + # dataframe, to provide a past trajectory for the MHE + self._history_var_names: list[str] = [ + v.name for v in self.config.known_inputs + ] + list(measured_states) + + self.history: pd.DataFrame = pd.DataFrame( + columns=self._history_var_names, dtype=float + ) + + # construct the optimization problem + try: + self._init_optimization() + except (RuntimeError, ValueError) as err: + raise ConfigurationError( + f"The optimization backend of Agent {self.source} could not " + f"finish its setup!" + ) from err + + def _setup_optimization_backend(self) -> OptimizationBackendT: + """Performs the setup of the optimization_backend, keeps track of status""" + self.init_status = mpc_datamodels.InitStatus.during_update + opti_back = create_optimization_backend( + self.config.optimization_backend, self.agent.id + ) + opti_back.register_logger(self.logger) + disc_opts = opti_back.config.discretization_options + disc_opts.time_step = self.config.time_step + return opti_back + + def _setup_var_ref(self) -> mpc_datamodels.MHEVariableReference: + var_ref = mpc_datamodels.MHEVariableReference.from_config(self.config) + var_ref.measured_states = list(self.measured_states) + var_ref.weights_states = list(self.weights_states) + return var_ref + + def _after_config_update(self): + self._create_auxiliary_variables() + self.var_ref = self._setup_var_ref() + self.optimization_backend = self._setup_optimization_backend() + self._init_optimization() + self.init_status = mpc_datamodels.InitStatus.ready + + def _init_optimization(self): + """Performs the setup of the optimization backend.""" + self.optimization_backend.setup_optimization( + var_ref=self.var_ref, + ) + self.logger.info("%s: Initialized optimization problem.", self.agent.id) + +
[docs] def process(self): + while True: + current_vars = self.collect_variables_for_optimization() + solution = self.optimization_backend.solve( + now=self.env.now, current_vars=current_vars + ) + self._set_estimation(solution) + self._remove_old_values_from_history() + yield self.env.timeout(self.config.time_step)
+ + def _remove_old_values_from_history(self): + """Clears the history of all entries that are older than current time minus + horizon length.""" + backwards_horizon_seconds = self.config.horizon * self.config.time_step + oldest_relevant_time = self.env.now - backwards_horizon_seconds + filt = self.history.index >= oldest_relevant_time + self.history = self.history[filt] + + def _set_estimation(self, solution: Results): + """Sets the estimated variables to the DataBroker.""" + + # parameters are scalars defined at the beginning of the problem, so we send + # the first value in the parameter trajectory + for parameter in self.var_ref.estimated_parameters: + par_val = solution[parameter] + self.set(parameter, par_val) + + # we want to know the most recent value of states and inputs + for var in self.var_ref.states + self.var_ref.estimated_inputs: + value = solution[var][-1] + self.set(var, float(value)) + +
[docs] def register_callbacks(self): + """Registers callbacks which listen to the variables which have to be saved as + time series. These callbacks save the values in the history for use in the + optimization.""" + + for inp in self.var_ref.known_inputs: + var = self.get(inp) + self.agent.data_broker.register_callback( + alias=var.alias, + source=var.source, + callback=self._callback_hist_vars, + name=var.name, + ) + + # registers callback which listens to alias/source of the state variable, but + # gets the name of the measured state as parameter, to correctly save it in the + # history + for state, meas_state in zip(self.var_ref.states, self.var_ref.measured_states): + var = self.get(state) + self.agent.data_broker.register_callback( + alias=var.alias, + source=var.source, + callback=self._callback_hist_vars, + name=meas_state, + )
+ +
[docs] def collect_variables_for_optimization( + self, var_ref: mpc_datamodels.MHEVariableReference = None + ) -> Dict[str, AgentVariable]: + """Gets all variables noted in the var ref and puts them in a flat + dictionary. The MHE Version of this function has to perform some checks and + lookups extra, since variables come from different sources, and some need to + incorporate trajectories of past values.""" + if var_ref is None: + var_ref = self.var_ref + + # first fetch all variables with get, that are in the config + all_variables = {v: self.get(v) for v in var_ref.all_variables()} + + # then, collect the variables for the weights and measured states, that have + # been generated and are not in the config + for ms_name, ms_var in self.measured_states.items(): + all_variables[ms_name] = ms_var.copy() + for w_name, w_var in self.weights_states.items(): + all_variables[w_name] = w_var.copy() + + # for values whose past trajectory is required in the optimization, set the + # var value to that trajectory + for hist_var in self._history_var_names: + past_values = self.history[hist_var].dropna() + if not any(past_values): + # if the history of a variable is empty, fallback to the scalar value + continue + + # create copy to not mess up scalar value of original variable in case + # fallback is needed + all_variables[hist_var].value = past_values + + return all_variables
+ + def _callback_hist_vars(self, variable: AgentVariable, name: str): + """Adds received measured inputs to the past trajectory.""" + self.history.loc[variable.timestamp, name] = variable.value + + def _create_auxiliary_variables(self) -> tuple[AG_VAR_DICT, AG_VAR_DICT]: + """Creates variables holding the weights and measurements of the states""" + states: mpc_datamodels.MPCVariables = self.config.states + measured_states: dict[str, AgentVariable] = {} + weights_states: dict[str, AgentVariable] = {} + for state in states: + weight_name = "weight_" + state.name + measurement_name = "measured_" + state.name + + weights_states[weight_name] = mpc_datamodels.MPCVariable( + name=weight_name, + value=self.config.state_weights.get(state.name, 0), + type="float", + source=Source(module_id=self.id), + ) + measured_states[measurement_name] = mpc_datamodels.MPCVariable( + name=measurement_name, + value=pd.Series(state.value), + type="pd.Series", + source=state.source, + ) + self.weights_states = weights_states + self.measured_states = measured_states + return measured_states, weights_states + +
[docs] def get_results(self) -> Optional[pd.DataFrame]: + """Read the results that were saved from the optimization backend and + returns them as Dataframe. + + Returns: + (results, stats) tuple of Dataframes. + """ + results_file = self.optimization_backend.config.results_file + try: + results, _ = self.read_results_file(results_file) + return results + except FileNotFoundError: + self.logger.error("Results file %s was not found.", results_file) + return None
+ +
[docs] @staticmethod + def read_results_file(results_file: str) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + Read the provided csv-file as an MPC results file. + Args: + results_file: File path + + Returns: + results, stats + results is the Dataframe with all inputs and outputs of the MPC + optimizations. + stats is the Dataframe with matching solver stats + """ + results = load_mpc(results_file) + stats = load_mpc_stats(results_file) + return results, stats
+ +
[docs] def cleanup_results(self): + results_file = self.optimization_backend.config.results_file + if not results_file: + return + os.remove(results_file) + os.remove(mpc_datamodels.stats_path(results_file))
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/minlp_mpc.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/minlp_mpc.html new file mode 100644 index 0000000..59f074e --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/minlp_mpc.html @@ -0,0 +1,200 @@ + + + + + + + + agentlib_mpc.modules.minlp_mpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.minlp_mpc

+import logging
+
+from pydantic import field_validator, Field
+
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.data_structures.mpc_datamodels import MINLPVariableReference
+from agentlib_mpc.modules.mpc import BaseMPCConfig, BaseMPC
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class MINLPMPCConfig(BaseMPCConfig): + """ + Pydantic data model for MPC configuration parser + """ + + # AgentVariables for the controls to be optimized + binary_controls: mpc_datamodels.MPCVariables = Field( + default=[], description="List of all binary control variables of the MPC. " + ) + +
[docs] @field_validator("binary_controls") + @classmethod + def validate_binary_bounds(cls, binary_controls: mpc_datamodels.MPCVariables): + """Assures all binary variables have 0 and 1 as boundaries.""" + for bc in binary_controls: + if bc.ub == 1 and bc.lb == 1: + continue + logger.warning( + f"Binary variable {bc.name} does not have bounds '0, 1'. This will be" + f" automatically changed." + ) + bc.ub = 1 + bc.lb = 0 + return binary_controls
+ + +
[docs]class MINLPMPC(BaseMPC): + config: MINLPMPCConfig + + def _setup_var_ref(self) -> mpc_datamodels.VariableReferenceT: + return MINLPVariableReference.from_config(self.config) + +
[docs] def assert_mpc_variables_are_in_model(self): + """ + Checks whether all variables of var_ref are contained in the model. + Returns names of model variables not contained in the var_ref, + sorted by keys: 'states', 'inputs', 'outputs', 'parameters'. + """ + + # arguments for validation function: + # (key in var_ref, model names, str for head error message) + args = [ + ( + "states", + self.model.get_state_names(), + "Differential variables / States", + ), + ("controls", self.model.get_input_names(), "Controls"), + ("binary_controls", self.model.get_input_names(), "Binary Controls"), + ("inputs", self.model.get_input_names(), "Inputs"), + ("outputs", self.model.get_output_names(), "Outputs"), + ("parameters", self.model.get_parameter_names(), "Parameters"), + ] + + # perform validations and make a dictionary of unassigned variables + unassigned_by_mpc_var = { + key: self.assert_subset(self.var_ref.__dict__[key], names, message) + for key, names, message in args + } + + # fix unassigned values for inputs + intersection_input = set.intersection( + unassigned_by_mpc_var["controls"], + unassigned_by_mpc_var["inputs"], + unassigned_by_mpc_var["binary_controls"], + ) + + # return dict should have model variables as keys, not mpc variables + unassigned_by_model_var = { + "states": unassigned_by_mpc_var["states"], + "inputs": intersection_input, + "outputs": unassigned_by_mpc_var["outputs"], + "parameters": unassigned_by_mpc_var["parameters"], + } + + return unassigned_by_model_var
+ +
[docs] def set_actuation(self, solution): + """Takes the solution from optimization backend and sends the first + step to AgentVariables.""" + super().set_actuation(solution) + for b_control in self.var_ref.binary_controls: + # take the first entry of the control trajectory + actuation = solution[b_control][0] + self.set(b_control, actuation)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/data_reduction.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/data_reduction.html new file mode 100644 index 0000000..6643b38 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/data_reduction.html @@ -0,0 +1,203 @@ + + + + + + + + agentlib_mpc.modules.ml_model_training.data_reduction — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.ml_model_training.data_reduction

+"""Code stolen from Max Berktold"""
+
+import numpy as np
+from sklearn import kernel_approximation
+from abc import ABC, abstractmethod
+from sklearn.gaussian_process.kernels import Kernel, RBF
+
+
+
[docs]class InducingPoints(ABC): + """ + The idea is to reduce the effective number of input data points x to the GP + from n to m, with m<n, where the set of m points are called inducing points. + Since this makes the effective covariance matrix K smaller, + many inducing point approaches reduce the computational complexity from O(n3) to O(nm2). + The smaller m is, the bigger the speed up. + + Source: https://bwengals.github.io/inducing-point-methods-to-speed-up-gps.html + """ + + def __init__(self): + pass + +
[docs] @abstractmethod + def reduce( + self, + x: np.ndarray, + y: np.ndarray, + plot_distance_matrix: bool = True, + ) -> tuple[np.ndarray, np.ndarray]: + pass
+ + +
[docs]class NystroemReducer(InducingPoints): + def __init__(self, n_components: int, kernel: Kernel = None): + super(NystroemReducer, self).__init__() + + if kernel is None: + kernel = RBF() + + self.nystroem = kernel_approximation.Nystroem( + kernel=kernel, n_components=n_components + ) + +
[docs] def reduce( + self, + x: np.ndarray, + y: np.ndarray, + plot_distance_matrix: bool = True, + ) -> tuple[np.ndarray, np.ndarray]: + self.nystroem.fit(x, y) + + return self.nystroem.components_, y[self.nystroem.component_indices_]
+ + +if __name__ == "__main__": + from sklearn.gaussian_process import GaussianProcessRegressor + import matplotlib.pyplot as plt + + n_components = 25 + + def f(x): + "some more or less complex output function" + + return x[:, 0] * 2 + x[:, 1] * x[:, 0] + x[:, 1] * 3 + 1 / x[:, 1] * x[:, 1] + + def get_score(x, y, x_test, y_test, message): + gpr = GaussianProcessRegressor(RBF(), normalize_y=True) + gpr.fit(x, y) + s = gpr.score(x_test, y_test) + + print(message, s, "samples:", x.shape, y.shape) + + return s + + scores = list() + + for i in range(100): + np.random.seed(i) + + x_train = np.random.normal(size=(800, 2), loc=0, scale=10) + y_train = f(x_train) + + x_test = np.random.normal(size=(200, 2), loc=0, scale=10) + y_test = f(x_test) + + x_red, y_red = NystroemReducer(n_components=n_components).reduce( + x_train, y_train + ) + + score_before = get_score(x_train, y_train, x_test, y_test, "before") + score_after = get_score(x_red, y_red, x_test, y_test, "after") + + plt.scatter(x_train.T[0], x_train.T[1], c=y_train) + plt.scatter(x_red.T[0], x_red.T[1], c="black", label="reduced_data") + plt.legend() + plt.title( + f"score_before: {round(score_before, 4)}, score_after: {round(score_after, 4)}\n n_components: {n_components}" + ) + plt.show() +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/ml_model_trainer.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/ml_model_trainer.html new file mode 100644 index 0000000..d50d7bb --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/ml_model_trainer.html @@ -0,0 +1,878 @@ + + + + + + + + agentlib_mpc.modules.ml_model_training.ml_model_trainer — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.ml_model_training.ml_model_trainer

+import abc
+import logging
+import math
+from pathlib import Path
+from typing import Type, TYPE_CHECKING
+
+import numpy as np
+import pandas as pd
+import pydantic
+from agentlib.core import (
+    BaseModuleConfig,
+    Agent,
+    BaseModule,
+    AgentVariables,
+    AgentVariable,
+    Source,
+)
+from agentlib.core.errors import ConfigurationError
+from pydantic_core.core_schema import FieldValidationInfo
+
+from agentlib_mpc.data_structures.ml_model_datatypes import name_with_lag
+from agentlib_mpc.models.casadi_predictor import CasadiPredictor
+from agentlib_mpc.utils.analysis import load_sim
+from agentlib_mpc.models.serialized_ml_model import (
+    SerializedMLModel,
+    SerializedANN,
+    SerializedGPR,
+    SerializedLinReg,
+)
+from agentlib_mpc.models.serialized_ml_model import CustomGPR, MLModels
+from agentlib_mpc.data_structures import ml_model_datatypes
+from agentlib_mpc.data_structures.interpolation import InterpolationMethods
+from agentlib_mpc.utils.plotting.ml_model_test import evaluate_model
+from agentlib_mpc.utils.sampling import sample_values_to_target_grid
+
+from keras import Sequential
+
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class MLModelTrainerConfig(BaseModuleConfig, abc.ABC): + """ + Abstract Base Class for all Trainer Configs. + """ + + step_size: float + retrain_delay: float = pydantic.Field( + default=10000000000, + description="Time in seconds, after which retraining is triggered in regular" + " intervals", + ) + inputs: AgentVariables = pydantic.Field( + default=[], + description="Variables which are inputs of the ML Model that should be trained.", + ) + outputs: AgentVariables = pydantic.Field( + default=[], + description="Variables which are outputs of the ML Model that should be trained.", + ) + lags: dict[str, int] = pydantic.Field( + default={}, + description="Dictionary specifying the lags of each input and output variable. " + "If not specified, will be set to one.", + validate_default=True, + ) + output_types: dict[str, ml_model_datatypes.OutputType] = pydantic.Field( + default={}, + description="Dictionary specifying the output types of output variables. " + "If not specified, will be set to 'difference'.", + validate_default=True, + ) + interpolations: dict[str, InterpolationMethods] = pydantic.Field( + default={}, + description="Dictionary specifying the interpolation types of output variables. " + "If not specified, will be set to 'linear'.", + validate_default=True, + ) + recursive_outputs: dict[str, bool] = pydantic.Field( + default={}, + description="Dictionary specifying whether output variables are recursive, i.e." + " automatically appear as an input as well. If not specified, will" + " be set to 'recursive'.", + validate_default=True, + ) + train_share: float = 0.7 + validation_share: float = 0.15 + test_share: float = 0.15 + save_directory: Path = pydantic.Field( + default=None, description="Path, where created ML Models should be saved." + ) + save_data: bool = pydantic.Field( + default=False, description="Whether the training data should be saved." + ) + save_ml_model: bool = pydantic.Field( + default=False, description="Whether the created ML Models should be saved." + ) + save_plots: bool = pydantic.Field( + default=False, + description="Whether a plot of the created ML Models performance should be saved.", + ) + MLModel: AgentVariable = pydantic.Field( + default=AgentVariable(name="MLModel", value=None), + description="Serialized ML Model which can be sent to other Agents.", + ) + time_series_memory_size: int = pydantic.Field( + default=1_000_000_000, + description="Maximum size of the data which is kept in memory for the ML Model " + "training. If saved data exceeds this value, the oldest data is " + "deleted.", + ) + time_series_length: float = pydantic.Field( + default=10 * 365 * 24 * 3600, + description="Maximum time window of data which is kept for the ML Model training. If" + " saved data is older than current time minus time_series_length, " + "it will be deleted.", + ) + use_values_for_incomplete_data: bool = pydantic.Field( + default=False, + description="Default False. If True, the values of inputs and outputs which are" + " defined in the config will be used for training, in case historic" + " data has not reached the trainer. If False, an Error will be " + "raised when the data is not sufficient.", + ) + data_sources: list[Path] = pydantic.Field( + default=[], + description="List of paths to time series data, which can be loaded on " + "initialization of the agent.", + ) + shared_variable_fields: list[str] = ["MLModel"] + +
[docs] @pydantic.field_validator("train_share", "validation_share", "test_share") + @classmethod + def check_shares_amount_to_one(cls, current_share, info: FieldValidationInfo): + """Makes sure, the shares amount to one.""" + shares = [] + if "train_share" in info.data: + shares.append(info.data["train_share"]) + if "validation_share" in info.data: + shares.append(info.data["validation_share"]) + if "test_share" in info.data: + shares.append(info.data["test_share"]) + shares.append(current_share) + if len(shares) == 3: + if not math.isclose(sum(shares), 1, abs_tol=0.01): + raise ConfigurationError( + f"Provided training, validation and testing shares do not equal " + f"one. Got {sum(shares):.2f} instead." + ) + return current_share
+ +
[docs] @pydantic.field_validator("lags") + @classmethod + def fill_lags(cls, lags, info: FieldValidationInfo): + """Adds lag one to all unspecified lags.""" + all_features = {var.name for var in info.data["inputs"] + info.data["outputs"]} + lag_to_var_diff = set(lags).difference(all_features) + if lag_to_var_diff: + raise ConfigurationError( + f"Specified lags do not appear in variables. The following lags do not" + f" appear in the inputs or outputs of the ML Model: '{lag_to_var_diff}'" + ) + all_lags = {feat: 1 for feat in all_features} + all_lags.update(lags) + return all_lags
+ +
[docs] @pydantic.field_validator("output_types") + @classmethod + def fill_output_types(cls, output_types, info: FieldValidationInfo): + """Adds output type one to all unspecified output types.""" + output_names = {out.name for out in info.data["outputs"]} + type_to_var_diff = set(output_types).difference(output_names) + if type_to_var_diff: + raise ConfigurationError( + f"Specified outputs for output_types do not appear in variables. The " + f"following lags do not appear in the inputs or outputs of the ML Model: " + f"'{type_to_var_diff}'" + ) + all_output_types = {feat: "absolute" for feat in output_names} + all_output_types.update(output_types) + return all_output_types
+ +
[docs] @pydantic.field_validator("interpolations") + @classmethod + def fill_interpolations(cls, interpolations, info: FieldValidationInfo): + """Adds interpolation method to all unspecified methods.""" + all_features = {var.name for var in info.data["inputs"] + info.data["outputs"]} + interp_to_var_diff = set(interpolations).difference(all_features) + if interp_to_var_diff: + raise ConfigurationError( + f"Specified outputs for output_types do not appear in variables. The " + f"following features do not appear in the inputs or outputs of the ML Model: " + f"'{interp_to_var_diff}'" + ) + all_interp_methods = {feat: "linear" for feat in all_features} + all_interp_methods.update(interpolations) + return all_interp_methods
+ +
[docs] @pydantic.field_validator("recursive_outputs") + @classmethod + def fill_recursive_outputs(cls, recursives, info: FieldValidationInfo): + """Adds recursive flag to all unspecified outputs.""" + output_names = {var.name for var in info.data["outputs"]} + recursives_to_var_diff = set(recursives).difference(output_names) + if recursives_to_var_diff: + raise ConfigurationError( + f"Specified outputs for recursive_outputs do not appear in variables. The " + f"following features do not appear in the inputs or outputs of the ML Model: " + f"'{recursives_to_var_diff}'" + ) + all_recursive_flags = {feat: True for feat in output_names} + all_recursive_flags.update(recursives) + return all_recursive_flags
+ +
[docs] @pydantic.field_validator("data_sources") + @classmethod + def check_data_sources_exist(cls, data_sources: list[Path]): + """Checks if all given data sources exist""" + existing_data = [] + for data_src in data_sources: + if data_src.exists(): + existing_data.append(data_src) + else: + logger.error(f"Given data source file {data_src} does not exist.") + return existing_data
+ +
[docs] @pydantic.field_validator("save_data", "save_ml_model") + @classmethod + def check_if_save_path_is_there(cls, save_on: bool, info: FieldValidationInfo): + save_path = info.data["save_directory"] + if save_path is None: + raise ConfigurationError( + "ML Model saving is on, but no save_directory was specified." + ) + return save_on
+ + +
[docs]class MLModelTrainer(BaseModule, abc.ABC): + """ + Abstract Base Class for all Trainer classes. + """ + + config: MLModelTrainerConfig + model_type: Type[SerializedMLModel] + + def __init__(self, config: dict, agent: Agent): + """ + Constructor for model predictive controller (MPC). + """ + super().__init__(config=config, agent=agent) + self.time_series_data = self._initialize_time_series_data() + history_type = dict[str, [tuple[list[float], list[float]]]] + self.history_dict: history_type = { + col: ([], []) for col in self.time_series_data.columns + } + self._data_sources: dict[str, Source] = { + var: None for var in self.time_series_data.columns + } + self.ml_model = self.build_ml_model() + self.input_features, self.output_features = self._define_features() + + @property + def training_info(self) -> dict: + """Returns a dict with relevant config parameters regarding the training.""" + # We exclude all fields of the Base Trainer, as its fields are with regard to + # data handling etc., and other relevant things from base trainer are already + # in the serialized model. + # However, parameters from child classes are relevant to the training of that + # model, and will be included + exclude = set(MLModelTrainerConfig.model_fields) + return self.config.model_dump(exclude=exclude) + +
[docs] def register_callbacks(self): + for feat in self.config.inputs + self.config.outputs: + var = self.get(feat.name) + self.agent.data_broker.register_callback( + alias=var.alias, + source=var.source, + callback=self._callback_data, + name=var.name, + )
+ +
[docs] def process(self): + while True: + yield self.env.timeout(self.config.retrain_delay) + self._update_time_series_data() + serialized_ml_model = self.retrain_model() + self.set(self.config.MLModel.name, serialized_ml_model)
+ + def _initialize_time_series_data(self) -> pd.DataFrame: + """Loads simulation data to initialize the time_series data""" + feature_names = list(self.config.lags.keys()) + time_series_data = {name: pd.Series(dtype=float) for name in feature_names} + for ann_src in self.config.data_sources: + loaded_time_series = load_sim(ann_src) + for column in loaded_time_series.columns: + if column in feature_names: + srs = loaded_time_series[column] + time_series_data[column] = pd.concat( + [time_series_data[column], srs] + ) + + return pd.DataFrame(time_series_data) + +
[docs] def retrain_model(self): + """Trains the model based on the current historic data.""" + sampled = self.resample() + inputs, outputs = self.create_inputs_and_outputs(sampled) + training_data = self.divide_in_tvt(inputs, outputs) + self.fit_ml_model(training_data) + serialized_ml_model = self.serialize_ml_model() + self.save_all(serialized_ml_model, training_data) + return serialized_ml_model
+ +
[docs] def save_all( + self, + serialized_ml_model: SerializedMLModel, + training_data: ml_model_datatypes.TrainingData, + ): + """Saves all relevant data and results of the training process if desired.""" + path = Path(self.config.save_directory, self.agent_and_time) + if self.config.save_data: + training_data.save(path) + if self.config.save_ml_model: + self.save_ml_model(serialized_ml_model, path=path) + if self.config.save_plots: + evaluate_model( + training_data, + CasadiPredictor.from_serialized_model(serialized_ml_model), + save_path=path, + show_plot=False, + )
+ + def _callback_data(self, variable: AgentVariable, name: str): + """Adds received measured inputs to the past trajectory.""" + # check that only data from the same source is used + if self._data_sources[name] is None: + self._data_sources[name] = variable.source + elif self._data_sources[name] != variable.source: + raise ValueError( + f"The trainer module got data from different sources " + f"({self._data_sources[name]}, {variable.source}). This is likely not " + f"intended. Please specify the intended source in the trainer config." + ) + + time_list, value_list = self.history_dict[name] + time_list.append(variable.timestamp) + value_list.append(variable.value) + self.logger.debug( + f"Updated variable {name} with {variable.value} at {variable.timestamp} s." + ) + + def _update_time_series_data(self): + """Clears the history of all entries that are older than current time minus + horizon length.""" + df_list: list[pd.DataFrame] = [] + for feature_name, (time_stamps, values) in self.history_dict.items(): + df = pd.DataFrame({feature_name: values}, index=time_stamps) + df_list.append(df) + self.time_series_data = pd.concat(df_list, axis=1).sort_index() + + data = self.time_series_data + if not data.size: + return + + # delete rows based on how old the data is + cut_off_time = self.env.now - self.config.time_series_length + cut_off_index = data.index.get_indexer([cut_off_time], method="backfill")[0] + data.drop(data.index[:cut_off_index], inplace=True) + + # delete rows if the memory usage is too high + del_rows_at_once = 20 # currently hard-coded + while data.memory_usage().sum() > self.config.time_series_memory_size: + data.drop(data.index[:del_rows_at_once], inplace=True) + +
[docs] @abc.abstractmethod + def build_ml_model(self): + """ + Builds and returns an ann model + """ + pass
+ +
[docs] @abc.abstractmethod + def fit_ml_model(self, training_data: ml_model_datatypes.TrainingData): + """ + Fits the ML Model with the training data. + """ + pass
+ +
[docs] def resample(self) -> pd.DataFrame: + """Samples the available time_series data to the required step size.""" + source_grids = { + col: self.time_series_data[col].dropna().index + for col in self.time_series_data.columns + } + + # check if data for all features is sufficient + features_with_insufficient_data = [] + for feat_name in list(source_grids): + if len(source_grids[feat_name]) < 5: + del source_grids[feat_name] + features_with_insufficient_data.append(feat_name) + if ( + not self.config.use_values_for_incomplete_data + and features_with_insufficient_data + ): + raise RuntimeError( + f"Called ANN Trainer in strict mode but there was insufficient data." + f" Features with insufficient data are: " + f"{features_with_insufficient_data}" + ) + + # make target grid, which spans the maximum length, where data for every feature + # is available + start = max(sg[0] for sg in source_grids.values()) + stop = min(sg[-1] for sg in source_grids.values()) + target_grid = np.arange(start, stop, self.config.step_size) + + # perform interpolation for all features with sufficient length + sampled = {} + for name, sg in source_grids.items(): + single_sampled = sample_values_to_target_grid( + values=self.time_series_data[name].dropna(), + original_grid=sg, + target_grid=target_grid, + method=self.config.interpolations[name], + ) + sampled[name] = single_sampled + sampled_data = pd.DataFrame(sampled, index=target_grid) + + # pad data with fix values when data is incomplete + if self.config.use_values_for_incomplete_data: + length = len(target_grid) + for feat_name in features_with_insufficient_data: + sampled_data[feat_name] = [self.get(feat_name).value] * length + + return sampled_data
+ +
[docs] def serialize_ml_model(self) -> SerializedMLModel: + """ + Serializes the ML Model, sa that it can be saved + as json file. + Returns: + SerializedMLModel version of the passed ML Model. + """ + ann_inputs, ann_outputs = self._define_features() + + serialized_ann = self.model_type.serialize( + model=self.ml_model, + dt=self.config.step_size, + input=ann_inputs, + output=ann_outputs, + training_info=self.training_info, + ) + return serialized_ann
+ +
[docs] def save_ml_model(self, serialized_ml_model: SerializedMLModel, path: Path): + """Saves the ML Model in serialized format.""" + serialized_ml_model.save_serialized_model(path=Path(path, "ml_model.json"))
+ + def _define_features( + self, + ) -> tuple[ + dict[str, ml_model_datatypes.Feature], + dict[str, ml_model_datatypes.OutputFeature], + ]: + """Defines dictionaries for all features of the ANN based on the inputs and + outputs. This will also be the order, in which the serialized ann is exported""" + ann_inputs = {} + for name in self.input_names: + ann_inputs[name] = ml_model_datatypes.Feature( + name=name, + lag=self.config.lags[name], + ) + ann_outputs = {} + for name in self.output_names: + ann_outputs[name] = ml_model_datatypes.OutputFeature( + name=name, + lag=self.config.lags[name], + output_type=self.config.output_types[name], + recursive=self.config.recursive_outputs[name], + ) + return ann_inputs, ann_outputs + + @property + def agent_and_time(self) -> str: + """A string that specifies id and time. Used to create save paths""" + return f"{self.agent.id}_{self.id}_{self.env.now}" + + @property + def input_names(self): + return [inp.name for inp in self.config.inputs] + + @property + def output_names(self): + return [out.name for out in self.config.outputs] + +
[docs] def create_inputs_and_outputs( + self, full_data_sampled: pd.DataFrame + ) -> tuple[pd.DataFrame, pd.DataFrame]: + """Creates extra columns in the data which contain the shifted time-series data + which is lagged accordingly. Returns a tuple (input_data, output_data)""" + # inputs are all inputs, plus recursive outputs with lag + inps = [name_with_lag(v.name, 0) for v in self.config.inputs] + inps.extend( + [ + name_with_lag(v.name, 0) + for v in self.config.outputs + if self.config.recursive_outputs[v.name] + ] + ) + + outs = [v.name for v in self.config.outputs] + input_df = pd.DataFrame(columns=inps) + output_df = pd.DataFrame(columns=(outs)) + + # inputs + for input_name in input_df.columns: + lag: int = self.config.lags[input_name] + for k in range(0, lag): + name = name_with_lag(input_name, k) + input_df[name] = full_data_sampled[input_name].shift(k) + + # output + for output_name in output_df.columns: + output_df[output_name] = self._create_output_column( + name=output_name, column=full_data_sampled[output_name] + ) + + # some rows have nan now due to lags and output shift, we remove them + na_rows = input_df.isna().any(axis=1) + output_df.isna().any(axis=1) + input_df = input_df.loc[~na_rows] + output_df = output_df.loc[~na_rows] + + # we have to make sure the columns are in consistent order, so the network is + # trained in the same way, that its features are defined when exported + columns_ordered = ml_model_datatypes.column_order( + inputs=self.input_features, outputs=self.output_features + ) + input_df = input_df[columns_ordered] + + return input_df, output_df
+ + def _create_output_column(self, name: str, column: pd.Series): + """Creates an output column in the table for training data. Depending on + whether the feature is recursive, or represents a time delta, some changes have + to be made.""" + output_type = self.config.output_types[name] + recursive = self.config.recursive_outputs[name] + if not recursive: + return column + if output_type == ml_model_datatypes.OutputType.difference: + return column.shift(-1) - column + else: # output_type == OutputType.absolute + return column.shift(-1) + +
[docs] def divide_in_tvt( + self, + inputs: pd.DataFrame, + outputs: pd.DataFrame, + ): + """splits the samples into mpc, validating and testing sets""" + + # calculate the sample count and shares + num_of_samples = inputs.shape[0] + n_training = int(self.config.train_share * num_of_samples) + n_validation = n_training + int(self.config.validation_share * num_of_samples) + + # shuffle the data + permutation = np.random.permutation(num_of_samples) + inputs = inputs.iloc[permutation] + outputs = outputs.iloc[permutation] + + # split the data + return ml_model_datatypes.TrainingData( + training_inputs=inputs.iloc[0:n_training], + training_outputs=outputs.iloc[0:n_training], + validation_inputs=inputs.iloc[n_training:n_validation], + validation_outputs=outputs.iloc[n_training:n_validation], + test_inputs=inputs.iloc[n_validation:], + test_outputs=outputs.iloc[n_validation:], + )
+ + +
[docs]class ANNTrainerConfig(MLModelTrainerConfig): + """ + Pydantic data model for ANNTrainer configuration parser + """ + + epochs: int = 100 + batch_size: int = 100 + layers: list[tuple[int, ml_model_datatypes.Activation]] = pydantic.Field( + default=[(16, "sigmoid")], + description="Hidden layers which should be created for the ANN. An ANN always " + "has a BatchNormalization Layer, and an Output Layer the size of " + "the output dimensions. Additional hidden layers can be specified " + "here as a list of tuples: " + "(#neurons of layer, activation function).", + ) + early_stopping: ml_model_datatypes.EarlyStoppingCallback = pydantic.Field( + default=ml_model_datatypes.EarlyStoppingCallback(), + description="Specification of the EarlyStopping Callback for training", + )
+ + +
[docs]class ANNTrainer(MLModelTrainer): + """ + Module that generates ANNs based on received data. + """ + + config: ANNTrainerConfig + model_type = SerializedANN + + def __init__(self, config: dict, agent: Agent): + super().__init__(config, agent) + +
[docs] def build_ml_model(self) -> Sequential: + """Build an ANN with a one layer structure, can only create one ANN""" + from keras import layers + + ann = Sequential() + ann.add(layers.BatchNormalization(axis=1)) + for units, activation in self.config.layers: + ann.add(layers.Dense(units=units, activation=activation)) + ann.add(layers.Dense(units=len(self.config.outputs), activation="linear")) + ann.compile(loss="mse", optimizer="adam") + return ann
+ +
[docs] def fit_ml_model(self, training_data: ml_model_datatypes.TrainingData): + callbacks = [] + if self.config.early_stopping.activate: + callbacks.append(self.config.early_stopping.callback()) + + self.ml_model.fit( + x=training_data.training_inputs, + y=training_data.training_outputs, + validation_data=( + training_data.validation_inputs, + training_data.validation_outputs, + ), + epochs=self.config.epochs, + batch_size=self.config.batch_size, + callbacks=callbacks, + )
+ + +
[docs]class GPRTrainerConfig(MLModelTrainerConfig): + """ + Pydantic data model for GPRTrainer configuration parser + """ + + constant_value_bounds: tuple = (1e-3, 1e5) + length_scale_bounds: tuple = (1e-3, 1e5) + noise_level_bounds: tuple = (1e-3, 1e5) + noise_level: float = 1.5 + normalize: bool = pydantic.Field( + default=False, + description="Defines whether the training data and the inputs are for prediction" + "are normalized before given to GPR.", + ) + scale: float = pydantic.Field( + default=1.0, + description="Defines by which value the output data is divided for training and " + "multiplied after prediction.", + ) + n_restarts_optimizer: int = pydantic.Field( + default=0, + description="Defines the number of restarts of the Optimizer for the " + "gpr_parameters of the kernel.", + )
+ + +
[docs]class GPRTrainer(MLModelTrainer): + """ + Module that generates ANNs based on received data. + """ + + config: GPRTrainerConfig + model_type = SerializedGPR + + def __init__(self, config: dict, agent: Agent): + super().__init__(config, agent) + +
[docs] def build_ml_model(self): + """Build a GPR with a constant Kernel in combination with a white kernel.""" + from sklearn.gaussian_process.kernels import ConstantKernel, RBF, WhiteKernel + + kernel = ConstantKernel( + constant_value_bounds=self.config.constant_value_bounds + ) * RBF(length_scale_bounds=self.config.length_scale_bounds) + WhiteKernel( + noise_level=self.config.noise_level, + noise_level_bounds=self.config.noise_level_bounds, + ) + + gpr = CustomGPR( + kernel=kernel, + copy_X_train=False, + n_restarts_optimizer=self.config.n_restarts_optimizer, + ) + gpr.data_handling.normalize = self.config.normalize + gpr.data_handling.scale = self.config.scale + return gpr
+ +
[docs] def fit_ml_model(self, training_data: ml_model_datatypes.TrainingData): + """Fits GPR to training data""" + if self.config.normalize: + x_train = self._normalize(training_data.training_inputs.to_numpy()) + else: + x_train = training_data.training_inputs + y_train = training_data.training_outputs / self.config.scale + self.ml_model.fit( + X=x_train, + y=y_train, + )
+ + def _normalize(self, x: np.ndarray): + # update the normal and the mean + mean = x.mean(axis=0, dtype=float) + std = x.std(axis=0, dtype=float) + for idx, val in enumerate(std): + if val == 0: + logger.info( + "Encountered zero while normalizing. Continuing with a std of one for this Input." + ) + std[idx] = 1.0 + + if mean is None and std is not None: + raise ValueError("Please update std and mean.") + + # save mean and standard deviation to data_handling + self.ml_model.data_handling.mean = mean.tolist() + self.ml_model.data_handling.std = std.tolist() + + # normalize x and return + return (x - mean) / std
+ + +
[docs]class LinRegTrainerConfig(MLModelTrainerConfig): + """ + Pydantic data model for GPRTrainer configuration parser + """
+ + +
[docs]class LinRegTrainer(MLModelTrainer): + """ + Module that generates ANNs based on received data. + """ + + config: LinRegTrainerConfig + model_type = SerializedLinReg + + def __init__(self, config: dict, agent: Agent): + super().__init__(config, agent) + +
[docs] def build_ml_model(self): + """Build a linear model.""" + from sklearn.linear_model import LinearRegression + + linear_model = LinearRegression() + return linear_model
+ +
[docs] def fit_ml_model(self, training_data: ml_model_datatypes.TrainingData): + """Fits linear model to training data""" + self.ml_model.fit( + X=training_data.training_inputs, + y=training_data.training_outputs, + )
+ + +ml_model_trainer = { + MLModels.ANN: ANNTrainer, + MLModels.GPR: GPRTrainer, + MLModels.LINREG: LinRegTrainer, +} +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/setpoint_generator.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/setpoint_generator.html new file mode 100644 index 0000000..676f697 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/ml_model_training/setpoint_generator.html @@ -0,0 +1,196 @@ + + + + + + + + agentlib_mpc.modules.ml_model_training.setpoint_generator — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.ml_model_training.setpoint_generator

+"""Module which generates random set points within a comfort zone. Code heavily stolen
+from Max Berktold"""
+
+import datetime
+import random
+
+from agentlib.core import BaseModuleConfig, BaseModule, Agent, AgentVariable
+
+
+
[docs]class SetPointGeneratorConfig(BaseModuleConfig): + """ + Pydantic data model for ANNTrainer configuration parser + """ + + target_variable: AgentVariable = AgentVariable(name="target") + day_start: int = 8 + day_end: int = 16 + day_lb: float = 273.15 + 19 + night_lb: float = 273.15 + 16 + day_ub: float = 273.15 + 21 + night_ub: float = 273.15 + 24 + interval: int = 60 * 60 * 4 + shared_variable_fields: list[str] = ["target_variable"]
+ + +
[docs]class SetPointGenerator(BaseModule): + """ + Module that generates and sends random set points based on daytime and values. + """ + + config: SetPointGeneratorConfig + + def __init__(self, config: dict, agent: Agent): + """ + Constructor for model predictive controller (MPC). + """ + super().__init__(config=config, agent=agent) + self.last_randomization: float = self.env.time + lb, ub = self._bounds() + self.current_target = random.uniform(lb, ub) + +
[docs] def register_callbacks(self): ...
+ +
[docs] def process(self): + while True: + self.update_target() + self.set(self.config.target_variable.name, self.current_target) + yield self.env.timeout(self.config.interval)
+ +
[docs] def update_target(self): + """Updates the control target for a given time""" + + time = self.env.time + lb, ub = self._bounds() + + # update target, if enough time has passed or the target violates boundaries + if ( + time - self.last_randomization >= self.config.interval + or self.current_target < lb + or ub < self.current_target + ): + self.current_target = random.uniform(lb, ub) + self.last_randomization = time + self.logger.debug( + f"Set target {self.config.target_variable.name} to " + f"{self.current_target:.2f} {self.config.target_variable.unit}" + )
+ + def _bounds(self) -> tuple[float, float]: + """Returns the lower and upper bound for a given time""" + + if self._is_weekend(): + return self.config.night_lb, self.config.night_ub + + if self._is_daytime(): + return self.config.day_lb, self.config.day_ub + + return self.config.night_lb, self.config.night_ub + + def _is_daytime(self) -> bool: + """Returns True if the given time is during day""" + + time = datetime.datetime.fromtimestamp(self.env.time) + + return self.config.day_start <= time.hour <= self.config.day_end + + def _is_weekend(self) -> bool: + """returns True if the given time is during weekend""" + + time = datetime.datetime.fromtimestamp(self.env.time) + + return 5 <= time.weekday()
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc.html new file mode 100644 index 0000000..f90b61b --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc.html @@ -0,0 +1,508 @@ + + + + + + + + agentlib_mpc.modules.mpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.mpc

+"""Holds the base class for MPCs."""
+
+import os
+from typing import Tuple, Dict, Optional
+
+import pandas as pd
+from pydantic import Field, field_validator
+
+from agentlib.core.datamodels import (
+    AgentVariable,
+)
+from agentlib.core import Model, BaseModule, BaseModuleConfig, Agent
+from agentlib.core.errors import OptionalDependencyError, ConfigurationError
+from agentlib.utils import custom_injection
+from pydantic_core.core_schema import FieldValidationInfo
+
+from agentlib_mpc.data_structures.mpc_datamodels import (
+    VariableReference,
+    InitStatus,
+    Results,
+)
+from agentlib_mpc.optimization_backends import backend_types, uninstalled_backend_types
+from agentlib_mpc.optimization_backends.backend import (
+    OptimizationBackend,
+    OptimizationBackendT,
+)
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.utils.analysis import load_mpc, load_mpc_stats
+
+
+
[docs]class BaseMPCConfig(BaseModuleConfig): + """ + Pydantic data model for MPC configuration parser + """ + + # todo use config of optimization backend in annotation and create like modules + optimization_backend: dict + time_step: float = Field( + default=60, + ge=0, + description="Time step of the MPC.", + ) + prediction_horizon: int = Field( + default=5, + ge=0, + description="Prediction horizon of the MPC.", + ) + sampling_time: Optional[float] = Field( + default=None, # seconds + description="Sampling interval for control steps. If None, will be the same as" + " time step. Does not affect the discretization of the MPC, " + "only the interval with which there will be optimization steps.", + validate_default=True, + ) + parameters: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of model parameters of the MPC. They are " + "constant over the horizon. Parameters not listed " + "here will have their default from the model file.", + ) + inputs: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of all input variables of the MPC. Includes " + "predictions for disturbances, set_points, dynamic " + "constraint boundaries etc.", + ) + outputs: mpc_datamodels.MPCVariables = Field( + default=[], description="List of all shared outputs of the MPC. " + ) + # AgentVariables for the controls to be optimized + controls: mpc_datamodels.MPCVariables = Field( + default=[], description="List of all control variables of the MPC. " + ) + # AgentVariables for the initial condition of states to be optimized + states: mpc_datamodels.MPCVariables = Field( + default=[], + description="List of all differential states of the MPC. The " + "entries can define the boundaries and the source for the measurements", + ) + set_outputs: bool = Field( + default=False, + description="Sets the full output time series to the data broker.", + ) + shared_variable_fields: list[str] = ["outputs", "controls"] + +
[docs] @field_validator("sampling_time") + @classmethod + def default_sampling_time(cls, samp_time, info: FieldValidationInfo): + if samp_time is None: + samp_time = info.data["time_step"] + return samp_time
+ + +
[docs]def create_optimization_backend(optimization_backend, agent_id): + """Set up the optimization_backend""" + optimization_backend = optimization_backend.copy() + if "type" not in optimization_backend: + raise KeyError( + "Given model config does not contain key 'type' (type of the model)." + ) + _type = optimization_backend.pop("type") + optimization_backend["name"] = agent_id + if isinstance(_type, dict): + custom_cls = custom_injection(config=_type) + backend = custom_cls(**optimization_backend) + elif isinstance(_type, str): + if _type in uninstalled_backend_types: + raise OptionalDependencyError( + dependency_name=_type, + dependency_install=uninstalled_backend_types[_type], + ) + if _type not in backend_types: + raise TypeError( + f"Given backend is not a valid internal optimization " + f"backend. Supported backends are " + f"{', '.join(list(backend_types.keys()))}" + ) + backend = backend_types[_type](config=optimization_backend) + else: + raise TypeError( + f"Error loading optimization backend. Config " + f"'type' has to be either str or dict. Got " + f"{type(_type)} instead. " + ) + assert isinstance(backend, OptimizationBackend) + return backend
+ + +
[docs]class BaseMPC(BaseModule): + """ + A model predictive controller. + More info to follow. + """ + + config: BaseMPCConfig + + def __init__(self, config: dict, agent: Agent): + """ + Constructor for model predictive controller (MPC). + Args: + config: name of the module + agent: agent the module belongs to + Configs: + outputs (object): + inputs (object): + ts: time step in s + n (int): prediction horizon + nc (int): control horizon (default prediction horizon) + """ + self.init_status = mpc_datamodels.InitStatus.pre_module_init + super().__init__(config=config, agent=agent) + + # Check that module config and model variables match + unassigned_model_variables = self.assert_mpc_variables_are_in_model() + assert unassigned_model_variables["inputs"] == set(), ( + f"All model inputs must be declared in the MPC config. Model " + f"variable(s) '{unassigned_model_variables['inputs']}' is/are free." + ) + + def _setup_optimization_backend(self) -> OptimizationBackendT: + """Performs the setup of the optimization_backend, keeps track of status""" + self.init_status = mpc_datamodels.InitStatus.during_update + opti_back = create_optimization_backend( + self.config.optimization_backend, self.agent.id + ) + opti_back.register_logger(self.logger) + disc_opts = opti_back.config.discretization_options + disc_opts.prediction_horizon = self.config.prediction_horizon + disc_opts.time_step = self.config.time_step + return opti_back + + def _setup_var_ref(self) -> mpc_datamodels.VariableReferenceT: + return VariableReference.from_config(self.config) + + def _after_config_update(self): + self.var_ref: mpc_datamodels.VariableReferenceT = self._setup_var_ref() + self.optimization_backend: OptimizationBackendT = ( + self._setup_optimization_backend() + ) + self._init_optimization() + self.init_status = mpc_datamodels.InitStatus.ready + +
[docs] def assert_subset(self, mpc_names, model_names, message_head): + """ + Helper function for assert assert_mpc_variables_are_in_model. Asserts + the variables of the var_ref corresponding to ref_key are a subset of + a list of names provided (usually obtained from the model) and prints + out an error if false. Returns the portion of model_names that are + not in the given var_ref. + """ + assert set(mpc_names).issubset(model_names), ( + f"{message_head} of MPC {self.agent.id} are not contained in " + f"model. Names must match. The following variables defined for the " + f"MPC do not appear in the model: " + f"'{set(mpc_names).difference(model_names)}'." + ) + return set(model_names).difference(mpc_names)
+ +
[docs] def assert_mpc_variables_are_in_model(self) -> dict[str, set[str]]: + """ + Checks whether all variables of var_ref are contained in the model. + Returns names of model variables not contained in the var_ref, + sorted by keys: 'states', 'inputs', 'outputs', 'parameters'. + """ + + # arguments for validation function: + # (key in var_ref, model names, str for head error message) + args = [ + ( + "states", + self.model.get_state_names(), + "Differential variables / States", + ), + ("controls", self.model.get_input_names(), "Controls"), + ("inputs", self.model.get_input_names(), "Inputs"), + ("outputs", self.model.get_output_names(), "Outputs"), + ("parameters", self.model.get_parameter_names(), "Parameters"), + ] + + # perform validations and make a dictionary of unassigned variables + unassigned_by_mpc_var = { + key: self.assert_subset(self.var_ref.__dict__[key], names, message) + for key, names, message in args + } + + # fix unassigned values for inputs + intersection_input = set(unassigned_by_mpc_var["controls"]).intersection( + unassigned_by_mpc_var["inputs"] + ) + + # return dict should have model variables as keys, not mpc variables + unassigned_by_model_var = { + "states": unassigned_by_mpc_var["states"], + "inputs": intersection_input, + "outputs": unassigned_by_mpc_var["outputs"], + "parameters": unassigned_by_mpc_var["parameters"], + } + + return unassigned_by_model_var
+ +
[docs] def collect_variables_for_optimization( + self, var_ref: mpc_datamodels.VariableReference = None + ) -> Dict[str, AgentVariable]: + """Gets all variables noted in the var ref and puts them in a flat + dictionary.""" + if var_ref is None: + var_ref = self.var_ref + return {v: self.get(v) for v in var_ref.all_variables()}
+ + # class AgVarDropin: + # ub: float + # lb: float + # value: Union[float, list, pd.Series] + # interpolation_method: InterpolationMethod + +
[docs] def process(self): + while True: + self.do_step() + yield self.env.timeout(self.config.time_step)
+ +
[docs] def register_callbacks(self): + """Registers the init_optimization callback to all parameters which + cannot be changed without recreating the optimization problem.""" + for key in OptimizationBackend.mpc_backend_parameters: + self.agent.data_broker.register_callback( + alias=key, source=None, callback=self.re_init_optimization + )
+ + def _init_optimization(self): + """Performs the setup of the optimization backend.""" + try: + self.optimization_backend.setup_optimization(var_ref=self.var_ref) + except (RuntimeError, ValueError) as err: + raise ConfigurationError( + f"The optimization backend of Agent {self.source} could not " + f"finish its setup!" + ) from err + self.logger.info("%s: Initialized optimization problem.", self.agent.id) + +
[docs] def re_init_optimization(self, parameter: AgentVariable): + """Re-initializes the optimization backend with new parameters.""" + self.optimization_backend.discretization_options[ + parameter.name + ] = parameter.value + self._init_optimization()
+ + @property + def model(self) -> Model: + """ + Getter for current simulation model + + Returns: + agentlib.model: Current simulation model + """ + return self.optimization_backend.model + +
[docs] def pre_computation_hook(self): + """ + This method is called in every computation step before the optimization starts. + Overwrite this method in a derived subclass if you want to take some actions + each time before the optimal control problem is solved. + """ + pass
+ +
[docs] def do_step(self): + """ + Performs an MPC step. + """ + if not self.init_status == InitStatus.ready: + self.logger.warning("Skipping step, optimization_backend is not ready.") + return + + self.pre_computation_hook() + + # get new values from data_broker + updated_vars = self.collect_variables_for_optimization() + + # solve optimization problem with up-to-date values from data_broker + result = self.optimization_backend.solve(self.env.time, updated_vars) + + # Set variables in data_broker + self.set_actuation(result) + self.set_output(result)
+ +
[docs] def set_actuation(self, solution: Results): + """Takes the solution from optimization backend and sends the first + step to AgentVariables.""" + self.logger.info("Sending optimal control values to data_broker.") + for control in self.var_ref.controls: + # take the first entry of the control trajectory + actuation = solution[control][0] + self.set(control, actuation)
+ +
[docs] def set_output(self, solution: Results): + """Takes the solution from optimization backend and sends it to AgentVariables.""" + # Output must be defined in the conig as "type"="pd.Series" + if not self.config.set_outputs: + return + self.logger.info("Sending optimal output values to data_broker.") + df = solution.df + for output in self.var_ref.outputs: + series = df.variable[output] + self.set(output, series)
+ +
[docs] def get_results(self) -> Optional[pd.DataFrame]: + """Read the results that were saved from the optimization backend and + returns them as Dataframe. + + Returns: + (results, stats) tuple of Dataframes. + """ + results_file = self.optimization_backend.config.results_file + if results_file is None or not self.optimization_backend.config.save_results: + self.logger.info("No results were saved .") + return None + try: + result, stat = self.read_results_file(results_file) + self.warn_for_missed_solves(stat) + return result + except FileNotFoundError: + self.logger.error("Results file %s was not found.", results_file) + return None
+ +
[docs] def warn_for_missed_solves(self, stats: Optional[pd.DataFrame]): + """ + Read the solver information from the optimization + Returns: + Warning if solver fails + """ + if stats is None: + return + if stats["success"].all(): + return + failures = ~stats["success"] + failure_indices = failures[failures].index.tolist() + self.logger.warning( + f"Warning: There were failed optimizations at the following times: " + f"{failure_indices}." + )
+ +
[docs] @staticmethod + def read_results_file(results_file: str) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + Read the provided csv-file as an MPC results file. + Args: + results_file: File path + + Returns: + results, stats + results is the Dataframe with all inputs and outputs of the MPC + optimizations. + stats is the Dataframe with matching solver stats + """ + + results = load_mpc(results_file) + stats = load_mpc_stats(results_file) + return results, stats
+ +
[docs] def cleanup_results(self): + results_file = self.optimization_backend.config.results_file + if not results_file: + return + os.remove(results_file) + os.remove(mpc_datamodels.stats_path(results_file))
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc_full.html b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc_full.html new file mode 100644 index 0000000..ae4084e --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/modules/mpc_full.html @@ -0,0 +1,282 @@ + + + + + + + + agentlib_mpc.modules.mpc_full — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.modules.mpc_full

+"""Holds the class for full featured MPCs."""
+
+import numpy as np
+import pandas as pd
+from agentlib.core import AgentVariable
+
+from agentlib_mpc.data_structures import mpc_datamodels
+from pydantic import Field, field_validator, FieldValidationInfo
+from rapidfuzz import process, fuzz
+
+from agentlib_mpc.modules.mpc import BaseMPCConfig, BaseMPC
+
+
+
[docs]class MPCConfig(BaseMPCConfig): + """ + Pydantic data model for MPC configuration parser + """ + + r_del_u: dict[str, float] = Field( + default={}, + description="Weights that are applied to the change in control variables.", + ) + +
[docs] @field_validator("r_del_u") + def check_r_del_u_in_controls( + cls, r_del_u: dict[str, float], info: FieldValidationInfo + ): + """Ensures r_del_u is only set for control variables.""" + controls = {ctrl.name for ctrl in info.data["controls"]} + for name in r_del_u: + if name in controls: + # everything is fine + continue + + # raise error + matches = process.extract(query=name, choices=controls, scorer=fuzz.WRatio) + matches = [m[0] for m in matches] + raise ValueError( + f"Tried to specify control change weight for {name}. However, " + f"{name} is not in the set of control variables. Did you mean one " + f"of these? {', '.join(matches)}" + ) + return r_del_u
+ + +
[docs]class MPC(BaseMPC): + """ + A model predictive controller. + More info to follow. + """ + + config: MPCConfig + + def _init_optimization(self): + super()._init_optimization() + self._lags_dict_seconds = self.optimization_backend.get_lags_per_variable() + + history = {} + # create a dict to keep track of all values for lagged variables timestamped + for v in self._lags_dict_seconds: + var = self.get(v) + history[v] = {} + # store scalar values as initial if they exist + if isinstance(var.value, (float, int)): + timestamp = var.timestamp or self.env.time + value = var.value + elif var.value is None: + self.logger.info( + "Initializing history for variable %s, but no value was available." + " Interpolating between bounds or setting to zero." + ) + timestamp = self.env.time + value = var.value or np.nan_to_num( + (var.ub + var.lb) / 2, posinf=1000, neginf=1000 + ) + else: + # in this case it should probably be a series, which we can take as is + continue + history[v][timestamp] = value + self.history: dict[str, dict[float, float]] = history + self.register_callbacks_for_lagged_variables() + +
[docs] def do_step(self): + super().do_step() + self._remove_old_values_from_history()
+ + def _remove_old_values_from_history(self): + """Clears the history of all entries that are older than current time minus + horizon length.""" + # iterate over all variables which save lag + for var_name, lag_in_seconds in self._lags_dict_seconds.items(): + var_history = self.history[var_name] + + # iterate over all saved values and delete them, if they are too old + for timestamp in list(var_history): + if timestamp < (self.env.time - lag_in_seconds): + var_history.pop(timestamp) + + def _callback_hist_vars(self, variable: AgentVariable, name: str): + """Adds received measured inputs to the past trajectory.""" + # if variables are intentionally sent as series, we don't need to store them + # ourselves + # only store scalar values + if isinstance(variable.value, (float, int)): + self.history[name][variable.timestamp] = variable.value + +
[docs] def register_callbacks_for_lagged_variables(self): + """Registers callbacks which listen to the variables which have to be saved as + time series. These callbacks save the values in the history for use in the + optimization.""" + + for lagged_input in self._lags_dict_seconds: + var = self.get(lagged_input) + self.agent.data_broker.register_callback( + alias=var.alias, + source=var.source, + callback=self._callback_hist_vars, + name=var.name, + )
+ + def _after_config_update(self): + self._internal_variables = self._create_internal_variables() + super()._after_config_update() + + def _setup_var_ref(self) -> mpc_datamodels.VariableReferenceT: + return mpc_datamodels.FullVariableReference.from_config(self.config) + +
[docs] def collect_variables_for_optimization( + self, var_ref: mpc_datamodels.VariableReference = None + ) -> dict[str, AgentVariable]: + """Gets all variables noted in the var ref and puts them in a flat + dictionary.""" + if var_ref is None: + var_ref = self.var_ref + + # config variables + variables = {v: self.get(v) for v in var_ref.all_variables()} + + # history variables + for hist_var in self._lags_dict_seconds: + past_values = self.history[hist_var] + if not past_values: + # if the history of a variable is empty, fallback to the scalar value + continue + + # create copy to not mess up scalar value of original variable in case + # fallback is needed + updated_var = variables[hist_var].copy( + update={"value": pd.Series(past_values)} + ) + variables[hist_var] = updated_var + + return {**variables, **self._internal_variables}
+ + # class AgVarDropin: + # ub: float + # lb: float + # value: Union[float, list, pd.Series] + # interpolation_method: InterpolationMethod + + def _create_internal_variables(self) -> dict[str, AgentVariable]: + """Creates a reference of all internal variables that are used for the MPC, + but not shared as AgentVariables. + + Currently, this includes: + - Weights for control change (r_del_u) + """ + r_del_u: dict[str, mpc_datamodels.MPCVariable] = {} + for control in self.config.controls: + r_del_u_name = mpc_datamodels.r_del_u_convention(control.name) + var = mpc_datamodels.MPCVariable(name=r_del_u_name) + r_del_u[r_del_u_name] = var + if control.name in self.config.r_del_u: + var.value = self.config.r_del_u[control.name] + else: + var.value = 0 + + return r_del_u
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends.html new file mode 100644 index 0000000..a1ddc38 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends.html @@ -0,0 +1,175 @@ + + + + + + + + agentlib_mpc.optimization_backends — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends

+import importlib
+
+from pydantic import BaseModel
+
+
+
[docs]class BackendImport(BaseModel): + """ + Data-Class to import a given python file + from ``import_path`` and load the given + ``class_name`` + """ + + import_path: str + class_name: str + + def __call__(self, *args, **kwargs): + """Import the Module with class_name from the import path""" + module = importlib.import_module(self.import_path) + cls = getattr(module, self.class_name) + return cls(*args, **kwargs)
+ + +backend_types = { + "casadi_basic": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.basic", + class_name="CasADiBaseBackend", + ), + "casadi": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.full", + class_name="CasADiFullBackend", + ), + "casadi_admm": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.admm", + class_name="CasADiADMMBackend", + ), + "casadi_minlp": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.minlp", + class_name="CasADiMINLPBackend", + ), + "casadi_cia": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.minlp_cia", + class_name="CasADiCIABackend", + ), + "casadi_ml": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.casadi_ml", + class_name="CasADiBBBackend", + ), + "casadi_admm_ml": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml", + class_name="CasADiADMMBackend_NN", + ), + "casadi_nn": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.casadi_ml", + class_name="CasADiBBBackend", + ), + "casadi_admm_nn": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml", + class_name="CasADiADMMBackend_NN", + ), + "casadi_mhe": BackendImport( + import_path="agentlib_mpc.optimization_backends.casadi_.mhe", + class_name="MHEBackend", + ), +} + + +uninstalled_backend_types = {} + +try: + pass +except ImportError: + uninstalled_backend_types.update() +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/backend.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/backend.html new file mode 100644 index 0000000..9ed75ef --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/backend.html @@ -0,0 +1,329 @@ + + + + + + + + agentlib_mpc.optimization_backends.backend — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.backend

+import abc
+import os
+from datetime import datetime
+import logging
+from pathlib import Path
+from typing import Dict, Union, Callable, TypeVar, Optional
+
+import pandas as pd
+import pydantic
+from agentlib.core.errors import ConfigurationError
+from pydantic import ConfigDict
+from pydantic_core.core_schema import FieldValidationInfo
+
+from agentlib.utils import custom_injection
+from agentlib.core import AgentVariable, Model
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.data_structures.mpc_datamodels import (
+    DiscretizationOptions,
+)
+from agentlib_mpc.data_structures.mpc_datamodels import Results
+
+logger = logging.getLogger(__name__)
+
+ModelT = TypeVar("ModelT", bound=Model)
+
+
+
[docs]class BackendConfig(pydantic.BaseModel): + model: dict + discretization_options: DiscretizationOptions + name: Optional[str] = None + results_file: Optional[Path] = pydantic.Field(default=None) + save_results: Optional[bool] = pydantic.Field(validate_default=True, default=None) + overwrite_result_file: Optional[bool] = pydantic.Field( + default=False, validate_default=True + ) + model_config = ConfigDict(extra="forbid") + +
[docs] @pydantic.field_validator("results_file") + @classmethod + def check_csv(cls, file: Path): + if not file.suffix == ".csv": + raise ConfigurationError( + f"Results filename has to be a 'csv' file. Got {file} instead." + ) + return file
+ +
[docs] @pydantic.field_validator("save_results") + @classmethod + def disable_results_if_no_file(cls, save_results: bool, info: FieldValidationInfo): + if save_results is None: + # if user did not specify if results should be saved, we save them if a + # file is specified. + return bool(info.data["results_file"]) + if save_results and info.data["results_file"] is None: + raise ConfigurationError( + "'save_results' was true, however there was no results file provided." + ) + return save_results
+ +
[docs] @pydantic.field_validator("overwrite_result_file") + @classmethod + def check_overwrite(cls, overwrite_result_file: bool, info: FieldValidationInfo): + """Checks, whether the overwrite results sttings are valid, and deletes + existing result files if applicable.""" + res_file = info.data.get("results_file") + if res_file and info.data["save_results"]: + if overwrite_result_file: + try: + os.remove(res_file) + os.remove(mpc_datamodels.stats_path(res_file)) + except FileNotFoundError: + pass + else: + if os.path.isfile(info.data["results_file"]): + raise FileExistsError( + f"Results file {res_file} already exists and will not be " + f"overwritten automatically. Set 'overwrite_result_file' to " + f"True to enable automatic overwrite it." + ) + return overwrite_result_file
+ + +
[docs]class OptimizationBackend(abc.ABC): + """ + Base class for all optimization backends. OptimizationBackends are a + plugin for the 'mpc' module. They provide means to setup and solve the + underlying optimization problem of the MPC. They also can save data of + the solutions. + """ + + _supported_models: dict[str, ModelT] = {} + mpc_backend_parameters = ("time_step", "prediction_horizon") + config_type = BackendConfig + + def __init__(self, config: dict): + self.logger = logger + self.config = self.config_type(**config) + self.model: ModelT = self.model_from_config(self.config.model) + self.var_ref: Optional[mpc_datamodels.VariableReference] = None + self.cost_function: Optional[Callable] = None + self.stats = {} + self._created_file: bool = False # flag if we checked the file location + +
[docs] def register_logger(self, logger: logging.Logger): + """Registers a logger, can be used to use the module logger""" + self.logger = logger
+ +
[docs] @abc.abstractmethod + def setup_optimization(self, var_ref: mpc_datamodels.VariableReference): + """ + Performs all necessary steps to make the ``solve`` method usable. + + Args: + var_ref: Variable Reference that specifies the role of each model variable + in the mpc + """ + self.var_ref = var_ref
+ +
[docs] @abc.abstractmethod + def solve( + self, now: Union[float, datetime], current_vars: Dict[str, AgentVariable] + ) -> Results: + """ + Solves the optimization problem given the current values of the + corresponding AgentVariables and system time. The standardization of + return values is a work in progress. + + Args: + now: Current time used for interpolation of input trajectories. + current_vars: Dict of AgentVariables holding the values relevant to + the optimization problem. Keys are the names + + Returns: + A dataframe with all optimization variables over their respective + grids. Depending on discretization, can include many nan's, so care + should be taken when using this, e.g. always use dropna() after + accessing a column. + + Example: + variables mDot | T_0 | slack_T + time + 0 0.1 | 298 | nan + 230 nan | 297 | 3 + 470 nan | 296 | 2 + 588 nan | 295 | 1 + 700 0.05 | 294 | nan + 930 nan | 294 | 0.1 + + + """ + raise NotImplementedError( + "The 'OptimizationBackend' class does not implement this because " + "it is individual to the subclasses" + )
+ +
[docs] def update_discretization_options(self, opts: dict): + """Updates the discretization options with the new dict.""" + self.config.discretization_options = ( + self.config.discretization_options.model_copy(update=opts) + ) + self.setup_optimization(var_ref=self.var_ref)
+ +
[docs] def model_from_config(self, model: dict): + """Set the model to the backend.""" + model = model.copy() + _type = model.pop("type") + custom_cls = custom_injection(config=_type) + model = custom_cls(**model) + if not any( + ( + isinstance(model, _supp_model) + for _supp_model in self._supported_models.values() + ) + ): + raise TypeError( + f"Given model is of type {type(model)} but " + f"should be instance of one of:" + f"{', '.join(list(self._supported_models.keys()))}" + ) + return model
+ +
[docs] def get_lags_per_variable(self) -> dict[str, float]: + """Returns the name of variables which include lags and their lag in seconds. + The MPC module can use this information to save relevant past data of lagged + variables""" + return {}
+ +
[docs] def results_file_exists(self) -> bool: + """Checks if the results file already exists, and if not, creates it with + headers.""" + if self._created_file: + return True + + if self.config.results_file.is_file(): + # todo, this case is weird, as it is the mistake-append + self._created_file = True + return True + + # we only check the file location once to save system calls + self.config.results_file.parent.mkdir(parents=True, exist_ok=True) + self._created_file = True + return False
+ +
[docs] def update_model_variables(self, current_vars: Dict[str, AgentVariable]): + """ + Internal method to write current data_broker to model variables. + Only update values, not other module_types. + """ + for inp in current_vars.values(): + logger.debug(f"Updating model variable {inp.name}={inp.value}") + self.model.set(name=inp.name, value=inp.value)
+ + +OptimizationBackendT = TypeVar("OptimizationBackendT", bound=OptimizationBackend) + + +
[docs]class ADMMBackend(OptimizationBackend): + """Base class for implementations of optimization backends for ADMM + algorithms.""" + + @property + @abc.abstractmethod + def coupling_grid(self) -> list[float]: + """Returns the grid on which the coupling variables are discretized.""" + raise NotImplementedError
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/admm.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/admm.html new file mode 100644 index 0000000..d2f8cbe --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/admm.html @@ -0,0 +1,517 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.admm — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.admm

+import casadi as ca
+import pandas as pd
+
+from agentlib_mpc.data_structures.casadi_utils import DiscretizationMethod, Integrators
+from agentlib_mpc.data_structures.mpc_datamodels import stats_path
+from agentlib_mpc.models.casadi_model import CasadiModel, CasadiInput, CasadiParameter
+from agentlib_mpc.data_structures import admm_datatypes
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.optimization_backends.casadi_.basic import (
+    DirectCollocation,
+    MultipleShooting,
+    CasADiBaseBackend,
+)
+from agentlib_mpc.optimization_backends.backend import ADMMBackend
+from agentlib_mpc.optimization_backends.casadi_.core.discretization import Results
+from agentlib_mpc.optimization_backends.casadi_.full import FullSystem
+
+
+
[docs]class CasadiADMMSystem(FullSystem): + local_couplings: OptimizationVariable + global_couplings: OptimizationParameter + multipliers: OptimizationParameter + local_exchange: OptimizationVariable + exchange_diff: OptimizationParameter + exchange_multipliers: OptimizationParameter + penalty_factor: OptimizationParameter + +
[docs] def initialize(self, model: CasadiModel, var_ref: admm_datatypes.VariableReference): + super().initialize(model=model, var_ref=var_ref) + + coup_names = [c.name for c in var_ref.couplings] + exchange_names = [c.name for c in var_ref.exchange] + pure_outs = [ + m for m in model.outputs if m.name not in coup_names + exchange_names + ] + self.outputs = OptimizationVariable.declare( + denotation="y", + variables=pure_outs, + ref_list=var_ref.outputs, + ) + + self.local_couplings = OptimizationVariable.declare( + denotation="local_couplings", + variables=[model.get(name) for name in coup_names], + ref_list=coup_names, + ) + couplings_global = [coup.mean for coup in var_ref.couplings] + self.global_couplings = OptimizationParameter.declare( + denotation="global_couplings", + variables=[CasadiInput(name=coup) for coup in couplings_global], + ref_list=couplings_global, + ) + + multipliers = [coup.multiplier for coup in var_ref.couplings] + self.multipliers = OptimizationParameter.declare( + denotation="multipliers", + variables=[CasadiInput(name=coup) for coup in multipliers], + ref_list=multipliers, + ) + + self.local_exchange = OptimizationVariable.declare( + denotation="local_exchange", + variables=[model.get(name) for name in exchange_names], + ref_list=exchange_names, + ) + couplings_mean_diff = [coup.mean_diff for coup in var_ref.exchange] + self.exchange_diff = OptimizationParameter.declare( + denotation="average_diff", + variables=[CasadiInput(name=coup) for coup in couplings_mean_diff], + ref_list=couplings_mean_diff, + ) + + multipliers = [coup.multiplier for coup in var_ref.exchange] + self.exchange_multipliers = OptimizationParameter.declare( + denotation="exchange_multipliers", + variables=[CasadiInput(name=coup) for coup in multipliers], + ref_list=multipliers, + ) + + self.penalty_factor = OptimizationParameter.declare( + denotation="rho", + variables=[CasadiParameter(name="penalty_factor")], + ref_list=["penalty_factor"], + ) + + # add admm terms to objective function + admm_objective = 0 + rho = self.penalty_factor.full_symbolic[0] + for i in range(len(var_ref.couplings)): + admm_in = self.global_couplings.full_symbolic[i] + admm_out = self.local_couplings.full_symbolic[i] + admm_lam = self.multipliers.full_symbolic[i] + admm_objective += admm_lam * admm_out + rho / 2 * (admm_in - admm_out) ** 2 + + for i in range(len(var_ref.exchange)): + admm_in = self.exchange_diff.full_symbolic[i] + admm_out = self.local_exchange.full_symbolic[i] + admm_lam = self.exchange_multipliers.full_symbolic[i] + admm_objective += admm_lam * admm_out + rho / 2 * (admm_in - admm_out) ** 2 + + self.cost_function += admm_objective
+ + +
[docs]class ADMMCollocation(DirectCollocation): + def _discretize(self, sys: CasadiADMMSystem): + """ + Perform a direct collocation discretization. + # pylint: disable=invalid-name + """ + + # setup the polynomial base + collocation_matrices = self._collocation_polynomial() + + # shorthands + n = self.options.prediction_horizon + ts = self.options.time_step + + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + uk = self.add_opt_par(sys.last_control) + + # Parameters that are constant over the horizon + const_par = self.add_opt_par(sys.model_parameters) + du_weights = self.add_opt_par(sys.r_del_u) + rho = self.add_opt_par(sys.penalty_factor) + + # Formulate the NLP + # loop over prediction horizon + while self.k < n: + # New NLP variable for the control + u_prev = uk + uk = self.add_opt_var(sys.controls) + # penalty for control change between time steps + self.objective_function += ts * ca.dot(du_weights, (u_prev - uk) ** 2) + + # New parameter for inputs + dk = self.add_opt_par(sys.non_controlled_inputs) + + # perform inner collocation loop + # perform inner collocation loop + opt_vars_inside_inner = [ + sys.algebraics, + sys.outputs, + sys.local_couplings, + sys.local_exchange, + ] + opt_pars_inside_inner = [ + sys.global_couplings, + sys.multipliers, + sys.exchange_multipliers, + sys.exchange_diff, + ] + constant_over_inner = { + sys.controls: uk, + sys.non_controlled_inputs: dk, + sys.model_parameters: const_par, + sys.penalty_factor: rho, + } + xk_end, constraints = self._collocation_inner_loop( + collocation=collocation_matrices, + state_at_beginning=xk, + states=sys.states, + opt_vars=opt_vars_inside_inner, + opt_pars=opt_pars_inside_inner, + const=constant_over_inner, + ) + + # increment loop counter and time + self.k += 1 + self.pred_time = ts * self.k + + # New NLP variables at end of interval + xk = self.add_opt_var(sys.states) + + # Add continuity constraint + self.add_constraint(xk - xk_end, gap_closing=True) + + # add collocation constraints later for fatrop + for constraint in constraints: + self.add_constraint(*constraint)
+ + +
[docs]class ADMMMultipleShooting(MultipleShooting): + def _discretize(self, sys: CasadiADMMSystem): + """Performs a multiple shooting discretization for ADMM-based optimization. + + This method implements the multiple shooting discretization scheme for both consensus + and exchange ADMM variants. It handles: + 1. State continuity across shooting intervals + 2. Local coupling variables and their consensus terms + 3. Exchange variables between subsystems + 4. Integration of system dynamics + 5. Objective function construction including ADMM penalty terms + + Args: + sys (CasadiADMMSystem): The system to be discretized, containing states, + controls, and ADMM-specific variables + """ + # Extract key parameters + prediction_horizon = self.options.prediction_horizon + timestep = self.options.time_step + integration_options = {"t0": 0, "tf": timestep} + + # Initialize state trajectory + initial_state = self.add_opt_par(sys.initial_state) + current_state = self.add_opt_var( + sys.states, lb=initial_state, ub=initial_state, guess=initial_state + ) + + # Initialize control input + previous_control = self.add_opt_par(sys.last_control) + + # Add time-invariant parameters + control_rate_weights = self.add_opt_par(sys.r_del_u) + model_parameters = self.add_opt_par(sys.model_parameters) + admm_penalty = self.add_opt_par(sys.penalty_factor) + + # Create system integrator + dynamics_integrator = self._create_ode( + sys, integration_options, self.options.integrator + ) + + # Perform multiple shooting discretization + for k in range(prediction_horizon): + # 1. Handle control inputs and their rate penalties + current_control = self.add_opt_var(sys.controls) + control_rate_penalty = timestep * ca.dot( + control_rate_weights, (previous_control - current_control) ** 2 + ) + self.objective_function += control_rate_penalty + previous_control = current_control + + # 2. Add optimization variables for current shooting interval + disturbance = self.add_opt_par(sys.non_controlled_inputs) + algebraic_vars = self.add_opt_var(sys.algebraics) + output_vars = self.add_opt_var(sys.outputs) + + # 3. Add ADMM consensus variables + local_coupling = self.add_opt_var(sys.local_couplings) + global_coupling = self.add_opt_par(sys.global_couplings) + coupling_multipliers = self.add_opt_par(sys.multipliers) + + # 4. Add ADMM exchange variables + exchange_difference = self.add_opt_par(sys.exchange_diff) + exchange_multipliers = self.add_opt_par(sys.exchange_multipliers) + local_exchange = self.add_opt_var(sys.local_exchange) + + # 5. Construct stage-wise optimization problem + stage_variables = { + sys.states.name: current_state, + sys.algebraics.name: algebraic_vars, + sys.local_couplings.name: local_coupling, + sys.outputs.name: output_vars, + sys.local_exchange.name: local_exchange, + sys.global_couplings.name: global_coupling, + sys.multipliers.name: coupling_multipliers, + sys.controls.name: current_control, + sys.non_controlled_inputs.name: disturbance, + sys.model_parameters.name: model_parameters, + sys.penalty_factor.name: admm_penalty, + sys.exchange_diff.name: exchange_difference, + sys.exchange_multipliers.name: exchange_multipliers, + } + + stage_result = self._stage_function(**stage_variables) + + # 6. Integrate system dynamics + integration_result = dynamics_integrator( + x0=current_state, + p=ca.vertcat( + current_control, + local_coupling, + disturbance, + model_parameters, + algebraic_vars, + output_vars, + ), + ) + + # 7. Add continuity constraints + self.k = k + 1 + self.pred_time = timestep * self.k + next_state = self.add_opt_var(sys.states) + self.add_constraint(next_state - integration_result["xf"], gap_closing=True) + + # 8. Add model constraints and objective contributions + self.add_constraint( + stage_result["model_constraints"], + lb=stage_result["lb_model_constraints"], + ub=stage_result["ub_model_constraints"], + ) + self.objective_function += stage_result["cost_function"] * timestep + + # Update for next interval + current_state = next_state + + def _create_ode( + self, sys: CasadiADMMSystem, opts: dict, integrator: Integrators + ) -> ca.Function: + # dummy function for empty ode, since ca.integrator would throw an error + if sys.states.full_symbolic.shape[0] == 0: + return lambda *args, **kwargs: {"xf": ca.MX.sym("xk_end", 0)} + + ode = sys.ode + # create inputs + x = sys.states.full_symbolic + p = ca.vertcat( + sys.controls.full_symbolic, + sys.local_couplings.full_symbolic, + sys.non_controlled_inputs.full_symbolic, + sys.model_parameters.full_symbolic, + sys.algebraics.full_symbolic, + sys.outputs.full_symbolic, + ) + integrator_ode = {"x": x, "p": p, "ode": ode} + if integrator == Integrators.euler: + xk_end = x + ode * opts["tf"] + opt_integrator = ca.Function( + "system", [x, p], [xk_end], ["x0", "p"], ["xf"] + ) + else: # rk, cvodes + opt_integrator = ca.integrator("system", integrator, integrator_ode, opts) + return opt_integrator
+ + +
[docs]class CasADiADMMBackend(CasADiBaseBackend, ADMMBackend): + """ + Class doing optimization of ADMM subproblems with CasADi. + """ + + system_type = CasadiADMMSystem + discretization_types = { + DiscretizationMethod.collocation: ADMMCollocation, + DiscretizationMethod.multiple_shooting: ADMMMultipleShooting, + } + system: CasadiADMMSystem + + def __init__(self, config: dict): + super().__init__(config) + self.results: list[pd.DataFrame] = [] + self.result_stats: list[str] = [] + self.it: int = 0 + self.now: float = 0 + + @property + def coupling_grid(self): + return self.discretization.grid(self.system.multipliers) + +
[docs] def save_result_df( + self, + results: Results, + now: float = 0, + ): + """ + Save the results of `solve` into a dataframe at each time step. + + Example results dataframe: + + value_type variable ... lower + variable T_0 T_0_slack ... T_0_slack mDot_0 + time_step ... + 2 0.000000 298.160000 NaN ... NaN NaN + 101.431499 297.540944 -149.465942 ... -inf 0.0 + 450.000000 295.779780 -147.704779 ... -inf 0.0 + 798.568501 294.720770 -146.645769 ... -inf 0.0 + Args: + results: + now: + + Returns: + + """ + if not self.config.save_results: + return + + res_file = self.config.results_file + + if self.results_file_exists(): + self.it += 1 + if now != self.now: # means we advanced to next step + self.it = 0 + self.now = now + else: + self.it = 0 + self.now = now + results.write_columns(res_file) + results.write_stats_columns(stats_path(res_file)) + + df = results.df + df.index = list(map(lambda x: str((now, self.it, x)), df.index)) + self.results.append(df) + + # append solve stats + index = str((now, self.it)) + self.result_stats.append(results.stats_line(index)) + + # save last results at the start of new sampling time, or if 1000 iterations + # are exceeded + if not (self.it == 0 or self.it % 1000 == 0): + return + + with open(res_file, "a", newline="") as f: + for iteration_result in self.results: + iteration_result.to_csv(f, mode="a", header=False) + + with open(stats_path(res_file), "a") as f: + f.writelines(self.result_stats) + self.results = [] + self.result_stats = []
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/basic.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/basic.html new file mode 100644 index 0000000..a0e8c0b --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/basic.html @@ -0,0 +1,661 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.basic — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.basic

+import dataclasses
+
+import casadi as ca
+import numpy as np
+
+from agentlib_mpc.data_structures.casadi_utils import (
+    Constraint,
+    LB_PREFIX,
+    UB_PREFIX,
+    DiscretizationMethod,
+    SolverFactory,
+    Integrators,
+)
+from agentlib_mpc.data_structures.mpc_datamodels import VariableReference
+from agentlib_mpc.models.casadi_model import CasadiModel
+from agentlib_mpc.optimization_backends.casadi_.core.casadi_backend import CasADiBackend
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationQuantity,
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.discretization import (
+    Discretization,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.system import System
+
+
+
[docs]class BaseSystem(System): + # variables + states: OptimizationVariable + controls: OptimizationVariable + algebraics: OptimizationVariable + outputs: OptimizationVariable + + # parameters + non_controlled_inputs: OptimizationParameter + model_parameters: OptimizationParameter + initial_state: OptimizationParameter + + # dynamics + model_constraints: Constraint + cost_function: ca.MX + ode: ca.MX + +
[docs] def initialize(self, model: CasadiModel, var_ref: VariableReference): + # define variables + self.states = OptimizationVariable.declare( + denotation="state", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + assert_complete=True, + ) + self.controls = OptimizationVariable.declare( + denotation="control", + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + assert_complete=True, + ) + self.algebraics = OptimizationVariable.declare( + denotation="z", + variables=model.auxiliaries, + ref_list=[], + ) + self.outputs = OptimizationVariable.declare( + denotation="y", + variables=model.outputs, + ref_list=var_ref.outputs, + ) + + # define parameters + self.non_controlled_inputs = OptimizationParameter.declare( + denotation="d", + variables=model.get_inputs(var_ref.inputs), + ref_list=var_ref.inputs, + assert_complete=True, + ) + self.model_parameters = OptimizationParameter.declare( + denotation="parameter", + variables=model.parameters, + ref_list=var_ref.parameters, + ) + self.initial_state = OptimizationParameter.declare( + denotation="initial_state", # append the 0 as a convention to get initial guess + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + use_in_stage_function=False, + assert_complete=True, + ) + + # dynamics + ode = ca.vertcat(*[sta.ode for sta in model.get_states(var_ref.states)]) + self.ode = ca.reshape(ode, -1, 1) + self.cost_function = model.cost_func + self.model_constraints = Constraint( + function=ca.vertcat(*[c.function for c in model.get_constraints()]), + lb=ca.vertcat(*[c.lb for c in model.get_constraints()]), + ub=ca.vertcat(*[c.ub for c in model.get_constraints()]), + )
+ + +
[docs]@dataclasses.dataclass +class CollocationMatrices: + order: int + root: np.ndarray + B: np.ndarray + C: np.ndarray + D: np.ndarray
+ + +
[docs]class DirectCollocation(Discretization): + def _discretize(self, sys: BaseSystem): + """ + Defines a direct collocation discretization. + # pylint: disable=invalid-name + """ + + # setup the polynomial base + collocation_matrices = self._collocation_polynomial() + + # shorthands + n = self.options.prediction_horizon + ts = self.options.time_step + + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + + # Parameters that are constant over the horizon + const_par = self.add_opt_par(sys.model_parameters) + + # Formulate the NLP + # loop over prediction horizon + k = 0 + while k < n: + # New NLP variable for the control + uk = self.add_opt_var(sys.controls) + + # New parameter for inputs + dk = self.add_opt_par(sys.non_controlled_inputs) + + # perform inner collocation loop + opt_vars_inside_inner = [sys.algebraics, sys.outputs] + opt_pars_inside_inner = [] + + constant_over_inner = { + sys.controls: uk, + sys.non_controlled_inputs: dk, + sys.model_parameters: const_par, + } + xk_end, constraints = self._collocation_inner_loop( + collocation=collocation_matrices, + state_at_beginning=xk, + states=sys.states, + opt_vars=opt_vars_inside_inner, + opt_pars=opt_pars_inside_inner, + const=constant_over_inner, + ) + + # increment loop counter and time + k += 1 + self.pred_time = ts * k + + # New NLP variable for differential state at end of interval + xk = self.add_opt_var(sys.states) + + # Add continuity constraint + self.add_constraint(xk - xk_end, gap_closing=True) + + # add collocation constraints later for fatrop + for constraint in constraints: + self.add_constraint(*constraint) + + def _construct_stage_function(self, system: BaseSystem): + """ + Combine information from the model and the var_ref to create CasADi + functions which describe the system dynamics and constraints at each + stage of the optimization problem. Sets the stage function. It has + all mpc variables as inputs, sorted by denotation (declared in + self.declare_quantities) and outputs ode, cost function and 3 outputs + per constraint (constraint, lb_constraint, ub_constraint). + + In the basic case, it has the form: + CasadiFunction: ['x', 'z', 'u', 'y', 'd', 'p'] -> + ['ode', 'cost_function', 'model_constraints', + 'ub_model_constraints', 'lb_model_constraints'] + + Args: + system + """ + all_system_quantities: dict[str, OptimizationQuantity] = { + var.name: var for var in system.quantities + } + constraints = {"model_constraints": system.model_constraints} + + inputs = [ + q.full_symbolic + for q in all_system_quantities.values() + if q.use_in_stage_function + ] + input_denotations = [ + q.name + for denotation, q in all_system_quantities.items() + if q.use_in_stage_function + ] + + # aggregate constraints + constraints_func = [c.function for c in constraints.values()] + constraints_lb = [c.lb for c in constraints.values()] + constraints_ub = [c.ub for c in constraints.values()] + constraint_denotations = list(constraints.keys()) + constraint_lb_denotations = [LB_PREFIX + k for k in constraints] + constraint_ub_denotations = [UB_PREFIX + k for k in constraints] + + # aggregate outputs + outputs = [ + system.ode, + system.cost_function, + *constraints_func, + *constraints_lb, + *constraints_ub, + ] + output_denotations = [ + "ode", + "cost_function", + *constraint_denotations, + *constraint_lb_denotations, + *constraint_ub_denotations, + ] + + # function describing system dynamics and cost function + self._stage_function = ca.Function( + "f", + inputs, + outputs, + # input handles to make kwarg use possible and to debug + input_denotations, + # output handles to make kwarg use possible and to debug + output_denotations, + ) + +
[docs] def initialize(self, system: BaseSystem, solver_factory: SolverFactory): + """Initializes the trajectory optimization problem, creating all symbolic + variables of the OCP, the mapping function and the numerical solver.""" + self._construct_stage_function(system) + super().initialize(system=system, solver_factory=solver_factory)
+ + def _collocation_inner_loop( + self, + state_at_beginning: ca.MX, + collocation: CollocationMatrices, + states: OptimizationVariable, + opt_vars: list[OptimizationVariable], + opt_pars: list[OptimizationParameter], + const: dict[OptimizationQuantity, ca.MX], + ) -> tuple[ca.MX, tuple]: + """ + Constructs the inner loop of a collocation discretization. Takes the + + Args + collocation: The collocation matrices + state_at_beginning: The casadi MX instance representing the state at the + beginning of the collocation interval + states: The OptimizationVariable representing the states + opt_vars: The OptimizationVariables which should be defined at each + collocation point + par_vars: The OptimizationParameters which should be defined at each + collocation point + const: Variables or parameters to feed into the system function that are + constant over the inner loop. Value is the current MX to be used. + + Returns: + state_k_end[MX]: state at the end of collocation interval + """ + constraints = [] + constants = {var.name: mx for var, mx in const.items()} + + # remember time at start of collocation loop + start_time = self.pred_time + + # shorthands + ts = self.options.time_step + + # State variables at collocation points + state_collocation = [] + opt_vars_collocation = [] + opt_pars_collocation = [] + + # add variables at collocation points + for j in range(collocation.order): # d is collocation order + # set time + self.pred_time = start_time + collocation.root[j + 1] * ts + + # differential state + state_kj = self.add_opt_var(states, post_den=f"_{j}") + state_collocation.append(state_kj) + + opt_vars_collocation.append({}) + for opt_var in opt_vars: + var_kj = self.add_opt_var(opt_var, post_den=f"_{j}") + opt_vars_collocation[-1].update({opt_var.name: var_kj}) + + opt_pars_collocation.append({}) + for opt_par in opt_pars: + par_kj = self.add_opt_par(opt_par, post_den=f"_{j}") + opt_pars_collocation[-1].update({opt_par.name: par_kj}) + + # Loop over collocation points + state_k_end = collocation.D[0] * state_at_beginning + for j in range(1, collocation.order + 1): + # Expression for the state derivative at the collocation point + xp = collocation.C[0, j] * state_at_beginning + for r in range(collocation.order): + xp = xp + collocation.C[r + 1, j] * state_collocation[r] + + stage = self._stage_function( + **{states.name: state_collocation[j - 1]}, + **opt_pars_collocation[j - 1], + **opt_vars_collocation[j - 1], + **constants, + ) + + constraints.append((ts * stage["ode"] - xp,)) + constraints.append( + ( + stage["model_constraints"], + stage["lb_model_constraints"], + stage["ub_model_constraints"], + ) + ) + + # Add contribution to the end state + state_k_end = state_k_end + collocation.D[j] * state_collocation[j - 1] + + # Add contribution to quadrature function + self.objective_function += collocation.B[j] * stage["cost_function"] * ts + + return state_k_end, constraints + + def _collocation_polynomial(self) -> CollocationMatrices: + """Returns the matrices needed for direct collocation discretization.""" + # Degree of interpolating polynomial + d = self.options.collocation_order + polynomial = self.options.collocation_method + + # Get collocation points + tau_root = np.append(0, ca.collocation_points(d, polynomial)) + + # Coefficients of the collocation equation + C = np.zeros((d + 1, d + 1)) + + # Coefficients of the continuity equation + D = np.zeros(d + 1) + + # Coefficients of the quadrature function + B = np.zeros(d + 1) + + # Construct polynomial basis + for j in range(d + 1): + # Construct Lagrange polynomials to get the polynomial basis at + # the collocation point + p = np.poly1d([1]) + for r in range(d + 1): + if r != j: + p *= np.poly1d([1, -tau_root[r]]) / (tau_root[j] - tau_root[r]) + + # Evaluate the polynomial at the final time to get the + # coefficients of the continuity equation + D[j] = p(1.0) + + # Evaluate the time derivative of the polynomial at all collocation + # points to get the coefficients of the continuity equation + pder = np.polyder(p) + for r in range(d + 1): + C[j, r] = pder(tau_root[r]) + + # Evaluate the integral of the polynomial to get the coefficients + # of the quadrature function + pint = np.polyint(p) + B[j] = pint(1.0) + + return CollocationMatrices( + order=d, + root=tau_root, + B=B, + C=C, + D=D, + )
+ + +
[docs]class MultipleShooting(Discretization): + def _discretize(self, sys: BaseSystem): + """ + Defines a multiple shooting discretization + """ + vars_dict = {sys.states.name: {}} + n = self.options.prediction_horizon + ts = self.options.time_step + opts = {"t0": 0, "tf": ts} + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + vars_dict[sys.states.name][0] = xk + const_par = self.add_opt_par(sys.model_parameters) + # ODE is used here because the algebraics can be calculated with the stage function + opt_integrator = self._create_ode(sys, opts, integrator=self.options.integrator) + # initiate states + while self.k < n: + uk = self.add_opt_var(sys.controls) + dk = self.add_opt_par(sys.non_controlled_inputs) + zk = self.add_opt_var(sys.algebraics) + yk = self.add_opt_var(sys.outputs) + # get stage + stage_arguments = { + # variables + sys.states.name: xk, + sys.algebraics.name: zk, + sys.outputs.name: yk, + # parameters + sys.controls.name: uk, + sys.non_controlled_inputs.name: dk, + sys.model_parameters.name: const_par, + } + # get stage + stage = self._stage_function(**stage_arguments) + + self.add_constraint( + stage["model_constraints"], + lb=stage["lb_model_constraints"], + ub=stage["ub_model_constraints"], + ) + fk = opt_integrator( + x0=xk, + p=ca.vertcat(uk, dk, const_par, zk, yk), + ) + xk_end = fk["xf"] + # calculate model constraint + self.k += 1 + self.pred_time = ts * self.k + xk = self.add_opt_var(sys.states) + vars_dict[sys.states.name][self.k] = xk + self.add_constraint(xk_end - xk, gap_closing=True) + self.objective_function += stage["cost_function"] * ts + + def _create_ode(self, sys: BaseSystem, opts: dict, integrator: Integrators): + # dummy function for empty ode, since ca.integrator would throw an error + if sys.states.full_symbolic.shape[0] == 0: + return lambda *args, **kwargs: {"xf": ca.MX.sym("xk_end", 0)} + + ode = sys.ode + # create inputs + x = sys.states.full_symbolic + # the order of elements here is important when calling the integrator! + p = ca.vertcat( + sys.controls.full_symbolic, + sys.non_controlled_inputs.full_symbolic, + sys.model_parameters.full_symbolic, + sys.algebraics.full_symbolic, + sys.outputs.full_symbolic, + ) + integrator_ode = {"x": x, "p": p, "ode": ode} + + if integrator == Integrators.euler: + xk_end = x + ode * opts["tf"] + opt_integrator = ca.Function( + "system", [x, p], [xk_end], ["x0", "p"], ["xf"] + ) + else: # rk, cvodes + opt_integrator = ca.integrator("system", integrator, integrator_ode, opts) + + return opt_integrator + + def _construct_stage_function(self, system: BaseSystem): + """ + Combine information from the model and the var_ref to create CasADi + functions which describe the system dynamics and constraints at each + stage of the optimization problem. Sets the stage function. It has + all mpc variables as inputs, sorted by denotation (declared in + self.declare_quantities) and outputs ode, cost function and 3 outputs + per constraint (constraint, lb_constraint, ub_constraint). + + In the basic case, it has the form: + CasadiFunction: ['x', 'z', 'u', 'y', 'd', 'p'] -> + ['ode', 'cost_function', 'model_constraints', + 'ub_model_constraints', 'lb_model_constraints'] + + Args: + system + """ + all_system_quantities: dict[str, OptimizationQuantity] = { + var.name: var for var in system.quantities + } + constraints = {"model_constraints": system.model_constraints} + + inputs = [ + q.full_symbolic + for q in all_system_quantities.values() + if q.use_in_stage_function + ] + input_denotations = [ + q.name + for denotation, q in all_system_quantities.items() + if q.use_in_stage_function + ] + + # aggregate constraints + constraints_func = [c.function for c in constraints.values()] + constraints_lb = [c.lb for c in constraints.values()] + constraints_ub = [c.ub for c in constraints.values()] + constraint_denotations = list(constraints.keys()) + constraint_lb_denotations = [LB_PREFIX + k for k in constraints] + constraint_ub_denotations = [UB_PREFIX + k for k in constraints] + + # aggregate outputs + outputs = [ + system.ode, + system.cost_function, + *constraints_func, + *constraints_lb, + *constraints_ub, + ] + output_denotations = [ + "ode", + "cost_function", + *constraint_denotations, + *constraint_lb_denotations, + *constraint_ub_denotations, + ] + + # function describing system dynamics and cost function + self._stage_function = ca.Function( + "f", + inputs, + outputs, + # input handles to make kwarg use possible and to debug + input_denotations, + # output handles to make kwarg use possible and to debug + output_denotations, + ) + +
[docs] def initialize(self, system: BaseSystem, solver_factory: SolverFactory): + """Initializes the trajectory optimization problem, creating all symbolic + variables of the OCP, the mapping function and the numerical solver.""" + self._construct_stage_function(system) + super().initialize(system=system, solver_factory=solver_factory)
+ + +
[docs]class CasADiBaseBackend(CasADiBackend): + """ + Class doing optimization of ADMM subproblems with CasADi. + """ + + system_type = BaseSystem + discretization_types = { + DiscretizationMethod.collocation: DirectCollocation, + DiscretizationMethod.multiple_shooting: MultipleShooting, + } + system: BaseSystem
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_admm_ml.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_admm_ml.html new file mode 100644 index 0000000..9b2bba3 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_admm_ml.html @@ -0,0 +1,612 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml

+import logging
+from typing import Union
+
+import casadi as ca
+
+from agentlib_mpc.models.casadi_model import CasadiInput, CasadiParameter
+from agentlib_mpc.data_structures.casadi_utils import (
+    LB_PREFIX,
+    UB_PREFIX,
+    DiscretizationMethod,
+    Constraint,
+)
+from agentlib_mpc.data_structures.ml_model_datatypes import name_with_lag
+from agentlib_mpc.models.casadi_ml_model import CasadiMLModel
+from agentlib_mpc.optimization_backends.casadi_.casadi_ml import (
+    CasadiMLSystem,
+    CasADiBBBackend,
+    MultipleShooting_ML,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.data_structures import admm_datatypes
+from agentlib_mpc.optimization_backends.casadi_.admm import (
+    ADMMMultipleShooting,
+    CasadiADMMSystem,
+    CasADiADMMBackend,
+)
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class CasadiADMMNNSystem(CasadiADMMSystem, CasadiMLSystem): + """ + In this class, the lags are determined by the trainer alone and the lags are + saved in the serialized MLModel so that it doesn't have to be defined in the + model again + """ + + past_couplings: OptimizationParameter + past_exchange: OptimizationParameter + +
[docs] def initialize( + self, model: CasadiMLModel, var_ref: admm_datatypes.VariableReference + ): + # define variables + self.states = OptimizationVariable.declare( + denotation="state", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + assert_complete=True, + ) + self.controls = OptimizationVariable.declare( + denotation="control", + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + assert_complete=True, + ) + self.algebraics = OptimizationVariable.declare( + denotation="z", + variables=model.auxiliaries, + ref_list=[], + ) + self.outputs = OptimizationVariable.declare( + denotation="y", + variables=model.outputs, + ref_list=var_ref.outputs, + ) + + # define parameters + self.non_controlled_inputs = OptimizationParameter.declare( + denotation="d", + variables=model.get_inputs(var_ref.inputs), + ref_list=var_ref.inputs, + assert_complete=True, + ) + self.model_parameters = OptimizationParameter.declare( + denotation="parameter", + variables=model.parameters, + ref_list=var_ref.parameters, + ) + self.initial_state = OptimizationParameter.declare( + denotation="initial_state", # append the 0 as a convention to get initial guess + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + use_in_stage_function=False, + assert_complete=True, + ) + self.last_control = OptimizationParameter.declare( + denotation="initial_control", # append the 0 as a convention to get initial guess + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + use_in_stage_function=False, + assert_complete=True, + ) + self.r_del_u = OptimizationParameter.declare( + denotation="r_del_u", + variables=[CasadiParameter(name=r_del_u) for r_del_u in var_ref.r_del_u], + ref_list=var_ref.r_del_u, + use_in_stage_function=False, + assert_complete=True, + ) + + self.cost_function = model.cost_func + self.model_constraints = Constraint( + function=ca.vertcat(*[c.function for c in model.get_constraints()]), + lb=ca.vertcat(*[c.lb for c in model.get_constraints()]), + ub=ca.vertcat(*[c.ub for c in model.get_constraints()]), + ) + self.sim_step = model.make_predict_function_for_mpc() + self.model = model + self.lags_dict: dict[str, int] = model.lags_dict + + coup_names = [c.name for c in var_ref.couplings] + exchange_names = [c.name for c in var_ref.exchange] + pure_outs = [ + m for m in model.outputs if m.name not in coup_names + exchange_names + ] + self.outputs = OptimizationVariable.declare( + denotation="y", + variables=pure_outs, + ref_list=var_ref.outputs, + ) + + self.local_couplings = OptimizationVariable.declare( + denotation="local_couplings", + variables=[model.get(name) for name in coup_names], + ref_list=coup_names, + ) + couplings_global = [coup.mean for coup in var_ref.couplings] + self.global_couplings = OptimizationParameter.declare( + denotation="global_couplings", + variables=[CasadiInput(name=coup) for coup in couplings_global], + ref_list=couplings_global, + ) + + multipliers = [coup.multiplier for coup in var_ref.couplings] + self.multipliers = OptimizationParameter.declare( + denotation="multipliers", + variables=[CasadiInput(name=coup) for coup in multipliers], + ref_list=multipliers, + ) + + self.local_exchange = OptimizationVariable.declare( + denotation="local_exchange", + variables=[model.get(name) for name in exchange_names], + ref_list=exchange_names, + ) + couplings_mean_diff = [coup.mean_diff for coup in var_ref.exchange] + self.exchange_diff = OptimizationParameter.declare( + denotation="average_diff", + variables=[CasadiInput(name=coup) for coup in couplings_mean_diff], + ref_list=couplings_mean_diff, + ) + + multipliers = [coup.multiplier for coup in var_ref.exchange] + self.exchange_multipliers = OptimizationParameter.declare( + denotation="exchange_multipliers", + variables=[CasadiInput(name=coup) for coup in multipliers], + ref_list=multipliers, + ) + + self.penalty_factor = OptimizationParameter.declare( + denotation="rho", + variables=[CasadiParameter(name="penalty_factor")], + ref_list=["penalty_factor"], + ) + past_coup_names = [coup.lagged for coup in var_ref.couplings] + self.past_couplings = OptimizationParameter.declare( + denotation="past_couplings", + variables=[CasadiInput(name=name) for name in past_coup_names], + ref_list=past_coup_names, + use_in_stage_function=False, + ) + past_exchange_names = [exchange.lagged for exchange in var_ref.exchange] + self.past_exchange = OptimizationParameter.declare( + denotation="past_exchange", + variables=[CasadiInput(name=name) for name in exchange_names], + ref_list=past_exchange_names, + use_in_stage_function=False, + ) + + # add admm terms to objective function + admm_objective = 0 + rho = self.penalty_factor.full_symbolic[0] + for i in range(len(var_ref.couplings)): + admm_in = self.global_couplings.full_symbolic[i] + admm_out = self.local_couplings.full_symbolic[i] + admm_lam = self.multipliers.full_symbolic[i] + admm_objective += admm_lam * admm_out + rho / 2 * (admm_in - admm_out) ** 2 + + for i in range(len(var_ref.exchange)): + admm_in = self.exchange_diff.full_symbolic[i] + admm_out = self.local_exchange.full_symbolic[i] + admm_lam = self.exchange_multipliers.full_symbolic[i] + admm_objective += admm_lam * admm_out + rho / 2 * (admm_in - admm_out) ** 2 + + self.cost_function += admm_objective
+ + @property + def variables(self) -> list[OptimizationVariable]: + return [ + var + for var in self.__dict__.values() + if isinstance(var, OptimizationVariable) + ] + + @property + def parameters(self) -> list[OptimizationParameter]: + return [ + var + for var in self.__dict__.values() + if isinstance(var, OptimizationParameter) + ] + + @property + def quantities(self) -> list[Union[OptimizationParameter, OptimizationVariable]]: + return self.variables + self.parameters + + @property + def sim_step_quantities( + self, + ) -> dict[str, Union[OptimizationParameter, OptimizationVariable]]: + omit_in_blackbox_function = { + "global_couplings", + "multipliers", + "average_diff", + "exchange_multipliers", + "rho", + } + return { + var.name: var + for var in self.quantities + if not var.name in omit_in_blackbox_function + }
+ + +
[docs]class MultipleShootingADMMNN(ADMMMultipleShooting, MultipleShooting_ML): + max_lag: int + + def _discretize(self, sys: CasadiADMMNNSystem): + n = self.options.prediction_horizon + ts = self.options.time_step + + # Parameters that are constant over the horizon + const_par = self.add_opt_par(sys.model_parameters) + rho = self.add_opt_par(sys.penalty_factor) + du_weights = self.add_opt_par(sys.r_del_u) + + pre_grid_states = [ts * i for i in range(-sys.max_lag + 1, 1)] + inputs_lag = min(-2, -sys.max_lag) # at least -2, to consider last control + pre_grid_inputs = [ts * i for i in range(inputs_lag + 1, 0)] + prediction_grid = [ts * i for i in range(0, n)] + + # sort for debugging purposes + full_grid = sorted( + list(set(prediction_grid + pre_grid_inputs + pre_grid_states)) + ) + + # dict[time, dict[denotation, ca.MX]] + mx_dict: dict[float, dict[str, ca.MX]] = {time: {} for time in full_grid} + + # add past state variables + for time in pre_grid_states: + self.pred_time = time + x_past = self.add_opt_par(sys.initial_state) + # add past states as optimization variables with fixed values so they can + # be accessed by the first few steps, when there are lags + mx_dict[time][sys.states.name] = self.add_opt_var( + sys.states, lb=x_past, ub=x_past, guess=x_past + ) + mx_dict[time][sys.initial_state.name] = x_past + + # add past inputs + for time in pre_grid_inputs: + self.pred_time = time + d = sys.non_controlled_inputs + mx_dict[time][d.name] = self.add_opt_par(d) + u_past = self.add_opt_par(sys.last_control) + mx_dict[time][sys.controls.name] = self.add_opt_var( + sys.controls, lb=u_past, ub=u_past, guess=u_past + ) + mx_dict[time][sys.last_control.name] = u_past + + # admm quantities + past_coup = self.add_opt_par(sys.past_couplings) + past_exch = self.add_opt_par(sys.past_exchange) + mx_dict[time][sys.local_couplings.name] = past_coup + mx_dict[time][sys.local_exchange.name] = past_exch + mx_dict[time][sys.local_couplings.name] = self.add_opt_var( + sys.local_couplings, lb=past_coup, ub=past_coup, guess=past_coup + ) + mx_dict[time][sys.local_exchange.name] = self.add_opt_var( + sys.local_exchange, lb=past_exch, ub=past_exch, guess=past_exch + ) + + # add all variables over future grid + for time in prediction_grid: + self.pred_time = time + mx_dict[time][sys.controls.name] = self.add_opt_var(sys.controls) + mx_dict[time][sys.non_controlled_inputs.name] = self.add_opt_par( + sys.non_controlled_inputs + ) + mx_dict[time][sys.algebraics.name] = self.add_opt_var(sys.algebraics) + mx_dict[time][sys.outputs.name] = self.add_opt_var(sys.outputs) + + # admm related quantities + mx_dict[time][sys.multipliers.name] = self.add_opt_par(sys.multipliers) + mx_dict[time][sys.exchange_multipliers.name] = self.add_opt_par( + sys.exchange_multipliers + ) + mx_dict[time][sys.exchange_diff.name] = self.add_opt_par(sys.exchange_diff) + mx_dict[time][sys.global_couplings.name] = self.add_opt_par( + sys.global_couplings + ) + mx_dict[time][sys.local_exchange.name] = self.add_opt_var( + sys.local_exchange + ) + mx_dict[time][sys.local_couplings.name] = self.add_opt_var( + sys.local_couplings + ) + + # create the state grid + # x0 will always be the state at time 0 since the loop it is defined in starts + # in the past and finishes at 0 + self.pred_time = 0 + for time in prediction_grid[1:]: + self.pred_time = time + mx_dict[time][sys.states.name] = self.add_opt_var(sys.states) + self.pred_time += ts + mx_dict[self.pred_time] = {sys.states.name: self.add_opt_var(sys.states)} + + all_quantities = sys.all_system_quantities() + # add constraints and create the objective function for all stages + for time in prediction_grid: + stage_mx = mx_dict[time] + + # add penalty on control change between intervals + u_prev = mx_dict[time - ts][sys.controls.name] + uk = stage_mx[sys.controls.name] + self.objective_function += ts * ca.dot(du_weights, (u_prev - uk) ** 2) + + # get stage arguments from current time step + stage_arguments = { + # variables + sys.states.name: stage_mx[sys.states.name], + sys.algebraics.name: stage_mx[sys.algebraics.name], + sys.outputs.name: stage_mx[sys.outputs.name], + # parameters + sys.controls.name: stage_mx[sys.controls.name], + sys.non_controlled_inputs.name: stage_mx[ + sys.non_controlled_inputs.name + ], + sys.model_parameters.name: const_par, + sys.penalty_factor.name: rho, + # admm related quantities + sys.multipliers.name: stage_mx[sys.multipliers.name], + sys.exchange_multipliers.name: stage_mx[sys.exchange_multipliers.name], + sys.exchange_diff.name: stage_mx[sys.exchange_diff.name], + sys.global_couplings.name: stage_mx[sys.global_couplings.name], + sys.local_exchange.name: stage_mx[sys.local_exchange.name], + sys.local_couplings.name: stage_mx[sys.local_couplings.name], + } + + # collect stage arguments for lagged variables + for lag, denotation_dict in self._lagged_input_names.items(): + for denotation, var_names in denotation_dict.items(): + l_name = name_with_lag(denotation, lag) + mx_list = [] + for v_name in var_names: + index = all_quantities[denotation].full_names.index(v_name) + mx_list.append(mx_dict[time - lag * ts][denotation][index]) + stage_arguments[l_name] = ca.vertcat(*mx_list) + + # evaluate a stage, add path constraints, multiple shooting constraints + # and add to the objective function + stage_result = self._stage_function(**stage_arguments) + self.add_constraint( + stage_result["model_constraints"], + lb=stage_result["lb_model_constraints"], + ub=stage_result["ub_model_constraints"], + ) + self.add_constraint( + stage_result["next_states"] - mx_dict[time + ts][sys.states.name] + ) + self.objective_function += stage_result["cost_function"] * ts + + def _construct_stage_function(self, system: CasadiADMMNNSystem): + """ + Combine information from the model and the var_ref to create CasADi + functions which describe the system dynamics and constraints at each + stage of the optimization problem. Sets the stage function. It has + all mpc variables as inputs, sorted by denotation (declared in + self.declare_quantities) and outputs ode, cost function and 3 outputs + per constraint (constraint, lb_constraint, ub_constraint). + + In the basic case, it has the form: + CasadiFunction: ['x', 'z', 'u', 'y', 'd', 'p'] -> + ['ode', 'cost_function', 'model_constraints', + 'ub_model_constraints', 'lb_model_constraints'] + + Args: + system + """ + all_system_quantities = system.all_system_quantities() + constraints = {"model_constraints": system.model_constraints} + + inputs = [ + q.full_symbolic + for q in all_system_quantities.values() + if q.use_in_stage_function + ] + input_denotations = [ + q.name + for denotation, q in all_system_quantities.items() + if q.use_in_stage_function + ] + + # aggregate constraints + constraints_func = [c.function for c in constraints.values()] + constraints_lb = [c.lb for c in constraints.values()] + constraints_ub = [c.ub for c in constraints.values()] + constraint_denotations = list(constraints.keys()) + constraint_lb_denotations = [LB_PREFIX + k for k in constraints] + constraint_ub_denotations = [UB_PREFIX + k for k in constraints] + + # create a dictionary which holds all the inputs for the sim step of the model + all_input_variables = {} + lagged_inputs: dict[int, dict[str, ca.MX]] = {} + # dict[lag, dict[denotation, list[var_name]]] + lagged_input_names: dict[int, dict[str, list[str]]] = {} + + for q_name, quantity in system.sim_step_quantities.items(): + if not quantity.use_in_stage_function: + continue + + for v_id, v_name in enumerate(quantity.full_names): + all_input_variables[v_name] = quantity.full_symbolic[v_id] + lag = system.lags_dict.get(v_name, 1) + + # if lag exists, we have to create and organize new variables + for j in range(1, lag): + # create an MX variable for this lag + l_name = name_with_lag(v_name, j) + new_lag_var = ca.MX.sym(l_name) + all_input_variables[l_name] = new_lag_var + + # add the mx variable to its lag time and denotation + lagged_inputs_j = lagged_inputs.setdefault(j, {}) + lv_mx = lagged_inputs_j.setdefault(q_name, ca.DM([])) + lagged_inputs[j][q_name] = ca.vertcat(lv_mx, new_lag_var) + + # keep track of the variable names that were added + lagged_input_names_j = lagged_input_names.setdefault(j, {}) + lv_names = lagged_input_names_j.setdefault(q_name, []) + lv_names.append(v_name) + + self._lagged_input_names = lagged_input_names + flat_lagged_inputs = { + f"{den}_{i}": mx + for i, subdict in lagged_inputs.items() + for den, mx in subdict.items() + } + + all_outputs = system.sim_step(**all_input_variables) + state_output_it = (all_outputs[s_name] for s_name in system.states.full_names) + state_output = ca.vertcat(*state_output_it) + + # aggregate outputs + outputs = [ + state_output, + system.cost_function, + *constraints_func, + *constraints_lb, + *constraints_ub, + ] + output_denotations = [ + "next_states", + "cost_function", + *constraint_denotations, + *constraint_lb_denotations, + *constraint_ub_denotations, + ] + + # function describing system dynamics and cost function + self._stage_function = ca.Function( + "f", + inputs + list(flat_lagged_inputs.values()), + outputs, + # input handles to make kwarg use possible and to debug + input_denotations + list(flat_lagged_inputs), + # output handles to make kwarg use possible and to debug + output_denotations, + )
+ + +
[docs]class CasADiADMMBackend_NN(CasADiADMMBackend, CasADiBBBackend): + """ + Class doing optimization with an MLModel. + """ + + system_type = CasadiADMMNNSystem + discretization_types = { + DiscretizationMethod.multiple_shooting: MultipleShootingADMMNN + } + system: CasadiADMMNNSystem
+ # a dictionary of collections of the variable lags +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_ml.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_ml.html new file mode 100644 index 0000000..84b2147 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/casadi_ml.html @@ -0,0 +1,501 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.casadi_ml — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.casadi_ml

+import casadi as ca
+from typing import Dict
+import collections
+
+from agentlib_mpc.models.casadi_model import CasadiParameter
+
+from agentlib_mpc.data_structures.casadi_utils import (
+    LB_PREFIX,
+    UB_PREFIX,
+    DiscretizationMethod,
+    SolverFactory,
+    Constraint,
+)
+from agentlib_mpc.data_structures.ml_model_datatypes import name_with_lag
+from agentlib_mpc.data_structures.mpc_datamodels import (
+    FullVariableReference,
+)
+from agentlib_mpc.models.casadi_ml_model import CasadiMLModel
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationQuantity,
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.optimization_backends.casadi_.basic import (
+    MultipleShooting,
+    CasADiBaseBackend,
+)
+from agentlib_mpc.optimization_backends.casadi_.full import FullSystem
+
+
+
[docs]class CasadiMLSystem(FullSystem): + # multiple possibilities of using the MLModel + # stage function for neural networks + model: CasadiMLModel + lags_dict: dict[str, int] + sim_step: ca.Function + +
[docs] def initialize(self, model: CasadiMLModel, var_ref: FullVariableReference): + # define variables + self.states = OptimizationVariable.declare( + denotation="state", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + assert_complete=True, + ) + self.controls = OptimizationVariable.declare( + denotation="control", + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + assert_complete=True, + ) + self.algebraics = OptimizationVariable.declare( + denotation="z", + variables=model.auxiliaries, + ref_list=[], + ) + self.outputs = OptimizationVariable.declare( + denotation="y", + variables=model.outputs, + ref_list=var_ref.outputs, + ) + + # define parameters + self.non_controlled_inputs = OptimizationParameter.declare( + denotation="d", + variables=model.get_inputs(var_ref.inputs), + ref_list=var_ref.inputs, + assert_complete=True, + ) + self.model_parameters = OptimizationParameter.declare( + denotation="parameter", + variables=model.parameters, + ref_list=var_ref.parameters, + ) + self.initial_state = OptimizationParameter.declare( + denotation="initial_state", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + use_in_stage_function=False, + assert_complete=True, + ) + self.last_control = OptimizationParameter.declare( + denotation="initial_control", + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + use_in_stage_function=False, + assert_complete=True, + ) + self.r_del_u = OptimizationParameter.declare( + denotation="r_del_u", + variables=[CasadiParameter(name=r_del_u) for r_del_u in var_ref.r_del_u], + ref_list=var_ref.r_del_u, + use_in_stage_function=False, + assert_complete=True, + ) + self.cost_function = model.cost_func + self.model_constraints = Constraint( + function=ca.vertcat(*[c.function for c in model.get_constraints()]), + lb=ca.vertcat(*[c.lb for c in model.get_constraints()]), + ub=ca.vertcat(*[c.ub for c in model.get_constraints()]), + ) + self.sim_step = model.make_predict_function_for_mpc() + self.model = model + self.lags_dict: dict[str, int] = model.lags_dict
+ + @property + def max_lag(self) -> int: + if self.lags_dict: + return max(self.lags_dict.values()) + else: + # if there is no bb variable, we have a lag of 1 + return 1 + +
[docs] def all_system_quantities(self) -> dict[str, OptimizationQuantity]: + return {var.name: var for var in self.quantities}
+ + +
[docs]class MultipleShooting_ML(MultipleShooting): + max_lag: int + + def _discretize(self, sys: CasadiMLSystem): + n = self.options.prediction_horizon + ts = self.options.time_step + const_par = self.add_opt_par(sys.model_parameters) + du_weights = self.add_opt_par(sys.r_del_u) + + pre_grid_states = [ts * i for i in range(-sys.max_lag + 1, 1)] + inputs_lag = min(-2, -sys.max_lag) # at least -2, to consider last control + pre_grid_inputs = [ts * i for i in range(inputs_lag + 1, 0)] + prediction_grid = [ts * i for i in range(0, n)] + + # sort for debugging purposes + full_grid = sorted( + list(set(prediction_grid + pre_grid_inputs + pre_grid_states)) + ) + + # dict[time, dict[denotation, ca.MX]] + mx_dict: dict[float, dict[str, ca.MX]] = {time: {} for time in full_grid} + + # add past state variables + for time in pre_grid_states: + self.pred_time = time + x_past = self.add_opt_par(sys.initial_state) + # add past states as optimization variables with fixed values so they can + # be accessed by the first few steps, when there are lags + mx_dict[time][sys.states.name] = self.add_opt_var( + sys.states, lb=x_past, ub=x_past, guess=x_past + ) + mx_dict[time][sys.initial_state.name] = x_past + + # add past inputs + for time in pre_grid_inputs: + self.pred_time = time + d = sys.non_controlled_inputs + mx_dict[time][d.name] = self.add_opt_par(d) + u_past = self.add_opt_par(sys.last_control) + mx_dict[time][sys.controls.name] = self.add_opt_var( + sys.controls, lb=u_past, ub=u_past, guess=u_past + ) + mx_dict[time][sys.last_control.name] = u_past + + # add all variables over future grid + for time in prediction_grid: + self.pred_time = time + mx_dict[time][sys.controls.name] = self.add_opt_var(sys.controls) + mx_dict[time][sys.non_controlled_inputs.name] = self.add_opt_par( + sys.non_controlled_inputs + ) + mx_dict[time][sys.algebraics.name] = self.add_opt_var(sys.algebraics) + mx_dict[time][sys.outputs.name] = self.add_opt_var(sys.outputs) + + # create the state grid + # x0 will always be the state at time 0 since the loop it is defined in starts + # in the past and finishes at 0 + self.pred_time = 0 + for time in prediction_grid[1:]: + self.pred_time = time + mx_dict[time][sys.states.name] = self.add_opt_var(sys.states) + self.pred_time += ts + mx_dict[self.pred_time] = {sys.states.name: self.add_opt_var(sys.states)} + + all_quantities = sys.all_system_quantities() + # add constraints and create the objective function for all stages + for time in prediction_grid: + stage_mx = mx_dict[time] + + # add penalty on control change between intervals + u_prev = mx_dict[time - ts][sys.controls.name] + uk = stage_mx[sys.controls.name] + self.objective_function += ts * ca.dot(du_weights, (u_prev - uk) ** 2) + + # get stage arguments from current time step + stage_arguments = { + # variables + sys.states.name: stage_mx[sys.states.name], + sys.algebraics.name: stage_mx[sys.algebraics.name], + sys.outputs.name: stage_mx[sys.outputs.name], + # parameters + sys.controls.name: stage_mx[sys.controls.name], + sys.non_controlled_inputs.name: stage_mx[ + sys.non_controlled_inputs.name + ], + sys.model_parameters.name: const_par, + } + + # collect stage arguments for lagged variables + for lag, denotation_dict in self._lagged_input_names.items(): + for denotation, var_names in denotation_dict.items(): + l_name = name_with_lag(denotation, lag) + mx_list = [] + for v_name in var_names: + # add only the singular variable which has a lag on this level + # to the stage arguments + index = all_quantities[denotation].full_names.index(v_name) + mx_list.append(mx_dict[time - lag * ts][denotation][index]) + stage_arguments[l_name] = ca.vertcat(*mx_list) + + # evaluate a stage, add path constraints, multiple shooting constraints + # and add to the objective function + stage_result = self._stage_function(**stage_arguments) + self.add_constraint( + stage_result["model_constraints"], + lb=stage_result["lb_model_constraints"], + ub=stage_result["ub_model_constraints"], + ) + self.add_constraint( + stage_result["next_states"] - mx_dict[time + ts][sys.states.name] + ) + self.objective_function += stage_result["cost_function"] * ts + +
[docs] def initialize(self, system: CasadiMLSystem, solver_factory: SolverFactory): + """Initializes the trajectory optimization problem, creating all symbolic + variables of the OCP, the mapping function and the numerical solver.""" + self._construct_stage_function(system) + super().initialize(system=system, solver_factory=solver_factory)
+ + def _construct_stage_function(self, system: CasadiMLSystem): + """ + Combine information from the model and the var_ref to create CasADi + functions which describe the system dynamics and constraints at each + stage of the optimization problem. Sets the stage function. It has + all mpc variables as inputs, sorted by denotation (declared in + self.declare_quantities) and outputs ode, cost function and 3 outputs + per constraint (constraint, lb_constraint, ub_constraint). + + In the basic case, it has the form: + CasadiFunction: ['x', 'z', 'u', 'y', 'd', 'p'] -> + ['ode', 'cost_function', 'model_constraints', + 'ub_model_constraints', 'lb_model_constraints'] + + Args: + system + """ + all_system_quantities = system.all_system_quantities() + constraints = {"model_constraints": system.model_constraints} + + inputs = [ + q.full_symbolic + for q in all_system_quantities.values() + if q.use_in_stage_function + ] + input_denotations = [ + q.name + for denotation, q in all_system_quantities.items() + if q.use_in_stage_function + ] + + # aggregate constraints + constraints_func = [c.function for c in constraints.values()] + constraints_lb = [c.lb for c in constraints.values()] + constraints_ub = [c.ub for c in constraints.values()] + constraint_denotations = list(constraints.keys()) + constraint_lb_denotations = [LB_PREFIX + k for k in constraints] + constraint_ub_denotations = [UB_PREFIX + k for k in constraints] + + # create a dictionary which holds all the inputs for the sim step of the model + all_input_variables = {} + lagged_inputs: dict[int, dict[str, ca.MX]] = {} + # dict[lag, dict[denotation, list[var_name]]] + lagged_input_names: dict[int, dict[str, list[str]]] = {} + for q_name, q_obj in all_system_quantities.items(): + if not q_obj.use_in_stage_function: + continue + for v_id, v_name in enumerate(q_obj.full_names): + all_input_variables[v_name] = q_obj.full_symbolic[v_id] + lag = system.lags_dict.get(v_name, 1) + + # if lag exists, we have to create and organize new variables + for j in range(1, lag): + # create an MX variable for this lag + l_name = name_with_lag(v_name, j) + new_lag_var = system.model.lags_mx_store[l_name] + all_input_variables[l_name] = new_lag_var + + # add the mx variable to its lag time and denotation + lagged_inputs_j = lagged_inputs.setdefault(j, {}) + lv_mx = lagged_inputs_j.setdefault(q_name, ca.DM([])) + lagged_inputs[j][q_name] = ca.vertcat(lv_mx, new_lag_var) + + # keep track of the variable names that were added + lagged_input_names_j = lagged_input_names.setdefault(j, {}) + lv_names = lagged_input_names_j.setdefault(q_name, []) + lv_names.append(v_name) + + self._lagged_input_names = lagged_input_names + flat_lagged_inputs = { + f"{den}_{i}": mx + for i, subdict in lagged_inputs.items() + for den, mx in subdict.items() + } + + all_outputs = system.sim_step(**all_input_variables) + state_output_it = (all_outputs[s_name] for s_name in system.states.full_names) + state_output = ca.vertcat(*state_output_it) + + # aggregate outputs + outputs = [ + state_output, + system.cost_function, + *constraints_func, + *constraints_lb, + *constraints_ub, + ] + output_denotations = [ + "next_states", + "cost_function", + *constraint_denotations, + *constraint_lb_denotations, + *constraint_ub_denotations, + ] + + # function describing system dynamics and cost function + self._stage_function = ca.Function( + "f", + inputs + list(flat_lagged_inputs.values()), + outputs, + # input handles to make kwarg use possible and to debug + input_denotations + list(flat_lagged_inputs), + # output handles to make kwarg use possible and to debug + output_denotations, + ) + + def _create_lag_structure_for_denotations(self, system: CasadiMLSystem): + all_system_quantities = self.all_system_quantities(system) + all_input_variables = {} + lagged_inputs: dict[int, dict[str, ca.MX]] = {} + # dict[lag, dict[denotation, list[var_name]]] + lagged_input_names: dict[int, dict[str, list[str]]] = {} + for q_name, q_obj in all_system_quantities.items(): + if not q_obj.use_in_stage_function: + continue + for v_id, v_name in enumerate(q_obj.full_names): + all_input_variables[v_name] = q_obj.full_symbolic[v_id] + lag = system.lags_dict.get(v_name, 1) + + # if lag exists, we have to create and organize new variables + for j in range(1, lag): + # create an MX variable for this lag + l_name = name_with_lag(v_name, j) + new_lag_var = ca.MX.sym(l_name) + all_input_variables[l_name] = new_lag_var + + # add the mx variable to its lag time and denotation + lagged_inputs_j = lagged_inputs.setdefault(j, {}) + lv_mx = lagged_inputs_j.setdefault(q_name, ca.DM([])) + lagged_inputs[j][q_name] = ca.vertcat(lv_mx, new_lag_var) + + # keep track of the variable names that were added + lagged_input_names_j = lagged_input_names.setdefault(j, {}) + lv_names = lagged_input_names_j.setdefault(q_name, []) + lv_names.append(v_name) + + return
+ + +
[docs]class CasADiBBBackend(CasADiBaseBackend): + """ + Class doing optimization with a MLModel. + """ + + system_type = CasadiMLSystem + discretization_types = {DiscretizationMethod.multiple_shooting: MultipleShooting_ML} + system: CasadiMLSystem + # a dictionary of collections of the variable lags + lag_collection: Dict[str, collections.deque] = {} + max_lag: int + +
[docs] def get_lags_per_variable(self) -> dict[str, float]: + """Returns the name of variables which include lags and their lag. The MPC + module can use this information to save relevant past data of lagged + variables""" + ts = self.config.discretization_options.time_step + return { + name: (lag - 1) * ts + for name, lag in self.system.lags_dict.items() + if name in self.var_ref + }
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/VariableGroup.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/VariableGroup.html new file mode 100644 index 0000000..511894a --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/VariableGroup.html @@ -0,0 +1,330 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core.VariableGroup — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.core.VariableGroup

+from __future__ import annotations
+
+import dataclasses
+
+import casadi as ca
+
+from agentlib_mpc.models.casadi_model import CasadiVariable
+
+
+
[docs]@dataclasses.dataclass(frozen=True) +class OptimizationQuantity: + name: str + full_symbolic: ca.MX # used in complex cost functions for admm etc + dim: int + ref_names: tuple[str] # used in get_mpc_inputs + full_names: tuple[str] # used in create_res_format + use_in_stage_function: bool + + def __hash__(self): + return hash(self.name)
+ + +def _check_ref_in_full(ref: list[str], full_names: list[str]): + diff = set(ref).difference(full_names) + if diff: + raise ValueError( + f"The variables from the variable ref are not a subset of the model " + f"variables. The following variables are wrong: {diff}" + ) + + +
[docs]@dataclasses.dataclass(frozen=True) +class OptimizationVariable(OptimizationQuantity): + input_map: ca.Function # get mpc inputs + output_map: ca.Function # get mpc outputs + use_in_stage_function: bool + binary: bool + +
[docs] @classmethod + def declare( + cls, + denotation: str, + variables: list[CasadiVariable], + ref_list: list[str], + use_in_stage_function: bool = True, + assert_complete: bool = False, + binary: bool = False, + ) -> OptimizationVariable: + """ + Declares a group of optimization variables that serve a purpose in + the optimization problem. Typical groups are states, the control + inputs or slack variables. + + Args: + binary: Flag, whether these variables are binary + denotation: The key of the variable, e.g. 'X', 'U', etc. Use + this key in the discretization function to add the variable at + different stages of the optimization problem. The optimal value + of these variables will also be mapped to this key. + variables: A list of + CasadiVariables or an MX/SX vector including all variables + within this category. + ref_list: A list of names indicating which variables + in full_list are AgentVariables and need to be updated before + each optimization. + use_in_stage_function: If False, the variable is not + added to the stage function. If True, the variable needs to be + provided to the stage function at every point in the + discretization function. + assert_complete: If True, throws an error if the ref_list does + not contain all variables. + """ + full_symbolic = [] + full_names = [] + ref_symbolic = [] + lb_full = [] + lb_ref = [] + ub_full = [] + ub_ref = [] + ref_list_ordered = [] + + for var in variables: + name = var.name + if assert_complete and name not in ref_list: + raise ValueError( + f"The variable {name} which is defined in the model " + f" has to be defined in the ModuleConfig!" + ) + + full_symbolic.append(var.sym) + full_names.append(name) + + if name in ref_list: + lb = ca.MX.sym(f"lb_{denotation}") + ub = ca.MX.sym(f"lb_{denotation}") + lb_ref.append(lb) + ub_ref.append(ub) + ref_symbolic.append(var.sym) + ref_list_ordered.append(name) + lb_full.append(lb) + ub_full.append(ub) + else: + lb_full.append(var.lb) + ub_full.append(var.ub) + + full_symbolic = ca.vertcat(*full_symbolic) + + # create functions that map between model variable vectors (so all variables) + # and variables from the var_ref (only the ones specified in the user config) + input_mapping = ca.Function( + f"par_map_{denotation}", + [ca.vertcat(*lb_ref), ca.vertcat(*ub_ref)], + [ca.vertcat(*lb_full), ca.vertcat(*ub_full)], + ["lb_ref", "ub_ref"], + [f"lb_{denotation}", f"ub_{denotation}"], + ) + output_mapping = ca.Function( + f"par_map_{denotation}", + [full_symbolic], + [ca.vertcat(*ref_symbolic)], + [denotation], + ["ref"], + ) + + dimension = full_symbolic.shape[0] + _check_ref_in_full(ref_list, full_names) + return cls( + name=denotation, + full_symbolic=full_symbolic, + dim=dimension, + ref_names=tuple(ref_list_ordered), + full_names=tuple(full_names), + use_in_stage_function=use_in_stage_function, + input_map=input_mapping, + output_map=output_mapping, + binary=binary, + )
+ + def __hash__(self): + return hash(self.name)
+ + +
[docs]@dataclasses.dataclass(frozen=True) +class OptimizationParameter(OptimizationQuantity): + full_with_defaults: ca.MX + add_default_values: ca.Function + +
[docs] @classmethod + def declare( + cls, + denotation: str, + variables: list[CasadiVariable], + ref_list: list[str], + use_in_stage_function=True, + assert_complete: bool = False, + ): + """ + Declares a group of optimization parameters that serve a purpose in + the optimization problem. Typical groups are uncontrollable inputs or + physical parameters. + + Args: + denotation: The key of the variable, e.g. 'p', 'd', etc. Use this + key in the discretization function to add the parameter at + different stages of the optimization problem. + variables: A list of CasadiVariables including all parameters + within this category. + ref_list: A list of names indicating which parameters in full_list + are AgentVariables and need to be updated before each + optimization. + use_in_stage_function: If False, the parameter is not added to the + stage function. If True, the variable needs to be provided to + the stage function at every point in the discretization function. + assert_complete: If True, throws an error if the ref_list does + not contain all variables. + """ + provided = [] + full_with_defaults = [] + full_symbolic = [] + full_names = [] + ref_list_ordered = [] + for var in variables: + name = var.name + if assert_complete: + assert name in ref_list, ( + f"The variable {name} which is defined in the model " + f" has to be defined in the ModuleConfig!" + ) + + full_symbolic.append(var.sym) + full_names.append(name) + if name in ref_list: + full_with_defaults.append(var.sym) + provided.append(var.sym) + ref_list_ordered.append(name) + else: + if var.value is None: + raise ValueError( + f"Parameter '{name}' is not declared in the module " + f"config. Tried using default from model " + f" but it was 'None'." + ) + full_with_defaults.append(var.value) + full_with_defaults = ca.vertcat(*full_with_defaults) + + add_default_values = ca.Function( + f"par_map_{denotation}", + [ca.vertcat(*provided)], + [full_with_defaults], + ["ref"], + [denotation], + ) + _check_ref_in_full(ref_list, full_names) + return OptimizationParameter( + name=denotation, + full_with_defaults=full_with_defaults, + full_symbolic=ca.vertcat(*full_symbolic), + dim=full_with_defaults.shape[0], + ref_names=tuple(ref_list_ordered), + full_names=tuple(full_names), + use_in_stage_function=use_in_stage_function, + add_default_values=add_default_values, + )
+ + def __hash__(self): + return hash(self.name)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/casadi_backend.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/casadi_backend.html new file mode 100644 index 0000000..4c0c556 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/casadi_backend.html @@ -0,0 +1,397 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core.casadi_backend — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.core.casadi_backend

+import logging
+import platform
+from pathlib import Path
+from typing import Type, Optional
+
+import casadi as ca
+import pydantic
+from agentlib.core.errors import ConfigurationError
+
+from agentlib_mpc.data_structures.mpc_datamodels import MPCVariable, stats_path
+from agentlib_mpc.optimization_backends.casadi_.core import system
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.discretization import (
+    DiscretizationT,
+    Results,
+)
+from agentlib_mpc.optimization_backends.backend import (
+    OptimizationBackend,
+    BackendConfig,
+)
+from agentlib_mpc.models.casadi_model import (
+    CasadiModel,
+)
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.data_structures.casadi_utils import (
+    CasadiDiscretizationOptions,
+    SolverFactory,
+    DiscretizationMethod,
+    SolverOptions,
+)
+from agentlib_mpc.utils import sampling
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class CasadiBackendConfig(BackendConfig): + discretization_options: CasadiDiscretizationOptions = pydantic.Field( + default_factory=CasadiDiscretizationOptions + ) + solver: SolverOptions = pydantic.Field(default_factory=SolverOptions) + build_batch_bat: Optional[Path] = pydantic.Field( + default=None, + description="Path to a batch file, which can compile C code on windows.", + ) + do_jit: Optional[bool] = pydantic.Field( + default=None, + description="Boolean to turn JIT of the optimization problems on or off.", + validate_default=True, + ) + +
[docs] @pydantic.field_validator("do_jit") + @classmethod + def validate_compile(cls, do_jit, info: pydantic.FieldValidationInfo): + """Checks whether code compilation should be done.""" + + # if we're on Linux, we cannot generate the code as of now + if platform.system() == "Linux": + if do_jit is True: + raise NotImplementedError( + "C Code generation not implemented yet for linux." + ) + # if not specified or False, we do not do jit + return False + + # assume we're on Windows. If there is no batch file, we have to return False + bat_file = info.data["build_batch_bat"] + if bat_file is None: + if do_jit is True: + raise ConfigurationError( + "Cannot do C-Code generation on Windows without specifying a " + "proper batch file through the 'build_batch_bat' option." + ) + return False + + # at this point we are on Windows and have a (hopefully) valid batch file + if do_jit is None: + # the user provided a batch file but no clear instruction. For backwards + # compatibility, we will assume compilation is desired and return True + return True + + # if both do_jit and the batch file are specified, we do not modify do_jit + return do_jit
+ + +
[docs]class CasADiBackend(OptimizationBackend): + """ + OptimizationBackend for solving the optimization problem with CasADi. + Requires the model to be a CasADi model. + """ + + system_type: Type[system.SystemT] + system: system.SystemT + discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] + discretization: DiscretizationT + _supported_models = {"CasadiModel": CasadiModel} + config_type = CasadiBackendConfig + +
[docs] def setup_optimization(self, var_ref: mpc_datamodels.VariableReference): + """ + Performs all necessary steps to make the ``solve`` method usable. + To do this, it calls several auxiliary functions. These functions can + be overloaded to change the resulting optimization problem. + + Args: + var_ref: class with variable name lists sorted by function in the mpc. + """ + super().setup_optimization(var_ref=var_ref) + self.reset_setup_attributes() + + # connect variable roles defined by the mpc module with the model + self.system.initialize(model=self.model, var_ref=self.var_ref) + solver_factory = SolverFactory( + do_jit=self.config.do_jit, + bat_file=self.config.build_batch_bat, + name=self.config.name, + options=self.config.solver, + logger=self.logger, + ) + self.discretization.initialize( + system=self.system, solver_factory=solver_factory + )
+ +
[docs] def solve(self, now: float, current_vars: dict[str, MPCVariable]) -> Results: + # collect and format inputs + mpc_inputs = self._get_current_mpc_inputs(agent_variables=current_vars, now=now) + full_results = self.discretization.solve(mpc_inputs) + self.save_result_df(full_results, now=now) + + return full_results
+ + def _get_current_mpc_inputs( + self, agent_variables: dict[str, MPCVariable], now: float + ) -> dict[str, ca.DM]: + """ + Reads the value from all received AgentVariables and performs the + necessary expansion/interpolation of values onto the correct grid. + + Args: + agent_variables: dictionary containing all AgentVariables from the + var_ref, with names as keys. + now: current time, used for interpolation of trajectory data + + Returns: + dictionary with keys matching the required input for + self._mpc_inputs_to_nlp_inputs() + """ + + def get_variable_boundaries(var: OptimizationVariable) -> dict[str, ca.DM]: + """ + Gets boundaries and initial guesses for all optimization + variables of denotation 'of'. Currently, initial guesses are used + without shifting. + + Args: + var: denotation matching the variable type that is gathered + + Returns: + dict of the form {lb_<den>: ca.MX, ub_<den>: ca.MX, guess_<den>: ca.MX} + """ + ref_list = var.ref_names + input_map = var.input_map + grid = self.discretization.grid(var) + + lower_bounds, upper_bounds = [], [] + for ref in ref_list: + agent_variable = agent_variables[ref] + ub = sampling.sample( + trajectory=agent_variable.ub, + grid=grid, + current=now, + method=agent_variable.interpolation_method, + ) + upper_bounds.append(ub) + lb = sampling.sample( + trajectory=agent_variable.lb, + grid=grid, + current=now, + method=agent_variable.interpolation_method, + ) + lower_bounds.append(lb) + + boundaries = input_map( + ub_ref=ca.horzcat(*upper_bounds).T, lb_ref=ca.horzcat(*lower_bounds).T + ) + + return boundaries + + def get_parameter_values(par: OptimizationParameter) -> dict[str, ca.DM]: + """ + Gets values for all optimization parameters of denotation 'of' + + Args: + par: denotation matching the variable type that is gathered + + Returns: + dict of the form {<den>: ca.MX} + """ + ref_list = par.ref_names + input_map = par.add_default_values + grid = self.discretization.grid(par) + + input_matrix = [] + for ref in ref_list: + var = agent_variables[ref] + value = var.value + if value is None: + raise ValueError( + f"Input for variable {ref} is empty. " + f"Cannot solve optimization problem." + ) + try: + interpolation_method = var.interpolation_method + except AttributeError as e: + # Catch the case where normal AgentVariables got mixed into the + # optimization input, possibly due to subclassing the MPC class + # and dynamically changing the MPC input + raise TypeError( + f"The variable {ref} does not have an interpolationmethod. All " + f"Variables used in MPC need to be of type MPCVariable " + f"(subclass of AgentVariable). This is likely caused by an " + f"error in a custom module." + ) from e + input_matrix.append( + sampling.sample( + trajectory=value, + grid=grid, + current=now, + method=interpolation_method, + ) + ) + + return input_map(ref=ca.horzcat(*input_matrix).T) + + mpc_inputs = {} + + for sys_par in self.system.parameters: + sys_par_values = get_parameter_values(par=sys_par) + mpc_inputs.update(sys_par_values) + for sys_var in self.system.variables: + sys_var_boundaries = get_variable_boundaries(var=sys_var) + mpc_inputs.update(sys_var_boundaries) + + return mpc_inputs + +
[docs] def reset_setup_attributes(self): + """Cleans all attributes that are used for optimization setup.""" + self.system = self.system_type() + opts = self.config.discretization_options + method = opts.method + self.discretization = self.discretization_types[method](options=opts) + self.discretization.logger = self.logger
+ +
[docs] def save_result_df( + self, + results: Results, + now: float = 0, + ): + """ + Save the results of `solve` into a dataframe at each time step. + + Example results dataframe: + + value_type variable ... lower + variable T_0 T_0_slack ... T_0_slack mDot_0 + time_step ... + 2 0.000000 298.160000 NaN ... NaN NaN + 101.431499 297.540944 -149.465942 ... -inf 0.0 + 450.000000 295.779780 -147.704779 ... -inf 0.0 + 798.568501 294.720770 -146.645769 ... -inf 0.0 + Args: + results: + now: + + Returns: + + """ + if not self.config.save_results: + return + + res_file = self.config.results_file + if not self.results_file_exists(): + results.write_columns(res_file) + results.write_stats_columns(stats_path(res_file)) + + df = results.df + df.index = list(map(lambda x: str((now, x)), df.index)) + df.to_csv(res_file, mode="a", header=False) + + with open(stats_path(res_file), "a") as f: + f.writelines(results.stats_line(str(now)))
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/discretization.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/discretization.html new file mode 100644 index 0000000..7e9fe29 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/discretization.html @@ -0,0 +1,676 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core.discretization — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.core.discretization

+"""Holds classes that implement different transcriptions of the OCP"""
+
+import abc
+import dataclasses
+from pathlib import Path
+from typing import TypeVar, Union, Callable, Optional
+
+import casadi as ca
+import numpy as np
+import pandas as pd
+
+from agentlib_mpc.data_structures.casadi_utils import (
+    CaFuncInputs,
+    OptVarMXContainer,
+    OptParMXContainer,
+    CasadiDiscretizationOptions,
+    SolverFactory,
+    MPCInputs,
+    GUESS_PREFIX,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationQuantity,
+    OptimizationParameter,
+    OptimizationVariable,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.system import System
+
+
+CasadiVariableList = Union[list[ca.MX], ca.MX]
+
+
+
[docs]@dataclasses.dataclass +class Results: + matrix: ca.MX + grid: list[float] + columns: pd.MultiIndex + stats: dict + variable_grid_indices: dict[str, list[int]] + _variable_name_to_index: dict[str, int] = None + + def __post_init__(self): + self._variable_name_to_index = self.variable_lookup() + try: + iters = self.stats.pop("iterations") + self.stats["obj"] = iters["obj"][-1] + except KeyError: + pass + if "fatrop" in self.stats: + self.stats.pop("ng") + self.stats.pop("nu") + self.stats.pop("nx") + self.stats.pop("fatrop") + + def __getitem__(self, item: str) -> np.ndarray: + return self.matrix[ + self.variable_grid_indices[item], self._variable_name_to_index[item] + ].toarray(simplify=True) + +
[docs] def variable_lookup(self) -> dict[str, int]: + """Creates a mapping from variable names to the column index in the Matrix""" + lookup = {} + for index, label in enumerate(self.columns): + if label[0] == "variable": + lookup[label[1]] = index + return lookup
+ + @property + def df(self) -> pd.DataFrame: + return pd.DataFrame(self.matrix, index=self.grid, columns=self.columns) + +
[docs] def write_columns(self, file: Path): + df = pd.DataFrame(columns=self.columns) + df.to_csv(file)
+ +
[docs] def write_stats_columns(self, file: Path): + line = f""",{",".join(self.stats)}\n""" + with open(file, "w") as f: + f.write(line)
+ +
[docs] def stats_line(self, index: str) -> str: + return f""""{index}",{",".join(map(str, self.stats.values()))}\n"""
+ + +
[docs]class Discretization(abc.ABC): + """ + opt_vars: holds symbolic variables during problem creation + opt_vars_lb: holds symbolic variables during problem creation + opt_vars_ub: holds symbolic variables during problem creation + initial_guess: holds symbolic variables during problem creation + opt_pars: holds symbolic variables during problem creation + constraints: holds symbolic variables during problem creation + constraints_lb: holds symbolic variables during problem creation + constraints_ub: holds symbolic variables during problem creation + objective_function: cost function during problem creation + mpc_opt_vars (dict): holds the symbolic variables and grids during + problem creation sorted by type as in system_variables + mpc_opt_pars (dict): holds the symbolic variables and grids during + problem creation sorted by type as in system_parameters + """ + + _stage_function: ca.Function + _mpc_inputs_to_nlp_inputs: ca.Function + _nlp_outputs_to_mpc_outputs: ca.Function + _optimizer: ca.Function + _result_map: ca.Function + only_positive_times_in_results = True + + def __init__(self, options: CasadiDiscretizationOptions): + self.options = options + self._finished_discretization: bool = False + + # attributes used for problem creation + self.k: int = 0 # increment for prediction loop + self.pred_time: float = 0 # for creation of grids + + # lists that hold all variables of the optimization problem + self.opt_vars: CasadiVariableList = [] # hold all optimization variables + self.opt_vars_lb: list[ca.MX] = [] + self.opt_vars_ub: list[ca.MX] = [] + self.initial_guess: list[ca.MX] = [] + self.opt_pars: CasadiVariableList = [] # hold all optimization parameters + self.constraints: CasadiVariableList = [] + self.constraints_lb: list[ca.MX] = [] + self.constraints_ub: list[ca.MX] = [] + self.objective_function: CaFuncInputs = ca.DM(0) + self.binary_opt_vars = [] + self.equalities: list[bool] = [] + + # dicts of variables of the optimization problem, sorted by role + self.mpc_opt_vars: dict[str, OptVarMXContainer] = {} + self.mpc_opt_pars: dict[str, OptParMXContainer] = {} + + self._create_results: Optional[Callable[[ca.DM, dict], Results]] = None + self.logger = None + +
[docs] def initialize(self, system: System, solver_factory: SolverFactory): + """Initializes the trajectory optimization problem, creating all symbolic + variables of the OCP, the mapping function and the numerical solver.""" + self._discretize(system) + self._finished_discretization = True + self.create_nlp_in_out_mapping(system) + self._create_solver(solver_factory)
+ + @abc.abstractmethod + def _discretize(self, sys: System): + """Specifies the discretization of direct optimization methods like + collocation, multiple shooting etc. This function creates the lists of + variables, parameters, constraints etc. by using the self.add_opt_var functions. + For an example see optimization_backends.casadi_.basic + """ + ... + + def _create_solver(self, solver_factory: SolverFactory): + self._optimizer = solver_factory.create_solver( + nlp=self.nlp, discrete=self.binary_vars, equalities=self.equalities + ) + +
[docs] def solve(self, mpc_inputs: MPCInputs) -> Results: + """ + Solves the discretized trajectory optimization problem. + + Args: + mpc_inputs: Casadi Matrices specifying the input of all different types + of optimization parameters. Matrices consist of different variable rows + and have a column for each time step in the discretization. + There are separate matrices for each input type (as defined in the + System), and also for the upper and lower boundaries of variables + respectively. + + + Returns: + Results: The complete evolution of the states, inputs and boundaries of each + variable and parameter over the prediction horizon, as well as solve + statistics. + + """ + # collect and format inputs + guesses = self._determine_initial_guess(mpc_inputs) + mpc_inputs.update(guesses) + nlp_inputs: dict[str, ca.DM] = self._mpc_inputs_to_nlp_inputs(**mpc_inputs) + + # perform optimization + nlp_output = self._optimizer(**nlp_inputs) + + # format and return solution + mpc_output = self._nlp_outputs_to_mpc_outputs(vars_at_optimum=nlp_output["x"]) + self._remember_solution(mpc_output) + result = self._process_solution(inputs=mpc_inputs, outputs=mpc_output) + return result
+ + def _determine_initial_guess(self, mpc_inputs: MPCInputs) -> MPCInputs: + """ + Collects initial guesses for all mpc variables. If possible, uses result + of last optimization. + If not available, the current measurement is used for states, and the mean of + the upper and lower bound is used otherwise. + """ + guesses = {} + + for denotation, var in self.mpc_opt_vars.items(): + guess = var.opt + if guess is None: + # if initial value is available, assume it is constant and make guess + guess_denotation = f"initial_{denotation}" + if guess_denotation in mpc_inputs: + # changes here because of the long guess.array caused by np.tile for lags + if mpc_inputs[guess_denotation].shape[1] > 1: + state_measurements = mpc_inputs[guess_denotation][:, -1] + else: + state_measurements = mpc_inputs[guess_denotation] + guess = np.tile(state_measurements, len(var.grid)) + # get guess from boundaries if last optimum is not available + else: + guess = np.array( + 0.5 + * ( + mpc_inputs[f"lb_{denotation}"] + + mpc_inputs[f"ub_{denotation}"] + ) + ) + guess = np.nan_to_num( + guess, posinf=100_000_000, neginf=-100_000_000 + ) + guesses.update({GUESS_PREFIX + denotation: guess}) + + return guesses + + def _remember_solution(self, optimum: dict[str, ca.DM]): + """Saves the last optimal solution for all optimization variables + sorted by type.""" + for den, var in self.mpc_opt_vars.items(): + var.opt = optimum[den] + + def _process_solution(self, inputs: dict, outputs: dict) -> Results: + """ + If self.result_file is not empty, + collect all inputs and outputs of the optimization problem and format + them as DataFrames and pass them to OptimizationBackend.save_df(). + Args: + inputs: mpc_inputs dict returned from _get_current_mpc_inputs + outputs: mpc_output from self._nlp_outputs_to_mpc_outputs + """ + # update the guess values at the variable positions with the outputs + for key, value in inputs.items(): + key: str + if key.startswith(GUESS_PREFIX): + out_key = key[len(GUESS_PREFIX) :] + inputs[key] = outputs[out_key] + + result_matrix = self._result_map(**inputs)["result"] + + return self._create_results(result_matrix, self._optimizer.stats()) + +
[docs] def create_nlp_in_out_mapping(self, system: System): + """ + Function creating mapping functions between the MPC variables ordered + by type (as defined in `declare_quantities` and the raw input/output + vector of the CasADi NLP. + """ + # Concatenate nlp variables to CasADi MX vectors + self.opt_vars = ca.vertcat(*self.opt_vars) + self.constraints = ca.vertcat(*self.constraints) + self.opt_pars = ca.vertcat(*self.opt_pars) + initial_guess = ca.vertcat(*self.initial_guess) + opt_vars_lb = ca.vertcat(*self.opt_vars_lb) + opt_vars_ub = ca.vertcat(*self.opt_vars_ub) + constraints_lb = ca.vertcat(*self.constraints_lb) + constraints_ub = ca.vertcat(*self.constraints_ub) + + # nlp inputs + nlp_inputs = [ + self.opt_pars, + initial_guess, + opt_vars_lb, + opt_vars_ub, + constraints_lb, + constraints_ub, + ] + nlp_input_denotations = [ + "p", + "x0", + "lbx", + "ubx", + "lbg", + "ubg", + ] + + # create empty lists to store all nlp inputs and outputs + mpc_inputs = [] + mpc_input_denotations = [] + mpc_outputs = [] + mpc_output_denotations = [] + + # Concatenate mpc outputs and their bounds to CasADi MX matrices + for denotation, opt_var in self.mpc_opt_vars.items(): + # mpc opt vars + var = opt_var.var + var = ca.horzcat(*var) + mpc_outputs.append(var) + mpc_output_denotations.append(denotation) + + # their bounds and guess + lb = ca.horzcat(*opt_var.lb) + ub = ca.horzcat(*opt_var.ub) + guess = ca.horzcat(*opt_var.guess) + mpc_inputs.extend([lb, ub, guess]) + mpc_input_denotations.extend( + [f"lb_{denotation}", f"ub_{denotation}", GUESS_PREFIX + denotation] + ) + + # Concatenate mpc inputs to CasADi MX matrices + for denotation, opt_par in self.mpc_opt_pars.items(): + var = opt_par.var + var = ca.horzcat(*var) + mpc_inputs.append(var) + mpc_input_denotations.append(denotation) + + # Mapping function that rearranges the variables for input into the NLP + self._mpc_inputs_to_nlp_inputs = ca.Function( + "mpc_inputs_to_nlp_inputs", + mpc_inputs, + nlp_inputs, + mpc_input_denotations, + nlp_input_denotations, + ) + + # Mapping function that rearranges the output of the nlp and sorts + # by denotation + self._nlp_outputs_to_mpc_outputs = ca.Function( + "nlp_outputs_to_mpc_outputs", + [self.opt_vars], + mpc_outputs, + ["vars_at_optimum"], + mpc_output_denotations, + ) + + matrix, col_index, full_grid, var_grids = self._create_result_format(system) + self._result_map = ca.Function( + "result_map", mpc_inputs, [matrix], mpc_input_denotations, ["result"] + ) + + def make_results_view(result_matrix: ca.DM, stats: dict) -> Results: + return Results( + matrix=result_matrix, + columns=col_index, + grid=full_grid, + variable_grid_indices=var_grids, + stats=stats, + ) + + self._create_results = make_results_view
+ + @property + def nlp(self) -> dict[str, ca.MX]: + """The nlp dict that casadi solvers need for instantiation""" + if not self._finished_discretization: + raise RuntimeError("You have to initialize first") + return { + "x": self.opt_vars, + "f": self.objective_function, + "g": self.constraints, + "p": self.opt_pars, + } + + @property + def binary_vars(self) -> list[bool]: + """List specifying for every optimization variable, whether it is binary.""" + if not self._finished_discretization: + raise RuntimeError("You have to initialize first") + return self.binary_opt_vars + + def _create_result_format( + self, system: System + ) -> (ca.MX, pd.MultiIndex, list[float], dict[str, list[int]]): + """ + Creates an MX matrix that includes all inputs and outputs of the nlp + in an ordered format. + Sets the _result_columns and _full_index private attributes. + + Created format: + variable upper lower parameter ... + t_0 t_0 t_0 rho ... + time . . . . + 1 . . . . + 2 . . . . + 3 + 4 + 5 + 6 + + Returns: + The Matrix as MX that defines the output format of the solver + A pandas column index for this matrix + The full grid + A dict specifying the row index with non-nan values for all variables + (not parameters) + + """ + + def make_column(vars_in_quantity: int, grid: list) -> (ca.MX, list[int]): + """Creates a matrix with the width of the number of variables in a quantity + group, and the length of the full grid. Also returns the indexes of this + variable group that point to non-nan entries. The indices are used in + slices of the results object.""" + col = [] + non_nan_entries = [] + for index_full, time in enumerate(full_grid): + if time in grid: + index = grid.index(time) + entry = mx_list[index].T + if not self.only_positive_times_in_results or time >= 0: + # with NARX there can be times smaller 0, however sometimes + # we dont want them in the results slice. + non_nan_entries.append(index_full) + else: + entry = np.full((1, vars_in_quantity), np.nan) + col = ca.vertcat(col, entry) + + return col, non_nan_entries + + full_grid = set() + variable_grids: dict[str, list[int]] = {} + for quant_type in {**self.mpc_opt_vars, **self.mpc_opt_pars}.values(): + full_grid.update(set(quant_type.grid)) + full_grid = sorted(full_grid) + columns = [] + output_matrix = ca.MX.sym("Results", len(full_grid), 0) + + for sys_pars in system.parameters: + names_list = sys_pars.full_names + if not names_list: + continue + + columns.extend(list(map(lambda x: ("parameter", x), names_list))) + grid = self.grid(sys_pars) + mx_list = self.mpc_opt_pars[sys_pars.name].var + column, _ = make_column(len(names_list), grid) + output_matrix = ca.horzcat(output_matrix, column) + + for sys_vars in system.variables: + names_list = sys_vars.full_names + + if not names_list: + continue + + grid = self.grid(sys_vars) + iterator = [("var", "variable"), ("ub", "upper"), ("lb", "lower")] + for key, header in iterator: + columns.extend(list(map(lambda x: (header, x), names_list))) + mx_list = self.mpc_opt_vars[sys_vars.name].__dict__[key] + column, grid_indices = make_column(len(names_list), grid) + output_matrix = ca.horzcat(output_matrix, column) + + if key == "var": + variable_grids.update({n: grid_indices for n in names_list}) + + result_columns = pd.MultiIndex.from_tuples(columns) + return output_matrix, result_columns, full_grid, variable_grids + +
[docs] def add_opt_var( + self, + quantity: OptimizationVariable, + lb: ca.MX = None, + ub: ca.MX = None, + guess: float = None, + post_den: str = "", + ): + """ + Create an optimization variable and append to all the associated + lists. If lb or ub are given, they override the values provided at + runtime! The usual application of this is, to fix the initial value + of a state to a parameter. + + Args: + quantity: corresponding system variable + lb: lower bound of the variable + ub: upper bound of the variable + guess: default for the initial guess + post_den: string to add to casadi MX after denotation (for debugging) + """ + # get dimension + dimension = quantity.dim + denotation = quantity.name + + # create symbolic variables + opt_var = ca.MX.sym(f"{denotation}_{self.pred_time}{post_den}", dimension) + lower = ca.MX.sym(f"lb_{denotation}_{self.pred_time}{post_den}", dimension) + upper = ca.MX.sym(f"ub_{denotation}_{self.pred_time}{post_den}", dimension) + + # if are not given (generally true), use the default variable for nlp lists + if lb is None: + lb = lower + if ub is None: + ub = upper + + # append to nlp specific lists + self.opt_vars.append(opt_var) + self.opt_vars_lb.append(lb) + self.opt_vars_ub.append(ub) + if guess is None: + guess = opt_var + self.initial_guess.append(guess) + self.binary_opt_vars.extend([quantity.binary] * dimension) + + # append to variable specific lists + var_list = self.mpc_opt_vars.setdefault(denotation, OptVarMXContainer()) + var_list.var.append(opt_var) + var_list.lb.append(lower) + var_list.ub.append(upper) + var_list.guess.append(opt_var) + var_list.grid.append(self.pred_time) + + return opt_var
+ +
[docs] def add_opt_par(self, quantity: OptimizationParameter, post_den: str = ""): + """ + Create an optimization parameter and append to all the associated lists. + + denotation[str]: the key of the parameter, e.g. 'P', 'Q', ... + dimension[int]: the dimension of the parameter + post_den[str]: string to add to casadi MX after denotation (for debugging) + """ + # get dimension + dimension = quantity.dim + denotation = quantity.name + + # create symbolic variables + opt_par = ca.MX.sym(f"{denotation}_{self.pred_time}{post_den}", dimension) + self.opt_pars.append(opt_par) + + # append to variable specific lists + par_list = self.mpc_opt_pars.setdefault(denotation, OptParMXContainer()) + par_list.var.append(opt_par) + par_list.grid.append(self.pred_time) + + return opt_par
+ +
[docs] def add_constraint( + self, + constraint_function: CaFuncInputs, + lb: CaFuncInputs = None, + ub: CaFuncInputs = None, + *, + gap_closing: bool = False, + ): + """ + Add a constraint to the optimization problem. If no bounds are given, + adds an equality constraint. + """ + # set equality for fatrop + self.equalities.extend([gap_closing] * constraint_function.shape[0]) + + # set bounds to default for equality constraints + if lb is None: + lb = ca.DM.zeros(constraint_function.shape[0], 1) + if ub is None: + ub = ca.DM.zeros(constraint_function.shape[0], 1) + + # Append inequality constraints + self.constraints.append(constraint_function) + self.constraints_lb.append(lb) + self.constraints_ub.append(ub)
+ +
[docs] def grid(self, var: OptimizationQuantity) -> list[float]: + denotation = var.name + if isinstance(var, OptimizationVariable): + return self.mpc_opt_vars[denotation].grid + if isinstance(var, OptimizationParameter): + return self.mpc_opt_pars[denotation].grid
+ + +DiscretizationT = TypeVar("DiscretizationT", bound=Discretization) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/system.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/system.html new file mode 100644 index 0000000..d21a3a3 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/core/system.html @@ -0,0 +1,181 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core.system — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.core.system

+"""Holds the System class, which knows the model"""
+
+from __future__ import annotations
+
+import abc
+from typing import TypeVar, Union
+
+from agentlib_mpc.data_structures.mpc_datamodels import VariableReference
+from agentlib_mpc.models.casadi_model import CasadiModel
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationVariable,
+    OptimizationParameter,
+)
+
+
+
[docs]class System(abc.ABC): + """ + + Examples: + class MySystem(System): + + # variables + states: OptimizationVariable + controls: OptimizationVariable + algebraics: OptimizationVariable + outputs: OptimizationVariable + + # parameters + non_controlled_inputs: OptimizationParameter + model_parameters: OptimizationParameter + initial_state: OptimizationParameter + + # dynamics + model_constraints: Constraint + cost_function: ca.MX + ode: ca.MX + + def initialize(self, model: CasadiModel, var_ref: VariableReference): + + self.states = OptimizationVariable.declare( + denotation="state", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + assert_complete=True, + ) + + . + . + . + ) + """ + +
[docs] @abc.abstractmethod + def initialize(self, model: CasadiModel, var_ref: VariableReference): ...
+ + @property + def variables(self) -> list[OptimizationVariable]: + return [ + var + for var in self.__dict__.values() + if isinstance(var, OptimizationVariable) + ] + + @property + def parameters(self) -> list[OptimizationParameter]: + return [ + var + for var in self.__dict__.values() + if isinstance(var, OptimizationParameter) + ] + + @property + def quantities(self) -> list[Union[OptimizationParameter, OptimizationVariable]]: + return self.variables + self.parameters
+ + +SystemT = TypeVar("SystemT", bound=System) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/full.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/full.html new file mode 100644 index 0000000..2062d17 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/full.html @@ -0,0 +1,287 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.full — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.full

+import casadi as ca
+
+from agentlib_mpc.optimization_backends.casadi_ import basic
+from agentlib_mpc.data_structures.casadi_utils import (
+    DiscretizationMethod,
+)
+from agentlib_mpc.data_structures.mpc_datamodels import (
+    FullVariableReference,
+)
+from agentlib_mpc.models.casadi_model import CasadiModel, CasadiParameter
+from agentlib_mpc.optimization_backends.casadi_.core.casadi_backend import CasADiBackend
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationParameter,
+)
+
+
+
[docs]class FullSystem(basic.BaseSystem): + last_control: OptimizationParameter + r_del_u: OptimizationParameter # penalty on change of control between time steps + +
[docs] def initialize(self, model: CasadiModel, var_ref: FullVariableReference): + super().initialize(model=model, var_ref=var_ref) + + self.last_control = OptimizationParameter.declare( + denotation="u_prev", + variables=model.get_inputs(var_ref.controls), + ref_list=var_ref.controls, + use_in_stage_function=False, + assert_complete=True, + ) + self.r_del_u = OptimizationParameter.declare( + denotation="r_del_u", + variables=[CasadiParameter(name=r_del_u) for r_del_u in var_ref.r_del_u], + ref_list=var_ref.r_del_u, + use_in_stage_function=False, + assert_complete=True, + )
+ + +
[docs]class DirectCollocation(basic.DirectCollocation): + def _discretize(self, sys: FullSystem): + """ + Defines a direct collocation discretization. + # pylint: disable=invalid-name + """ + + # setup the polynomial base + collocation_matrices = self._collocation_polynomial() + + # shorthands + n = self.options.prediction_horizon + ts = self.options.time_step + + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + uk = self.add_opt_par(sys.last_control) + + # Parameters that are constant over the horizon + const_par = self.add_opt_par(sys.model_parameters) + du_weights = self.add_opt_par(sys.r_del_u) + + # Formulate the NLP + # loop over prediction horizon + while self.k < n: + # New NLP variable for the control + u_prev = uk + uk = self.add_opt_var(sys.controls) + # penalty for control change between time steps + self.objective_function += ts * ca.dot(du_weights, (u_prev - uk) ** 2) + + # New parameter for inputs + dk = self.add_opt_par(sys.non_controlled_inputs) + + # perform inner collocation loop + opt_vars_inside_inner = [sys.algebraics, sys.outputs] + opt_pars_inside_inner = [] + + constant_over_inner = { + sys.controls: uk, + sys.non_controlled_inputs: dk, + sys.model_parameters: const_par, + } + xk_end, constraints = self._collocation_inner_loop( + collocation=collocation_matrices, + state_at_beginning=xk, + states=sys.states, + opt_vars=opt_vars_inside_inner, + opt_pars=opt_pars_inside_inner, + const=constant_over_inner, + ) + + # increment loop counter and time + self.k += 1 + self.pred_time = ts * self.k + + # New NLP variable for differential state at end of interval + xk = self.add_opt_var(sys.states) + + # Add continuity constraint + self.add_constraint(xk - xk_end, gap_closing=True) + + # add collocation constraints later for fatrop + for constraint in constraints: + self.add_constraint(*constraint)
+ + +
[docs]class MultipleShooting(basic.MultipleShooting): + def _discretize(self, sys: FullSystem): + """ + Defines a multiple shooting discretization + """ + vars_dict = {sys.states.name: {}} + n = self.options.prediction_horizon + ts = self.options.time_step + opts = {"t0": 0, "tf": ts} + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + vars_dict[sys.states.name][0] = xk + uk = self.add_opt_par(sys.last_control) + + # Parameters that are constant over the horizon + du_weights = self.add_opt_par(sys.r_del_u) + const_par = self.add_opt_par(sys.model_parameters) + + # ODE is used here because the algebraics can be calculated with the stage function + opt_integrator = self._create_ode(sys, opts, self.options.integrator) + # initiate states + while self.k < n: + u_prev = uk + uk = self.add_opt_var(sys.controls) + # penalty for control change between time steps + self.objective_function += ts * ca.dot(du_weights, (u_prev - uk) ** 2) + dk = self.add_opt_par(sys.non_controlled_inputs) + zk = self.add_opt_var(sys.algebraics) + yk = self.add_opt_var(sys.outputs) + + # get path constraints and objective values (stage) + stage_arguments = { + # variables + sys.states.name: xk, + sys.algebraics.name: zk, + sys.outputs.name: yk, + # parameters + sys.controls.name: uk, + sys.non_controlled_inputs.name: dk, + sys.model_parameters.name: const_par, + } + stage = self._stage_function(**stage_arguments) + + # integral and multiple shooting constraint + fk = opt_integrator( + x0=xk, + p=ca.vertcat(uk, dk, const_par, zk, yk), + ) + xk_end = fk["xf"] + self.k += 1 + self.pred_time = ts * self.k + xk = self.add_opt_var(sys.states) + vars_dict[sys.states.name][self.k] = xk + self.add_constraint(xk - xk_end, gap_closing=True) + + # add model constraints last due to fatrop + self.add_constraint( + stage["model_constraints"], + lb=stage["lb_model_constraints"], + ub=stage["ub_model_constraints"], + ) + self.objective_function += stage["cost_function"] * ts
+ + +
[docs]class CasADiFullBackend(CasADiBackend): + """ + Class doing optimization of ADMM subproblems with CasADi. + """ + + system_type = FullSystem + discretization_types = { + DiscretizationMethod.collocation: DirectCollocation, + DiscretizationMethod.multiple_shooting: MultipleShooting, + } + system: FullSystem
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/mhe.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/mhe.html new file mode 100644 index 0000000..4ce8032 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/mhe.html @@ -0,0 +1,646 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.mhe — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.mhe

+import dataclasses
+import logging
+from typing import Union
+
+import casadi as ca
+import numpy as np
+import pandas as pd
+from scipy import interpolate
+
+from agentlib_mpc.data_structures.casadi_utils import (
+    Constraint,
+    LB_PREFIX,
+    UB_PREFIX,
+    DiscretizationMethod,
+    SolverFactory,
+)
+from agentlib_mpc.data_structures.mpc_datamodels import MHEVariableReference
+from agentlib_mpc.models.casadi_model import CasadiModel, CasadiInput
+from agentlib_mpc.optimization_backends.casadi_.core.casadi_backend import CasADiBackend
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationQuantity,
+    OptimizationVariable,
+    OptimizationParameter,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.discretization import (
+    Discretization,
+)
+from agentlib_mpc.optimization_backends.casadi_.core.system import System
+
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]class MHESystem(System): + # variables + estimated_states: OptimizationVariable + estimated_inputs: OptimizationVariable + estimated_parameters: OptimizationVariable + algebraics: OptimizationVariable + outputs: OptimizationVariable + + # parameters + measured_states: OptimizationParameter + known_inputs: OptimizationParameter + known_parameters: OptimizationParameter + + # dynamics + model_constraints: Constraint + cost_function: ca.MX + ode: ca.MX + +
[docs] def initialize(self, model: CasadiModel, var_ref: MHEVariableReference): + # define variables + self.states = OptimizationVariable.declare( + denotation="states", + variables=model.get_states(var_ref.states), + ref_list=var_ref.states, + assert_complete=True, + ) + self.estimated_inputs = OptimizationVariable.declare( + denotation="estimated_inputs", + variables=model.get_inputs(var_ref.estimated_inputs), + ref_list=var_ref.estimated_inputs, + assert_complete=True, + ) + self.estimated_parameters = OptimizationVariable.declare( + denotation="estimated_parameters", + variables=model.get_parameters(var_ref.estimated_parameters), + ref_list=var_ref.estimated_parameters, + ) + self.algebraics = OptimizationVariable.declare( + denotation="algebraics", + variables=model.auxiliaries, + ref_list=[], + ) + self.outputs = OptimizationVariable.declare( + denotation="outputs", + variables=model.outputs, + ref_list=var_ref.outputs, + ) + + self.known_inputs = OptimizationParameter.declare( + denotation="known_inputs", + variables=model.get_inputs(var_ref.known_inputs), + ref_list=var_ref.known_inputs, + assert_complete=True, + ) + known_parameter_names = set(model.get_parameter_names()) - set( + var_ref.estimated_parameters + ) + self.known_parameters = OptimizationParameter.declare( + denotation="known_parameters", + variables=model.get_parameters(list(known_parameter_names)), + ref_list=var_ref.known_parameters, + assert_complete=False, + ) + self.measured_states = OptimizationParameter.declare( + denotation="measured_states", + variables=[CasadiInput(name=name) for name in var_ref.measured_states], + ref_list=var_ref.measured_states, + ) + self.weights_states = OptimizationParameter.declare( + denotation="weight_states", + variables=[CasadiInput(name=name) for name in var_ref.weights_states], + ref_list=var_ref.weights_states, + ) + + # add admm terms to objective function + objective: ca.MX = 0 + for i in range(len(var_ref.states)): + states = self.states.full_symbolic[i] + measured_states = self.measured_states.full_symbolic[i] + weights = self.weights_states.full_symbolic[i] + objective += weights * (states - measured_states) ** 2 + + # dynamics + self.ode = ca.vertcat(*[sta.ode for sta in model.get_states(var_ref.states)]) + self.cost_function = objective + self.model_constraints = Constraint( + function=ca.vertcat(*[c.function for c in model.get_constraints()]), + lb=ca.vertcat(*[c.lb for c in model.get_constraints()]), + ub=ca.vertcat(*[c.ub for c in model.get_constraints()]), + )
+ + +
[docs]@dataclasses.dataclass +class CollocationMatrices: + order: int + root: np.ndarray + B: np.ndarray + C: np.ndarray + D: np.ndarray
+ + +
[docs]class DirectCollocation(Discretization): + only_positive_times_in_results: bool = False + + def _discretize(self, sys: MHESystem): + """ + Defines a direct collocation discretization. + # pylint: disable=invalid-name + """ + + # setup the polynomial base + collocation_matrices = self._collocation_polynomial() + + # shorthands + n = self.options.prediction_horizon + ts = self.options.time_step + start_time = -n * ts + self.pred_time = start_time + + # Initial State + x_est_k = self.add_opt_var(sys.states) + + # Parameters that are constant over the horizon + known_pars = self.add_opt_par(sys.known_parameters) + estimated_pars = self.add_opt_var(sys.estimated_parameters) + weights = self.add_opt_par(sys.weights_states) + + # Formulate the NLP + # loop over prediction horizon + while self.k < n: + # New NLP variable for the control + inp_known = self.add_opt_par(sys.known_inputs) + inp_est = self.add_opt_var(sys.estimated_inputs) + + # perform inner collocation loop + opt_vars_inside_inner = [sys.outputs, sys.algebraics] + opt_pars_inside_inner = [sys.measured_states] + + constant_over_inner = { + sys.known_inputs: inp_known, + sys.estimated_inputs: inp_est, + sys.estimated_parameters: estimated_pars, + sys.known_parameters: known_pars, + sys.weights_states: weights, + } + xk_end = self._collocation_inner_loop( + collocation=collocation_matrices, + state_at_beginning=x_est_k, + states=sys.states, + opt_vars=opt_vars_inside_inner, + opt_pars=opt_pars_inside_inner, + const=constant_over_inner, + ) + + # increment loop counter and time + self.k += 1 + self.pred_time = start_time + ts * self.k + + # New NLP variable for differential state at end of interval + xk = self.add_opt_var(sys.states) + + # Add continuity constraint + self.add_constraint(xk_end - xk) + + def _construct_stage_function(self, system: MHESystem): + """ + Combine information from the model and the var_ref to create CasADi + functions which describe the system dynamics and constraints at each + stage of the optimization problem. Sets the stage function. It has + all mpc variables as inputs, sorted by denotation (declared in + self.declare_quantities) and outputs ode, cost function and 3 outputs + per constraint (constraint, lb_constraint, ub_constraint). + + In the basic case, it has the form: + CasadiFunction: ['x', 'z', 'u', 'y', 'd', 'p'] -> + ['ode', 'cost_function', 'model_constraints', + 'ub_model_constraints', 'lb_model_constraints'] + + Args: + system + """ + all_system_quantities: dict[str, OptimizationQuantity] = { + var.name: var for var in system.quantities + } + constraints = {"model_constraints": system.model_constraints} + + inputs = [ + q.full_symbolic + for q in all_system_quantities.values() + if q.use_in_stage_function + ] + input_denotations = [ + q.name + for denotation, q in all_system_quantities.items() + if q.use_in_stage_function + ] + + # aggregate constraints + constraints_func = [c.function for c in constraints.values()] + constraints_lb = [c.lb for c in constraints.values()] + constraints_ub = [c.ub for c in constraints.values()] + constraint_denotations = list(constraints.keys()) + constraint_lb_denotations = [LB_PREFIX + k for k in constraints] + constraint_ub_denotations = [UB_PREFIX + k for k in constraints] + + # aggregate outputs + outputs = [ + system.ode, + system.cost_function, + *constraints_func, + *constraints_lb, + *constraints_ub, + ] + output_denotations = [ + "ode", + "cost_function", + *constraint_denotations, + *constraint_lb_denotations, + *constraint_ub_denotations, + ] + + # function describing system dynamics and cost function + self._stage_function = ca.Function( + "f", + inputs, + outputs, + # input handles to make kwarg use possible and to debug + input_denotations, + # output handles to make kwarg use possible and to debug + output_denotations, + ) + +
[docs] def initialize(self, system: MHESystem, solver_factory: SolverFactory): + """Initializes the trajectory optimization problem, creating all symbolic + variables of the OCP, the mapping function and the numerical solver.""" + self._construct_stage_function(system) + super().initialize(system=system, solver_factory=solver_factory)
+ + def _collocation_inner_loop( + self, + state_at_beginning: ca.MX, + collocation: CollocationMatrices, + states: OptimizationVariable, + opt_vars: list[OptimizationVariable], + opt_pars: list[OptimizationParameter], + const: dict[OptimizationQuantity, ca.MX], + ) -> ca.MX: + """ + Constructs the inner loop of a collocation discretization. Takes the + + Args + collocation: The collocation matrices + state_at_beginning: The casadi MX instance representing the state at the + beginning of the collocation interval + states: The OptimizationVariable representing the states + opt_vars: The OptimizationVariables which should be defined at each + collocation point + par_vars: The OptimizationParameters which should be defined at each + collocation point + const: Variables or parameters to feed into the system function that are + constant over the inner loop. Value is the current MX to be used. + + Returns: + state_k_end[MX]: state at the end of collocation interval + """ + constants = {var.name: mx for var, mx in const.items()} + + # remember time at start of collocation loop + start_time = self.pred_time + + # shorthands + ts = self.options.time_step + + # State variables at collocation points + state_collocation = [] + opt_vars_collocation = [] + opt_pars_collocation = [] + + # add variables at collocation points + for j in range(collocation.order): # d is collocation order + # set time + self.pred_time = start_time + collocation.root[j + 1] * ts + + # differential state + state_kj = self.add_opt_var(states, post_den=f"_{j}") + state_collocation.append(state_kj) + + opt_vars_collocation.append({}) + for opt_var in opt_vars: + var_kj = self.add_opt_var(opt_var, post_den=f"_{j}") + opt_vars_collocation[-1].update({opt_var.name: var_kj}) + + opt_pars_collocation.append({}) + for opt_par in opt_pars: + par_kj = self.add_opt_par(opt_par, post_den=f"_{j}") + opt_pars_collocation[-1].update({opt_par.name: par_kj}) + + # Loop over collocation points + state_k_end = collocation.D[0] * state_at_beginning + for j in range(1, collocation.order + 1): + # Expression for the state derivative at the collocation point + xp = collocation.C[0, j] * state_at_beginning + for r in range(collocation.order): + xp = xp + collocation.C[r + 1, j] * state_collocation[r] + + stage = self._stage_function( + **{states.name: state_collocation[j - 1]}, + **opt_pars_collocation[j - 1], + **opt_vars_collocation[j - 1], + **constants, + ) + + self.add_constraint(ts * stage["ode"] - xp) + + # Append inequality constraints + self.add_constraint( + stage["model_constraints"], + lb=stage["lb_model_constraints"], + ub=stage["ub_model_constraints"], + ) + + # Add contribution to the end state + state_k_end = state_k_end + collocation.D[j] * state_collocation[j - 1] + + # Add contribution to quadrature function + self.objective_function += collocation.B[j] * stage["cost_function"] * ts + + return state_k_end + + def _collocation_polynomial(self) -> CollocationMatrices: + """Returns the matrices needed for direct collocation discretization.""" + # Degree of interpolating polynomial + d = self.options.collocation_order + polynomial = self.options.collocation_method + + # Get collocation points + tau_root = np.append(0, ca.collocation_points(d, polynomial)) + + # Coefficients of the collocation equation + C = np.zeros((d + 1, d + 1)) + + # Coefficients of the continuity equation + D = np.zeros(d + 1) + + # Coefficients of the quadrature function + B = np.zeros(d + 1) + + # Construct polynomial basis + for j in range(d + 1): + # Construct Lagrange polynomials to get the polynomial basis at + # the collocation point + p = np.poly1d([1]) + for r in range(d + 1): + if r != j: + p *= np.poly1d([1, -tau_root[r]]) / (tau_root[j] - tau_root[r]) + + # Evaluate the polynomial at the final time to get the + # coefficients of the continuity equation + D[j] = p(1.0) + + # Evaluate the time derivative of the polynomial at all collocation + # points to get the coefficients of the continuity equation + pder = np.polyder(p) + for r in range(d + 1): + C[j, r] = pder(tau_root[r]) + + # Evaluate the integral of the polynomial to get the coefficients + # of the quadrature function + pint = np.polyint(p) + B[j] = pint(1.0) + + return CollocationMatrices( + order=d, + root=tau_root, + B=B, + C=C, + D=D, + )
+ + +
[docs]class MHEBackend(CasADiBackend): + """ + Class doing optimization of ADMM subproblems with CasADi. + """ + + system_type = MHESystem + discretization_types = { + DiscretizationMethod.collocation: DirectCollocation, + } + system: MHESystem + +
[docs] @staticmethod + def sample( + trajectory: Union[float, int, pd.Series, list[Union[float, int]]], + grid: Union[list, np.ndarray], + current: float = 0, + method: str = "linear", + ) -> list: + """ + Obtain the specified portion of the trajectory. + + Args: + trajectory: The trajectory to be sampled. Scalars will be + expanded onto the grid. Lists need to exactly match the provided + grid. Otherwise, a list of tuples is accepted with the form ( + timestamp, value). A dict with the keys 'grid' and 'value' is also + accepted. + current: start time of requested trajectory + grid: target interpolation grid in seconds in relative terms (i.e. + starting from 0 usually) + method: interpolation method, currently accepted: 'linear', + 'spline', 'previous' + + Returns: + Sampled list of values. + + Takes a slice of the trajectory from the current time step with the + specified length and interpolates it to match the requested sampling. + If the requested horizon is longer than the available data, the last + available value will be used for the remainder. + + Raises: + ValueError + TypeError + """ + target_grid_length = len(grid) + if isinstance(trajectory, (float, int)): + # return constant trajectory for scalars + return [trajectory] * target_grid_length + if isinstance(trajectory, list): + # return lists of matching length without timestamps + if len(trajectory) == target_grid_length: + return trajectory + raise ValueError( + f"Passed list with length {len(trajectory)} " + f"does not match target ({target_grid_length})." + ) + if isinstance(trajectory, pd.Series): + source_grid = np.array(trajectory.index) + values = trajectory.values + else: + raise TypeError( + f"Passed trajectory of type '{type(trajectory)}' " f"cannot be sampled." + ) + target_grid = np.array(grid) + current + + # expand scalar values + if len(source_grid) == 1: + return [trajectory[0]] * target_grid_length + + # skip resampling if grids are (almost) the same + if (target_grid.shape == source_grid.shape) and all(target_grid == source_grid): + return list(values) + values = np.array(values) + + # check requested portion of trajectory, whether the most recent value in the + # source grid is older than the first value in the MHE trajectory + if target_grid[0] >= source_grid[-1]: + # return the last value of the trajectory if requested sample + # starts out of range + logger.warning( + f"Latest value of source grid %s is older than " + f"current time (%s. Returning latest value anyway.", + source_grid[-1], + current, + ) + return [values[-1]] * target_grid_length + + # determine whether the target grid lies within the available source grid, and + # how many entries to extrapolate on either side + source_grid_oldest_time: float = source_grid[0] + source_grid_newest_time: float = source_grid[-1] + source_is_recent_enough: np.ndarray = target_grid < source_grid_newest_time + source_is_old_enough: np.ndarray = target_grid > source_grid_oldest_time + number_of_missing_old_entries: int = target_grid_length - np.count_nonzero( + source_is_old_enough + ) + number_of_missing_new_entries: int = target_grid_length - np.count_nonzero( + source_is_recent_enough + ) + # shorten target interpolation grid by extra points that go above or below + # available data range + target_grid = target_grid[source_is_recent_enough * source_is_old_enough] + + # interpolate data to match new grid + if method == "linear": + tck = interpolate.interp1d(x=source_grid, y=values, kind="linear") + sequence_new = list(tck(target_grid)) + elif method == "spline": + raise NotImplementedError( + "Spline interpolation is currently not " "supported" + ) + elif method == "previous": + tck = interpolate.interp1d(source_grid, values, kind="previous") + sequence_new = list(tck(target_grid)) + else: + raise ValueError( + f"Chosen 'method' {method} is not a valid method. " + f"Currently supported: linear, spline, previous" + ) + + # extrapolate sequence with last available value if necessary + interpolated_trajectory = ( + [values[0]] * number_of_missing_old_entries + + sequence_new + + [values[-1]] * number_of_missing_new_entries + ) + + return interpolated_trajectory
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/minlp.html b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/minlp.html new file mode 100644 index 0000000..4af7bba --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/optimization_backends/casadi_/minlp.html @@ -0,0 +1,240 @@ + + + + + + + + agentlib_mpc.optimization_backends.casadi_.minlp — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.optimization_backends.casadi_.minlp

+import casadi as ca
+import numpy as np
+
+from agentlib_mpc.data_structures.casadi_utils import DiscretizationMethod
+from agentlib_mpc.data_structures.mpc_datamodels import MINLPVariableReference
+from agentlib_mpc.models.casadi_model import CasadiModel
+from agentlib_mpc.optimization_backends.casadi_.core.VariableGroup import (
+    OptimizationVariable,
+)
+
+from agentlib_mpc.optimization_backends.casadi_ import basic
+from agentlib_mpc.optimization_backends.casadi_.core.casadi_backend import CasADiBackend
+
+# todo: All the names are minlp, but this is actually minlp capable
+
+
+
[docs]class CasadiMINLPSystem(basic.BaseSystem): + binary_controls: OptimizationVariable + + def __init__(self): + super().__init__() + self.is_linear = False + +
[docs] def initialize(self, model: CasadiModel, var_ref: MINLPVariableReference): + self.binary_controls = OptimizationVariable.declare( + denotation="w", + variables=model.get_inputs(var_ref.binary_controls), + ref_list=var_ref.binary_controls, + assert_complete=True, + binary=True, + ) + super().initialize(model=model, var_ref=var_ref) + self.is_linear = self._is_minlp()
+ + def _is_minlp(self) -> bool: + inputs = ca.vertcat(*(v.full_symbolic for v in self.variables)) + parameters = ca.vertcat( + *(v.full_symbolic for v in self.parameters if v.use_in_stage_function) + ) + test_params = [1] * ca.vertcat( + *( + v.add_default_values()[v.name] + for v in self.parameters + if v.use_in_stage_function + ) + ) + ode = self.ode + constraints = self.model_constraints.function + outputs = ca.vertcat(ode, constraints) + jac = ca.jacobian(outputs, inputs) + print(jac) + test_input = [0] * inputs.shape[0] + jac_func = ca.Function( + "jac_func", + [inputs, parameters], + [jac], + ["inputs", "parameters"], + ["jacobian"], + ) + test2 = np.array(test_input) + 0.5 + return jac_func(test_input, test_params) == jac_func(test2, test_params)
+ + +
[docs]class DirectCollocation(basic.DirectCollocation): + def _discretize(self, sys: CasadiMINLPSystem): + """ + Defines a direct collocation discretization. + # pylint: disable=invalid-name + """ + + # setup the polynomial base + collocation_matrices = self._collocation_polynomial() + + # shorthands + n = self.options.prediction_horizon + ts = self.options.time_step + + # Initial State + x0 = self.add_opt_par(sys.initial_state) + xk = self.add_opt_var(sys.states, lb=x0, ub=x0, guess=x0) + + # Parameters that are constant over the horizon + const_par = self.add_opt_par(sys.model_parameters) + + # Formulate the NLP + # loop over prediction horizon + while self.k < n: + # New NLP variable for the control + uk = self.add_opt_var(sys.controls) + wk = self.add_opt_var(sys.binary_controls) + + # New parameter for inputs + dk = self.add_opt_par(sys.non_controlled_inputs) + + # perform inner collocation loop + opt_vars_inside_inner = [sys.algebraics, sys.outputs] + opt_pars_inside_inner = [] + + constant_over_inner = { + sys.controls: uk, + sys.non_controlled_inputs: dk, + sys.model_parameters: const_par, + sys.binary_controls: wk, + } + xk_end, constraints = self._collocation_inner_loop( + collocation=collocation_matrices, + state_at_beginning=xk, + states=sys.states, + opt_vars=opt_vars_inside_inner, + opt_pars=opt_pars_inside_inner, + const=constant_over_inner, + ) + + # increment loop counter and time + self.k += 1 + self.pred_time = ts * self.k + + # New NLP variable for differential state at end of interval + xk = self.add_opt_var(sys.states) + + # Add continuity constraint + self.add_constraint(xk - xk_end, gap_closing=True) + + # add collocation constraints later for fatrop + for constraint in constraints: + self.add_constraint(*constraint)
+ + +
[docs]class CasADiMINLPBackend(CasADiBackend): + """ + Class doing optimization of ADMM subproblems with CasADi. + """ + + system_type = CasadiMINLPSystem + discretization_types = {DiscretizationMethod.collocation: DirectCollocation} + system: CasadiMINLPSystem
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/analysis.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/analysis.html new file mode 100644 index 0000000..e061040 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/analysis.html @@ -0,0 +1,393 @@ + + + + + + + + agentlib_mpc.utils.analysis — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.utils.analysis

+import warnings
+from ast import literal_eval
+import datetime
+from pathlib import Path
+from typing import NewType, Literal, Union, Optional, Iterable
+
+import pandas as pd
+from pandas.api.types import is_float_dtype
+import numpy as np
+
+from agentlib_mpc.data_structures import mpc_datamodels
+from agentlib_mpc.utils import TimeConversionTypes, TIME_CONVERSION
+
+SimulationTime = NewType("SimulationTime", float)
+
+
+
[docs]def load_admm(file: Union[Path, str]) -> pd.DataFrame: + return load_mpc(file)
+ + +
[docs]def load_mpc(file: Union[Path, str]) -> pd.DataFrame: + df = pd.read_csv(file, index_col=[0], header=[0, 1]) + new_ind = [literal_eval(i) for i in df.index] + df.index = pd.MultiIndex.from_tuples(new_ind) + return df
+ + +
[docs]def load_mpc_stats(results_file: Union[str, Path]) -> Optional[pd.DataFrame]: + stats_file = mpc_datamodels.stats_path(results_file) + try: + df = pd.read_csv(stats_file, index_col=0) + except Exception: + return None + if is_float_dtype(df.index): + return df + new_ind = [literal_eval(i) for i in df.index] + df.index = pd.MultiIndex.from_tuples(new_ind) + return df
+ + +
[docs]def load_sim(file: Path, causality=None) -> pd.DataFrame: + df = pd.read_csv(file, header=[0, 1, 2], index_col=0) + if causality: + df = df[causality] + return df.droplevel(level=1, axis=1) + return df.droplevel(level=2, axis=1).droplevel(level=0, axis=1)
+ + +
[docs]def convert_multi_index( + data: pd.DataFrame, convert_to: Union[TimeConversionTypes, Literal["datetime"]] +): + """Converts an index of an MPC or ADMM results Dataframe to a different unit, + assuming it is passed in seconds.""" + # last = data.index.nlevels - 1 # should be 1 for mpc, 2 for admm + outer = convert_index(convert_to, data.index.unique(0)) + return data.set_index( + data.index.set_levels(outer, level=0) + ) # .set_levels(inner, level=last)
+ + +
[docs]def convert_index( + convert_to: Union[TimeConversionTypes, Literal["datetime"]], index: pd.Index +): + """ + Converts an index from seconds to datetime or another unit + Args: + convert_to: unit, e.g. minutes, hours, datetime + index: pandas index object + + Returns: + + """ + if convert_to == "datetime": + return pd.to_datetime(index.astype(int), unit="s") + else: + return index / TIME_CONVERSION[convert_to]
+ + +
[docs]def perform_index_update( + data: pd.DataFrame, offset: Union[float, Literal["auto"], bool], admm: bool = False +) -> pd.DataFrame: + """Updates the index of a raw mpc/admm result dataframe, to be offset by a desired + time value.""" + if not offset: + return data + outer_index = data.index.get_level_values(0) + if offset == "auto" or offset is True: + _index_offset = outer_index[0] + else: + _index_offset = offset + outer_index = outer_index - _index_offset + + if admm: + arrays = [ + outer_index, + data.index.get_level_values(1), + data.index.get_level_values(2), + ] + else: # mpc + arrays = [outer_index, data.index.get_level_values(1)] + + # set index like this, because set_index() only works for dataframes, not series + data_copy = data.copy() + data_copy.index = pd.MultiIndex.from_arrays(arrays) + return data_copy
+ + +
[docs]def mpc_at_time_step( + data: pd.DataFrame, + time_step: float, + variable=None, + variable_type="variable", + index_offset: Union[float, Literal["auto"], bool] = True, +) -> pd.DataFrame: + """ + Gets the results of an optimization at a time step. + + Args: + data: The multi-indexed results data frame from the mpc + time_step: The time step from which results should be shown. + If no exact match, shows closest. + variable: If specified, only returns results + with regard to a certain variable. + variable_type: The type of the variable provided (parameter, variable, lower, ...) + index_offset: Determines how the index will be updated when loading the data. + The offset will be subtracted from the time-index. This is useful for results + of realtime systems, where the time value with be a unix time stamp and we want + to cut the number down to something understandable. For example, if the time + index (level 0 of the input Dataframe) is [105, 115, 125] and we give an + index_offset of 100, the data will be handled as if the index was [5, 15, 25]. + If "auto" or True is provided as an argument, the index will be modified to + start at 0. If 0 or False are provided, no modifications will be made. + + Returns: + pd.DataFrame: A single-indexed Dataframe of the optimization results + at the specified time step. If variable is not specified, + returns all variables with a double column index, if it + is specified returns only values and/or bounds with + single indexed columns. + """ + + # get the closest matching (outer) index matching the requested time step + data = perform_index_update(data, index_offset, admm=False) + outer_index = data.index.get_level_values(0) + idx = np.searchsorted(outer_index, time_step, side="left") + if idx > 0 and ( + idx == len(outer_index) + or np.fabs(time_step - outer_index[idx - 1]) + < np.fabs(time_step - outer_index[idx]) + ): + closest = outer_index[idx - 1] + else: + closest = outer_index[idx] + + # select the data at this index and increment the inner index + if variable: + data_at_ts = data[variable_type][variable].loc[closest] + else: + data_at_ts = data.loc[closest] + data_at_ts = data_at_ts.copy() + data_at_ts.index = data_at_ts.index + closest + + return data_at_ts
+ + +
[docs]def admm_at_time_step( + data: Union[pd.DataFrame, pd.Series], + time_step: float = None, + variable=None, + iteration: float = -1, + index_offset: Union[float, Literal["auto"], bool] = True, + convert_to: TimeConversionTypes = "seconds", +) -> pd.DataFrame: + """ + Gets the results of an optimization at a time step. + Args: + index_offset: Determines how the index will be updated when loading the data. + The offset will be subtracted from the time-index. This is useful for results + of realtime systems, where the time value with be a unix time stamp and we want + to cut the number down to something understandable. For example, if the time + index (level 0 of the input Dataframe) is [105, 115, 125] and we give an + index_offset of 100, the data will be handled as if the index was [5, 15, 25]. + If "auto" or True is provided as an argument, the index will be modified to + start at 0. If 0 or False are provided, no modifications will be made. + data: The multi-indexed results data frame from the mpc + time_step: The time step from which results should be shown. + If no exact match, shows closest. + variable: If specified, only returns results + with regard to a certain variable. + iteration: Specifies, from which inner ADMM iteration data should be + from. If negative, counts from last iteration. Default -1. + convert_to: Whether the data should be converted to datetime, minutes etc. + + + Returns: + A single-indexed Dataframe of the optimization results + at the specified time step. If variable is not specified, + returns all variables with a double column index, if it + is specified returns only values and/or bounds with + single indexed columns. + """ + + # get the closest matching (outer) index matching the requested time step + data = convert_multi_index(data, convert_to=convert_to) + if not convert_to == "datetime": + data = perform_index_update(data, index_offset, admm=True) + outer_index = data.index.get_level_values(0) + + if time_step is None: + time_step = 0 if not convert_to == "datetime" else datetime.datetime.now() + + idx = np.searchsorted(outer_index, time_step, side="left") + if idx > 0 and ( + idx == len(outer_index) + or np.fabs(time_step - outer_index[idx - 1]) + < np.fabs(time_step - outer_index[idx]) + ): + closest = outer_index[idx - 1] + else: + closest = outer_index[idx] + + data_at_ts = data.loc[closest] + + # if iteration provided is negative we count backwards (like list indexing) + if iteration < 0: + number_of_admm_iterations = data_at_ts.index.get_level_values(0).max() + iteration = number_of_admm_iterations + 1 + iteration + + # select the data at this index and increment the inner index + if variable: + data_at_it = data_at_ts.xs(variable, axis=1, level="variable").loc[iteration] + else: + data_at_it = data_at_ts.loc[iteration] + data_at_it = data_at_it.copy() + + if convert_to == "datetime": + index = convert_index(convert_to, data_at_it.index + closest.value // 1e9) + else: + index = convert_index(convert_to, data_at_it.index) + closest + data_at_it.index = index + return data_at_it
+ + +
[docs]def get_number_of_iterations(data: pd.DataFrame) -> dict[SimulationTime, int]: + """Returns the number of iterations at each time instance of the ADMM simulation.""" + + ind_full = data.index + ind = ind_full.droplevel(2).drop_duplicates() + time_stamps = ind.droplevel(1).drop_duplicates() + result = {} + for t in time_stamps: + _slice = ind.get_loc(t) + result[SimulationTime(t)] = len(ind[_slice]) + + return result
+ + +
[docs]def get_time_steps(data: pd.DataFrame) -> Iterable[float]: + """Returns the time steps at which an MPC step was performed.""" + return sorted(set(data.index.get_level_values(0)))
+ + +
[docs]def first_vals_at_trajectory_index(data: Union[pd.DataFrame, pd.Series]): + """Gets the first values at each time step of a results trajectory.""" + time_steps = get_time_steps(data) + first_vals = pd.Series( + {time_step: data.loc[time_step].iloc[0] for time_step in time_steps} + ) + if np.nan in first_vals: + warnings.warn( + "Nan detected in first values. You may need to select the " + "correct column of the DataFrame and drop NaN before." + ) + return first_vals
+ + +
[docs]def last_vals_at_trajectory_index(data: Union[pd.DataFrame, pd.Series]): + """Gets the last values at each time step of a results trajectory.""" + time_steps = get_time_steps(data) + # -1 covers for parameters (only one entry) and states (-horizon until 0) + last_vals = pd.Series( + {time_step: data.at[time_step].iloc[-1] for time_step in time_steps} + ) + + if np.nan in last_vals: + warnings.warn( + "Nan detected in first values. You may need to select the " + "correct column of the DataFrame and drop NaN before." + ) + return last_vals
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_animation.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_animation.html new file mode 100644 index 0000000..d5834aa --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_animation.html @@ -0,0 +1,296 @@ + + + + + + + + agentlib_mpc.utils.plotting.admm_animation — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.admm_animation

+"""Modules that defines functions to be used for automatically creating animations of
+ADMM convergence"""
+
+import functools
+from pathlib import Path
+from typing import NewType, Iterable, Union, Callable
+
+import matplotlib.pyplot as plt
+import pandas as pd
+from matplotlib.animation import FuncAnimation
+
+from agentlib_mpc.utils.analysis import (
+    admm_at_time_step,
+    load_admm,
+    get_number_of_iterations,
+)
+from agentlib_mpc.utils.plotting.basic import make_grid, make_fig, Style, Customizer
+
+Label = str
+LinesDict = dict[Label, plt.Line2D]
+Data = dict[Label, pd.DataFrame]
+Init = Callable[[], None]
+Animate = Callable[[Union[int, Iterable]], None]
+
+
+
[docs]def make_lines(labels: list[Label], ax: plt.Axes, fig: plt.Figure) -> LinesDict: + lines: LinesDict = {} + + for label in labels: + lines[label] = ax.plot([], [], lw=2, label=str(label))[0] + + return lines
+ + +
[docs]def init_full(lines: LinesDict, annotation: plt.Annotation, ax: plt.Axes): + for line in lines.values(): + line.set_data([], []) + + ax.legend(list(lines.values()), list(lines)) + # annotation + return tuple(lines.values()) + (annotation,)
+ + +
[docs]def animate_full( + i: int, lines: LinesDict, annotation: plt.Annotation, data: Data, time_step: float +): # Upper plot: Temperatures + for label, line in lines.items(): + data_for_iter = admm_at_time_step( + data=data[label], + time_step=time_step, + iteration=i, + ).dropna() + + line.set_data(data_for_iter.index, data_for_iter) + + # annotation + annotation.set_text(f"Iteration: {i}") + + print(f"Made Frame {i}") + + return tuple(lines.values()) + (annotation,)
+ + +
[docs]def make_image( + data: Data, + time_step: float = 0, + file_name: str = "", + customize: Customizer = None, + iteration=-1, +): + labels = list(data) # from data + + with Style() as style: + fig, ax = make_fig(style) + if customize: + fig, ax = customize(fig, ax) + lines = make_lines(labels, ax=ax, fig=fig) + annotation = ax.annotate( + xy=(0.1, 0.1), + xytext=(0.5, 1.05), + text="Iteration: 0", + animated=True, + textcoords="axes fraction", + xycoords="axes fraction", + ha="center", + ) + + animate = functools.partial( + animate_full, + annotation=annotation, + lines=lines, + data=data, + time_step=time_step, + ) + init = functools.partial(init_full, annotation=annotation, lines=lines, ax=ax) + init() + animate(i=iteration) + if file_name: + fig.savefig(fname=file_name)
+ + +
[docs]def make_animation( + data: Data, + time_step: float = 0, + file_name: str = "", + customize: Customizer = None, + iteration=-1, + interval: int = 300, +): + labels = list(data) # from data + + with Style() as style: + fig, ax = make_fig(style) + if customize: + fig, ax = customize(fig, ax) + lines = make_lines(labels, ax=ax, fig=fig) + annotation = ax.annotate( + xy=(0.1, 0.1), + xytext=(0.5, 1.05), + text="Iteration: 0", + animated=True, + textcoords="axes fraction", + xycoords="axes fraction", + ha="center", + ) + + animate = functools.partial( + animate_full, + annotation=annotation, + lines=lines, + data=data, + time_step=time_step, + ) + init = functools.partial(init_full, annotation=annotation, lines=lines, ax=ax) + + # setup_figure() + anim = FuncAnimation( + fig, + animate, + init_func=init, + frames=iteration, + interval=interval, + blit=True, + repeat_delay=1500, + ) + if not file_name.endswith(".gif"): + raise ValueError( + f"Target filename needs '.gif' extension. Given filename was {file_name}" + ) + anim.save(file_name, writer="imagemagick")
+ + +if __name__ == "__main__": + + def customize_fig(fig: plt.Figure, ax: plt.Axes) -> (plt.Figure, plt.Axes): + # grids + make_grid(ax) + + # auxiliary + ax.set_ylim(0, 0.11) + ax.set_xlim(0, 3000) + ax.legend() + # cax.get_legend().remove() + ax.set_ylabel("Temperature / $°C$") + + # ticks + # xticks = np.arange(mpc_log.index[0], mpc_log.index[-1] + 1, 24 * 3600) + # xtickval = [str(i) for i, _ in enumerate(xticks)] + # plt.xticks(xticks, xtickval) + ax.set_xlabel("Time / h") + return fig, ax + + test_dir = Path( + r"C:\Users\ses\Dokumente\Vorträge\Freitagsvorträge\2021September\admm" + ) + filename = "first_anim.gif" + room = load_admm(Path(test_dir, "admm_opt.csv")) + cooler = load_admm(Path(test_dir, "cooler_res.csv")) + data_ = { + Label("room_T"): room["variable"]["mDot_0"], + Label("cooler_T"): cooler["variable"]["mDot"], + } + + iter_dict = get_number_of_iterations(room) + iters = pd.Series(iter_dict).iloc[0] + + make_animation( + file_name=filename, + data=data_, + customize=customize_fig, + time_step=500, + iteration=iters, + ) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_consensus_shades.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_consensus_shades.html new file mode 100644 index 0000000..ff40ab2 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_consensus_shades.html @@ -0,0 +1,179 @@ + + + + + + + + agentlib_mpc.utils.plotting.admm_consensus_shades — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.admm_consensus_shades

+import pandas as pd
+
+import agentlib_mpc.data_structures.admm_datatypes as adt
+from agentlib_mpc.utils.analysis import admm_at_time_step
+from agentlib_mpc.utils.plotting.basic import EBCColors
+from agentlib_mpc.utils.plotting.mpc import interpolate_colors
+
+
+
[docs]def plot_consensus_shades( + results: dict[str, dict[str, pd.DataFrame]], + data: dict[str, pd.DataFrame], + time_step: float, + # series: pd.Series, + # ax: plt.Axes, + # plot_actual_values: bool = False, + # step: bool = False, +): + """ + + Args: + series: + + Returns: + + """ + data = {} + + def mean(df: pd.DataFrame, name: str) -> pd.Series: + return df["parameter"][adt.MEAN_PREFIX + name] + + def local(df: pd.DataFrame, name: str) -> pd.Series: + return df["variable"][adt.LOCAL_PREFIX + name] + + def lmbda(df: pd.DataFrame, name: str) -> pd.Series: + return df["parameter"][adt.MULTIPLIER_PREFIX + name] + + room_2 = results["CooledRoom_nn2"]["admm_module"] + trajectories = {label: admm_at_time_step(srs) for label, srs in data.items()} + + # check the number of iterations on a random trajectory + a_trajectory = next(iter(trajectories.values())) + number_of_iterations: int = room_2.index.unique(level=0).shape[0] + + # series = room_2[] + number_of_predictions: int = room_2.index.unique(level=0).shape[0] + + # stores the first value of each prediction. In the case of a control_variable, + # this will give the optimal control output the mpc determined this step, or in + # the case of a state, this will give the measurement it worked with + actual_values: dict[float, float] = {} + + for i, (time, prediction) in enumerate(series.groupby(level=0)): + prediction: pd.Series = prediction.dropna() + actual_values[time] = prediction.iloc[0] + + progress = i / number_of_predictions + prediction_color = interpolate_colors( + progress=progress, + colors=[EBCColors.red, EBCColors.dark_grey, EBCColors.light_grey], + ) + prediction.index = prediction.index.droplevel(0) + time + print(prediction)
+ # if not step: + # prediction.plot(ax=ax, color=prediction_color) + # else: + # prediction.plot(ax=ax, color=prediction_color, drawstyle="steps-post") + + # if plot_actual_values: + # actual_series = pd.Series(actual_values) + # if not step: + # actual_series.plot(ax=ax, color="black") + # else: + # actual_series.plot(ax=ax, color=EBCColors.dark_red, drawstyle="steps-post") + + # last_index = prediction.index[-1] + # num_iters = last_index[1] +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_dashboard.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_dashboard.html new file mode 100644 index 0000000..a4e3b1d --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_dashboard.html @@ -0,0 +1,688 @@ + + + + + + + + agentlib_mpc.utils.plotting.admm_dashboard — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.admm_dashboard

+import os
+import webbrowser
+from pathlib import Path
+from typing import List, Dict, Optional, Literal
+
+from agentlib.core.errors import OptionalDependencyError
+import pandas as pd
+
+
+from agentlib_mpc.utils.analysis import load_mpc
+from agentlib_mpc.utils.plotting.admm_residuals import load_residuals
+from agentlib_mpc.utils.plotting.interactive import get_port
+
+try:
+    import dash
+    from dash import html, dcc
+    from dash.dependencies import Input, Output, State
+    import plotly.graph_objects as go
+    import dash_daq as daq
+except ImportError as e:
+    raise OptionalDependencyError(
+        dependency_name="interactive",
+        dependency_install="plotly, dash",
+        used_object="interactive",
+    ) from e
+
+
+
[docs]def load_agent_data(directory: str) -> Dict[str, pd.DataFrame]: + """ + Load MPC data for multiple agents from files containing 'admm' in their name. + + Args: + directory (str): Directory path containing the data files. + + Returns: + Dict[str, pd.DataFrame]: Dictionary with agent names as keys and their data as values. + """ + agent_data = {} + for filename in os.listdir(directory): + if ( + "admm" in filename.casefold() + and filename.endswith(".csv") + and not "stats" in filename.casefold() + ): + file_path = os.path.join(directory, filename) + agent_name = f"Agent_{len(agent_data) + 1}" + try: + agent_data[agent_name] = load_mpc(file_path) + except Exception as e: + print(f"Error loading file {filename}: {str(e)}") + return agent_data
+ + +
[docs]def get_coupling_variables(df: pd.DataFrame) -> List[str]: + """ + Identify coupling variables in the dataframe. + + Args: + df (pd.DataFrame): The MPC data for an agent. + + Returns: + List[str]: List of coupling variable names. + """ + coupling_vars = [] + for col in df.columns: + if col[0] == "parameter" and col[1].startswith("admm_coupling_mean_"): + var_name = col[1].replace("admm_coupling_mean_", "") + if ("variable", var_name) in df.columns: + coupling_vars.append(var_name) + return coupling_vars
+ + +
[docs]def get_data_for_plot( + agent_data: Dict[str, pd.DataFrame], + time_step: float, + iteration: int, + coupling_var: str, +) -> Dict[str, List[float]]: + """ + Extract data for the coupling variable plot. + + Args: + agent_data (Dict[str, pd.DataFrame]): Dictionary containing data for each agent. + time_step (float): Selected time step. + iteration (int): Selected iteration number. + coupling_var (str): Name of the selected coupling variable. + + Returns: + Dict[str, List[float]]: Dictionary with agent names as keys and their values as lists. + """ + plot_data = {} + prediction_grid = None + + for agent_name, df in agent_data.items(): + try: + agent_data_at_step = df.loc[(time_step, iteration)] + agent_values = agent_data_at_step[("variable", coupling_var)].values + plot_data[agent_name] = agent_values.tolist() + + if prediction_grid is None: + prediction_grid = agent_data_at_step.index.tolist() + + # Get mean value (assuming it's the same for all agents) + if "Mean" not in plot_data: + mean_values = agent_data_at_step[ + ("parameter", f"admm_coupling_mean_{coupling_var}") + ].values + plot_data["Mean"] = mean_values.tolist() + except KeyError: + continue # Skip this agent if data is not available for the selected time step and iteration + + return plot_data, prediction_grid
+ + +
[docs]def create_coupling_var_plot( + plot_data: Dict[str, List[float]], prediction_grid: List[float], coupling_var: str +) -> go.Figure: + """ + Create a plotly figure for the coupling variable plot. + + Args: + plot_data (Dict[str, List[float]]): Dictionary with agent names as keys and their values as lists. + prediction_grid (List[float]): List of prediction grid values. + coupling_var (str): Name of the coupling variable. + + Returns: + go.Figure: Plotly figure object. + """ + fig = go.Figure() + + for agent_name, values in plot_data.items(): + if agent_name == "Mean": + line_style = dict(color="red", dash="dash", width=2) + else: + line_style = dict(width=1) + + fig.add_trace( + go.Scatter( + x=prediction_grid, + y=values, + mode="lines", + name=agent_name, + line=line_style, + ) + ) + + fig.update_layout( + title=f"Coupling Variable: {coupling_var}", + xaxis_title="Prediction Grid", + yaxis_title="Value", + legend_title="Legend", + legend=dict(yanchor="top", y=0.99, xanchor="left", x=0.01), + ) + + return fig
+ + +
[docs]def get_max_iterations_per_timestep( + agent_data: Dict[str, pd.DataFrame], +) -> Dict[float, int]: + max_iterations = {} + for df in agent_data.values(): + for time_step in df.index.get_level_values(0).unique(): + iterations = df.loc[time_step].index.get_level_values(0).max() + if ( + time_step not in max_iterations + or iterations > max_iterations[time_step] + ): + max_iterations[time_step] = iterations + return max_iterations
+ + +
[docs]def create_residuals_plot(residuals_df: pd.DataFrame, time_step: float) -> go.Figure: + """ + Create a plotly figure for the residuals plot. + + Args: + residuals_df (pd.DataFrame): DataFrame containing residuals data. + time_step (float): Selected time step. + + Returns: + go.Figure: Plotly figure object. + """ + fig = go.Figure() + + residuals_data = residuals_df.loc[time_step] + + if len(residuals_data) == 1: # Only one iteration (iteration = 0) + primal_residual = residuals_data["primal_residual"].iloc[0] + dual_residual = residuals_data["dual_residual"].iloc[0] + + fig.add_trace( + go.Scatter( + x=[0, 1], + y=[primal_residual, primal_residual], + mode="lines", + name="Primal Residual", + ) + ) + + fig.add_trace( + go.Scatter( + x=[0, 1], + y=[dual_residual, dual_residual], + mode="lines", + name="Dual Residual", + ) + ) + + fig.update_layout( + xaxis_range=[0, 1], + xaxis_title="Iteration", + ) + else: + fig.add_trace( + go.Scatter( + x=residuals_data.index, + y=residuals_data["primal_residual"], + mode="lines", + name="Primal Residual", + ) + ) + + fig.add_trace( + go.Scatter( + x=residuals_data.index, + y=residuals_data["dual_residual"], + mode="lines", + name="Dual Residual", + ) + ) + + fig.update_layout( + xaxis_title="Iteration", + ) + + fig.update_layout( + title="Primal and Dual Residuals", + yaxis_title="Residual Value", + yaxis_type="log", + yaxis=dict( + tickformat=".2e", # Use scientific notation with 2 decimal places + exponentformat="e", # Use "e" notation for exponents + ), + legend_title="Legend", + ) + + return fig
+ + +
[docs]def create_app(agent_data: Dict[str, pd.DataFrame], residuals_df: pd.DataFrame): + """ + Create and configure the Dash app. + + Args: + agent_data (Dict[str, pd.DataFrame]): Dictionary containing data for each agent. + residuals_df (pd.DataFrame): DataFrame containing residuals data. + + Returns: + dash.Dash: Configured Dash app. + """ + app = dash.Dash(__name__) + + # Get time steps and iteration numbers + first_agent_data = next(iter(agent_data.values())) + time_steps = sorted(first_agent_data.index.get_level_values(0).unique()) + max_iterations_per_timestep = get_max_iterations_per_timestep(agent_data) + overall_max_iterations = max(max_iterations_per_timestep.values()) + + # Get coupling variables + coupling_vars = get_coupling_variables(first_agent_data) + + app.layout = html.Div( + [ + html.H1("Distributed MPC with ADMM Dashboard"), + # time step slider + html.Div( + [ + html.Label("Time Step"), + html.Div( + [ + html.Div( + [ + dcc.Slider( + id="time-step-slider", + min=0, + max=len(time_steps) - 1, + value=0, + marks={ + i: f"{time_steps[i]:.2f}" + for i in range( + 0, + len(time_steps), + max(1, len(time_steps) // 10), + ) + }, + step=1, + ) + ], + style={ + "width": "80%", + "display": "inline-block", + "verticalAlign": "middle", + }, + ), + html.Div( + [ + html.Button( + "◀", + id="prev-time-step", + n_clicks=0, + style={"marginRight": "5px"}, + ), + html.Button( + "▶", + id="next-time-step", + n_clicks=0, + style={"marginRight": "5px"}, + ), + html.Div( + id="time-step-display", + style={ + "display": "inline-block", + "marginRight": "10px", + }, + ), + daq.NumericInput( + id="time-step-input", + min=0, + max=len(time_steps) - 1, + value=0, + size=60, + ), + ], + style={ + "width": "20%", + "display": "inline-block", + "verticalAlign": "middle", + "textAlign": "right", + }, + ), + ] + ), + ] + ), + # iteration slide + html.Div( + [ + html.Label("Iteration Number"), + html.Div( + [ + html.Div( + [ + dcc.Slider( + id="iteration-slider", + min=0, + max=overall_max_iterations, + value=0, + marks={ + i: str(i) + for i in range( + 0, + overall_max_iterations + 1, + max(1, overall_max_iterations // 10), + ) + }, + step=1, + ) + ], + style={ + "width": "80%", + "display": "inline-block", + "verticalAlign": "middle", + }, + ), + html.Div( + [ + daq.NumericInput( + id="iteration-input", + min=0, + max=overall_max_iterations, + value=0, + size=60, + ) + ], + style={ + "width": "20%", + "display": "inline-block", + "verticalAlign": "middle", + "textAlign": "right", + }, + ), + ] + ), + ] + ), + html.Div( + [ + html.Label("Coupling Variable"), + dcc.Dropdown( + id="coupling-var-dropdown", + options=[{"label": var, "value": var} for var in coupling_vars], + value=coupling_vars[0] if coupling_vars else None, + ), + ] + ), + dcc.Graph(id="coupling-var-plot"), + dcc.Graph(id="residuals-plot"), + dcc.Store(id="y-axis-range"), + ] + ) + + @app.callback( + [ + Output("time-step-input", "value"), + Output("time-step-display", "children"), + Output("time-step-slider", "value"), + ], + [ + Input("time-step-slider", "value"), + Input("prev-time-step", "n_clicks"), + Input("next-time-step", "n_clicks"), + Input("time-step-input", "value"), + ], + [State("time-step-input", "value")], + ) + def update_time_step( + slider_value, prev_clicks, next_clicks, input_value, current_value + ): + ctx = dash.callback_context + if not ctx.triggered: + return ( + current_value, + f"Current time step: {time_steps[current_value]:.2f}", + current_value, + ) + + input_id = ctx.triggered[0]["prop_id"].split(".")[0] + + if input_id == "time-step-slider": + new_value = slider_value + elif input_id == "prev-time-step": + new_value = max(0, current_value - 1) + elif input_id == "next-time-step": + new_value = min(len(time_steps) - 1, current_value + 1) + elif input_id == "time-step-input": + new_value = input_value + else: + new_value = current_value + + return new_value, f"Current time step: {time_steps[new_value]:.2f}", new_value + + @app.callback( + [ + Output("iteration-slider", "max"), + Output("iteration-slider", "marks"), + Output("iteration-input", "max"), + ], + [Input("time-step-input", "value")], + ) + def update_iteration_range(time_step_index): + time_step = time_steps[time_step_index] + max_iter = max_iterations_per_timestep[time_step] + marks = {i: str(i) for i in range(0, max_iter + 1, max(1, max_iter // 10))} + return max_iter, marks, max_iter + + @app.callback( + Output("coupling-var-plot", "figure"), + [ + Input("time-step-input", "value"), + Input("iteration-input", "value"), + Input("coupling-var-dropdown", "value"), + Input("y-axis-range", "data"), + ], + ) + def update_coupling_var_plot(time_step_index, iteration, coupling_var, y_range): + if coupling_var is None: + return go.Figure() + + time_step = time_steps[time_step_index] + max_iter = max_iterations_per_timestep[time_step] + iteration = min(iteration, max_iter) + + plot_data, prediction_grid = get_data_for_plot( + agent_data, time_step, iteration, coupling_var + ) + fig = create_coupling_var_plot(plot_data, prediction_grid, coupling_var) + + if y_range is not None: + fig.update_layout(yaxis_range=y_range) + + return fig + + @app.callback( + Output("y-axis-range", "data"), + [Input("time-step-input", "value"), Input("coupling-var-dropdown", "value")], + ) + def compute_y_axis_range(time_step_index, coupling_var): + if coupling_var is None: + return None + + time_step = time_steps[time_step_index] + + max_vals = [] + min_vals = [] + for agent, data in agent_data.items(): + try: + step_data = data[("variable", coupling_var)][time_step] + except KeyError: + continue + max_vals.append(step_data.max()) + min_vals.append(step_data.min()) + + y_min = min(min_vals) + y_max = max(max_vals) + + y_range = [y_min - 0.1 * (y_max - y_min), y_max + 0.1 * (y_max - y_min)] + return y_range + + @app.callback( + Output("residuals-plot", "figure"), + [Input("time-step-input", "value")], + ) + def update_residuals_plot(time_step_index): + time_step = time_steps[time_step_index] + + # Check if residuals data exists for this time step + if time_step not in residuals_df.index: + # If no data, return an empty figure with a message + fig = go.Figure() + fig.add_annotation( + text="No residuals data available for this time step", + xref="paper", + yref="paper", + x=0.5, + y=0.5, + showarrow=False, + ) + return fig + + return create_residuals_plot(residuals_df, time_step) + + return app
+ + +
[docs]def main(): + # Specify the directory containing the data files + data_directory = Path(r"D:\repos\juelich_mpc\juelich_mpc\mpc\simple_model\results") + + # Load agent data + agent_data = load_agent_data(data_directory) + agent_data["heating"] = load_mpc(Path(data_directory, "heating_agent_res.csv")) + # "room_1": load_mpc(Path(data_directory, "room_1_admm.csv")), + # "room_2": load_mpc(Path(data_directory, "room_2_admm.csv")), + # "room_3": load_mpc(Path(data_directory, "room_3_admm.csv")), + # "heating": load_mpc(Path(data_directory, "heating_agent_res.csv")), + + # Load residuals data + residuals_file = os.path.join( + data_directory, "residuals.csv" + ) # Adjust the filename as needed + residuals_df = load_residuals(residuals_file) + + # Create and run the app + app = create_app(agent_data, residuals_df) + port = get_port() + + webbrowser.open_new_tab(f"http://localhost:{port}") + app.run_server(debug=False, port=port)
+ + +
[docs]def show_admm_dashboard( + data: dict[str, pd.DataFrame], + residuals: Optional[pd.DataFrame] = None, + scale: Literal["seconds", "minutes", "hours", "days"] = "seconds", +): + app = create_app(data, residuals) + port = get_port() + + webbrowser.open_new_tab(f"http://localhost:{port}") + app.run_server(debug=False, port=port)
+ + +if __name__ == "__main__": + main() +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_residuals.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_residuals.html new file mode 100644 index 0000000..5cd320e --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/admm_residuals.html @@ -0,0 +1,261 @@ + + + + + + + + agentlib_mpc.utils.plotting.admm_residuals — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.admm_residuals

+from ast import literal_eval
+from pathlib import Path
+from typing import Union
+
+import matplotlib.pyplot as plt
+import pandas as pd
+
+from agentlib_mpc.utils.plotting.basic import Style, make_fig, make_grid, EBCColors
+
+
+
[docs]def load_residuals(file: Union[str, Path]) -> pd.DataFrame: + """Loads a residuals csv file in the correct format.""" + df = pd.read_csv(file, index_col=0) + new_ind = [literal_eval(i) for i in df.index] + df.index = pd.MultiIndex.from_tuples(new_ind) + return df
+ + +
[docs]def plot_single_time_step( + residuals: pd.DataFrame, + time_step: float = None, + primal_tol: float = None, + dual_tol: float = None, +) -> (plt.Figure, plt.Axes): + """Plots the decrease of the residuals over iterations for a time step""" + + if time_step is None: + residuals_time = residuals.index.get_level_values(0)[0] + first_opt = residuals.loc[residuals_time] + else: + first_opt = residuals.loc[time_step] + + with Style() as style: + fig, ax = make_fig(style) + make_grid(ax) + ax.set_ylabel("Residuals") + + first_opt["primal_residual"].plot( + ax=ax, label="$r^k$", color=EBCColors.blue, linewidth=0.7 + ) + first_opt["dual_residual"].plot( + ax=ax, label="$s^k$", color=EBCColors.red, linewidth=0.7 + ) + ax.set_yscale("log") + + if primal_tol: + ax.axhline( + primal_tol, + label="$r_0$", + color=EBCColors.blue, + linewidth=0.7, + linestyle="--", + ) + if dual_tol: + ax.axhline( + dual_tol, + label="$s_0$", + color=EBCColors.red, + linewidth=0.7, + linestyle="--", + ) + ax.legend( + loc="center left", bbox_to_anchor=(1, 0.5), frameon=False, handlelength=1 + ) + return fig, ax
+ + +
[docs]def plot_over_time( + residuals: pd.DataFrame, + primal_tol: float = None, + dual_tol: float = None, + max_iters: int = None, +) -> (plt.Figure, (plt.Axes, plt.Axes)): + """Plots the final residuals over time.""" + res_over_time = residuals_over_time(residuals) + + with Style() as style: + fig, (ax_res, ax_iter) = plt.subplots(2, 1) + ax_res: plt.Axes + ax_iter: plt.Axes + ax_res.tick_params( + axis="both", + which="major", + labelsize=style.font_dict["fontsize"], + left=False, + ) + ax_iter.tick_params( + axis="both", + which="major", + labelsize=style.font_dict["fontsize"], + left=False, + ) + make_grid(ax_res) + make_grid(ax_iter) + + res_over_time["primal_residual"].plot( + ax=ax_res, label="$r_t$", color=EBCColors.blue, linewidth=0.7 + ) + res_over_time["dual_residual"].plot( + ax=ax_res, label="$s_t$", color=EBCColors.red, linewidth=0.7 + ) + if primal_tol: + ax_res.axhline( + primal_tol, + label="$r_0$", + color=EBCColors.blue, + linewidth=0.7, + linestyle="--", + ) + if dual_tol: + ax_res.axhline( + dual_tol, + label="$s_0$", + color=EBCColors.red, + linewidth=0.7, + linestyle="--", + ) + ax_res.set_ylabel("Residuals") + ax_res.legend( + loc="center left", bbox_to_anchor=(1, 0.5), frameon=False, handlelength=1 + ) + # ax_res.set_yscale("log") + + ax_iter.set_ylabel("Iterations") + res_over_time["iters"].plot( + ax=ax_iter, label="iterations", color="black", linewidth=0.7 + ) + if max_iters: + ax_iter.axhline( + max_iters, + label="Iteration limit", + color="black", + linewidth=0.7, + linestyle="--", + ) + ax_iter.legend( + loc="center left", bbox_to_anchor=(1, 0.5), frameon=False, handlelength=1 + ) + return fig, (ax_res, ax_iter)
+ + +
[docs]def residuals_over_time(residuals: pd.DataFrame) -> pd.DataFrame: + """Evaluates the residuals over time. Takes a raw residuals DataFrame and returns a + Dataframe, which has for each time step the number of iterations and the final primal and dual residuals. + + Returns: + DataFrame with float index (time in seconds) and the columns + ("primal_residual", "dual_residual", "iters") + """ + time_vals = set(residuals.index.get_level_values(0)) + iters = {t: residuals.loc[t].shape[0] for t in time_vals} + prim_res = {t: residuals.loc[t].iloc[-1]["primal_residual"] for t in time_vals} + dual_res = {t: residuals.loc[t].iloc[-1]["dual_residual"] for t in time_vals} + + df = pd.DataFrame( + {"primal_residual": prim_res, "dual_residual": dual_res, "iters": iters} + ).sort_index() + return df
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/basic.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/basic.html new file mode 100644 index 0000000..2aced77 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/basic.html @@ -0,0 +1,275 @@ + + + + + + + + agentlib_mpc.utils.plotting.basic — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.basic

+"""Some basic plotting utilities"""
+
+import logging
+import typing
+from dataclasses import dataclass
+from pathlib import Path
+from typing import Tuple, Callable, TypedDict, Annotated
+
+import matplotlib
+from matplotlib import pyplot as plt
+from matplotlib.ticker import AutoMinorLocator
+
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]@dataclass +class ValueRange: + min: float + max: float
+ + +Float0to1 = Annotated[float, ValueRange(0.0, 1.0)] +ColorTuple = tuple[Float0to1, Float0to1, Float0to1] + + +
[docs]class EBCColors: + dark_red: ColorTuple = (172 / 255, 43 / 255, 28 / 255) + red: ColorTuple = (221 / 255, 64 / 255, 45 / 255) + light_red: ColorTuple = (235 / 255, 140 / 255, 129 / 255) + green: ColorTuple = (112 / 255, 173 / 255, 71 / 255) + light_grey: ColorTuple = (217 / 255, 217 / 255, 217 / 255) + grey: ColorTuple = (157 / 255, 158 / 255, 160 / 255) + dark_grey: ColorTuple = (78 / 255, 79 / 255, 80 / 255) + light_blue: ColorTuple = (157 / 255, 195 / 255, 230 / 255) + blue: ColorTuple = (0 / 255, 84 / 255, 159 / 255) + ebc_palette_sort_1: list[ColorTuple] = [ + dark_red, + red, + light_red, + dark_grey, + grey, + light_grey, + blue, + light_blue, + green, + ] + ebc_palette_sort_2: list[ColorTuple] = [ + red, + blue, + grey, + green, + dark_red, + dark_grey, + light_red, + light_blue, + light_grey, + ]
+ + +
[docs]class FontDict(TypedDict): + fontsize: float
+ + +
[docs]class Style: + def __init__(self, use_tex: bool = False): + self.font_dict: FontDict = {"fontsize": 11} + self.use_tex = use_tex + + def __enter__(self): + try: + style_path = Path(Path(__file__).parent, "ebc.paper.mplstyle") + plt.style.use(style_path) + except OSError: + logger.warning("Style Sheet could not be loaded, using default style.") + if self.use_tex: + matplotlib.rc("text", usetex=True) + matplotlib.rcParams["text.latex.preamble"] = r"\usepackage{amsmath}" + # matplotlib.rcParams.update({ + # "font.family": 'serif', + # 'font.serif': 'Times', + # }) + # + # fontP = FontProperties().set_size('xx-small') + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + matplotlib.rcParams.update(matplotlib.rcParamsDefault)
+ + +Customizer = Callable[[plt.Figure, plt.Axes, Style], Tuple[plt.Figure, plt.Axes]] +MultiCustomizer = Callable[ + [plt.Figure, tuple[plt.Axes], Style], Tuple[plt.Figure, tuple[plt.Axes]] +] + + +@typing.overload +def make_fig( + style: Style, customizer: Customizer = None, rows: int = 1 +) -> tuple[plt.Figure, tuple[plt.Axes, ...]]: ... + + +@typing.overload +def make_fig( + style: Style, customizer: MultiCustomizer = None +) -> tuple[plt.Figure, plt.Axes]: ... + + +@typing.overload +def make_fig(style: Style) -> tuple[plt.Figure, plt.Axes]: ... + + +
[docs]def make_fig( + style: Style, customizer: Customizer = None, rows=None +) -> Tuple[plt.Figure, tuple[plt.Axes]]: + """Creates a figure and axes with an amount of rows. If rows is specified, return + a tuple of axes, else only an ax""" + if rows is None: + _rows = 1 + else: + _rows = rows + fig, all_ax = plt.subplots(_rows, 1, sharex=True) + + if rows is None: + # if rows was not specified, return a single axes object + ax = all_ax + ax.tick_params( + axis="both", + which="major", + labelsize=style.font_dict["fontsize"], + left=False, + ) + if customizer: + customizer(fig, all_ax, style) + return fig, all_ax + + # if rows was specified, return a tuple + if rows == 1: + all_ax = (all_ax,) + + for ax in all_ax: + ax.tick_params( + axis="both", + which="major", + labelsize=style.font_dict["fontsize"], + left=False, + ) + if customizer: + customizer(fig, all_ax, style) + return fig, all_ax
+ + +
[docs]def make_grid(ax: plt.Axes): + ax.xaxis.set_minor_locator(AutoMinorLocator()) + ax.yaxis.set_minor_locator(AutoMinorLocator()) + ax.grid( + which="major", + axis="both", + linestyle="--", + linewidth=0.5, + color="black", + zorder=0, + ) + ax.grid( + which="minor", axis="both", linestyle="--", linewidth=0.5, color="0.7", zorder=0 + )
+ + +
[docs]def make_side_legend(ax: plt.Axes, fig: plt.Figure = None, right_position: float = 1): + ax.legend(loc="center left", bbox_to_anchor=(1, 0.5), frameon=False, handlelength=1) + if fig and right_position > 0: + fig.subplots_adjust(right=right_position)
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/discretization_structure.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/discretization_structure.html new file mode 100644 index 0000000..63ae766 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/discretization_structure.html @@ -0,0 +1,182 @@ + + + + + + + + agentlib_mpc.utils.plotting.discretization_structure — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.discretization_structure

+from pathlib import Path
+
+import matplotlib.pyplot as plt
+import pandas as pd
+
+from agentlib_mpc.utils.analysis import load_admm, admm_at_time_step
+from agentlib_mpc.utils.plotting import basic
+from agentlib_mpc.utils.plotting.basic import Customizer, Style, EBCColors
+
+
+
[docs]def spy_structure(df: pd.DataFrame, customizer: Customizer = None, file: Path = ""): + with basic.Style() as style: + style.font_dict["fontsize"] = 12 + fig, ax = basic.make_fig(style, customizer=customizer) + + columns = df.columns + index = df.index + ax.spy( + df.notnull(), + markersize=10, + markerfacecolor=EBCColors.red, + markeredgecolor=EBCColors.red, + ) + ax.set_xticklabels(columns, fontsize=style.font_dict["fontsize"]) + ax.set_xticks([i for i, _ in enumerate(columns)]) + ax.set_yticklabels( + [f"{int(time)} s" for i, time in enumerate(index)], + fontsize=style.font_dict["fontsize"], + ) + ax.set_yticks([i for i, _ in enumerate(index)]) + + if file: + fig.savefig(file) + else: + fig.show()
+ + +if __name__ == "__main__": + + def customize(fig: plt.Figure, ax: plt.Axes, style: Style): + cm = 1 / 2.54 + fig.set_size_inches(8 * cm, 9 * cm) + return fig, ax + + base_path = Path( + r"C:\Users\ses\Dokumente\Konferenzen\MED2022\Figures\Simulations" + r"\iteration analysis\tracking_constantrho1" + ) + + cons1_path = Path(base_path, "admm_consumer1.csv") + cons2_path = Path(base_path, "admm_consumer2.csv") + prod_path = Path(base_path, "admm_prod_opt.csv") + + cons1 = load_admm(cons1_path) + room_0_0 = admm_at_time_step(cons1, time_step=0, iteration=0) + room_0_0_vars = room_0_0["variable"].iloc[:8] + # room_0_0_vars = room_0_0_vars[['room_T', 'wall_T', 'room_T_slack', 'Heat_flow_in', 'heating_T']] + room_0_0_vars.drop("room_T_slack", axis=1, inplace=True) + column_labels = ["$T_z$", "$T_w$", r"$\dot{Q}_{in}$", "$T_h$"] + room_0_0_vars.columns = column_labels + spy_structure( + room_0_0_vars, customizer=customize, file=Path("cons_structure_short.png") + ) + + def customize(fig: plt.Figure, ax: plt.Axes, style: Style): + cm = 1 / 2.54 + fig.set_size_inches(8 * cm, 9 * cm) + ax.yaxis.tick_right() + return fig, ax + + prod = load_admm(prod_path) + prod_0_0 = admm_at_time_step(prod, time_step=0, iteration=0) + prod_0_0_vars = prod_0_0["variable"].iloc[:8] + prod_0_0_vars = prod_0_0_vars[["heating_1_T", "Heat_flow_out_1", "heating_1_speed"]] + column_labels = ["$T_h$", r"$\dot{Q}_{in}$", "$u_1$"] + prod_0_0_vars.columns = column_labels + spy_structure( + prod_0_0_vars, customizer=customize, file=Path("prod_structure_short.png") + ) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/interactive.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/interactive.html new file mode 100644 index 0000000..2486949 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/interactive.html @@ -0,0 +1,617 @@ + + + + + + + + agentlib_mpc.utils.plotting.interactive — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.interactive

+import pandas as pd
+from typing import Literal, Optional
+
+import socket
+import webbrowser
+
+from agentlib.core.errors import OptionalDependencyError
+
+from agentlib_mpc.utils import TIME_CONVERSION
+from agentlib_mpc.utils.analysis import load_mpc
+from agentlib_mpc.utils.plotting.basic import EBCColors
+from agentlib_mpc.utils.plotting.mpc import interpolate_colors
+
+try:
+    import dash
+    from dash import html, dcc
+    from dash.dependencies import Input, Output, State
+    import plotly.graph_objects as go
+except ImportError as e:
+    raise OptionalDependencyError(
+        dependency_name="interactive",
+        dependency_install="plotly, dash",
+        used_object="interactive",
+    ) from e
+
+
+
[docs]def make_figure_plotly() -> go.Figure: + fig = go.Figure() + fig.update_layout( + title="Interactive Plot Example", + showlegend=True, + updatemenus=[ + dict( + type="buttons", + direction="left", + buttons=list( + [ + dict(args=["type", "scatter"], label="Line", method="restyle"), + # dict( + # args=["type", "bar"], + # label="Bar", + # method="restyle" + # ), + ] + ), + ), + ], + ) + + # This function toggles the visibility of a trace (line) in the plot + def toggle_traces(trace, points, selector): + if len(points.trace_indexes) == 0: # No point has been clicked, do nothing + return + trace_index = points.trace_indexes[0] # Get the index of the clicked trace + fig.data[trace_index].visible = not fig.data[ + trace_index + ].visible # Toggle visibility + + # Add Click event handler to traces + fig.for_each_trace(lambda trace: trace.on_click(toggle_traces)) + return fig
+ + +
[docs]def plot_mpc_plotly( + series: pd.Series, + step: bool = False, + convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds", + y_axis_label: str = "", +) -> go.Figure: + """ + Args: + title: + y_axis_label: + series: A column of the MPC results Dataframe + plot_actual_values: whether the closed loop actual values at the start of each + optimization should be plotted (default True) + plot_predictions: whether all predicted trajectories should be plotted + step: whether to use a step plot or a line plot + convert_to: Will convert the index of the returned series to the specified unit + (seconds, minutes, hours, days) + + Returns: + Figure + """ + fig = go.Figure() + number_of_predictions: int = series.index.unique(level=0).shape[0] + + # stores the first value of each prediction + actual_values: dict[float, float] = {} + + for i, (time_seconds, prediction) in enumerate(series.groupby(level=0)): + prediction: pd.Series = prediction.dropna().droplevel(0) + + time_converted = time_seconds / TIME_CONVERSION[convert_to] + actual_values[time_converted] = prediction.loc[0] + prediction.index = (prediction.index + time_seconds) / TIME_CONVERSION[ + convert_to + ] + + progress = i / number_of_predictions + prediction_color = interpolate_colors( + progress=progress, + colors=[EBCColors.red, EBCColors.dark_grey], + ) + if not step: + fig.add_trace( + go.Scatter( + x=prediction.index, + y=prediction, + mode="lines", + line=dict(color=f"rgb{prediction_color}", width=0.7), + name=f"{time_converted} {convert_to[0]}", + legendgroup=f"Prediction", + legendgrouptitle_text=f"Predictions", + visible=True, + legendrank=i + 2, + # id=f"trace-{y_axis_label}-{i}", + ) + ) + else: + fig.add_trace( + go.Scatter( + x=prediction.index, + y=prediction, + mode="lines", + line=dict( + color=f"rgb{prediction_color}", + width=0.7, + shape="hv", + ), + name=f"{time_converted} {convert_to[0]}", + legendgroup=f"Prediction", + legendgrouptitle_text=f"Predictions", + visible=True, + legendrank=i + 2, + # id=f"trace-{y_axis_label}-{i}", + ) + ) + + actual_series = pd.Series(actual_values) + if not step: + fig.add_trace( + go.Scatter( + x=actual_series.index, + y=actual_series, + mode="lines", + line=dict(color="black", width=1.5), + name="Actual Values", + legendrank=1, + ) + ) + else: + fig.add_trace( + go.Scatter( + x=actual_series.index, + y=actual_series, + mode="lines", + line=dict(color="black", width=1.5, shape="hv"), + name="Actual Values", + legendrank=1, + ) + ) + + # Update x-axis label based on convert_to argument + x_axis_label = f"Time in {convert_to}" + + fig.update_layout( + showlegend=True, + legend=dict( + groupclick="toggleitem", + itemclick="toggle", + itemdoubleclick="toggleothers", + ), + xaxis_title=x_axis_label, + yaxis_title=y_axis_label, + uirevision="same", # Add this line + ) + + return fig
+ + +
[docs]def plot_admm_plotly( + series: pd.Series, + plot_actual_values: bool = True, + plot_predictions: bool = False, + step: bool = False, + convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds", +): + """ + Args: + series: A column of the MPC results Dataframe + fig: Plotly figure to plot on + plot_actual_values: whether the closed loop actual values at the start of each + optimization should be plotted (default True) + plot_predictions: whether all predicted trajectories should be plotted + step: whether to use a step plot or a line plot + convert_to: Will convert the index of the returned series to the specified unit + (seconds, minutes, hours, days) + + Returns: + None + """ + grid = series.index.get_level_values(2).unique() + tail_length = len(grid[grid >= 0]) + series_final_predictions = series.groupby(level=0).tail(tail_length).droplevel(1) + plot_mpc_plotly( + series=series_final_predictions, + step=step, + convert_to=convert_to, + )
+ + +
[docs]def show_dashboard( + data: pd.DataFrame, + stats: Optional[pd.DataFrame] = None, + scale: Literal["seconds", "minutes", "hours", "days"] = "seconds", +): + app = dash.Dash(__name__, title="MPC Results") + + # Get the list of columns from the DataFrame, and check if they can be plotted + columns = data["variable"].columns + columns_okay = [] + for column in columns: + try: + fig = plot_mpc_plotly( + data["variable"][column], + convert_to=scale, + y_axis_label=column, + ) + columns_okay.append(column) + except Exception: + pass + + # Store initial figures + initial_figures = {} + for column in columns_okay: + fig = plot_mpc_plotly( + data["variable"][column], + convert_to=scale, + y_axis_label=column, + ) + # Add uirevision to maintain legend state + fig.update_layout(uirevision="same") + initial_figures[column] = fig + + # Define the layout of the webpage + app.layout = html.Div( + [ + html.H1("MPC Results"), + # Store for keeping track of trace visibility + dcc.Store(id="trace-visibility", data={}), + make_components(columns_okay, data, stats=stats, convert_to=scale), + ] + ) + + port = get_port() + + @app.callback( + [Output(f"plot-{column}", "figure") for column in columns_okay], + [Input(f"plot-{column}", "restyleData") for column in columns_okay], + [State(f"plot-{column}", "figure") for column in columns_okay], + ) + def update_plots(*args): + ctx = dash.callback_context + if not ctx.triggered: + return [dash.no_update] * len(columns_okay) + + n_plots = len(columns_okay) + restyle_data = args[:n_plots] + current_figures = args[n_plots:] + + # Find which plot was changed + triggered_prop = ctx.triggered[0]["prop_id"].split(".")[0] + triggered_index = next( + i for i, col in enumerate(columns_okay) if f"plot-{col}" == triggered_prop + ) + triggered_data = restyle_data[triggered_index] + + if not triggered_data: + return [dash.no_update] * n_plots + + # Get the visibility update from the triggered plot + visibility_update = triggered_data[0].get("visible", [None])[0] + trace_indices = triggered_data[1] + + # Update all figures + updated_figures = [] + for fig in current_figures: + # Ensure uirevision is set + fig["layout"]["uirevision"] = "same" + # Update visibility for the corresponding traces + for idx in trace_indices: + fig["data"][idx]["visible"] = visibility_update + updated_figures.append(fig) + + return updated_figures + + webbrowser.open_new_tab(f"http://localhost:{port}") + app.run(debug=False, port=port)
+ + +
[docs]def make_components( + columns, data, convert_to, stats: Optional[pd.DataFrame] = None +) -> [html.Div]: + components = [ + html.Div( + [ + # html.H3(column), + dcc.Graph( + id=f"plot-{column}", + figure=plot_mpc_plotly( + data["variable"][column], + convert_to=convert_to, + y_axis_label=column, + ), + style={ + "min-width": "600px", + "min-height": "400px", + "max-width": "900px", + "max-height": "450px", + }, + ), + ], + className="draggable", + ) + for column in columns + ] + if stats is not None: + components.insert(0, html.Div([solver_return(stats, convert_to)])) + components.insert( + 1, html.Div([obj_plot(stats, convert_to)]) + ) # Add the "obj" plot + + return html.Div( + components, + style={ + "display": "grid", + "grid-template-columns": "repeat(auto-fit, minmax(600px, 1fr))", + "grid-gap": "20px", + "padding": "20px", + "min-width": "600px", + "min-height": "200px", + }, + id="plot-container", + )
+ + +
[docs]def obj_plot( + data, convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds" +) -> dcc.Graph: + df = data.copy() + index = df.index.values / TIME_CONVERSION[convert_to] + + trace = go.Scatter( + x=index, + y=df["obj"], + mode="lines", + name="Objective Value", + ) + + layout = go.Layout( + title="Objective Value", + xaxis_title=f"Time in {convert_to}", + yaxis_title="Objective Value", + showlegend=True, + ) + + fig = go.Figure(data=[trace], layout=layout) + + return dcc.Graph( + id="plot-obj", + figure=fig, + style={ + "min-width": "600px", + "min-height": "400px", + "max-width": "900px", + "max-height": "450px", + }, + )
+ + +
[docs]def solver_return( + data, convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds" +) -> dcc.Graph: + solver_data = [] + indices = [] + j = 0 + for i in reversed(data.index.values): + if i in indices: + break + j += 1 + indices.append(i) + solver_data.append(data.iloc[len(data) - j]) + df = pd.DataFrame(solver_data) + df = df.iloc[::-1] + + return_status = {} + for idx, success in df.success.items(): + if success: + solver_return = df.return_status[idx] + else: + solver_return = "Solve_Not_Succeeded" + return_status[idx] = solver_return + + solver_returns = pd.Series(return_status) + index = solver_returns.index.values / TIME_CONVERSION[convert_to] + + colors = { + "Solve_Succeeded": "green", + "Solved_To_Acceptable_Level": "orange", + "Solve_Not_Succeeded": "red", + } + legend_names = { + "Solved_To_Acceptable_Level": "Acceptable", + "Solve_Succeeded": "Optimal", + "Solve_Not_Succeeded": "Failure", + } + + traces = [] + for status in colors: + mask = solver_returns.values == status + if mask.any(): + trace = go.Scatter( + x=index[mask], + y=df.loc[solver_returns.index[mask], "iter_count"], + mode="markers", + marker=dict( + color=colors[status], + size=10, + ), + name=legend_names[status], + ) + else: + trace = go.Scatter( + x=[None], + y=[None], + mode="markers", + marker=dict( + color=colors[status], + size=10, + ), + name=legend_names[status], + ) + traces.append(trace) + + layout = go.Layout( + title="Solver Return Status", + xaxis_title=f"Time in {convert_to}", + yaxis_title="Iterations", + showlegend=True, + ) + + fig = go.Figure(data=traces, layout=layout) + + return dcc.Graph( + id="plot-solver-return", + figure=fig, + style={ + "min-width": "600px", + "min-height": "400px", + "max-width": "900px", + "max-height": "450px", + }, + )
+ + +
[docs]def draggable_script(): + return html.Script( + """ + var draggableElements = document.getElementsByClassName('draggable'); + for (var i = 0; i < draggableElements.length; i++) { + var element = draggableElements[i]; + element.addEventListener('mousedown', function(e) { + var offset = [ + this.offsetLeft - e.clientX, + this.offsetTop - e.clientY + ]; + var moveHandler = function(e) { + element.style.left = (e.clientX + offset[0]) + 'px'; + element.style.top = (e.clientY + offset[1]) + 'px'; + }; + document.addEventListener('mousemove', moveHandler); + document.addEventListener('mouseup', function() { + document.removeEventListener('mousemove', moveHandler); + }); + }); + } + """ + )
+ + +
[docs]def get_port(): + port = 8050 + while True: + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + is_free = s.connect_ex(("localhost", port)) != 0 + if is_free: + return port + else: + port += 1
+ + +if __name__ == "__main__": + data_ = load_mpc( + r"D:\repos\agentlib_mpc\examples\one_room_mpc\physical\results\mpc.csv" + ) + show_dashboard(data_) + # fig = plot_mpc_plotly( + # data["variable"]["T"] - 273.15, + # y_axis_label="Room temperature", + # convert_to="minutes", + # step=False, + # ) + # fig.show() +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/ml_model_test.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/ml_model_test.html new file mode 100644 index 0000000..cfd8fea --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/ml_model_test.html @@ -0,0 +1,235 @@ + + + + + + + + agentlib_mpc.utils.plotting.ml_model_test — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.ml_model_test

+from pathlib import Path
+from typing import Callable, Union, Optional
+
+import numpy as np
+import pandas as pd
+from matplotlib import pyplot as plt
+
+from agentlib_mpc.models.casadi_predictor import CasadiPredictor, casadi_predictors
+from agentlib_mpc.models.serialized_ml_model import SerializedMLModel
+from agentlib_mpc.utils.plotting import basic
+from agentlib_mpc.data_structures import ml_model_datatypes
+
+
+
[docs]def calc_scores(errors: np.ndarray, metric: Callable) -> float: + if all(np.isnan(errors)): + return 0 + + return float(np.mean(metric(errors)))
+ + +
[docs]def predict_array( + df: pd.DataFrame, ml_model: CasadiPredictor, outputs: pd.Index +) -> pd.DataFrame: + arr = ( + ml_model.predict(df.values.reshape(1, -1)) + .toarray() + .reshape((df.shape[0], len(outputs))) + ) + return pd.DataFrame(arr, columns=outputs, index=df.index)
+ + +
[docs]def pairwise_sort(*arrays: tuple[np.ndarray, np.ndarray]): + true_sorted = np.concatenate([true.flatten() for true, pred in arrays]) + empty = np.empty(shape=true_sorted.shape) + empty[:] = np.nan + + idx = np.argsort(true_sorted) + true_sorted = true_sorted[idx] + + i = 0 + out = list() + + for _, pred in arrays: + copy_empty = empty.copy() + copy_empty[i : i + len(pred)] = pred + i += len(pred) + + copy_empty = copy_empty[idx] + + out.append(copy_empty) + + return out, true_sorted
+ + +# Change +
[docs]def evaluate_model( + training_data: ml_model_datatypes.TrainingData, + model: Union[CasadiPredictor, SerializedMLModel], + metric: Callable = None, + show_plot: bool = True, + save_path: Optional[Path] = None, +): + """Tests the Model on test data""" + + if metric is None: + metric = lambda x: x * x + + # make model executable + if isinstance(model, SerializedMLModel): + model_ = casadi_predictors[model.model_type](model) + else: + model_ = model + + # # make the predictions + outputs = training_data.training_outputs.columns + + train_pred = predict_array( + df=training_data.training_inputs, ml_model=model_, outputs=outputs + ) + valid_pred = predict_array( + df=training_data.validation_inputs, ml_model=model_, outputs=outputs + ) + test_pred = predict_array( + df=training_data.test_inputs, ml_model=model_, outputs=outputs + ) + train_error = training_data.training_outputs - train_pred + valid_error = training_data.validation_outputs - valid_pred + test_error = training_data.test_outputs - test_pred + + for name in outputs: + train_score = calc_scores(train_error[name], metric=metric) + valid_score = calc_scores(valid_error[name], metric=metric) + test_score = calc_scores(test_error[name], metric=metric) + total_score = sum([train_score, valid_score, test_score]) / 3 + + # plot + y_pred_sorted, y_true_sorted = pairwise_sort( + (training_data.training_outputs[name].values, train_pred[name]), + (training_data.validation_outputs[name].values, valid_pred[name]), + (training_data.test_outputs[name].values, test_pred[name]), + ) + + scale = range(len(y_true_sorted)) + + with basic.Style() as style: + fig, ax = basic.make_fig(style=style) + ax: plt.Axes + for y, c, label in zip( + y_pred_sorted, + [basic.EBCColors.red, basic.EBCColors.green, basic.EBCColors.blue], + ["Train", "Valid", "Test"], + ): + if not all(np.isnan(y)): + ax.scatter(scale, y, s=0.6, color=c, label=label) + + ax.scatter( + scale, + y_true_sorted, + s=0.6, + color=basic.EBCColors.dark_grey, + label="True", + ) + ax.set_xlabel("Samples") + ax.legend(loc="upper left") + ax.yaxis.grid(linestyle="dotted") + ax.set_title( + f"{name}\ntest_score={test_score.__round__(4)}\ntotal_score={total_score.__round__(4)}" + ) + if show_plot: + fig.show() + if save_path is not None: + fig.savefig(fname=Path(save_path, f"evaluation_{name}.png"))
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/mpc.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/mpc.html new file mode 100644 index 0000000..75e81e6 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/plotting/mpc.html @@ -0,0 +1,257 @@ + + + + + + + + agentlib_mpc.utils.plotting.mpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + + +
  • +
  • +
+
+
+
+
+ +

Source code for agentlib_mpc.utils.plotting.mpc

+# from agentlib_mpc.utils.plotting.basic import ColorTuple
+from pathlib import Path
+from typing import Literal
+
+import matplotlib.pyplot as plt
+import pandas as pd
+
+from agentlib_mpc.utils import TIME_CONVERSION
+from agentlib_mpc.utils.analysis import load_mpc
+from agentlib_mpc.utils.plotting.basic import (
+    ColorTuple,
+    EBCColors,
+    Float0to1,
+    make_fig,
+    Style,
+)
+
+
+
[docs]def interpolate_colors(progress: Float0to1, colors: list[ColorTuple]) -> ColorTuple: + """ + Interpolates colors based on a sample number. To be used when plotting many mpc + predictions in one plot, so a fade from old to new predictions can be seen. + + Original credit to Max Berktold. + + Args: + progress: + colors: + + Returns: + + """ + if progress <= 0: + return colors[0] + elif progress >= 1: + return colors[-1] + + num_colors = len(colors) + interval = 1 / (num_colors - 1) + color_index = int(progress / interval) + t = (progress - interval * color_index) / interval + color1 = colors[color_index] + color2 = colors[color_index + 1] + return ( + (1 - t) * color1[0] + t * color2[0], + (1 - t) * color1[1] + t * color2[1], + (1 - t) * color1[2] + t * color2[2], + )
+ + +
[docs]def plot_mpc( + series: pd.Series, + ax: plt.Axes, + plot_actual_values: bool = True, + plot_predictions: bool = False, + step: bool = False, + convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds", +): + """ + + Args: + series: A column of the MPC results Dataframe + ax: which Axes to plot on + plot_actual_values: whether the closed loop actual values at the start of each + optimization should be plotted (default True) + plot_predictions: whether all predicted trajectories should be plotted + step: + convert_to: Will convert the index of the returned series to the specified unit + (seconds, minutes, hours, days) + + Returns: + + """ + number_of_predictions: int = series.index.unique(level=0).shape[0] + + # stores the first value of each prediction. In the case of a control_variable, + # this will give the optimal control output the mpc determined this step, or in + # the case of a state, this will give the measurement it worked with + actual_values: dict[float, float] = {} + + for i, (time_seconds, prediction) in enumerate(series.groupby(level=0)): + prediction: pd.Series = prediction.dropna().droplevel(0) + + time_converted = time_seconds / TIME_CONVERSION[convert_to] + if plot_actual_values: + actual_values[time_converted] = prediction.at[0] + + prediction.index = (prediction.index + time_seconds) / TIME_CONVERSION[ + convert_to + ] + + if plot_predictions: + progress = i / number_of_predictions + prediction_color = interpolate_colors( + progress=progress, + colors=[EBCColors.red, EBCColors.dark_grey, EBCColors.light_grey], + ) + if not step: + prediction.plot( + ax=ax, color=prediction_color, linewidth=0.7, label="_nolegend_" + ) + else: + prediction.plot( + ax=ax, + color=prediction_color, + drawstyle="steps-post", + linewidth=0.7, + label="_nolegend_", + ) + + if plot_actual_values: + actual_series = pd.Series(actual_values) + if not step: + actual_series.plot(ax=ax, color="black", linewidth=1.5) + else: + actual_series.plot( + ax=ax, color="black", linewidth=1.5, drawstyle="steps-post" + )
+ + +
[docs]def plot_admm( + series: pd.Series, + ax: plt.Axes, + plot_actual_values: bool = True, + plot_predictions: bool = False, + step: bool = False, + convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds", +): + """ + + Args: + series: A column of the MPC results Dataframe + ax: which Axes to plot on + plot_actual_values: whether the closed loop actual values at the start of each + optimization should be plotted (default True) + plot_predictions: whether all predicted trajectories should be plotted + step: + convert_to: Will convert the index of the returned series to the specified unit + (seconds, minutes, hours, days) + + Returns: + + """ + grid = series.index.get_level_values(2).unique() + tail_length = len(grid[grid >= 0]) + series_final_predictions = series.groupby(level=0).tail(tail_length).droplevel(1) + return plot_mpc( + series=series_final_predictions, + ax=ax, + plot_actual_values=plot_actual_values, + plot_predictions=plot_predictions, + step=step, + convert_to=convert_to, + )
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/agentlib_mpc/utils/sampling.html b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/sampling.html new file mode 100644 index 0000000..6768f86 --- /dev/null +++ b/docs/0.6.4/docs/_modules/agentlib_mpc/utils/sampling.html @@ -0,0 +1,296 @@ + + + + + + + + agentlib_mpc.utils.sampling — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for agentlib_mpc.utils.sampling

+import itertools
+import logging
+from typing import Union, Iterable, Sequence, List
+from numbers import Real
+
+import numpy as np
+import pandas as pd
+
+from agentlib_mpc.data_structures.interpolation import InterpolationMethods
+
+logger = logging.getLogger(__name__)
+
+
+
[docs]def sample_values_to_target_grid( + values: Iterable[float], + original_grid: Iterable[float], + target_grid: Iterable[float], + method: Union[str, InterpolationMethods], +) -> list[float]: + if method == InterpolationMethods.linear: + return np.interp(target_grid, original_grid, values).tolist() + elif method == InterpolationMethods.spline3: + raise NotImplementedError("Spline interpolation is currently not supported") + elif method == InterpolationMethods.previous: + return interpolate_to_previous(target_grid, original_grid, values) + elif method == InterpolationMethods.mean_over_interval: + values = np.array(values) + original_grid = np.array(original_grid) + result = [] + for i, j in pairwise(target_grid): + slicer = np.logical_and(original_grid >= i, original_grid < j) + result.append(values[slicer].mean()) + # take last value twice, so the length is consistent with the other resampling + # methods + result.append(result[-1]) + return result + else: + raise ValueError( + f"Chosen 'method' {method} is not a valid method. " + f"Currently supported: linear, spline, previous" + )
+ + +
[docs]def sample( + trajectory: Union[Real, pd.Series, list[Real], dict[Real, Real]], + grid: Union[list, np.ndarray], + current: float = 0, + method: str = "linear", +) -> list: + """ + Obtain the specified portion of the trajectory. + + Args: + trajectory: The trajectory to be sampled. Scalars will be + expanded onto the grid. Lists need to exactly match the provided + grid. Otherwise, a pandas Series is accepted with the timestamp as index. A + dict with the keys as time stamps is also accepted. + current: start time of requested trajectory + grid: target interpolation grid in seconds in relative terms (i.e. + starting from 0 usually) + method: interpolation method, currently accepted: 'linear', + 'spline', 'previous' + + Returns: + Sampled list of values. + + Takes a slice of the trajectory from the current time step with the + specified length and interpolates it to match the requested sampling. + If the requested horizon is longer than the available data, the last + available value will be used for the remainder. + + Raises: + ValueError + TypeError + """ + target_grid_length = len(grid) + if isinstance(trajectory, (float, int)): + # return constant trajectory for scalars + return [trajectory] * target_grid_length + if isinstance(trajectory, list): + # return lists of matching length without timestamps + if len(trajectory) == target_grid_length: + return trajectory + raise ValueError( + f"Passed list with length {len(trajectory)} " + f"does not match target ({target_grid_length})." + ) + if isinstance(trajectory, pd.Series): + trajectory = trajectory.dropna() + source_grid = np.array(trajectory.index) + values = trajectory.values + elif isinstance(trajectory, dict): + source_grid = np.array(list(trajectory)) + values = np.array(list(trajectory.values())) + else: + raise TypeError( + f"Passed trajectory of type '{type(trajectory)}' " f"cannot be sampled." + ) + target_grid = np.array(grid) + current + + # expand scalar values + if len(source_grid) == 1: + if isinstance(trajectory, list): + return [trajectory[0]] * target_grid_length + # if not list, assume it is a series + else: + return [trajectory.iloc[0]] * target_grid_length + + # skip resampling if grids are (almost) the same + if (target_grid.shape == source_grid.shape) and all(target_grid == source_grid): + return list(values) + values = np.array(values) + + # check requested portion of trajectory, whether the most recent value in the + # source grid is older than the first value in the MHE trajectory + if target_grid[0] >= source_grid[-1]: + # return the last value of the trajectory if requested sample + # starts out of range + logger.warning( + f"Latest value of source grid %s is older than " + f"current time (%s. Returning latest value anyway.", + source_grid[-1], + current, + ) + return [values[-1]] * target_grid_length + + # determine whether the target grid lies within the available source grid, and + # how many entries to extrapolate on either side + source_grid_oldest_time: float = source_grid[0] + source_grid_newest_time: float = source_grid[-1] + source_is_recent_enough: np.ndarray = target_grid < source_grid_newest_time + source_is_old_enough: np.ndarray = target_grid > source_grid_oldest_time + number_of_missing_old_entries: int = target_grid_length - np.count_nonzero( + source_is_old_enough + ) + number_of_missing_new_entries: int = target_grid_length - np.count_nonzero( + source_is_recent_enough + ) + # shorten target interpolation grid by extra points that go above or below + # available data range + target_grid = target_grid[source_is_recent_enough * source_is_old_enough] + + # interpolate data to match new grid + sequence_new = sample_values_to_target_grid( + values=values, original_grid=source_grid, target_grid=target_grid, method=method + ) + + # extrapolate sequence with last available value if necessary + interpolated_trajectory = ( + [values[0]] * number_of_missing_old_entries + + sequence_new + + [values[-1]] * number_of_missing_new_entries + ) + + return interpolated_trajectory
+ + +
[docs]def pairwise(iterable: Iterable): + "s -> (s0,s1), (s1,s2), (s2, s3), ..." + a, b = itertools.tee(iterable) + next(b, None) + return zip(a, b)
+ + +
[docs]def earliest_index(time, arr, stop, start=0): + """Helper function for interpolate_to_previous. + Finds the current index to which we should forwardfill.""" + for i in range(start, stop): + if arr[i] > time: + return i - 1 + return 0
+ + +
[docs]def interpolate_to_previous( + target_grid: Iterable[float], + original_grid: Iterable[float], + values: Sequence[float], +) -> List[float]: + """Interpolates to previous value of original grid, i.e. a forward fill. + + Stand-in for the following scipy code: + tck = interpolate.interp1d(list(original_grid), values, kind="previous") + result = list(tck(target_grid)) + """ + result = [] + _grid_index = 0 + stop = len(original_grid) + for target_point in target_grid: + _grid_index = earliest_index( + target_point, original_grid, stop, start=_grid_index + ) + result.append(values[_grid_index]) + return result
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_modules/index.html b/docs/0.6.4/docs/_modules/index.html new file mode 100644 index 0000000..7c4fb2b --- /dev/null +++ b/docs/0.6.4/docs/_modules/index.html @@ -0,0 +1,152 @@ + + + + + + + + Overview: module code — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ +

All modules for which code is available

+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/_sources/PackageReference.md.txt b/docs/0.6.4/docs/_sources/PackageReference.md.txt new file mode 100644 index 0000000..e7a55f0 --- /dev/null +++ b/docs/0.6.4/docs/_sources/PackageReference.md.txt @@ -0,0 +1,15 @@ +Package Reference +================= + +This section contains auto-generated documentation of all modules and +functions. + +.. toctree:: + :maxdepth: 2 + + agentlib_mpc.data_structures + agentlib_mpc.models + agentlib_mpc.modules + agentlib_mpc.optimization_backends + agentlib_mpc.utils + diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.data_structures.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.data_structures.rst.txt new file mode 100644 index 0000000..22eb609 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.data_structures.rst.txt @@ -0,0 +1,45 @@ +agentlib\_mpc.data\_structures package +====================================== + +Submodules +---------- + +agentlib\_mpc.data\_structures.admm\_datatypes module +----------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.admm_datatypes + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.casadi\_utils module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.casadi_utils + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.coordinator\_datatypes module +------------------------------------------------------------ + +.. automodule:: agentlib_mpc.data_structures.coordinator_datatypes + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.mpc\_datamodels module +----------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.mpc_datamodels + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.data_structures + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.models.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.models.rst.txt new file mode 100644 index 0000000..7e1c7b0 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.models.rst.txt @@ -0,0 +1,53 @@ +agentlib\_mpc.models package +============================ + +Submodules +---------- + +agentlib\_mpc.models.ann\_model module +-------------------------------------- + +.. automodule:: agentlib_mpc.models.ann_model + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.casadi\_model module +----------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_model + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.casadi\_model\_ann module +---------------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_model_ann + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.casadi\_neural\_network module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_neural_network + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.serialized\_ann module +------------------------------------------- + +.. automodule:: agentlib_mpc.models.serialized_ann + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.models + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.admm.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.admm.rst.txt new file mode 100644 index 0000000..54343ed --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.admm.rst.txt @@ -0,0 +1,37 @@ +agentlib\_mpc.modules.dmpc.admm package +======================================= + +Submodules +---------- + +agentlib\_mpc.modules.dmpc.admm.admm module +------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.admm.admm\_coordinated module +-------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm_coordinated + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.admm.admm\_coordinator module +-------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm_coordinator + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.rst.txt new file mode 100644 index 0000000..e512365 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.dmpc.rst.txt @@ -0,0 +1,37 @@ +agentlib\_mpc.modules.dmpc package +================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.modules.dmpc.admm + +Submodules +---------- + +agentlib\_mpc.modules.dmpc.coordinator module +--------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.coordinator + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.employee module +------------------------------------------ + +.. automodule:: agentlib_mpc.modules.dmpc.employee + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.modules.dmpc + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.modules.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.rst.txt new file mode 100644 index 0000000..37c451a --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.modules.rst.txt @@ -0,0 +1,21 @@ +agentlib\_mpc.modules package +============================= + +Submodules +---------- + +agentlib\_mpc.modules.mpc module +-------------------------------- + +.. automodule:: agentlib_mpc.modules.mpc + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.modules + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.core.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.core.rst.txt new file mode 100644 index 0000000..f7a1861 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.core.rst.txt @@ -0,0 +1,45 @@ +agentlib\_mpc.optimization\_backends.casadi\_.core package +========================================================== + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.casadi\_.core.VariableGroup module +----------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.VariableGroup + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.casadi\_backend module +------------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.casadi_backend + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.discretization module +------------------------------------------------------------------------ + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.discretization + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.system module +---------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.system + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.rst.txt new file mode 100644 index 0000000..2143228 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.casadi_.rst.txt @@ -0,0 +1,69 @@ +agentlib\_mpc.optimization\_backends.casadi\_ package +===================================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.optimization_backends.casadi_.core + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.casadi\_.admm module +--------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.admm + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.basic module +---------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.basic + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.casadi\_admm\_nn module +--------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.casadi_admm_nn + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.casadi\_nn module +--------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.casadi_nn + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.full module +--------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.full + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.minlp module +--------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.minlp + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_ + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.rst.txt new file mode 100644 index 0000000..40194c2 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.optimization_backends.rst.txt @@ -0,0 +1,29 @@ +agentlib\_mpc.optimization\_backends package +============================================ + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.optimization_backends.casadi_ + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.backend module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.backend + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.optimization_backends + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.rst.txt new file mode 100644 index 0000000..2c6a4c3 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.rst.txt @@ -0,0 +1,21 @@ +agentlib\_mpc package +===================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.data_structures + agentlib_mpc.models + agentlib_mpc.optimization_backends + agentlib_mpc.utils + +Module contents +--------------- + +.. automodule:: agentlib_mpc + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.utils.plotting.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.utils.plotting.rst.txt new file mode 100644 index 0000000..be38854 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.utils.plotting.rst.txt @@ -0,0 +1,37 @@ +agentlib\_mpc.utils.plotting package +==================================== + +Submodules +---------- + +agentlib\_mpc.utils.plotting.admm\_animation module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_animation + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.admm\_residuals module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_residuals + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.basic module +----------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.basic + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.utils.plotting + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/agentlib_mpc.utils.rst.txt b/docs/0.6.4/docs/_sources/agentlib_mpc.utils.rst.txt new file mode 100644 index 0000000..fc674b5 --- /dev/null +++ b/docs/0.6.4/docs/_sources/agentlib_mpc.utils.rst.txt @@ -0,0 +1,37 @@ +agentlib\_mpc.utils package +=========================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.utils.plotting + +Submodules +---------- + +agentlib\_mpc.utils.analysis module +----------------------------------- + +.. automodule:: agentlib_mpc.utils.analysis + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.debug module +-------------------------------- + +.. automodule:: agentlib_mpc.utils.debug + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: agentlib_mpc.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.data_structures.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.data_structures.rst.txt new file mode 100644 index 0000000..981b3cb --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.data_structures.rst.txt @@ -0,0 +1,58 @@ +agentlib\_mpc.data\_structures package +====================================== + +.. automodule:: agentlib_mpc.data_structures + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.data\_structures.admm\_datatypes module +----------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.admm_datatypes + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.casadi\_utils module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.casadi_utils + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.coordinator\_datatypes module +------------------------------------------------------------ + +.. automodule:: agentlib_mpc.data_structures.coordinator_datatypes + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.interpolation module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.interpolation + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.ml\_model\_datatypes module +---------------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.ml_model_datatypes + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.data\_structures.mpc\_datamodels module +----------------------------------------------------- + +.. automodule:: agentlib_mpc.data_structures.mpc_datamodels + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.models.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.models.rst.txt new file mode 100644 index 0000000..64dbb4d --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.models.rst.txt @@ -0,0 +1,42 @@ +agentlib\_mpc.models package +============================ + +.. automodule:: agentlib_mpc.models + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.models.casadi\_ml\_model module +--------------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_ml_model + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.casadi\_model module +----------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_model + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.casadi\_predictor module +--------------------------------------------- + +.. automodule:: agentlib_mpc.models.casadi_predictor + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.models.serialized\_ml\_model module +------------------------------------------------- + +.. automodule:: agentlib_mpc.models.serialized_ml_model + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.InputPrediction.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.InputPrediction.rst.txt new file mode 100644 index 0000000..4e9d18d --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.InputPrediction.rst.txt @@ -0,0 +1,18 @@ +agentlib\_mpc.modules.InputPrediction package +============================================= + +.. automodule:: agentlib_mpc.modules.InputPrediction + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.modules.InputPrediction.try\_predictor module +----------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.InputPrediction.try_predictor + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.admm.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.admm.rst.txt new file mode 100644 index 0000000..10bd6ea --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.admm.rst.txt @@ -0,0 +1,34 @@ +agentlib\_mpc.modules.dmpc.admm package +======================================= + +.. automodule:: agentlib_mpc.modules.dmpc.admm + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.modules.dmpc.admm.admm module +------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.admm.admm\_coordinated module +-------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm_coordinated + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.admm.admm\_coordinator module +-------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.admm.admm_coordinator + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.rst.txt new file mode 100644 index 0000000..2184353 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.dmpc.rst.txt @@ -0,0 +1,34 @@ +agentlib\_mpc.modules.dmpc package +================================== + +.. automodule:: agentlib_mpc.modules.dmpc + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.modules.dmpc.admm + +Submodules +---------- + +agentlib\_mpc.modules.dmpc.coordinator module +--------------------------------------------- + +.. automodule:: agentlib_mpc.modules.dmpc.coordinator + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.dmpc.employee module +------------------------------------------ + +.. automodule:: agentlib_mpc.modules.dmpc.employee + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.estimation.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.estimation.rst.txt new file mode 100644 index 0000000..0fb2b2e --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.estimation.rst.txt @@ -0,0 +1,18 @@ +agentlib\_mpc.modules.estimation package +======================================== + +.. automodule:: agentlib_mpc.modules.estimation + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.modules.estimation.mhe module +------------------------------------------- + +.. automodule:: agentlib_mpc.modules.estimation.mhe + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.ml_model_training.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.ml_model_training.rst.txt new file mode 100644 index 0000000..9c9e9a9 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.ml_model_training.rst.txt @@ -0,0 +1,34 @@ +agentlib\_mpc.modules.ml\_model\_training package +================================================= + +.. automodule:: agentlib_mpc.modules.ml_model_training + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.modules.ml\_model\_training.data\_reduction module +---------------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.ml_model_training.data_reduction + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.ml\_model\_training.ml\_model\_trainer module +------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.ml_model_training.ml_model_trainer + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.ml\_model\_training.setpoint\_generator module +-------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.ml_model_training.setpoint_generator + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.rst.txt new file mode 100644 index 0000000..fc5c57c --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.modules.rst.txt @@ -0,0 +1,61 @@ +agentlib\_mpc.modules package +============================= + +.. automodule:: agentlib_mpc.modules + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.modules.InputPrediction + agentlib_mpc.modules.dmpc + agentlib_mpc.modules.estimation + agentlib_mpc.modules.ml_model_training + +Submodules +---------- + +agentlib\_mpc.modules.data\_source module +----------------------------------------- + +.. automodule:: agentlib_mpc.modules.data_source + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.minlp\_mpc module +--------------------------------------- + +.. automodule:: agentlib_mpc.modules.minlp_mpc + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.ml\_model\_simulator module +------------------------------------------------- + +.. automodule:: agentlib_mpc.modules.ml_model_simulator + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.mpc module +-------------------------------- + +.. automodule:: agentlib_mpc.modules.mpc + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.modules.mpc\_full module +-------------------------------------- + +.. automodule:: agentlib_mpc.modules.mpc_full + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.core.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.core.rst.txt new file mode 100644 index 0000000..ece2450 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.core.rst.txt @@ -0,0 +1,42 @@ +agentlib\_mpc.optimization\_backends.casadi\_.core package +========================================================== + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.casadi\_.core.VariableGroup module +----------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.VariableGroup + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.casadi\_backend module +------------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.casadi_backend + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.discretization module +------------------------------------------------------------------------ + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.discretization + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.core.system module +---------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.core.system + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.rst.txt new file mode 100644 index 0000000..7f18fc5 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.casadi_.rst.txt @@ -0,0 +1,82 @@ +agentlib\_mpc.optimization\_backends.casadi\_ package +===================================================== + +.. automodule:: agentlib_mpc.optimization_backends.casadi_ + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.optimization_backends.casadi_.core + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.casadi\_.admm module +--------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.admm + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.basic module +---------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.basic + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.casadi\_admm\_ml module +--------------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.casadi\_ml module +--------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.casadi_ml + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.full module +--------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.full + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.mhe module +-------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.mhe + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.minlp module +---------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.minlp + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.optimization\_backends.casadi\_.minlp\_cia module +--------------------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.casadi_.minlp_cia + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.rst.txt new file mode 100644 index 0000000..babcbba --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.optimization_backends.rst.txt @@ -0,0 +1,26 @@ +agentlib\_mpc.optimization\_backends package +============================================ + +.. automodule:: agentlib_mpc.optimization_backends + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.optimization_backends.casadi_ + +Submodules +---------- + +agentlib\_mpc.optimization\_backends.backend module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.optimization_backends.backend + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.rst.txt new file mode 100644 index 0000000..6bdbc33 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.rst.txt @@ -0,0 +1,19 @@ +agentlib\_mpc package +===================== + +.. automodule:: agentlib_mpc + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.data_structures + agentlib_mpc.models + agentlib_mpc.modules + agentlib_mpc.optimization_backends + agentlib_mpc.utils diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.plotting.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.plotting.rst.txt new file mode 100644 index 0000000..66963d0 --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.plotting.rst.txt @@ -0,0 +1,82 @@ +agentlib\_mpc.utils.plotting package +==================================== + +.. automodule:: agentlib_mpc.utils.plotting + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +agentlib\_mpc.utils.plotting.admm\_animation module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_animation + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.admm\_consensus\_shades module +----------------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_consensus_shades + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.admm\_dashboard module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_dashboard + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.admm\_residuals module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.admm_residuals + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.basic module +----------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.basic + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.discretization\_structure module +------------------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.discretization_structure + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.interactive module +----------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.interactive + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.ml\_model\_test module +--------------------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.ml_model_test + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.plotting.mpc module +--------------------------------------- + +.. automodule:: agentlib_mpc.utils.plotting.mpc + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.rst.txt b/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.rst.txt new file mode 100644 index 0000000..1f36fed --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/agentlib_mpc.utils.rst.txt @@ -0,0 +1,34 @@ +agentlib\_mpc.utils package +=========================== + +.. automodule:: agentlib_mpc.utils + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc.utils.plotting + +Submodules +---------- + +agentlib\_mpc.utils.analysis module +----------------------------------- + +.. automodule:: agentlib_mpc.utils.analysis + :members: + :undoc-members: + :show-inheritance: + +agentlib\_mpc.utils.sampling module +----------------------------------- + +.. automodule:: agentlib_mpc.utils.sampling + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/0.6.4/docs/_sources/code/modules.rst.txt b/docs/0.6.4/docs/_sources/code/modules.rst.txt new file mode 100644 index 0000000..5582c4b --- /dev/null +++ b/docs/0.6.4/docs/_sources/code/modules.rst.txt @@ -0,0 +1,7 @@ +agentlib_mpc +============ + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc diff --git a/docs/0.6.4/docs/_sources/index.rst.txt b/docs/0.6.4/docs/_sources/index.rst.txt new file mode 100644 index 0000000..9054e89 --- /dev/null +++ b/docs/0.6.4/docs/_sources/index.rst.txt @@ -0,0 +1,32 @@ +.. agentlib documentation master file, created by + sphinx-quickstart on Wed Feb 10 11:08:26 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to agentlib_mpc's documentation! +======================================== + +Content of the documentation +----------------------------- + +.. toctree:: + :maxdepth: 2 + + installation + tutorials/tutorial + PackageReference + +Readme of the agentlib +----------------------- + +.. mdinclude:: ../../README.md + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + diff --git a/docs/0.6.4/docs/_sources/installation.md.txt b/docs/0.6.4/docs/_sources/installation.md.txt new file mode 100644 index 0000000..9d15c8c --- /dev/null +++ b/docs/0.6.4/docs/_sources/installation.md.txt @@ -0,0 +1,13 @@ +# Installation + +Clone agentlib_mpc into a local directory. +Then, run: +``` +pip install .\ +``` + +If you want to contribute code and help develop this repository, first clone the repo and then install it via an .egg: + +``` +pip install -e . +``` \ No newline at end of file diff --git a/docs/0.6.4/docs/_sources/modules.rst.txt b/docs/0.6.4/docs/_sources/modules.rst.txt new file mode 100644 index 0000000..5582c4b --- /dev/null +++ b/docs/0.6.4/docs/_sources/modules.rst.txt @@ -0,0 +1,7 @@ +agentlib_mpc +============ + +.. toctree:: + :maxdepth: 4 + + agentlib_mpc diff --git a/docs/0.6.4/docs/_sources/tutorials/ADMM.md.txt b/docs/0.6.4/docs/_sources/tutorials/ADMM.md.txt new file mode 100644 index 0000000..459cd54 --- /dev/null +++ b/docs/0.6.4/docs/_sources/tutorials/ADMM.md.txt @@ -0,0 +1,227 @@ +Alternating Direction Method of Multipliers +------------------------------------------- + +In this section, we will learn how to use agentlib for distributed MPC using +the alternating direction method of multipliers (ADMM). The required example +files are located in 'examples/admm/'. They include two +main scripts and two directories with models and config files respectively. +We simulate the same system as before, however this time the AHU determines +its mass flow without knowing the system behaviour of the room, creating the +need for coordination. + +### Main script +There are three main scripts. One runs a local version of the ADMM algorithm, which +operates within a single thread and is suited for simulation and testing. The other +one runs the agents in separate python processes and communicates through MQTT. +The last one implements a coordinated ADMM, which can be useful, since it helps +unify parameter setting and provides better convergence criteria. +Here, we will look at the Realtime implementation using multiprocessing. + +````python +from agentlib.utils.multi_agent_system import MultiProcessingMAS +import logging +import matplotlib.pyplot as plt +```` +The only new import this time is the +``MultiProcessingMAS`` utility. Unlike the LocalMASAgency we used before, +the MultiprocessingMAS spawns a separate python process for each agent, +allowing +for the true parallelism that would take place in a real-world MAS. However, +this also requires the condition that simulations are performed in Realtime, +since time is now the common variable between systems that keeps them in sync. +Now onto the main script. +````python + env_config = {"rt": True, + "strict": True, + "factor": 0.1, + "t_sample": 60} + + mas = MultiProcessingMAS(agent_configs=['configs\\cooler.json', + 'configs\\cooled_room.json', + 'configs\\simulator.json'], + env=env_config, + variable_logging=True) + mas.run(until=until) + results = mas.get_results() +```` +As explained, we choose a Realtime environment, set it to ``strict`` +(RuntimeError will be raised if simulation is too slow), and give it a +``factor`` of 0.1 to speed it up. Finally, we set ``t_sample`` to 60, so we +will save our results in an interval of 60 seconds. Then, we provide our MAS +three configs - one for the room controller, one for the AHU controller and +one to simulate the full system. + +### System models +There are three models. The simulation model and the room model are similar to +the models we used in the MPC examples before, with the main difference +being in the constraints and cost function. The simulation model omits the +MPC-related parts of the model, while the room model is the same as before, +with only the air mass flow term missing from the cost function. The cooler +model on the other hand is a simple input equals output model of the mass +flow, including the cost function term that was removed from the room model. +Therefore, we created a situation, where the room is not explicitly +penalized for usage of the mass flow anymore, but instead a separate system is. + +### Communication via MQTT +For this example, we are not providing the configs in the python script +itself, but store them separately as json. Both agent configs and configs of +single modules can be stored in separate json. Let's look at the config file +``configs/communicators/cooled_room_mqtt.json``. +Since the agents are now using separate processes, we cannot use the +``local_broadcast`` communicator anymore. Instead, we are using the MQTT +communicator from the agentlib. The config for an MQTT commincator is a bit +more complicated than the local_broadcast. After providing +an id and specifying the type to "mqtt", there are some parameters to provide:\ +"url" and "subscriptions". For small test scripts, the url from the snippet +below will do. + +````json +{ + "module_id": "Ag1Com", + "type": "mqtt", + "url": "mqtt://test.mosquitto.org", + "subscriptions": ["Cooler", "Simulation"] +} +```` +The subscriptions are a list of agent ids the agent is subscribed to. For more info +on MQTT topics visit e.g. +[here](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/). +In agentlib, the mqtt communicator sends messages under a topic consisting of +"/agentlib/". The ``#`` is a wildcard, so by specifying the topics +in the way above, the agent will receive all messages from the Cooler agent +and the Simulation agent. The resulting communication structure can be seen +in the image below: + +.. image:: ../images/tutorials/admm_comm.png + + +### ADMM config +tbd +Let's look at the beginning of the config for the room agent. First of all, +we see a file path in the list of modules, which points to our communicator +config. The root of relative filepaths is the directory, where the main +script is run. +````json +{ + "id": "CooledRoom", + "modules": [ + "configs/communicators/cooled_room_mqtt.json", + { + "module_id": "admm_module", + "type": "admm", + "optimization_backend": { + "type": "casadi_admm", + "model": { + "type": { + "file": "models/ca_room_model.py", + "class_name": "CaCooledRoom" + } + }, + "solver": { + "name": "ipopt", + "options": { + "print_level": 0 + } + }, + "results_file": "admm_opt.csv" + }, +```` +We can see, that the module type for the controller now reads "admm", and the +optimization backend type is "casadi_admm". We can also see, that there are +some new options set for the optimization_backend, namely the solver option. +The numerical solver name can be chosen from a list of supported solvers +(currently supported are ``ipopt``, ``sqpmethod``, ``qpoases``). For most purposes, +IPOPT will be the solver of choice. However, we can change the default +options for the chosen solver. To see applicable options, please refer to +the documentation of the solver. For IPOPT, an overview of all the options +can be found [on the official site](https://coin-or.github.io/Ipopt/OPTIONS.html). +In our +case, we set the print_level to 0 to avoid clutter in the console output. +We also specify a ``results_file``, so we save detailed information about each +NLP solution in csv format, readable e.g. as a multi-indexed pandas +Dataframe. + +After providing parameters and inputs in the usual way, let's +have a look at what changed between the central MPC and the ADMM. + +.. note:: + The ``prediction_horizon``, ``time_step`` and ``penalty_factor`` parameters of + the ADMM module affect the strucuture of the optimization problem and + need to be identical for all modules taking part in the ADMM algorithm. + Currently, this is not validated automatically, so care should be taken when + writing the config. The ``timeout``, ``registration_period`` and + ``admm_iter_max`` parameters should also be the same our similar. + +````json + "controls": [ + ], + "states": [ + { + "name": "T_0", + "value": 298.16, + "ub": 303.15, + "lb": 288.15 + } + ], + "couplings": [ + { + "name": "mDot_0", + "alias": "mDotCoolAir", + "value": 0.05, + "ub": 0.1, + "lb": 0} +```` +The ``controls`` list is now empty, as the air mass flow is not determined by +the room anymore. Instead, it is now listed under the new type ``couplings``. +The couplings are optimization variables, so they should also have upper and +lower boundaries. ADMM with agentlib is based on consensus, meaning partial +systems that have to agree on shared variables are optimized. The shared +variables are identified through their alias. In this +example, all agents that define a coupling with alias "mDotCoolAir" share +this variable. The value for the state "T_0" is obtained from the Simulation +agent, so care should be taken to make sure the alias matches. In this case, +the default alias of "T_0" will match, since the name exists in the +simulation model. + +Now let's see the config on the side of the cooler: +````json + "controls": [ + { + "name": "mDot", + "value": 0.02, + "ub": 0.1, + "lb": 0 + } + ], + "states": [ + ], + "couplings": [ + { + "name": "mDot_out", + "alias": "mDotCoolAir", + "value": 0.05 + } + ] + }, +```` +We can see, that there are two variables of interest, one in ``controls`` and +one in ``couplings``. The control "mDot" is the actuation that is sent to the +simulator after optimization. Therefore, the alias of the mass flow in the +Simulation agent must match "mDot". The coupling "mDot_out" is assigned with +the alias "mDotCoolAir", which matches the coupling in the room agent. + +
+ + Why do I have to declare two variables, if they mean the same thing? + +
+Because the models follow the FMU standard, where variables are divided +between inputs, outputs, locals/states and parameters. In this case, our +cooler model takes a mass flow as an input ("mDot" in this case) and +produces the same mass flow as an output to other systems ("mDot_out" in +this case). In a more complex setting, the cooler might have an internal PID +controller to set the mass flow to its correct value. In that case, "mDot" +would be setpoint of the mass flow, and "mDot_out" would be the actual mass +flow. +
+
diff --git a/docs/0.6.4/docs/_sources/tutorials/MPC.md.txt b/docs/0.6.4/docs/_sources/tutorials/MPC.md.txt new file mode 100644 index 0000000..4f6e721 --- /dev/null +++ b/docs/0.6.4/docs/_sources/tutorials/MPC.md.txt @@ -0,0 +1,352 @@ +Model Predictive Control +------------------------ + +### Creating an MPC in agentlib with CasADi +To run a model predictive controller, a system model for use in optimization +is required. What model types are available depends on the chosen +optimization backend. In this section, creating an MPC with a CasADi backend +is explained. \ +Open the 'examples/one_room_mpc/physical/simple_mpc.py' example. +#### Imports +As usual, let's look at the imports first. +```python +import logging +from typing import List +import matplotlib.pyplot as plt +from agentlib.models.casadi_model import CasadiModel, CasadiInput, CasadiState, \ + CasadiParameter, CasadiOutput +from agentlib.utils.multi_agent_system import LocalMASAgency +``` +We import logging as usual and +``typing`` is used to annotate the optimzation model we will be creating, +and matplotlib is used to plot the results. Next, we import the CasadiModel and +some CasadiVariables. We will use these to specify an agentlib-style +CasadiModel. Finally, we import the LocalMASAgency utility. This can be used +to conveniently create and run your local MAS, without creating the agents +and their environment by hand. + +#### Model creation + +Now let's see how we can create an optimization model. The model contains +the physical system dynamics, as well as the cost function and additional +constraints on the system. + + +In this example, we will create a model of a room, which is under a constant +heat load and can be controlled by changing the mass flow of cool air from +an air handling unit. + +Creating a custom CasadiModel is similar to creating a module. +1. Creating a class that inherits from ``CasadiModelConfig`` + - Declare the model variables in the config class + - inputs + - outputs + - states + - parameters +2. Creating a class that inherits from ``CasadiModel`` + 1. Assign the config with ``config: <>`` + 2. Define model equations by overwriting the ``setup_system`` method + +##### Variable declaration + +Let's see, how we declare the variables required for our simple room model. +Since modeling in agentlib is based on the FMU-standard, we divide our +variables into inputs, outputs, parameters and locals (called states to +avoid clash with the python builtin _locals_). First, we need to create a custom +config for our CasadiModel. +````python +class MyCasadiModelConfig(CasadiModelConfig): + inputs: List[CasadiInput] = [ + # controls + CasadiInput(name="mDot", value=0.0225, unit="K", description="Air mass flow into zone"), + + # disturbances + CasadiInput(name="load", value=150, unit="W", description="Heat " + "load into zone"), + CasadiInput(name="T_in", value=290.15, unit="K", description="Inflow air temperature"), + + # settings + CasadiInput(name="T_upper", value=294.15, unit="K", description="Upper boundary (soft) for T."), + ] + + states: List[CasadiState] = [ + # differential + CasadiState(name="T", value=293.15, unit="K", description="Temperature of zone"), + + # algebraic + + # slack variables + CasadiState(name="T_slack", value=0, unit="K", description="Slack variable of temperature of zone") + ] + + parameters: List[CasadiParameter] = [ + CasadiParameter(name="cp", value=1000, unit="J/kg*K", description="thermal capacity of the air"), + CasadiParameter(name="C", value=100000, unit="J/K", + description="thermal capacity of zone"), + CasadiParameter(name="s_T", value=1, unit="-", description="Weight for T in constraint function"), + CasadiParameter(name="r_mDot", value=1, unit="-", + description="Weight for mDot in objective function") + ] + outputs: List[CasadiOutput] = [ + CasadiOutput(name='T_out', unit="K", description="Temperature of zone") + ] +```` +Our room model has four inputs. These include the inputs of the physical +system, being the air mass flow from the AHU, the temperature of this mass flow and +the load on the system. We also count the upper room temperature limit as an +input, since it should be settable by the occupants of the room. \ +To declare an input, we put a CasadiInput object into a list _inputs_. A +variable always needs a name. You can also give it a value, which will be +used if no other value is provided at Runtime. The _unit_ and _description_ +parameters currently serve no purpose, but can be helpful to readers of the +model. \ +Next we define the states. For one, that is the temperature of the room. +Since we use soft constraints to enforce an adequate room temperature, we also have to include +a slack variable. + +.. note:: + States in the context of an AgentLib model refers to all variables that + are local to a model. All differential variables have to be declared as + states, but not all states need to be associated with a + differential equation. + +Next, we have the parameters. These include the specific thermal capacity of +air, the thermal capacity of the room and two weights for the cost function. +Finally, we specify an output of the model. It is not required for the MPC +in this example, but can be useful for situations, where one might want to +use the same model for optimization and simulation. Outputs always need to be +associated with an algebraic equation. + +##### Equation and constraints +After specifying a config, we can write the model class itself, which containts the +dynamics. First, it is important to specify the ``config_type`` attribute of the +class and set it to the config class we defined. \ +The model equations and constraints are specified in the ``setup_system`` method. +We can access the variables defined above by referencing `self.`. +Differential equations are associated with a variable by setting the ``ode`` +attribute of that variable. In the same way, algebraic equations can be +defined by setting the ``alg`` attribute. + +````python +class MyCasadiModel(CasadiModel): + + config: MyCasadiModelConfig + + def setup_system(self): + # Define ode + self.T.ode = self.cp * self.mDot / self.C * \ + (self.T_in - self.T) + \ + self.load / self.C + + # Define ae + self.T_out.alg = self.T + + # Constraints: List[(lower bound, function, upper bound)] + self.constraints = [ + + # soft constraints + (0, self.T + self.T_slack, self.T_upper), + + ] + + # Objective function + objective = sum([ + self.r_mDot * self.mDot, + self.s_T * self.T_slack ** 2, + ]) + + return objective +```` +Constraints can be added to the model through the ``constraints`` attribute. +It should be defined as a list of tuples, with the lower bound coming first, +the constraint function coming second and the upper bound coming last. +Equality constraints can be added by setting upper and lower bound to the +same value. Note that algebraic equations will also be converted to equality +constraints internally. Here, we set one constraint to implement the soft +constraint on the room temperature. + +
+ + What's the difference between an algebraic equation and setting an +equality constraint? + +
+Algebraic equations are explicit assignments to a CasadiOutput. They are considered when simulating the model or when doing MPC with it. +Constraints specified as tuples can be of implicit nature, however they are +ignored for simulation. The only limitation on constraints is, that +variables that make up the upper or lower bound cannot be used as +optimization variables in the MPC. +
+
+ +.. note:: + Python intuition tells us ``self.`` should not work, as we did not + set the attribute. + In the model base class of agentlib, the ``__get_attr__`` method is written + in a way that allows access to all variables that are defined in the + Config class of the model. + +Finally, we can specify and return the objective function in the same way as +the other equations. We use the ``sum()`` function from python to +improve readability. + +#### Configuration of the multi-agent-system +Let's look at the environment config first. +````python +ENV_CONFIG = {"rt": False, + "t_sample": 60} +```` +This time, we specify 'rt' +(=Realtime) as False, meaning we want the simulation to run as fast as possible. +The 't_sample' option specifies the time step in which the interal clock of +the environment ticks. This is relevant e.g. for classical controllers like +PID. It will also affect the sampling with which results are saved. + +Below is the config for the MPC agent. As before, we specify an "id" and a +list of modules, with the first one being a local_broadcast communicator. +Then, we add the MPC module. We specify "mpc" as the type, and then add the +other options. A central part of the MPC is its _optimization_backend_. The +optimization backend is specified by another dictionary, always consisting +of "type" and "model". The model will usually be user-specified and usually +is provided with the same syntax of "file" and "class_name" as the custom +module in the PingPong example. The optimization backend also takes an +option "discretization_options", however we will look at that later. + +````python +AGENT_MPC = {"id": "myMPCAgent", + "modules": [ + {"module_id": "Ag1Com", + "type": "local_broadcast"}, + {"module_id": "myMPC", + "type": "mpc", + "optimization_backend": + {"type": "casadi", + "model": { + "type": {"file": __file__, + "class_name": "MyCasadiModel"}}, + ... + }, + "time_step": 900, + "prediction_horizon": 5, + "parameters": [ + {"name": "s_T", "value": 3}, + {"name": "r_mDot", "value": 1}, + ], + "inputs": [ + {"name": "load", "value": 150}, + {"name": "T_upper", "value": ub}, + {"name": "T_in", "value": 290.15}, + ], + "controls": [{"name": "mDot", "value": 0.02, "ub": 1, "lb": 0}], + "states": [{"name": "T", "value": 298.16, "ub": 303.15, "lb": 288.15}], + }, + ]} + ]} +```` +Aside from that, "time_step" and "prediction_horizon" need to be specified. +The other options the MPC module takes are ``parameters``, ``inputs``, ``controls`` and +``states`` . The time step should be provided +in seconds. The states in the MPC config refer to differential variables, +not to be confused with states in the model, which refer to any internal +variables. \ +Quantities declared in the module config are variables of the multi-agent-system and +can be shared with other modules of the same agent, and communicated with +other agents. All agent variables declared here must match - in name - their +counterpart in the provided model. Controls, states and inputs must be +provided fully matching the model. Outputs can be ignored if they are not +required. Finally, parameters can be omitted, if a default value is provided +in the model definition. Here, the weight parameters in the cost function +are provided, as it might be required to change them. However, physical +parameters such as the thermal capacity of air are taken from the model, as +they are not expected to change. \ +A variable is given a name and a value. For states, the value will determine +the initial value of the differential variable, if it is not provided +externally, for example by a simulation agent. Since controls and +states are the variables of the optimization +problem, boundaries should be provided via the keys "ub" and "lb". These +values are for constant hard boundaries. If time-variant boundaries are +required, one should declare an additional variable and constraint in the model. + +#### Running the multi-agent-system + +Now that we have our control agent setup, we need to simulate our system. +The easiest way to do this in agentlib, is to setup an agent with a +``simulator`` module. Usually in agentlib, we would use an FMU to simulate a +system. In this example, we will use the CasadiModel we created for the +optimization. The resulting agent config is shown below. + +````python +AGENT_SIM = {"id": "SimAgent", + "modules": [ + {"module_id": "Ag1Com", + "type": "local_broadcast"}, + {"module_id": "room", + "type": "simulator", + "model": {"type": {"file": __file__, + "class_name": "MyCasadiModel"}, + "states": [ + {"name": "T", "value": 298.16} + ]}, + "t_sample": 60, + "outputs": [ + {"name": "T_out", "alias": "T"}, + ], + "inputs": [ + {"name": "mDot", "value": 0.02, "alias": "mDot"}, + ]}, + ]} +```` + +The model type for the simulator is provided in the same manner as before. +However, here we can see, that we have the option to provide additional +variable options to the model. For example, here we change the starting +value of the temperature to a value above the upper (soft) boundary, so our +controller has to work. + +Then, inputs and outputs of the simulator. Every +simulator needs to be provided with a sampling rate "t_sample" in seconds. +Additionally, declare the output "T_out". This is the first time we use the +_alias_ keyword. The alias is part of the duo of ``alias`` and ``source`` that uniquely +define a variable within the MAS. The source is the combination of the ``agent_id`` +and the ``module_id`` where the variable was defined. When expecting variables from +another agent, only the ``agent_id`` has to be specified, and when the variable is from +a module within the same agent, the module_id shoudld be specified. The +``alias`` is a name independent of the variable name in models (think of long Modelica names) +and is consistent across agents for the same variable. By default, the name +of a variable is also its alias. In the case of T_out however, we have to +specify that this is the variable we want to send to the MPC for its initial +state. Since the state in the MPC agent is named "T" (and by default has +alias "T"), we have to set "T" as the alias for our model output. \ +The model in turn takes the computed mass flow setpoint as input, hence we +also have to declare the input. Since the names mDot already match between +simulator and MPC, the explicit alias declaration is redundant in this case. +Additionally, we set a default value for "mDot", which is used before the +first value is received from the MPC. + +
+ + Why are some values specified in the model and others in the module? + +
+Before every step, the simulator gets the current input values from the +agent and sets them to the model. After performing the step, the outputs +from the model are written to the agent. Since states per definition are +internal to the model, they are not set by the agent and their initial +values have to be changed in the model itself. The same goes for parameters. +
+
+ +With all of the setup done, we can now see our MAS run. +Last time, we manually created the agents and the environment. This time, we +use the ``LocalMASAgency`` utility to setup the system and save results. By +setting the ``variable_logging`` option to True, time series of all agent +variables present in the system will be saved. After running the MAS, we can +retrieve and plot the results of our simulation. +````python +def run_example(with_plots=True): + mas = LocalMASAgency(agent_configs=[AGENT_MPC, AGENT_SIM], + env=ENV_CONFIG, + variable_logging=True) + mas.run(until=10000) + results = mas.get_results() +```` \ No newline at end of file diff --git a/docs/0.6.4/docs/_sources/tutorials/Trajectories.md.txt b/docs/0.6.4/docs/_sources/tutorials/Trajectories.md.txt new file mode 100644 index 0000000..47ec41f --- /dev/null +++ b/docs/0.6.4/docs/_sources/tutorials/Trajectories.md.txt @@ -0,0 +1,5 @@ +Working with time series +------------------------ +Explanation of 'examples/multi-agent-systems/casadi/mpc_trajectories.py' + +tbd \ No newline at end of file diff --git a/docs/0.6.4/docs/_sources/tutorials/tutorial.md.txt b/docs/0.6.4/docs/_sources/tutorials/tutorial.md.txt new file mode 100644 index 0000000..3247db1 --- /dev/null +++ b/docs/0.6.4/docs/_sources/tutorials/tutorial.md.txt @@ -0,0 +1,14 @@ +Tutorial +======== + +This section collects tutorials on how to get started with agentlib. + +.. note:: +This tutorial is periodically updated, but for the most current and accurate information, please refer to the actual example files in the repository. The example files should be considered the authoritative source if there are any discrepancies. + +.. toctree:: + :maxdepth: 2 + + MPC + Trajectories + ADMM diff --git a/docs/0.6.4/docs/_static/_sphinx_javascript_frameworks_compat.js b/docs/0.6.4/docs/_static/_sphinx_javascript_frameworks_compat.js new file mode 100644 index 0000000..8141580 --- /dev/null +++ b/docs/0.6.4/docs/_static/_sphinx_javascript_frameworks_compat.js @@ -0,0 +1,123 @@ +/* Compatability shim for jQuery and underscores.js. + * + * Copyright Sphinx contributors + * Released under the two clause BSD licence + */ + +/** + * small helper function to urldecode strings + * + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL + */ +jQuery.urldecode = function(x) { + if (!x) { + return x + } + return decodeURIComponent(x.replace(/\+/g, ' ')); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + var bbox = node.parentElement.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} diff --git a/docs/0.6.4/docs/_static/autodoc_pydantic.css b/docs/0.6.4/docs/_static/autodoc_pydantic.css new file mode 100644 index 0000000..994a3e5 --- /dev/null +++ b/docs/0.6.4/docs/_static/autodoc_pydantic.css @@ -0,0 +1,11 @@ +.autodoc_pydantic_validator_arrow { + padding-left: 8px; + } + +.autodoc_pydantic_collapsable_json { + cursor: pointer; + } + +.autodoc_pydantic_collapsable_erd { + cursor: pointer; + } \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/basic.css b/docs/0.6.4/docs/_static/basic.css new file mode 100644 index 0000000..7577acb --- /dev/null +++ b/docs/0.6.4/docs/_static/basic.css @@ -0,0 +1,903 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/css/badge_only.css b/docs/0.6.4/docs/_static/css/badge_only.css new file mode 100644 index 0000000..88ba55b --- /dev/null +++ b/docs/0.6.4/docs/_static/css/badge_only.css @@ -0,0 +1 @@ +.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px} \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff new file mode 100644 index 0000000..6cb6000 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 new file mode 100644 index 0000000..7059e23 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff new file mode 100644 index 0000000..f815f63 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 new file mode 100644 index 0000000..f2c76e5 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.eot b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000..e9f60ca Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.eot differ diff --git a/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.svg b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000..855c845 --- /dev/null +++ b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.ttf b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.ttf differ diff --git a/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000..400014a Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff2 b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000..4d13fc6 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/fontawesome-webfont.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff b/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff new file mode 100644 index 0000000..88ad05b Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff2 b/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff2 new file mode 100644 index 0000000..c4e3d80 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-bold-italic.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff b/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff new file mode 100644 index 0000000..c6dff51 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff2 b/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff2 new file mode 100644 index 0000000..bb19504 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-bold.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff b/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff new file mode 100644 index 0000000..76114bc Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff2 b/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff2 new file mode 100644 index 0000000..3404f37 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-normal-italic.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff b/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff new file mode 100644 index 0000000..ae1307f Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff differ diff --git a/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff2 b/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff2 new file mode 100644 index 0000000..3bf9843 Binary files /dev/null and b/docs/0.6.4/docs/_static/css/fonts/lato-normal.woff2 differ diff --git a/docs/0.6.4/docs/_static/css/theme.css b/docs/0.6.4/docs/_static/css/theme.css new file mode 100644 index 0000000..0f14f10 --- /dev/null +++ b/docs/0.6.4/docs/_static/css/theme.css @@ -0,0 +1,4 @@ +html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden],audio:not([controls]){display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:0}dfn{font-style:italic}ins{background:#ff9;text-decoration:none}ins,mark{color:#000}mark{background:#ff0;font-style:italic;font-weight:700}.rst-content code,.rst-content tt,code,kbd,pre,samp{font-family:monospace,serif;_font-family:courier new,monospace;font-size:1em}pre{white-space:pre}q{quotes:none}q:after,q:before{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,ol,ul{margin:0;padding:0;list-style:none;list-style-image:none}li{list-style:none}dd{margin:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle;max-width:100%}svg:not(:root){overflow:hidden}figure,form{margin:0}label{cursor:pointer}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}textarea{resize:vertical}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr;*line-height:0}.ir br{display:none}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.relative{position:relative}big,small{font-size:100%}@media print{body,html,section{background:none!important}*{box-shadow:none!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{text-decoration:underline}.ir a:after,a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}.rst-content .toctree-wrapper>p.caption,h2,h3,p{orphans:3;widows:3}.rst-content .toctree-wrapper>p.caption,h2,h3{page-break-after:avoid}}.btn,.fa:before,.icon:before,.rst-content .admonition,.rst-content .admonition-title:before,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .code-block-caption .headerlink:before,.rst-content .danger,.rst-content .eqno .headerlink:before,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-alert,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before,input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select,textarea{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:FontAwesome;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713);src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix&v=4.7.0) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#fontawesomeregular) format("svg");font-weight:400;font-style:normal}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14286em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14286em;width:2.14286em;top:.14286em;text-align:center}.fa-li.fa-lg{left:-1.85714em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa-pull-left.icon,.fa.fa-pull-left,.rst-content .code-block-caption .fa-pull-left.headerlink,.rst-content .eqno .fa-pull-left.headerlink,.rst-content .fa-pull-left.admonition-title,.rst-content code.download span.fa-pull-left:first-child,.rst-content dl dt .fa-pull-left.headerlink,.rst-content h1 .fa-pull-left.headerlink,.rst-content h2 .fa-pull-left.headerlink,.rst-content h3 .fa-pull-left.headerlink,.rst-content h4 .fa-pull-left.headerlink,.rst-content h5 .fa-pull-left.headerlink,.rst-content h6 .fa-pull-left.headerlink,.rst-content p .fa-pull-left.headerlink,.rst-content table>caption .fa-pull-left.headerlink,.rst-content tt.download span.fa-pull-left:first-child,.wy-menu-vertical li.current>a button.fa-pull-left.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-left.toctree-expand,.wy-menu-vertical li button.fa-pull-left.toctree-expand{margin-right:.3em}.fa-pull-right.icon,.fa.fa-pull-right,.rst-content .code-block-caption .fa-pull-right.headerlink,.rst-content .eqno .fa-pull-right.headerlink,.rst-content .fa-pull-right.admonition-title,.rst-content code.download span.fa-pull-right:first-child,.rst-content dl dt .fa-pull-right.headerlink,.rst-content h1 .fa-pull-right.headerlink,.rst-content h2 .fa-pull-right.headerlink,.rst-content h3 .fa-pull-right.headerlink,.rst-content h4 .fa-pull-right.headerlink,.rst-content h5 .fa-pull-right.headerlink,.rst-content h6 .fa-pull-right.headerlink,.rst-content p .fa-pull-right.headerlink,.rst-content table>caption .fa-pull-right.headerlink,.rst-content tt.download span.fa-pull-right:first-child,.wy-menu-vertical li.current>a button.fa-pull-right.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-right.toctree-expand,.wy-menu-vertical li button.fa-pull-right.toctree-expand{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left,.pull-left.icon,.rst-content .code-block-caption .pull-left.headerlink,.rst-content .eqno .pull-left.headerlink,.rst-content .pull-left.admonition-title,.rst-content code.download span.pull-left:first-child,.rst-content dl dt .pull-left.headerlink,.rst-content h1 .pull-left.headerlink,.rst-content h2 .pull-left.headerlink,.rst-content h3 .pull-left.headerlink,.rst-content h4 .pull-left.headerlink,.rst-content h5 .pull-left.headerlink,.rst-content h6 .pull-left.headerlink,.rst-content p .pull-left.headerlink,.rst-content table>caption .pull-left.headerlink,.rst-content tt.download span.pull-left:first-child,.wy-menu-vertical li.current>a button.pull-left.toctree-expand,.wy-menu-vertical li.on a button.pull-left.toctree-expand,.wy-menu-vertical li button.pull-left.toctree-expand{margin-right:.3em}.fa.pull-right,.pull-right.icon,.rst-content .code-block-caption .pull-right.headerlink,.rst-content .eqno .pull-right.headerlink,.rst-content .pull-right.admonition-title,.rst-content code.download span.pull-right:first-child,.rst-content dl dt .pull-right.headerlink,.rst-content h1 .pull-right.headerlink,.rst-content h2 .pull-right.headerlink,.rst-content h3 .pull-right.headerlink,.rst-content h4 .pull-right.headerlink,.rst-content h5 .pull-right.headerlink,.rst-content h6 .pull-right.headerlink,.rst-content p .pull-right.headerlink,.rst-content table>caption .pull-right.headerlink,.rst-content tt.download span.pull-right:first-child,.wy-menu-vertical li.current>a button.pull-right.toctree-expand,.wy-menu-vertical li.on a button.pull-right.toctree-expand,.wy-menu-vertical li button.pull-right.toctree-expand{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:""}.fa-music:before{content:""}.fa-search:before,.icon-search:before{content:""}.fa-envelope-o:before{content:""}.fa-heart:before{content:""}.fa-star:before{content:""}.fa-star-o:before{content:""}.fa-user:before{content:""}.fa-film:before{content:""}.fa-th-large:before{content:""}.fa-th:before{content:""}.fa-th-list:before{content:""}.fa-check:before{content:""}.fa-close:before,.fa-remove:before,.fa-times:before{content:""}.fa-search-plus:before{content:""}.fa-search-minus:before{content:""}.fa-power-off:before{content:""}.fa-signal:before{content:""}.fa-cog:before,.fa-gear:before{content:""}.fa-trash-o:before{content:""}.fa-home:before,.icon-home:before{content:""}.fa-file-o:before{content:""}.fa-clock-o:before{content:""}.fa-road:before{content:""}.fa-download:before,.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{content:""}.fa-arrow-circle-o-down:before{content:""}.fa-arrow-circle-o-up:before{content:""}.fa-inbox:before{content:""}.fa-play-circle-o:before{content:""}.fa-repeat:before,.fa-rotate-right:before{content:""}.fa-refresh:before{content:""}.fa-list-alt:before{content:""}.fa-lock:before{content:""}.fa-flag:before{content:""}.fa-headphones:before{content:""}.fa-volume-off:before{content:""}.fa-volume-down:before{content:""}.fa-volume-up:before{content:""}.fa-qrcode:before{content:""}.fa-barcode:before{content:""}.fa-tag:before{content:""}.fa-tags:before{content:""}.fa-book:before,.icon-book:before{content:""}.fa-bookmark:before{content:""}.fa-print:before{content:""}.fa-camera:before{content:""}.fa-font:before{content:""}.fa-bold:before{content:""}.fa-italic:before{content:""}.fa-text-height:before{content:""}.fa-text-width:before{content:""}.fa-align-left:before{content:""}.fa-align-center:before{content:""}.fa-align-right:before{content:""}.fa-align-justify:before{content:""}.fa-list:before{content:""}.fa-dedent:before,.fa-outdent:before{content:""}.fa-indent:before{content:""}.fa-video-camera:before{content:""}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:""}.fa-pencil:before{content:""}.fa-map-marker:before{content:""}.fa-adjust:before{content:""}.fa-tint:before{content:""}.fa-edit:before,.fa-pencil-square-o:before{content:""}.fa-share-square-o:before{content:""}.fa-check-square-o:before{content:""}.fa-arrows:before{content:""}.fa-step-backward:before{content:""}.fa-fast-backward:before{content:""}.fa-backward:before{content:""}.fa-play:before{content:""}.fa-pause:before{content:""}.fa-stop:before{content:""}.fa-forward:before{content:""}.fa-fast-forward:before{content:""}.fa-step-forward:before{content:""}.fa-eject:before{content:""}.fa-chevron-left:before{content:""}.fa-chevron-right:before{content:""}.fa-plus-circle:before{content:""}.fa-minus-circle:before{content:""}.fa-times-circle:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before{content:""}.fa-check-circle:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before{content:""}.fa-question-circle:before{content:""}.fa-info-circle:before{content:""}.fa-crosshairs:before{content:""}.fa-times-circle-o:before{content:""}.fa-check-circle-o:before{content:""}.fa-ban:before{content:""}.fa-arrow-left:before{content:""}.fa-arrow-right:before{content:""}.fa-arrow-up:before{content:""}.fa-arrow-down:before{content:""}.fa-mail-forward:before,.fa-share:before{content:""}.fa-expand:before{content:""}.fa-compress:before{content:""}.fa-plus:before{content:""}.fa-minus:before{content:""}.fa-asterisk:before{content:""}.fa-exclamation-circle:before,.rst-content .admonition-title:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before{content:""}.fa-gift:before{content:""}.fa-leaf:before{content:""}.fa-fire:before,.icon-fire:before{content:""}.fa-eye:before{content:""}.fa-eye-slash:before{content:""}.fa-exclamation-triangle:before,.fa-warning:before{content:""}.fa-plane:before{content:""}.fa-calendar:before{content:""}.fa-random:before{content:""}.fa-comment:before{content:""}.fa-magnet:before{content:""}.fa-chevron-up:before{content:""}.fa-chevron-down:before{content:""}.fa-retweet:before{content:""}.fa-shopping-cart:before{content:""}.fa-folder:before{content:""}.fa-folder-open:before{content:""}.fa-arrows-v:before{content:""}.fa-arrows-h:before{content:""}.fa-bar-chart-o:before,.fa-bar-chart:before{content:""}.fa-twitter-square:before{content:""}.fa-facebook-square:before{content:""}.fa-camera-retro:before{content:""}.fa-key:before{content:""}.fa-cogs:before,.fa-gears:before{content:""}.fa-comments:before{content:""}.fa-thumbs-o-up:before{content:""}.fa-thumbs-o-down:before{content:""}.fa-star-half:before{content:""}.fa-heart-o:before{content:""}.fa-sign-out:before{content:""}.fa-linkedin-square:before{content:""}.fa-thumb-tack:before{content:""}.fa-external-link:before{content:""}.fa-sign-in:before{content:""}.fa-trophy:before{content:""}.fa-github-square:before{content:""}.fa-upload:before{content:""}.fa-lemon-o:before{content:""}.fa-phone:before{content:""}.fa-square-o:before{content:""}.fa-bookmark-o:before{content:""}.fa-phone-square:before{content:""}.fa-twitter:before{content:""}.fa-facebook-f:before,.fa-facebook:before{content:""}.fa-github:before,.icon-github:before{content:""}.fa-unlock:before{content:""}.fa-credit-card:before{content:""}.fa-feed:before,.fa-rss:before{content:""}.fa-hdd-o:before{content:""}.fa-bullhorn:before{content:""}.fa-bell:before{content:""}.fa-certificate:before{content:""}.fa-hand-o-right:before{content:""}.fa-hand-o-left:before{content:""}.fa-hand-o-up:before{content:""}.fa-hand-o-down:before{content:""}.fa-arrow-circle-left:before,.icon-circle-arrow-left:before{content:""}.fa-arrow-circle-right:before,.icon-circle-arrow-right:before{content:""}.fa-arrow-circle-up:before{content:""}.fa-arrow-circle-down:before{content:""}.fa-globe:before{content:""}.fa-wrench:before{content:""}.fa-tasks:before{content:""}.fa-filter:before{content:""}.fa-briefcase:before{content:""}.fa-arrows-alt:before{content:""}.fa-group:before,.fa-users:before{content:""}.fa-chain:before,.fa-link:before,.icon-link:before{content:""}.fa-cloud:before{content:""}.fa-flask:before{content:""}.fa-cut:before,.fa-scissors:before{content:""}.fa-copy:before,.fa-files-o:before{content:""}.fa-paperclip:before{content:""}.fa-floppy-o:before,.fa-save:before{content:""}.fa-square:before{content:""}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:""}.fa-list-ul:before{content:""}.fa-list-ol:before{content:""}.fa-strikethrough:before{content:""}.fa-underline:before{content:""}.fa-table:before{content:""}.fa-magic:before{content:""}.fa-truck:before{content:""}.fa-pinterest:before{content:""}.fa-pinterest-square:before{content:""}.fa-google-plus-square:before{content:""}.fa-google-plus:before{content:""}.fa-money:before{content:""}.fa-caret-down:before,.icon-caret-down:before,.wy-dropdown .caret:before{content:""}.fa-caret-up:before{content:""}.fa-caret-left:before{content:""}.fa-caret-right:before{content:""}.fa-columns:before{content:""}.fa-sort:before,.fa-unsorted:before{content:""}.fa-sort-desc:before,.fa-sort-down:before{content:""}.fa-sort-asc:before,.fa-sort-up:before{content:""}.fa-envelope:before{content:""}.fa-linkedin:before{content:""}.fa-rotate-left:before,.fa-undo:before{content:""}.fa-gavel:before,.fa-legal:before{content:""}.fa-dashboard:before,.fa-tachometer:before{content:""}.fa-comment-o:before{content:""}.fa-comments-o:before{content:""}.fa-bolt:before,.fa-flash:before{content:""}.fa-sitemap:before{content:""}.fa-umbrella:before{content:""}.fa-clipboard:before,.fa-paste:before{content:""}.fa-lightbulb-o:before{content:""}.fa-exchange:before{content:""}.fa-cloud-download:before{content:""}.fa-cloud-upload:before{content:""}.fa-user-md:before{content:""}.fa-stethoscope:before{content:""}.fa-suitcase:before{content:""}.fa-bell-o:before{content:""}.fa-coffee:before{content:""}.fa-cutlery:before{content:""}.fa-file-text-o:before{content:""}.fa-building-o:before{content:""}.fa-hospital-o:before{content:""}.fa-ambulance:before{content:""}.fa-medkit:before{content:""}.fa-fighter-jet:before{content:""}.fa-beer:before{content:""}.fa-h-square:before{content:""}.fa-plus-square:before{content:""}.fa-angle-double-left:before{content:""}.fa-angle-double-right:before{content:""}.fa-angle-double-up:before{content:""}.fa-angle-double-down:before{content:""}.fa-angle-left:before{content:""}.fa-angle-right:before{content:""}.fa-angle-up:before{content:""}.fa-angle-down:before{content:""}.fa-desktop:before{content:""}.fa-laptop:before{content:""}.fa-tablet:before{content:""}.fa-mobile-phone:before,.fa-mobile:before{content:""}.fa-circle-o:before{content:""}.fa-quote-left:before{content:""}.fa-quote-right:before{content:""}.fa-spinner:before{content:""}.fa-circle:before{content:""}.fa-mail-reply:before,.fa-reply:before{content:""}.fa-github-alt:before{content:""}.fa-folder-o:before{content:""}.fa-folder-open-o:before{content:""}.fa-smile-o:before{content:""}.fa-frown-o:before{content:""}.fa-meh-o:before{content:""}.fa-gamepad:before{content:""}.fa-keyboard-o:before{content:""}.fa-flag-o:before{content:""}.fa-flag-checkered:before{content:""}.fa-terminal:before{content:""}.fa-code:before{content:""}.fa-mail-reply-all:before,.fa-reply-all:before{content:""}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:""}.fa-location-arrow:before{content:""}.fa-crop:before{content:""}.fa-code-fork:before{content:""}.fa-chain-broken:before,.fa-unlink:before{content:""}.fa-question:before{content:""}.fa-info:before{content:""}.fa-exclamation:before{content:""}.fa-superscript:before{content:""}.fa-subscript:before{content:""}.fa-eraser:before{content:""}.fa-puzzle-piece:before{content:""}.fa-microphone:before{content:""}.fa-microphone-slash:before{content:""}.fa-shield:before{content:""}.fa-calendar-o:before{content:""}.fa-fire-extinguisher:before{content:""}.fa-rocket:before{content:""}.fa-maxcdn:before{content:""}.fa-chevron-circle-left:before{content:""}.fa-chevron-circle-right:before{content:""}.fa-chevron-circle-up:before{content:""}.fa-chevron-circle-down:before{content:""}.fa-html5:before{content:""}.fa-css3:before{content:""}.fa-anchor:before{content:""}.fa-unlock-alt:before{content:""}.fa-bullseye:before{content:""}.fa-ellipsis-h:before{content:""}.fa-ellipsis-v:before{content:""}.fa-rss-square:before{content:""}.fa-play-circle:before{content:""}.fa-ticket:before{content:""}.fa-minus-square:before{content:""}.fa-minus-square-o:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before{content:""}.fa-level-up:before{content:""}.fa-level-down:before{content:""}.fa-check-square:before{content:""}.fa-pencil-square:before{content:""}.fa-external-link-square:before{content:""}.fa-share-square:before{content:""}.fa-compass:before{content:""}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:""}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:""}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:""}.fa-eur:before,.fa-euro:before{content:""}.fa-gbp:before{content:""}.fa-dollar:before,.fa-usd:before{content:""}.fa-inr:before,.fa-rupee:before{content:""}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:""}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:""}.fa-krw:before,.fa-won:before{content:""}.fa-bitcoin:before,.fa-btc:before{content:""}.fa-file:before{content:""}.fa-file-text:before{content:""}.fa-sort-alpha-asc:before{content:""}.fa-sort-alpha-desc:before{content:""}.fa-sort-amount-asc:before{content:""}.fa-sort-amount-desc:before{content:""}.fa-sort-numeric-asc:before{content:""}.fa-sort-numeric-desc:before{content:""}.fa-thumbs-up:before{content:""}.fa-thumbs-down:before{content:""}.fa-youtube-square:before{content:""}.fa-youtube:before{content:""}.fa-xing:before{content:""}.fa-xing-square:before{content:""}.fa-youtube-play:before{content:""}.fa-dropbox:before{content:""}.fa-stack-overflow:before{content:""}.fa-instagram:before{content:""}.fa-flickr:before{content:""}.fa-adn:before{content:""}.fa-bitbucket:before,.icon-bitbucket:before{content:""}.fa-bitbucket-square:before{content:""}.fa-tumblr:before{content:""}.fa-tumblr-square:before{content:""}.fa-long-arrow-down:before{content:""}.fa-long-arrow-up:before{content:""}.fa-long-arrow-left:before{content:""}.fa-long-arrow-right:before{content:""}.fa-apple:before{content:""}.fa-windows:before{content:""}.fa-android:before{content:""}.fa-linux:before{content:""}.fa-dribbble:before{content:""}.fa-skype:before{content:""}.fa-foursquare:before{content:""}.fa-trello:before{content:""}.fa-female:before{content:""}.fa-male:before{content:""}.fa-gittip:before,.fa-gratipay:before{content:""}.fa-sun-o:before{content:""}.fa-moon-o:before{content:""}.fa-archive:before{content:""}.fa-bug:before{content:""}.fa-vk:before{content:""}.fa-weibo:before{content:""}.fa-renren:before{content:""}.fa-pagelines:before{content:""}.fa-stack-exchange:before{content:""}.fa-arrow-circle-o-right:before{content:""}.fa-arrow-circle-o-left:before{content:""}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:""}.fa-dot-circle-o:before{content:""}.fa-wheelchair:before{content:""}.fa-vimeo-square:before{content:""}.fa-try:before,.fa-turkish-lira:before{content:""}.fa-plus-square-o:before,.wy-menu-vertical li button.toctree-expand:before{content:""}.fa-space-shuttle:before{content:""}.fa-slack:before{content:""}.fa-envelope-square:before{content:""}.fa-wordpress:before{content:""}.fa-openid:before{content:""}.fa-bank:before,.fa-institution:before,.fa-university:before{content:""}.fa-graduation-cap:before,.fa-mortar-board:before{content:""}.fa-yahoo:before{content:""}.fa-google:before{content:""}.fa-reddit:before{content:""}.fa-reddit-square:before{content:""}.fa-stumbleupon-circle:before{content:""}.fa-stumbleupon:before{content:""}.fa-delicious:before{content:""}.fa-digg:before{content:""}.fa-pied-piper-pp:before{content:""}.fa-pied-piper-alt:before{content:""}.fa-drupal:before{content:""}.fa-joomla:before{content:""}.fa-language:before{content:""}.fa-fax:before{content:""}.fa-building:before{content:""}.fa-child:before{content:""}.fa-paw:before{content:""}.fa-spoon:before{content:""}.fa-cube:before{content:""}.fa-cubes:before{content:""}.fa-behance:before{content:""}.fa-behance-square:before{content:""}.fa-steam:before{content:""}.fa-steam-square:before{content:""}.fa-recycle:before{content:""}.fa-automobile:before,.fa-car:before{content:""}.fa-cab:before,.fa-taxi:before{content:""}.fa-tree:before{content:""}.fa-spotify:before{content:""}.fa-deviantart:before{content:""}.fa-soundcloud:before{content:""}.fa-database:before{content:""}.fa-file-pdf-o:before{content:""}.fa-file-word-o:before{content:""}.fa-file-excel-o:before{content:""}.fa-file-powerpoint-o:before{content:""}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:""}.fa-file-archive-o:before,.fa-file-zip-o:before{content:""}.fa-file-audio-o:before,.fa-file-sound-o:before{content:""}.fa-file-movie-o:before,.fa-file-video-o:before{content:""}.fa-file-code-o:before{content:""}.fa-vine:before{content:""}.fa-codepen:before{content:""}.fa-jsfiddle:before{content:""}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:""}.fa-circle-o-notch:before{content:""}.fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:""}.fa-empire:before,.fa-ge:before{content:""}.fa-git-square:before{content:""}.fa-git:before{content:""}.fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:""}.fa-tencent-weibo:before{content:""}.fa-qq:before{content:""}.fa-wechat:before,.fa-weixin:before{content:""}.fa-paper-plane:before,.fa-send:before{content:""}.fa-paper-plane-o:before,.fa-send-o:before{content:""}.fa-history:before{content:""}.fa-circle-thin:before{content:""}.fa-header:before{content:""}.fa-paragraph:before{content:""}.fa-sliders:before{content:""}.fa-share-alt:before{content:""}.fa-share-alt-square:before{content:""}.fa-bomb:before{content:""}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:""}.fa-tty:before{content:""}.fa-binoculars:before{content:""}.fa-plug:before{content:""}.fa-slideshare:before{content:""}.fa-twitch:before{content:""}.fa-yelp:before{content:""}.fa-newspaper-o:before{content:""}.fa-wifi:before{content:""}.fa-calculator:before{content:""}.fa-paypal:before{content:""}.fa-google-wallet:before{content:""}.fa-cc-visa:before{content:""}.fa-cc-mastercard:before{content:""}.fa-cc-discover:before{content:""}.fa-cc-amex:before{content:""}.fa-cc-paypal:before{content:""}.fa-cc-stripe:before{content:""}.fa-bell-slash:before{content:""}.fa-bell-slash-o:before{content:""}.fa-trash:before{content:""}.fa-copyright:before{content:""}.fa-at:before{content:""}.fa-eyedropper:before{content:""}.fa-paint-brush:before{content:""}.fa-birthday-cake:before{content:""}.fa-area-chart:before{content:""}.fa-pie-chart:before{content:""}.fa-line-chart:before{content:""}.fa-lastfm:before{content:""}.fa-lastfm-square:before{content:""}.fa-toggle-off:before{content:""}.fa-toggle-on:before{content:""}.fa-bicycle:before{content:""}.fa-bus:before{content:""}.fa-ioxhost:before{content:""}.fa-angellist:before{content:""}.fa-cc:before{content:""}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:""}.fa-meanpath:before{content:""}.fa-buysellads:before{content:""}.fa-connectdevelop:before{content:""}.fa-dashcube:before{content:""}.fa-forumbee:before{content:""}.fa-leanpub:before{content:""}.fa-sellsy:before{content:""}.fa-shirtsinbulk:before{content:""}.fa-simplybuilt:before{content:""}.fa-skyatlas:before{content:""}.fa-cart-plus:before{content:""}.fa-cart-arrow-down:before{content:""}.fa-diamond:before{content:""}.fa-ship:before{content:""}.fa-user-secret:before{content:""}.fa-motorcycle:before{content:""}.fa-street-view:before{content:""}.fa-heartbeat:before{content:""}.fa-venus:before{content:""}.fa-mars:before{content:""}.fa-mercury:before{content:""}.fa-intersex:before,.fa-transgender:before{content:""}.fa-transgender-alt:before{content:""}.fa-venus-double:before{content:""}.fa-mars-double:before{content:""}.fa-venus-mars:before{content:""}.fa-mars-stroke:before{content:""}.fa-mars-stroke-v:before{content:""}.fa-mars-stroke-h:before{content:""}.fa-neuter:before{content:""}.fa-genderless:before{content:""}.fa-facebook-official:before{content:""}.fa-pinterest-p:before{content:""}.fa-whatsapp:before{content:""}.fa-server:before{content:""}.fa-user-plus:before{content:""}.fa-user-times:before{content:""}.fa-bed:before,.fa-hotel:before{content:""}.fa-viacoin:before{content:""}.fa-train:before{content:""}.fa-subway:before{content:""}.fa-medium:before{content:""}.fa-y-combinator:before,.fa-yc:before{content:""}.fa-optin-monster:before{content:""}.fa-opencart:before{content:""}.fa-expeditedssl:before{content:""}.fa-battery-4:before,.fa-battery-full:before,.fa-battery:before{content:""}.fa-battery-3:before,.fa-battery-three-quarters:before{content:""}.fa-battery-2:before,.fa-battery-half:before{content:""}.fa-battery-1:before,.fa-battery-quarter:before{content:""}.fa-battery-0:before,.fa-battery-empty:before{content:""}.fa-mouse-pointer:before{content:""}.fa-i-cursor:before{content:""}.fa-object-group:before{content:""}.fa-object-ungroup:before{content:""}.fa-sticky-note:before{content:""}.fa-sticky-note-o:before{content:""}.fa-cc-jcb:before{content:""}.fa-cc-diners-club:before{content:""}.fa-clone:before{content:""}.fa-balance-scale:before{content:""}.fa-hourglass-o:before{content:""}.fa-hourglass-1:before,.fa-hourglass-start:before{content:""}.fa-hourglass-2:before,.fa-hourglass-half:before{content:""}.fa-hourglass-3:before,.fa-hourglass-end:before{content:""}.fa-hourglass:before{content:""}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:""}.fa-hand-paper-o:before,.fa-hand-stop-o:before{content:""}.fa-hand-scissors-o:before{content:""}.fa-hand-lizard-o:before{content:""}.fa-hand-spock-o:before{content:""}.fa-hand-pointer-o:before{content:""}.fa-hand-peace-o:before{content:""}.fa-trademark:before{content:""}.fa-registered:before{content:""}.fa-creative-commons:before{content:""}.fa-gg:before{content:""}.fa-gg-circle:before{content:""}.fa-tripadvisor:before{content:""}.fa-odnoklassniki:before{content:""}.fa-odnoklassniki-square:before{content:""}.fa-get-pocket:before{content:""}.fa-wikipedia-w:before{content:""}.fa-safari:before{content:""}.fa-chrome:before{content:""}.fa-firefox:before{content:""}.fa-opera:before{content:""}.fa-internet-explorer:before{content:""}.fa-television:before,.fa-tv:before{content:""}.fa-contao:before{content:""}.fa-500px:before{content:""}.fa-amazon:before{content:""}.fa-calendar-plus-o:before{content:""}.fa-calendar-minus-o:before{content:""}.fa-calendar-times-o:before{content:""}.fa-calendar-check-o:before{content:""}.fa-industry:before{content:""}.fa-map-pin:before{content:""}.fa-map-signs:before{content:""}.fa-map-o:before{content:""}.fa-map:before{content:""}.fa-commenting:before{content:""}.fa-commenting-o:before{content:""}.fa-houzz:before{content:""}.fa-vimeo:before{content:""}.fa-black-tie:before{content:""}.fa-fonticons:before{content:""}.fa-reddit-alien:before{content:""}.fa-edge:before{content:""}.fa-credit-card-alt:before{content:""}.fa-codiepie:before{content:""}.fa-modx:before{content:""}.fa-fort-awesome:before{content:""}.fa-usb:before{content:""}.fa-product-hunt:before{content:""}.fa-mixcloud:before{content:""}.fa-scribd:before{content:""}.fa-pause-circle:before{content:""}.fa-pause-circle-o:before{content:""}.fa-stop-circle:before{content:""}.fa-stop-circle-o:before{content:""}.fa-shopping-bag:before{content:""}.fa-shopping-basket:before{content:""}.fa-hashtag:before{content:""}.fa-bluetooth:before{content:""}.fa-bluetooth-b:before{content:""}.fa-percent:before{content:""}.fa-gitlab:before,.icon-gitlab:before{content:""}.fa-wpbeginner:before{content:""}.fa-wpforms:before{content:""}.fa-envira:before{content:""}.fa-universal-access:before{content:""}.fa-wheelchair-alt:before{content:""}.fa-question-circle-o:before{content:""}.fa-blind:before{content:""}.fa-audio-description:before{content:""}.fa-volume-control-phone:before{content:""}.fa-braille:before{content:""}.fa-assistive-listening-systems:before{content:""}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:""}.fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:""}.fa-glide:before{content:""}.fa-glide-g:before{content:""}.fa-sign-language:before,.fa-signing:before{content:""}.fa-low-vision:before{content:""}.fa-viadeo:before{content:""}.fa-viadeo-square:before{content:""}.fa-snapchat:before{content:""}.fa-snapchat-ghost:before{content:""}.fa-snapchat-square:before{content:""}.fa-pied-piper:before{content:""}.fa-first-order:before{content:""}.fa-yoast:before{content:""}.fa-themeisle:before{content:""}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:""}.fa-fa:before,.fa-font-awesome:before{content:""}.fa-handshake-o:before{content:""}.fa-envelope-open:before{content:""}.fa-envelope-open-o:before{content:""}.fa-linode:before{content:""}.fa-address-book:before{content:""}.fa-address-book-o:before{content:""}.fa-address-card:before,.fa-vcard:before{content:""}.fa-address-card-o:before,.fa-vcard-o:before{content:""}.fa-user-circle:before{content:""}.fa-user-circle-o:before{content:""}.fa-user-o:before{content:""}.fa-id-badge:before{content:""}.fa-drivers-license:before,.fa-id-card:before{content:""}.fa-drivers-license-o:before,.fa-id-card-o:before{content:""}.fa-quora:before{content:""}.fa-free-code-camp:before{content:""}.fa-telegram:before{content:""}.fa-thermometer-4:before,.fa-thermometer-full:before,.fa-thermometer:before{content:""}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:""}.fa-thermometer-2:before,.fa-thermometer-half:before{content:""}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:""}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:""}.fa-shower:before{content:""}.fa-bath:before,.fa-bathtub:before,.fa-s15:before{content:""}.fa-podcast:before{content:""}.fa-window-maximize:before{content:""}.fa-window-minimize:before{content:""}.fa-window-restore:before{content:""}.fa-times-rectangle:before,.fa-window-close:before{content:""}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:""}.fa-bandcamp:before{content:""}.fa-grav:before{content:""}.fa-etsy:before{content:""}.fa-imdb:before{content:""}.fa-ravelry:before{content:""}.fa-eercast:before{content:""}.fa-microchip:before{content:""}.fa-snowflake-o:before{content:""}.fa-superpowers:before{content:""}.fa-wpexplorer:before{content:""}.fa-meetup:before{content:""}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-dropdown .caret,.wy-inline-validate.wy-inline-validate-danger .wy-input-context,.wy-inline-validate.wy-inline-validate-info .wy-input-context,.wy-inline-validate.wy-inline-validate-success .wy-input-context,.wy-inline-validate.wy-inline-validate-warning .wy-input-context,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{font-family:inherit}.fa:before,.icon:before,.rst-content .admonition-title:before,.rst-content .code-block-caption .headerlink:before,.rst-content .eqno .headerlink:before,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before{font-family:FontAwesome;display:inline-block;font-style:normal;font-weight:400;line-height:1;text-decoration:inherit}.rst-content .code-block-caption a .headerlink,.rst-content .eqno a .headerlink,.rst-content a .admonition-title,.rst-content code.download a span:first-child,.rst-content dl dt a .headerlink,.rst-content h1 a .headerlink,.rst-content h2 a .headerlink,.rst-content h3 a .headerlink,.rst-content h4 a .headerlink,.rst-content h5 a .headerlink,.rst-content h6 a .headerlink,.rst-content p.caption a .headerlink,.rst-content p a .headerlink,.rst-content table>caption a .headerlink,.rst-content tt.download a span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li a button.toctree-expand,a .fa,a .icon,a .rst-content .admonition-title,a .rst-content .code-block-caption .headerlink,a .rst-content .eqno .headerlink,a .rst-content code.download span:first-child,a .rst-content dl dt .headerlink,a .rst-content h1 .headerlink,a .rst-content h2 .headerlink,a .rst-content h3 .headerlink,a .rst-content h4 .headerlink,a .rst-content h5 .headerlink,a .rst-content h6 .headerlink,a .rst-content p.caption .headerlink,a .rst-content p .headerlink,a .rst-content table>caption .headerlink,a .rst-content tt.download span:first-child,a .wy-menu-vertical li button.toctree-expand{display:inline-block;text-decoration:inherit}.btn .fa,.btn .icon,.btn .rst-content .admonition-title,.btn .rst-content .code-block-caption .headerlink,.btn .rst-content .eqno .headerlink,.btn .rst-content code.download span:first-child,.btn .rst-content dl dt .headerlink,.btn .rst-content h1 .headerlink,.btn .rst-content h2 .headerlink,.btn .rst-content h3 .headerlink,.btn .rst-content h4 .headerlink,.btn .rst-content h5 .headerlink,.btn .rst-content h6 .headerlink,.btn .rst-content p .headerlink,.btn .rst-content table>caption .headerlink,.btn .rst-content tt.download span:first-child,.btn .wy-menu-vertical li.current>a button.toctree-expand,.btn .wy-menu-vertical li.on a button.toctree-expand,.btn .wy-menu-vertical li button.toctree-expand,.nav .fa,.nav .icon,.nav .rst-content .admonition-title,.nav .rst-content .code-block-caption .headerlink,.nav .rst-content .eqno .headerlink,.nav .rst-content code.download span:first-child,.nav .rst-content dl dt .headerlink,.nav .rst-content h1 .headerlink,.nav .rst-content h2 .headerlink,.nav .rst-content h3 .headerlink,.nav .rst-content h4 .headerlink,.nav .rst-content h5 .headerlink,.nav .rst-content h6 .headerlink,.nav .rst-content p .headerlink,.nav .rst-content table>caption .headerlink,.nav .rst-content tt.download span:first-child,.nav .wy-menu-vertical li.current>a button.toctree-expand,.nav .wy-menu-vertical li.on a button.toctree-expand,.nav .wy-menu-vertical li button.toctree-expand,.rst-content .btn .admonition-title,.rst-content .code-block-caption .btn .headerlink,.rst-content .code-block-caption .nav .headerlink,.rst-content .eqno .btn .headerlink,.rst-content .eqno .nav .headerlink,.rst-content .nav .admonition-title,.rst-content code.download .btn span:first-child,.rst-content code.download .nav span:first-child,.rst-content dl dt .btn .headerlink,.rst-content dl dt .nav .headerlink,.rst-content h1 .btn .headerlink,.rst-content h1 .nav .headerlink,.rst-content h2 .btn .headerlink,.rst-content h2 .nav .headerlink,.rst-content h3 .btn .headerlink,.rst-content h3 .nav .headerlink,.rst-content h4 .btn .headerlink,.rst-content h4 .nav .headerlink,.rst-content h5 .btn .headerlink,.rst-content h5 .nav .headerlink,.rst-content h6 .btn .headerlink,.rst-content h6 .nav .headerlink,.rst-content p .btn .headerlink,.rst-content p .nav .headerlink,.rst-content table>caption .btn .headerlink,.rst-content table>caption .nav .headerlink,.rst-content tt.download .btn span:first-child,.rst-content tt.download .nav span:first-child,.wy-menu-vertical li .btn button.toctree-expand,.wy-menu-vertical li.current>a .btn button.toctree-expand,.wy-menu-vertical li.current>a .nav button.toctree-expand,.wy-menu-vertical li .nav button.toctree-expand,.wy-menu-vertical li.on a .btn button.toctree-expand,.wy-menu-vertical li.on a .nav button.toctree-expand{display:inline}.btn .fa-large.icon,.btn .fa.fa-large,.btn .rst-content .code-block-caption .fa-large.headerlink,.btn .rst-content .eqno .fa-large.headerlink,.btn .rst-content .fa-large.admonition-title,.btn .rst-content code.download span.fa-large:first-child,.btn .rst-content dl dt .fa-large.headerlink,.btn .rst-content h1 .fa-large.headerlink,.btn .rst-content h2 .fa-large.headerlink,.btn .rst-content h3 .fa-large.headerlink,.btn .rst-content h4 .fa-large.headerlink,.btn .rst-content h5 .fa-large.headerlink,.btn .rst-content h6 .fa-large.headerlink,.btn .rst-content p .fa-large.headerlink,.btn .rst-content table>caption .fa-large.headerlink,.btn .rst-content tt.download span.fa-large:first-child,.btn .wy-menu-vertical li button.fa-large.toctree-expand,.nav .fa-large.icon,.nav .fa.fa-large,.nav .rst-content .code-block-caption .fa-large.headerlink,.nav .rst-content .eqno .fa-large.headerlink,.nav .rst-content .fa-large.admonition-title,.nav .rst-content code.download span.fa-large:first-child,.nav .rst-content dl dt .fa-large.headerlink,.nav .rst-content h1 .fa-large.headerlink,.nav .rst-content h2 .fa-large.headerlink,.nav .rst-content h3 .fa-large.headerlink,.nav .rst-content h4 .fa-large.headerlink,.nav .rst-content h5 .fa-large.headerlink,.nav .rst-content h6 .fa-large.headerlink,.nav .rst-content p .fa-large.headerlink,.nav .rst-content table>caption .fa-large.headerlink,.nav .rst-content tt.download span.fa-large:first-child,.nav .wy-menu-vertical li button.fa-large.toctree-expand,.rst-content .btn .fa-large.admonition-title,.rst-content .code-block-caption .btn .fa-large.headerlink,.rst-content .code-block-caption .nav .fa-large.headerlink,.rst-content .eqno .btn .fa-large.headerlink,.rst-content .eqno .nav .fa-large.headerlink,.rst-content .nav .fa-large.admonition-title,.rst-content code.download .btn span.fa-large:first-child,.rst-content code.download .nav span.fa-large:first-child,.rst-content dl dt .btn .fa-large.headerlink,.rst-content dl dt .nav .fa-large.headerlink,.rst-content h1 .btn .fa-large.headerlink,.rst-content h1 .nav .fa-large.headerlink,.rst-content h2 .btn .fa-large.headerlink,.rst-content h2 .nav .fa-large.headerlink,.rst-content h3 .btn .fa-large.headerlink,.rst-content h3 .nav .fa-large.headerlink,.rst-content h4 .btn .fa-large.headerlink,.rst-content h4 .nav .fa-large.headerlink,.rst-content h5 .btn .fa-large.headerlink,.rst-content h5 .nav .fa-large.headerlink,.rst-content h6 .btn .fa-large.headerlink,.rst-content h6 .nav .fa-large.headerlink,.rst-content p .btn .fa-large.headerlink,.rst-content p .nav .fa-large.headerlink,.rst-content table>caption .btn .fa-large.headerlink,.rst-content table>caption .nav .fa-large.headerlink,.rst-content tt.download .btn span.fa-large:first-child,.rst-content tt.download .nav span.fa-large:first-child,.wy-menu-vertical li .btn button.fa-large.toctree-expand,.wy-menu-vertical li .nav button.fa-large.toctree-expand{line-height:.9em}.btn .fa-spin.icon,.btn .fa.fa-spin,.btn .rst-content .code-block-caption .fa-spin.headerlink,.btn .rst-content .eqno .fa-spin.headerlink,.btn .rst-content .fa-spin.admonition-title,.btn .rst-content code.download span.fa-spin:first-child,.btn .rst-content dl dt .fa-spin.headerlink,.btn .rst-content h1 .fa-spin.headerlink,.btn .rst-content h2 .fa-spin.headerlink,.btn .rst-content h3 .fa-spin.headerlink,.btn .rst-content h4 .fa-spin.headerlink,.btn .rst-content h5 .fa-spin.headerlink,.btn .rst-content h6 .fa-spin.headerlink,.btn .rst-content p .fa-spin.headerlink,.btn .rst-content table>caption .fa-spin.headerlink,.btn .rst-content tt.download span.fa-spin:first-child,.btn .wy-menu-vertical li button.fa-spin.toctree-expand,.nav .fa-spin.icon,.nav .fa.fa-spin,.nav .rst-content .code-block-caption .fa-spin.headerlink,.nav .rst-content .eqno .fa-spin.headerlink,.nav .rst-content .fa-spin.admonition-title,.nav .rst-content code.download span.fa-spin:first-child,.nav .rst-content dl dt .fa-spin.headerlink,.nav .rst-content h1 .fa-spin.headerlink,.nav .rst-content h2 .fa-spin.headerlink,.nav .rst-content h3 .fa-spin.headerlink,.nav .rst-content h4 .fa-spin.headerlink,.nav .rst-content h5 .fa-spin.headerlink,.nav .rst-content h6 .fa-spin.headerlink,.nav .rst-content p .fa-spin.headerlink,.nav .rst-content table>caption .fa-spin.headerlink,.nav .rst-content tt.download span.fa-spin:first-child,.nav .wy-menu-vertical li button.fa-spin.toctree-expand,.rst-content .btn .fa-spin.admonition-title,.rst-content .code-block-caption .btn .fa-spin.headerlink,.rst-content .code-block-caption .nav .fa-spin.headerlink,.rst-content .eqno .btn .fa-spin.headerlink,.rst-content .eqno .nav .fa-spin.headerlink,.rst-content .nav .fa-spin.admonition-title,.rst-content code.download .btn span.fa-spin:first-child,.rst-content code.download .nav span.fa-spin:first-child,.rst-content dl dt .btn .fa-spin.headerlink,.rst-content dl dt .nav .fa-spin.headerlink,.rst-content h1 .btn .fa-spin.headerlink,.rst-content h1 .nav .fa-spin.headerlink,.rst-content h2 .btn .fa-spin.headerlink,.rst-content h2 .nav .fa-spin.headerlink,.rst-content h3 .btn .fa-spin.headerlink,.rst-content h3 .nav .fa-spin.headerlink,.rst-content h4 .btn .fa-spin.headerlink,.rst-content h4 .nav .fa-spin.headerlink,.rst-content h5 .btn .fa-spin.headerlink,.rst-content h5 .nav .fa-spin.headerlink,.rst-content h6 .btn .fa-spin.headerlink,.rst-content h6 .nav .fa-spin.headerlink,.rst-content p .btn .fa-spin.headerlink,.rst-content p .nav .fa-spin.headerlink,.rst-content table>caption .btn .fa-spin.headerlink,.rst-content table>caption .nav .fa-spin.headerlink,.rst-content tt.download .btn span.fa-spin:first-child,.rst-content tt.download .nav span.fa-spin:first-child,.wy-menu-vertical li .btn button.fa-spin.toctree-expand,.wy-menu-vertical li .nav button.fa-spin.toctree-expand{display:inline-block}.btn.fa:before,.btn.icon:before,.rst-content .btn.admonition-title:before,.rst-content .code-block-caption .btn.headerlink:before,.rst-content .eqno .btn.headerlink:before,.rst-content code.download span.btn:first-child:before,.rst-content dl dt .btn.headerlink:before,.rst-content h1 .btn.headerlink:before,.rst-content h2 .btn.headerlink:before,.rst-content h3 .btn.headerlink:before,.rst-content h4 .btn.headerlink:before,.rst-content h5 .btn.headerlink:before,.rst-content h6 .btn.headerlink:before,.rst-content p .btn.headerlink:before,.rst-content table>caption .btn.headerlink:before,.rst-content tt.download span.btn:first-child:before,.wy-menu-vertical li button.btn.toctree-expand:before{opacity:.5;-webkit-transition:opacity .05s ease-in;-moz-transition:opacity .05s ease-in;transition:opacity .05s ease-in}.btn.fa:hover:before,.btn.icon:hover:before,.rst-content .btn.admonition-title:hover:before,.rst-content .code-block-caption .btn.headerlink:hover:before,.rst-content .eqno .btn.headerlink:hover:before,.rst-content code.download span.btn:first-child:hover:before,.rst-content dl dt .btn.headerlink:hover:before,.rst-content h1 .btn.headerlink:hover:before,.rst-content h2 .btn.headerlink:hover:before,.rst-content h3 .btn.headerlink:hover:before,.rst-content h4 .btn.headerlink:hover:before,.rst-content h5 .btn.headerlink:hover:before,.rst-content h6 .btn.headerlink:hover:before,.rst-content p .btn.headerlink:hover:before,.rst-content table>caption .btn.headerlink:hover:before,.rst-content tt.download span.btn:first-child:hover:before,.wy-menu-vertical li button.btn.toctree-expand:hover:before{opacity:1}.btn-mini .fa:before,.btn-mini .icon:before,.btn-mini .rst-content .admonition-title:before,.btn-mini .rst-content .code-block-caption .headerlink:before,.btn-mini .rst-content .eqno .headerlink:before,.btn-mini .rst-content code.download span:first-child:before,.btn-mini .rst-content dl dt .headerlink:before,.btn-mini .rst-content h1 .headerlink:before,.btn-mini .rst-content h2 .headerlink:before,.btn-mini .rst-content h3 .headerlink:before,.btn-mini .rst-content h4 .headerlink:before,.btn-mini .rst-content h5 .headerlink:before,.btn-mini .rst-content h6 .headerlink:before,.btn-mini .rst-content p .headerlink:before,.btn-mini .rst-content table>caption .headerlink:before,.btn-mini .rst-content tt.download span:first-child:before,.btn-mini .wy-menu-vertical li button.toctree-expand:before,.rst-content .btn-mini .admonition-title:before,.rst-content .code-block-caption .btn-mini .headerlink:before,.rst-content .eqno .btn-mini .headerlink:before,.rst-content code.download .btn-mini span:first-child:before,.rst-content dl dt .btn-mini .headerlink:before,.rst-content h1 .btn-mini .headerlink:before,.rst-content h2 .btn-mini .headerlink:before,.rst-content h3 .btn-mini .headerlink:before,.rst-content h4 .btn-mini .headerlink:before,.rst-content h5 .btn-mini .headerlink:before,.rst-content h6 .btn-mini .headerlink:before,.rst-content p .btn-mini .headerlink:before,.rst-content table>caption .btn-mini .headerlink:before,.rst-content tt.download .btn-mini span:first-child:before,.wy-menu-vertical li .btn-mini button.toctree-expand:before{font-size:14px;vertical-align:-15%}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.wy-alert{padding:12px;line-height:24px;margin-bottom:24px;background:#e7f2fa}.rst-content .admonition-title,.wy-alert-title{font-weight:700;display:block;color:#fff;background:#6ab0de;padding:6px 12px;margin:-12px -12px 12px}.rst-content .danger,.rst-content .error,.rst-content .wy-alert-danger.admonition,.rst-content .wy-alert-danger.admonition-todo,.rst-content .wy-alert-danger.attention,.rst-content .wy-alert-danger.caution,.rst-content .wy-alert-danger.hint,.rst-content .wy-alert-danger.important,.rst-content .wy-alert-danger.note,.rst-content .wy-alert-danger.seealso,.rst-content .wy-alert-danger.tip,.rst-content .wy-alert-danger.warning,.wy-alert.wy-alert-danger{background:#fdf3f2}.rst-content .danger .admonition-title,.rst-content .danger .wy-alert-title,.rst-content .error .admonition-title,.rst-content .error .wy-alert-title,.rst-content .wy-alert-danger.admonition-todo .admonition-title,.rst-content .wy-alert-danger.admonition-todo .wy-alert-title,.rst-content .wy-alert-danger.admonition .admonition-title,.rst-content .wy-alert-danger.admonition .wy-alert-title,.rst-content .wy-alert-danger.attention .admonition-title,.rst-content .wy-alert-danger.attention .wy-alert-title,.rst-content .wy-alert-danger.caution .admonition-title,.rst-content .wy-alert-danger.caution .wy-alert-title,.rst-content .wy-alert-danger.hint .admonition-title,.rst-content .wy-alert-danger.hint .wy-alert-title,.rst-content .wy-alert-danger.important .admonition-title,.rst-content .wy-alert-danger.important .wy-alert-title,.rst-content .wy-alert-danger.note .admonition-title,.rst-content .wy-alert-danger.note .wy-alert-title,.rst-content .wy-alert-danger.seealso .admonition-title,.rst-content .wy-alert-danger.seealso .wy-alert-title,.rst-content .wy-alert-danger.tip .admonition-title,.rst-content .wy-alert-danger.tip .wy-alert-title,.rst-content .wy-alert-danger.warning .admonition-title,.rst-content .wy-alert-danger.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-danger .admonition-title,.wy-alert.wy-alert-danger .rst-content .admonition-title,.wy-alert.wy-alert-danger .wy-alert-title{background:#f29f97}.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .warning,.rst-content .wy-alert-warning.admonition,.rst-content .wy-alert-warning.danger,.rst-content .wy-alert-warning.error,.rst-content .wy-alert-warning.hint,.rst-content .wy-alert-warning.important,.rst-content .wy-alert-warning.note,.rst-content .wy-alert-warning.seealso,.rst-content .wy-alert-warning.tip,.wy-alert.wy-alert-warning{background:#ffedcc}.rst-content .admonition-todo .admonition-title,.rst-content .admonition-todo .wy-alert-title,.rst-content .attention .admonition-title,.rst-content .attention .wy-alert-title,.rst-content .caution .admonition-title,.rst-content .caution .wy-alert-title,.rst-content .warning .admonition-title,.rst-content .warning .wy-alert-title,.rst-content .wy-alert-warning.admonition .admonition-title,.rst-content .wy-alert-warning.admonition .wy-alert-title,.rst-content .wy-alert-warning.danger .admonition-title,.rst-content .wy-alert-warning.danger .wy-alert-title,.rst-content .wy-alert-warning.error .admonition-title,.rst-content .wy-alert-warning.error .wy-alert-title,.rst-content .wy-alert-warning.hint .admonition-title,.rst-content .wy-alert-warning.hint .wy-alert-title,.rst-content .wy-alert-warning.important .admonition-title,.rst-content .wy-alert-warning.important .wy-alert-title,.rst-content .wy-alert-warning.note .admonition-title,.rst-content .wy-alert-warning.note .wy-alert-title,.rst-content .wy-alert-warning.seealso .admonition-title,.rst-content .wy-alert-warning.seealso .wy-alert-title,.rst-content .wy-alert-warning.tip .admonition-title,.rst-content .wy-alert-warning.tip .wy-alert-title,.rst-content .wy-alert.wy-alert-warning .admonition-title,.wy-alert.wy-alert-warning .rst-content .admonition-title,.wy-alert.wy-alert-warning .wy-alert-title{background:#f0b37e}.rst-content .note,.rst-content .seealso,.rst-content .wy-alert-info.admonition,.rst-content .wy-alert-info.admonition-todo,.rst-content .wy-alert-info.attention,.rst-content .wy-alert-info.caution,.rst-content .wy-alert-info.danger,.rst-content .wy-alert-info.error,.rst-content .wy-alert-info.hint,.rst-content .wy-alert-info.important,.rst-content .wy-alert-info.tip,.rst-content .wy-alert-info.warning,.wy-alert.wy-alert-info{background:#e7f2fa}.rst-content .note .admonition-title,.rst-content .note .wy-alert-title,.rst-content .seealso .admonition-title,.rst-content .seealso .wy-alert-title,.rst-content .wy-alert-info.admonition-todo .admonition-title,.rst-content .wy-alert-info.admonition-todo .wy-alert-title,.rst-content .wy-alert-info.admonition .admonition-title,.rst-content .wy-alert-info.admonition .wy-alert-title,.rst-content .wy-alert-info.attention .admonition-title,.rst-content .wy-alert-info.attention .wy-alert-title,.rst-content .wy-alert-info.caution .admonition-title,.rst-content .wy-alert-info.caution .wy-alert-title,.rst-content .wy-alert-info.danger .admonition-title,.rst-content .wy-alert-info.danger .wy-alert-title,.rst-content .wy-alert-info.error .admonition-title,.rst-content .wy-alert-info.error .wy-alert-title,.rst-content .wy-alert-info.hint .admonition-title,.rst-content .wy-alert-info.hint .wy-alert-title,.rst-content .wy-alert-info.important .admonition-title,.rst-content .wy-alert-info.important .wy-alert-title,.rst-content .wy-alert-info.tip .admonition-title,.rst-content .wy-alert-info.tip .wy-alert-title,.rst-content .wy-alert-info.warning .admonition-title,.rst-content .wy-alert-info.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-info .admonition-title,.wy-alert.wy-alert-info .rst-content .admonition-title,.wy-alert.wy-alert-info .wy-alert-title{background:#6ab0de}.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .wy-alert-success.admonition,.rst-content .wy-alert-success.admonition-todo,.rst-content .wy-alert-success.attention,.rst-content .wy-alert-success.caution,.rst-content .wy-alert-success.danger,.rst-content .wy-alert-success.error,.rst-content .wy-alert-success.note,.rst-content .wy-alert-success.seealso,.rst-content .wy-alert-success.warning,.wy-alert.wy-alert-success{background:#dbfaf4}.rst-content .hint .admonition-title,.rst-content .hint .wy-alert-title,.rst-content .important .admonition-title,.rst-content .important .wy-alert-title,.rst-content .tip .admonition-title,.rst-content .tip .wy-alert-title,.rst-content .wy-alert-success.admonition-todo .admonition-title,.rst-content .wy-alert-success.admonition-todo .wy-alert-title,.rst-content .wy-alert-success.admonition .admonition-title,.rst-content .wy-alert-success.admonition .wy-alert-title,.rst-content .wy-alert-success.attention .admonition-title,.rst-content .wy-alert-success.attention .wy-alert-title,.rst-content .wy-alert-success.caution .admonition-title,.rst-content .wy-alert-success.caution .wy-alert-title,.rst-content .wy-alert-success.danger .admonition-title,.rst-content .wy-alert-success.danger .wy-alert-title,.rst-content .wy-alert-success.error .admonition-title,.rst-content .wy-alert-success.error .wy-alert-title,.rst-content .wy-alert-success.note .admonition-title,.rst-content .wy-alert-success.note .wy-alert-title,.rst-content .wy-alert-success.seealso .admonition-title,.rst-content .wy-alert-success.seealso .wy-alert-title,.rst-content .wy-alert-success.warning .admonition-title,.rst-content .wy-alert-success.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-success .admonition-title,.wy-alert.wy-alert-success .rst-content .admonition-title,.wy-alert.wy-alert-success .wy-alert-title{background:#1abc9c}.rst-content .wy-alert-neutral.admonition,.rst-content .wy-alert-neutral.admonition-todo,.rst-content .wy-alert-neutral.attention,.rst-content .wy-alert-neutral.caution,.rst-content .wy-alert-neutral.danger,.rst-content .wy-alert-neutral.error,.rst-content .wy-alert-neutral.hint,.rst-content .wy-alert-neutral.important,.rst-content .wy-alert-neutral.note,.rst-content .wy-alert-neutral.seealso,.rst-content .wy-alert-neutral.tip,.rst-content .wy-alert-neutral.warning,.wy-alert.wy-alert-neutral{background:#f3f6f6}.rst-content .wy-alert-neutral.admonition-todo .admonition-title,.rst-content .wy-alert-neutral.admonition-todo .wy-alert-title,.rst-content .wy-alert-neutral.admonition .admonition-title,.rst-content .wy-alert-neutral.admonition .wy-alert-title,.rst-content .wy-alert-neutral.attention .admonition-title,.rst-content .wy-alert-neutral.attention .wy-alert-title,.rst-content .wy-alert-neutral.caution .admonition-title,.rst-content .wy-alert-neutral.caution .wy-alert-title,.rst-content .wy-alert-neutral.danger .admonition-title,.rst-content .wy-alert-neutral.danger .wy-alert-title,.rst-content .wy-alert-neutral.error .admonition-title,.rst-content .wy-alert-neutral.error .wy-alert-title,.rst-content .wy-alert-neutral.hint .admonition-title,.rst-content .wy-alert-neutral.hint .wy-alert-title,.rst-content .wy-alert-neutral.important .admonition-title,.rst-content .wy-alert-neutral.important .wy-alert-title,.rst-content .wy-alert-neutral.note .admonition-title,.rst-content .wy-alert-neutral.note .wy-alert-title,.rst-content .wy-alert-neutral.seealso .admonition-title,.rst-content .wy-alert-neutral.seealso .wy-alert-title,.rst-content .wy-alert-neutral.tip .admonition-title,.rst-content .wy-alert-neutral.tip .wy-alert-title,.rst-content .wy-alert-neutral.warning .admonition-title,.rst-content .wy-alert-neutral.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-neutral .admonition-title,.wy-alert.wy-alert-neutral .rst-content .admonition-title,.wy-alert.wy-alert-neutral .wy-alert-title{color:#404040;background:#e1e4e5}.rst-content .wy-alert-neutral.admonition-todo a,.rst-content .wy-alert-neutral.admonition a,.rst-content .wy-alert-neutral.attention a,.rst-content .wy-alert-neutral.caution a,.rst-content .wy-alert-neutral.danger a,.rst-content .wy-alert-neutral.error a,.rst-content .wy-alert-neutral.hint a,.rst-content .wy-alert-neutral.important a,.rst-content .wy-alert-neutral.note a,.rst-content .wy-alert-neutral.seealso a,.rst-content .wy-alert-neutral.tip a,.rst-content .wy-alert-neutral.warning a,.wy-alert.wy-alert-neutral a{color:#2980b9}.rst-content .admonition-todo p:last-child,.rst-content .admonition p:last-child,.rst-content .attention p:last-child,.rst-content .caution p:last-child,.rst-content .danger p:last-child,.rst-content .error p:last-child,.rst-content .hint p:last-child,.rst-content .important p:last-child,.rst-content .note p:last-child,.rst-content .seealso p:last-child,.rst-content .tip p:last-child,.rst-content .warning p:last-child,.wy-alert p:last-child{margin-bottom:0}.wy-tray-container{position:fixed;bottom:0;left:0;z-index:600}.wy-tray-container li{display:block;width:300px;background:transparent;color:#fff;text-align:center;box-shadow:0 5px 5px 0 rgba(0,0,0,.1);padding:0 24px;min-width:20%;opacity:0;height:0;line-height:56px;overflow:hidden;-webkit-transition:all .3s ease-in;-moz-transition:all .3s ease-in;transition:all .3s ease-in}.wy-tray-container li.wy-tray-item-success{background:#27ae60}.wy-tray-container li.wy-tray-item-info{background:#2980b9}.wy-tray-container li.wy-tray-item-warning{background:#e67e22}.wy-tray-container li.wy-tray-item-danger{background:#e74c3c}.wy-tray-container li.on{opacity:1;height:56px}@media screen and (max-width:768px){.wy-tray-container{bottom:auto;top:0;width:100%}.wy-tray-container li{width:100%}}button{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;cursor:pointer;line-height:normal;-webkit-appearance:button;*overflow:visible}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}button[disabled]{cursor:default}.btn{display:inline-block;border-radius:2px;line-height:normal;white-space:nowrap;text-align:center;cursor:pointer;font-size:100%;padding:6px 12px 8px;color:#fff;border:1px solid rgba(0,0,0,.1);background-color:#27ae60;text-decoration:none;font-weight:400;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 2px -1px hsla(0,0%,100%,.5),inset 0 -2px 0 0 rgba(0,0,0,.1);outline-none:false;vertical-align:middle;*display:inline;zoom:1;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all .1s linear;-moz-transition:all .1s linear;transition:all .1s linear}.btn-hover{background:#2e8ece;color:#fff}.btn:hover{background:#2cc36b;color:#fff}.btn:focus{background:#2cc36b;outline:0}.btn:active{box-shadow:inset 0 -1px 0 0 rgba(0,0,0,.05),inset 0 2px 0 0 rgba(0,0,0,.1);padding:8px 12px 6px}.btn:visited{color:#fff}.btn-disabled,.btn-disabled:active,.btn-disabled:focus,.btn-disabled:hover,.btn:disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:.4;cursor:not-allowed;box-shadow:none}.btn::-moz-focus-inner{padding:0;border:0}.btn-small{font-size:80%}.btn-info{background-color:#2980b9!important}.btn-info:hover{background-color:#2e8ece!important}.btn-neutral{background-color:#f3f6f6!important;color:#404040!important}.btn-neutral:hover{background-color:#e5ebeb!important;color:#404040}.btn-neutral:visited{color:#404040!important}.btn-success{background-color:#27ae60!important}.btn-success:hover{background-color:#295!important}.btn-danger{background-color:#e74c3c!important}.btn-danger:hover{background-color:#ea6153!important}.btn-warning{background-color:#e67e22!important}.btn-warning:hover{background-color:#e98b39!important}.btn-invert{background-color:#222}.btn-invert:hover{background-color:#2f2f2f!important}.btn-link{background-color:transparent!important;color:#2980b9;box-shadow:none;border-color:transparent!important}.btn-link:active,.btn-link:hover{background-color:transparent!important;color:#409ad5!important;box-shadow:none}.btn-link:visited{color:#9b59b6}.wy-btn-group .btn,.wy-control .btn{vertical-align:middle}.wy-btn-group{margin-bottom:24px;*zoom:1}.wy-btn-group:after,.wy-btn-group:before{display:table;content:""}.wy-btn-group:after{clear:both}.wy-dropdown{position:relative;display:inline-block}.wy-dropdown-active .wy-dropdown-menu{display:block}.wy-dropdown-menu{position:absolute;left:0;display:none;float:left;top:100%;min-width:100%;background:#fcfcfc;z-index:100;border:1px solid #cfd7dd;box-shadow:0 2px 2px 0 rgba(0,0,0,.1);padding:12px}.wy-dropdown-menu>dd>a{display:block;clear:both;color:#404040;white-space:nowrap;font-size:90%;padding:0 12px;cursor:pointer}.wy-dropdown-menu>dd>a:hover{background:#2980b9;color:#fff}.wy-dropdown-menu>dd.divider{border-top:1px solid #cfd7dd;margin:6px 0}.wy-dropdown-menu>dd.search{padding-bottom:12px}.wy-dropdown-menu>dd.search input[type=search]{width:100%}.wy-dropdown-menu>dd.call-to-action{background:#e3e3e3;text-transform:uppercase;font-weight:500;font-size:80%}.wy-dropdown-menu>dd.call-to-action:hover{background:#e3e3e3}.wy-dropdown-menu>dd.call-to-action .btn{color:#fff}.wy-dropdown.wy-dropdown-up .wy-dropdown-menu{bottom:100%;top:auto;left:auto;right:0}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu{background:#fcfcfc;margin-top:2px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a{padding:6px 12px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a:hover{background:#2980b9;color:#fff}.wy-dropdown.wy-dropdown-left .wy-dropdown-menu{right:0;left:auto;text-align:right}.wy-dropdown-arrow:before{content:" ";border-bottom:5px solid #f5f5f5;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute;display:block;top:-4px;left:50%;margin-left:-3px}.wy-dropdown-arrow.wy-dropdown-arrow-left:before{left:11px}.wy-form-stacked select{display:block}.wy-form-aligned .wy-help-inline,.wy-form-aligned input,.wy-form-aligned label,.wy-form-aligned select,.wy-form-aligned textarea{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-form-aligned .wy-control-group>label{display:inline-block;vertical-align:middle;width:10em;margin:6px 12px 0 0;float:left}.wy-form-aligned .wy-control{float:left}.wy-form-aligned .wy-control label{display:block}.wy-form-aligned .wy-control select{margin-top:6px}fieldset{margin:0}fieldset,legend{border:0;padding:0}legend{width:100%;white-space:normal;margin-bottom:24px;font-size:150%;*margin-left:-7px}label,legend{display:block}label{margin:0 0 .3125em;color:#333;font-size:90%}input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}.wy-control-group{margin-bottom:24px;max-width:1200px;margin-left:auto;margin-right:auto;*zoom:1}.wy-control-group:after,.wy-control-group:before{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group.wy-control-group-required>label:after{content:" *";color:#e74c3c}.wy-control-group .wy-form-full,.wy-control-group .wy-form-halves,.wy-control-group .wy-form-thirds{padding-bottom:12px}.wy-control-group .wy-form-full input[type=color],.wy-control-group .wy-form-full input[type=date],.wy-control-group .wy-form-full input[type=datetime-local],.wy-control-group .wy-form-full input[type=datetime],.wy-control-group .wy-form-full input[type=email],.wy-control-group .wy-form-full input[type=month],.wy-control-group .wy-form-full input[type=number],.wy-control-group .wy-form-full input[type=password],.wy-control-group .wy-form-full input[type=search],.wy-control-group .wy-form-full input[type=tel],.wy-control-group .wy-form-full input[type=text],.wy-control-group .wy-form-full input[type=time],.wy-control-group .wy-form-full input[type=url],.wy-control-group .wy-form-full input[type=week],.wy-control-group .wy-form-full select,.wy-control-group .wy-form-halves input[type=color],.wy-control-group .wy-form-halves input[type=date],.wy-control-group .wy-form-halves input[type=datetime-local],.wy-control-group .wy-form-halves input[type=datetime],.wy-control-group .wy-form-halves input[type=email],.wy-control-group .wy-form-halves input[type=month],.wy-control-group .wy-form-halves input[type=number],.wy-control-group .wy-form-halves input[type=password],.wy-control-group .wy-form-halves input[type=search],.wy-control-group .wy-form-halves input[type=tel],.wy-control-group .wy-form-halves input[type=text],.wy-control-group .wy-form-halves input[type=time],.wy-control-group .wy-form-halves input[type=url],.wy-control-group .wy-form-halves input[type=week],.wy-control-group .wy-form-halves select,.wy-control-group .wy-form-thirds input[type=color],.wy-control-group .wy-form-thirds input[type=date],.wy-control-group .wy-form-thirds input[type=datetime-local],.wy-control-group .wy-form-thirds input[type=datetime],.wy-control-group .wy-form-thirds input[type=email],.wy-control-group .wy-form-thirds input[type=month],.wy-control-group .wy-form-thirds input[type=number],.wy-control-group .wy-form-thirds input[type=password],.wy-control-group .wy-form-thirds input[type=search],.wy-control-group .wy-form-thirds input[type=tel],.wy-control-group .wy-form-thirds input[type=text],.wy-control-group .wy-form-thirds input[type=time],.wy-control-group .wy-form-thirds input[type=url],.wy-control-group .wy-form-thirds input[type=week],.wy-control-group .wy-form-thirds select{width:100%}.wy-control-group .wy-form-full{float:left;display:block;width:100%;margin-right:0}.wy-control-group .wy-form-full:last-child{margin-right:0}.wy-control-group .wy-form-halves{float:left;display:block;margin-right:2.35765%;width:48.82117%}.wy-control-group .wy-form-halves:last-child,.wy-control-group .wy-form-halves:nth-of-type(2n){margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(odd){clear:left}.wy-control-group .wy-form-thirds{float:left;display:block;margin-right:2.35765%;width:31.76157%}.wy-control-group .wy-form-thirds:last-child,.wy-control-group .wy-form-thirds:nth-of-type(3n){margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n+1){clear:left}.wy-control-group.wy-control-group-no-input .wy-control,.wy-control-no-input{margin:6px 0 0;font-size:90%}.wy-control-no-input{display:inline-block}.wy-control-group.fluid-input input[type=color],.wy-control-group.fluid-input input[type=date],.wy-control-group.fluid-input input[type=datetime-local],.wy-control-group.fluid-input input[type=datetime],.wy-control-group.fluid-input input[type=email],.wy-control-group.fluid-input input[type=month],.wy-control-group.fluid-input input[type=number],.wy-control-group.fluid-input input[type=password],.wy-control-group.fluid-input input[type=search],.wy-control-group.fluid-input input[type=tel],.wy-control-group.fluid-input input[type=text],.wy-control-group.fluid-input input[type=time],.wy-control-group.fluid-input input[type=url],.wy-control-group.fluid-input input[type=week]{width:100%}.wy-form-message-inline{padding-left:.3em;color:#666;font-size:90%}.wy-form-message{display:block;color:#999;font-size:70%;margin-top:.3125em;font-style:italic}.wy-form-message p{font-size:inherit;font-style:italic;margin-bottom:6px}.wy-form-message p:last-child{margin-bottom:0}input{line-height:normal}input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;*overflow:visible}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week]{-webkit-appearance:none;padding:6px;display:inline-block;border:1px solid #ccc;font-size:80%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 3px #ddd;border-radius:0;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}input[type=datetime-local]{padding:.34375em .625em}input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{padding:0;margin-right:.3125em;*height:13px;*width:13px}input[type=checkbox],input[type=radio],input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{outline:0;outline:thin dotted\9;border-color:#333}input.no-focus:focus{border-color:#ccc!important}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin dotted #333;outline:1px auto #129fea}input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled]{cursor:not-allowed;background-color:#fafafa}input:focus:invalid,select:focus:invalid,textarea:focus:invalid{color:#e74c3c;border:1px solid #e74c3c}input:focus:invalid:focus,select:focus:invalid:focus,textarea:focus:invalid:focus{border-color:#e74c3c}input[type=checkbox]:focus:invalid:focus,input[type=file]:focus:invalid:focus,input[type=radio]:focus:invalid:focus{outline-color:#e74c3c}input.wy-input-large{padding:12px;font-size:100%}textarea{overflow:auto;vertical-align:top;width:100%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif}select,textarea{padding:.5em .625em;display:inline-block;border:1px solid #ccc;font-size:80%;box-shadow:inset 0 1px 3px #ddd;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}select{border:1px solid #ccc;background-color:#fff}select[multiple]{height:auto}select:focus,textarea:focus{outline:0}input[readonly],select[disabled],select[readonly],textarea[disabled],textarea[readonly]{cursor:not-allowed;background-color:#fafafa}input[type=checkbox][disabled],input[type=radio][disabled]{cursor:not-allowed}.wy-checkbox,.wy-radio{margin:6px 0;color:#404040;display:block}.wy-checkbox input,.wy-radio input{vertical-align:baseline}.wy-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-input-prefix,.wy-input-suffix{white-space:nowrap;padding:6px}.wy-input-prefix .wy-input-context,.wy-input-suffix .wy-input-context{line-height:27px;padding:0 8px;display:inline-block;font-size:80%;background-color:#f3f6f6;border:1px solid #ccc;color:#999}.wy-input-suffix .wy-input-context{border-left:0}.wy-input-prefix .wy-input-context{border-right:0}.wy-switch{position:relative;display:block;height:24px;margin-top:12px;cursor:pointer}.wy-switch:before{left:0;top:0;width:36px;height:12px;background:#ccc}.wy-switch:after,.wy-switch:before{position:absolute;content:"";display:block;border-radius:4px;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.wy-switch:after{width:18px;height:18px;background:#999;left:-3px;top:-3px}.wy-switch span{position:absolute;left:48px;display:block;font-size:12px;color:#ccc;line-height:1}.wy-switch.active:before{background:#1e8449}.wy-switch.active:after{left:24px;background:#27ae60}.wy-switch.disabled{cursor:not-allowed;opacity:.8}.wy-control-group.wy-control-group-error .wy-form-message,.wy-control-group.wy-control-group-error>label{color:#e74c3c}.wy-control-group.wy-control-group-error input[type=color],.wy-control-group.wy-control-group-error input[type=date],.wy-control-group.wy-control-group-error input[type=datetime-local],.wy-control-group.wy-control-group-error input[type=datetime],.wy-control-group.wy-control-group-error input[type=email],.wy-control-group.wy-control-group-error input[type=month],.wy-control-group.wy-control-group-error input[type=number],.wy-control-group.wy-control-group-error input[type=password],.wy-control-group.wy-control-group-error input[type=search],.wy-control-group.wy-control-group-error input[type=tel],.wy-control-group.wy-control-group-error input[type=text],.wy-control-group.wy-control-group-error input[type=time],.wy-control-group.wy-control-group-error input[type=url],.wy-control-group.wy-control-group-error input[type=week],.wy-control-group.wy-control-group-error textarea{border:1px solid #e74c3c}.wy-inline-validate{white-space:nowrap}.wy-inline-validate .wy-input-context{padding:.5em .625em;display:inline-block;font-size:80%}.wy-inline-validate.wy-inline-validate-success .wy-input-context{color:#27ae60}.wy-inline-validate.wy-inline-validate-danger .wy-input-context{color:#e74c3c}.wy-inline-validate.wy-inline-validate-warning .wy-input-context{color:#e67e22}.wy-inline-validate.wy-inline-validate-info .wy-input-context{color:#2980b9}.rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.mirror{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1)}.mirror.rotate-90{-webkit-transform:scaleX(-1) rotate(90deg);-moz-transform:scaleX(-1) rotate(90deg);-ms-transform:scaleX(-1) rotate(90deg);-o-transform:scaleX(-1) rotate(90deg);transform:scaleX(-1) rotate(90deg)}.mirror.rotate-180{-webkit-transform:scaleX(-1) rotate(180deg);-moz-transform:scaleX(-1) rotate(180deg);-ms-transform:scaleX(-1) rotate(180deg);-o-transform:scaleX(-1) rotate(180deg);transform:scaleX(-1) rotate(180deg)}.mirror.rotate-270{-webkit-transform:scaleX(-1) rotate(270deg);-moz-transform:scaleX(-1) rotate(270deg);-ms-transform:scaleX(-1) rotate(270deg);-o-transform:scaleX(-1) rotate(270deg);transform:scaleX(-1) rotate(270deg)}@media only screen and (max-width:480px){.wy-form button[type=submit]{margin:.7em 0 0}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=text],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week],.wy-form label{margin-bottom:.3em;display:block}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week]{margin-bottom:0}.wy-form-aligned .wy-control-group label{margin-bottom:.3em;text-align:left;display:block;width:100%}.wy-form-aligned .wy-control{margin:1.5em 0 0}.wy-form-message,.wy-form-message-inline,.wy-form .wy-help-inline{display:block;font-size:80%;padding:6px 0}}@media screen and (max-width:768px){.tablet-hide{display:none}}@media screen and (max-width:480px){.mobile-hide{display:none}}.float-left{float:left}.float-right{float:right}.full-width{width:100%}.rst-content table.docutils,.rst-content table.field-list,.wy-table{border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px}.rst-content table.docutils caption,.rst-content table.field-list caption,.wy-table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.rst-content table.docutils td,.rst-content table.docutils th,.rst-content table.field-list td,.rst-content table.field-list th,.wy-table td,.wy-table th{font-size:90%;margin:0;overflow:visible;padding:8px 16px}.rst-content table.docutils td:first-child,.rst-content table.docutils th:first-child,.rst-content table.field-list td:first-child,.rst-content table.field-list th:first-child,.wy-table td:first-child,.wy-table th:first-child{border-left-width:0}.rst-content table.docutils thead,.rst-content table.field-list thead,.wy-table thead{color:#000;text-align:left;vertical-align:bottom;white-space:nowrap}.rst-content table.docutils thead th,.rst-content table.field-list thead th,.wy-table thead th{font-weight:700;border-bottom:2px solid #e1e4e5}.rst-content table.docutils td,.rst-content table.field-list td,.wy-table td{background-color:transparent;vertical-align:middle}.rst-content table.docutils td p,.rst-content table.field-list td p,.wy-table td p{line-height:18px}.rst-content table.docutils td p:last-child,.rst-content table.field-list td p:last-child,.wy-table td p:last-child{margin-bottom:0}.rst-content table.docutils .wy-table-cell-min,.rst-content table.field-list .wy-table-cell-min,.wy-table .wy-table-cell-min{width:1%;padding-right:0}.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox],.wy-table .wy-table-cell-min input[type=checkbox]{margin:0}.wy-table-secondary{color:grey;font-size:90%}.wy-table-tertiary{color:grey;font-size:80%}.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,.wy-table-backed,.wy-table-odd td,.wy-table-striped tr:nth-child(2n-1) td{background-color:#f3f6f6}.rst-content table.docutils,.wy-table-bordered-all{border:1px solid #e1e4e5}.rst-content table.docutils td,.wy-table-bordered-all td{border-bottom:1px solid #e1e4e5;border-left:1px solid #e1e4e5}.rst-content table.docutils tbody>tr:last-child td,.wy-table-bordered-all tbody>tr:last-child td{border-bottom-width:0}.wy-table-bordered{border:1px solid #e1e4e5}.wy-table-bordered-rows td{border-bottom:1px solid #e1e4e5}.wy-table-bordered-rows tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal td,.wy-table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #e1e4e5}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-responsive{margin-bottom:24px;max-width:100%;overflow:auto}.wy-table-responsive table{margin-bottom:0!important}.wy-table-responsive table td,.wy-table-responsive table th{white-space:nowrap}a{color:#2980b9;text-decoration:none;cursor:pointer}a:hover{color:#3091d1}a:visited{color:#9b59b6}html{height:100%}body,html{overflow-x:hidden}body{font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;font-weight:400;color:#404040;min-height:100%;background:#edf0f2}.wy-text-left{text-align:left}.wy-text-center{text-align:center}.wy-text-right{text-align:right}.wy-text-large{font-size:120%}.wy-text-normal{font-size:100%}.wy-text-small,small{font-size:80%}.wy-text-strike{text-decoration:line-through}.wy-text-warning{color:#e67e22!important}a.wy-text-warning:hover{color:#eb9950!important}.wy-text-info{color:#2980b9!important}a.wy-text-info:hover{color:#409ad5!important}.wy-text-success{color:#27ae60!important}a.wy-text-success:hover{color:#36d278!important}.wy-text-danger{color:#e74c3c!important}a.wy-text-danger:hover{color:#ed7669!important}.wy-text-neutral{color:#404040!important}a.wy-text-neutral:hover{color:#595959!important}.rst-content .toctree-wrapper>p.caption,h1,h2,h3,h4,h5,h6,legend{margin-top:0;font-weight:700;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif}p{line-height:24px;font-size:16px;margin:0 0 24px}h1{font-size:175%}.rst-content .toctree-wrapper>p.caption,h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}hr{display:block;height:1px;border:0;border-top:1px solid #e1e4e5;margin:24px 0;padding:0}.rst-content code,.rst-content tt,code{white-space:nowrap;max-width:100%;background:#fff;border:1px solid #e1e4e5;font-size:75%;padding:0 5px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#e74c3c;overflow-x:auto}.rst-content tt.code-large,code.code-large{font-size:90%}.rst-content .section ul,.rst-content .toctree-wrapper ul,.rst-content section ul,.wy-plain-list-disc,article ul{list-style:disc;line-height:24px;margin-bottom:24px}.rst-content .section ul li,.rst-content .toctree-wrapper ul li,.rst-content section ul li,.wy-plain-list-disc li,article ul li{list-style:disc;margin-left:24px}.rst-content .section ul li p:last-child,.rst-content .section ul li ul,.rst-content .toctree-wrapper ul li p:last-child,.rst-content .toctree-wrapper ul li ul,.rst-content section ul li p:last-child,.rst-content section ul li ul,.wy-plain-list-disc li p:last-child,.wy-plain-list-disc li ul,article ul li p:last-child,article ul li ul{margin-bottom:0}.rst-content .section ul li li,.rst-content .toctree-wrapper ul li li,.rst-content section ul li li,.wy-plain-list-disc li li,article ul li li{list-style:circle}.rst-content .section ul li li li,.rst-content .toctree-wrapper ul li li li,.rst-content section ul li li li,.wy-plain-list-disc li li li,article ul li li li{list-style:square}.rst-content .section ul li ol li,.rst-content .toctree-wrapper ul li ol li,.rst-content section ul li ol li,.wy-plain-list-disc li ol li,article ul li ol li{list-style:decimal}.rst-content .section ol,.rst-content .section ol.arabic,.rst-content .toctree-wrapper ol,.rst-content .toctree-wrapper ol.arabic,.rst-content section ol,.rst-content section ol.arabic,.wy-plain-list-decimal,article ol{list-style:decimal;line-height:24px;margin-bottom:24px}.rst-content .section ol.arabic li,.rst-content .section ol li,.rst-content .toctree-wrapper ol.arabic li,.rst-content .toctree-wrapper ol li,.rst-content section ol.arabic li,.rst-content section ol li,.wy-plain-list-decimal li,article ol li{list-style:decimal;margin-left:24px}.rst-content .section ol.arabic li ul,.rst-content .section ol li p:last-child,.rst-content .section ol li ul,.rst-content .toctree-wrapper ol.arabic li ul,.rst-content .toctree-wrapper ol li p:last-child,.rst-content .toctree-wrapper ol li ul,.rst-content section ol.arabic li ul,.rst-content section ol li p:last-child,.rst-content section ol li ul,.wy-plain-list-decimal li p:last-child,.wy-plain-list-decimal li ul,article ol li p:last-child,article ol li ul{margin-bottom:0}.rst-content .section ol.arabic li ul li,.rst-content .section ol li ul li,.rst-content .toctree-wrapper ol.arabic li ul li,.rst-content .toctree-wrapper ol li ul li,.rst-content section ol.arabic li ul li,.rst-content section ol li ul li,.wy-plain-list-decimal li ul li,article ol li ul li{list-style:disc}.wy-breadcrumbs{*zoom:1}.wy-breadcrumbs:after,.wy-breadcrumbs:before{display:table;content:""}.wy-breadcrumbs:after{clear:both}.wy-breadcrumbs>li{display:inline-block;padding-top:5px}.wy-breadcrumbs>li.wy-breadcrumbs-aside{float:right}.rst-content .wy-breadcrumbs>li code,.rst-content .wy-breadcrumbs>li tt,.wy-breadcrumbs>li .rst-content tt,.wy-breadcrumbs>li code{all:inherit;color:inherit}.breadcrumb-item:before{content:"/";color:#bbb;font-size:13px;padding:0 6px 0 3px}.wy-breadcrumbs-extra{margin-bottom:0;color:#b3b3b3;font-size:80%;display:inline-block}@media screen and (max-width:480px){.wy-breadcrumbs-extra,.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}@media print{.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}html{font-size:16px}.wy-affix{position:fixed;top:1.618em}.wy-menu a:hover{text-decoration:none}.wy-menu-horiz{*zoom:1}.wy-menu-horiz:after,.wy-menu-horiz:before{display:table;content:""}.wy-menu-horiz:after{clear:both}.wy-menu-horiz li,.wy-menu-horiz ul{display:inline-block}.wy-menu-horiz li:hover{background:hsla(0,0%,100%,.1)}.wy-menu-horiz li.divide-left{border-left:1px solid #404040}.wy-menu-horiz li.divide-right{border-right:1px solid #404040}.wy-menu-horiz a{height:32px;display:inline-block;line-height:32px;padding:0 16px}.wy-menu-vertical{width:300px}.wy-menu-vertical header,.wy-menu-vertical p.caption{color:#55a5d9;height:32px;line-height:32px;padding:0 1.618em;margin:12px 0 0;display:block;font-weight:700;text-transform:uppercase;font-size:85%;white-space:nowrap}.wy-menu-vertical ul{margin-bottom:0}.wy-menu-vertical li.divide-top{border-top:1px solid #404040}.wy-menu-vertical li.divide-bottom{border-bottom:1px solid #404040}.wy-menu-vertical li.current{background:#e3e3e3}.wy-menu-vertical li.current a{color:grey;border-right:1px solid #c9c9c9;padding:.4045em 2.427em}.wy-menu-vertical li.current a:hover{background:#d6d6d6}.rst-content .wy-menu-vertical li tt,.wy-menu-vertical li .rst-content tt,.wy-menu-vertical li code{border:none;background:inherit;color:inherit;padding-left:0;padding-right:0}.wy-menu-vertical li button.toctree-expand{display:block;float:left;margin-left:-1.2em;line-height:18px;color:#4d4d4d;border:none;background:none;padding:0}.wy-menu-vertical li.current>a,.wy-menu-vertical li.on a{color:#404040;font-weight:700;position:relative;background:#fcfcfc;border:none;padding:.4045em 1.618em}.wy-menu-vertical li.current>a:hover,.wy-menu-vertical li.on a:hover{background:#fcfcfc}.wy-menu-vertical li.current>a:hover button.toctree-expand,.wy-menu-vertical li.on a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand{display:block;line-height:18px;color:#333}.wy-menu-vertical li.toctree-l1.current>a{border-bottom:1px solid #c9c9c9;border-top:1px solid #c9c9c9}.wy-menu-vertical .toctree-l1.current .toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .toctree-l11>ul{display:none}.wy-menu-vertical .toctree-l1.current .current.toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .current.toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .current.toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .current.toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .current.toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .current.toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .current.toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .current.toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .current.toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .current.toctree-l11>ul{display:block}.wy-menu-vertical li.toctree-l3,.wy-menu-vertical li.toctree-l4{font-size:.9em}.wy-menu-vertical li.toctree-l2 a,.wy-menu-vertical li.toctree-l3 a,.wy-menu-vertical li.toctree-l4 a,.wy-menu-vertical li.toctree-l5 a,.wy-menu-vertical li.toctree-l6 a,.wy-menu-vertical li.toctree-l7 a,.wy-menu-vertical li.toctree-l8 a,.wy-menu-vertical li.toctree-l9 a,.wy-menu-vertical li.toctree-l10 a{color:#404040}.wy-menu-vertical li.toctree-l2 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l3 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l4 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l5 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l6 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l7 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l8 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l9 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l10 a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a,.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a,.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a,.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a,.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a,.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a,.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a,.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{display:block}.wy-menu-vertical li.toctree-l2.current>a{padding:.4045em 2.427em}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{padding:.4045em 1.618em .4045em 4.045em}.wy-menu-vertical li.toctree-l3.current>a{padding:.4045em 4.045em}.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{padding:.4045em 1.618em .4045em 5.663em}.wy-menu-vertical li.toctree-l4.current>a{padding:.4045em 5.663em}.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a{padding:.4045em 1.618em .4045em 7.281em}.wy-menu-vertical li.toctree-l5.current>a{padding:.4045em 7.281em}.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a{padding:.4045em 1.618em .4045em 8.899em}.wy-menu-vertical li.toctree-l6.current>a{padding:.4045em 8.899em}.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a{padding:.4045em 1.618em .4045em 10.517em}.wy-menu-vertical li.toctree-l7.current>a{padding:.4045em 10.517em}.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a{padding:.4045em 1.618em .4045em 12.135em}.wy-menu-vertical li.toctree-l8.current>a{padding:.4045em 12.135em}.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a{padding:.4045em 1.618em .4045em 13.753em}.wy-menu-vertical li.toctree-l9.current>a{padding:.4045em 13.753em}.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a{padding:.4045em 1.618em .4045em 15.371em}.wy-menu-vertical li.toctree-l10.current>a{padding:.4045em 15.371em}.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{padding:.4045em 1.618em .4045em 16.989em}.wy-menu-vertical li.toctree-l2.current>a,.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{background:#c9c9c9}.wy-menu-vertical li.toctree-l2 button.toctree-expand{color:#a3a3a3}.wy-menu-vertical li.toctree-l3.current>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{background:#bdbdbd}.wy-menu-vertical li.toctree-l3 button.toctree-expand{color:#969696}.wy-menu-vertical li.current ul{display:block}.wy-menu-vertical li ul{margin-bottom:0;display:none}.wy-menu-vertical li ul li a{margin-bottom:0;color:#d9d9d9;font-weight:400}.wy-menu-vertical a{line-height:18px;padding:.4045em 1.618em;display:block;position:relative;font-size:90%;color:#d9d9d9}.wy-menu-vertical a:hover{background-color:#4e4a4a;cursor:pointer}.wy-menu-vertical a:hover button.toctree-expand{color:#d9d9d9}.wy-menu-vertical a:active{background-color:#2980b9;cursor:pointer;color:#fff}.wy-menu-vertical a:active button.toctree-expand{color:#fff}.wy-side-nav-search{display:block;width:300px;padding:.809em;margin-bottom:.809em;z-index:200;background-color:#2980b9;text-align:center;color:#fcfcfc}.wy-side-nav-search input[type=text]{width:100%;border-radius:50px;padding:6px 12px;border-color:#2472a4}.wy-side-nav-search img{display:block;margin:auto auto .809em;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-side-nav-search .wy-dropdown>a,.wy-side-nav-search>a{color:#fcfcfc;font-size:100%;font-weight:700;display:inline-block;padding:4px 6px;margin-bottom:.809em;max-width:100%}.wy-side-nav-search .wy-dropdown>a:hover,.wy-side-nav-search .wy-dropdown>aactive,.wy-side-nav-search .wy-dropdown>afocus,.wy-side-nav-search>a:hover,.wy-side-nav-search>aactive,.wy-side-nav-search>afocus{background:hsla(0,0%,100%,.1)}.wy-side-nav-search .wy-dropdown>a img.logo,.wy-side-nav-search>a img.logo{display:block;margin:0 auto;height:auto;width:auto;border-radius:0;max-width:100%;background:transparent}.wy-side-nav-search .wy-dropdown>a.icon,.wy-side-nav-search>a.icon{display:block}.wy-side-nav-search .wy-dropdown>a.icon img.logo,.wy-side-nav-search>a.icon img.logo{margin-top:.85em}.wy-side-nav-search>div.switch-menus{position:relative;display:block;margin-top:-.4045em;margin-bottom:.809em;font-weight:400;color:hsla(0,0%,100%,.3)}.wy-side-nav-search>div.switch-menus>div.language-switch,.wy-side-nav-search>div.switch-menus>div.version-switch{display:inline-block;padding:.2em}.wy-side-nav-search>div.switch-menus>div.language-switch select,.wy-side-nav-search>div.switch-menus>div.version-switch select{display:inline-block;margin-right:-2rem;padding-right:2rem;max-width:240px;text-align-last:center;background:none;border:none;border-radius:0;box-shadow:none;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;font-size:1em;font-weight:400;color:hsla(0,0%,100%,.3);cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none}.wy-side-nav-search>div.switch-menus>div.language-switch select:active,.wy-side-nav-search>div.switch-menus>div.language-switch select:focus,.wy-side-nav-search>div.switch-menus>div.language-switch select:hover,.wy-side-nav-search>div.switch-menus>div.version-switch select:active,.wy-side-nav-search>div.switch-menus>div.version-switch select:focus,.wy-side-nav-search>div.switch-menus>div.version-switch select:hover{background:hsla(0,0%,100%,.1);color:hsla(0,0%,100%,.5)}.wy-side-nav-search>div.switch-menus>div.language-switch select option,.wy-side-nav-search>div.switch-menus>div.version-switch select option{color:#000}.wy-side-nav-search>div.switch-menus>div.language-switch:has(>select):after,.wy-side-nav-search>div.switch-menus>div.version-switch:has(>select):after{display:inline-block;width:1.5em;height:100%;padding:.1em;content:"\f0d7";font-size:1em;line-height:1.2em;font-family:FontAwesome;text-align:center;pointer-events:none;box-sizing:border-box}.wy-nav .wy-menu-vertical header{color:#2980b9}.wy-nav .wy-menu-vertical a{color:#b3b3b3}.wy-nav .wy-menu-vertical a:hover{background-color:#2980b9;color:#fff}[data-menu-wrap]{-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;transition:all .2s ease-in;position:absolute;opacity:1;width:100%;opacity:0}[data-menu-wrap].move-center{left:0;right:auto;opacity:1}[data-menu-wrap].move-left{right:auto;left:-100%;opacity:0}[data-menu-wrap].move-right{right:-100%;left:auto;opacity:0}.wy-body-for-nav{background:#fcfcfc}.wy-grid-for-nav{position:absolute;width:100%;height:100%}.wy-nav-side{position:fixed;top:0;bottom:0;left:0;padding-bottom:2em;width:300px;overflow-x:hidden;overflow-y:hidden;min-height:100%;color:#9b9b9b;background:#343131;z-index:200}.wy-side-scroll{width:320px;position:relative;overflow-x:hidden;overflow-y:scroll;height:100%}.wy-nav-top{display:none;background:#2980b9;color:#fff;padding:.4045em .809em;position:relative;line-height:50px;text-align:center;font-size:100%;*zoom:1}.wy-nav-top:after,.wy-nav-top:before{display:table;content:""}.wy-nav-top:after{clear:both}.wy-nav-top a{color:#fff;font-weight:700}.wy-nav-top img{margin-right:12px;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-nav-top i{font-size:30px;float:left;cursor:pointer;padding-top:inherit}.wy-nav-content-wrap{margin-left:300px;background:#fcfcfc;min-height:100%}.wy-nav-content{padding:1.618em 3.236em;height:100%;max-width:800px;margin:auto}.wy-body-mask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.2);display:none;z-index:499}.wy-body-mask.on{display:block}footer{color:grey}footer p{margin-bottom:12px}.rst-content footer span.commit tt,footer span.commit .rst-content tt,footer span.commit code{padding:0;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:1em;background:none;border:none;color:grey}.rst-footer-buttons{*zoom:1}.rst-footer-buttons:after,.rst-footer-buttons:before{width:100%;display:table;content:""}.rst-footer-buttons:after{clear:both}.rst-breadcrumbs-buttons{margin-top:12px;*zoom:1}.rst-breadcrumbs-buttons:after,.rst-breadcrumbs-buttons:before{display:table;content:""}.rst-breadcrumbs-buttons:after{clear:both}#search-results .search li{margin-bottom:24px;border-bottom:1px solid #e1e4e5;padding-bottom:24px}#search-results .search li:first-child{border-top:1px solid #e1e4e5;padding-top:24px}#search-results .search li a{font-size:120%;margin-bottom:12px;display:inline-block}#search-results .context{color:grey;font-size:90%}.genindextable li>ul{margin-left:24px}@media screen and (max-width:768px){.wy-body-for-nav{background:#fcfcfc}.wy-nav-top{display:block}.wy-nav-side{left:-300px}.wy-nav-side.shift{width:85%;left:0}.wy-menu.wy-menu-vertical,.wy-side-nav-search,.wy-side-scroll{width:auto}.wy-nav-content-wrap{margin-left:0}.wy-nav-content-wrap .wy-nav-content{padding:1.618em}.wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}}@media screen and (min-width:1100px){.wy-nav-content-wrap{background:rgba(0,0,0,.05)}.wy-nav-content{margin:0;background:#fcfcfc}}@media print{.rst-versions,.wy-nav-side,footer{display:none}.wy-nav-content-wrap{margin-left:0}}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60;*zoom:1}.rst-versions .rst-current-version:after,.rst-versions .rst-current-version:before{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-content .code-block-caption .rst-versions .rst-current-version .headerlink,.rst-content .eqno .rst-versions .rst-current-version .headerlink,.rst-content .rst-versions .rst-current-version .admonition-title,.rst-content code.download .rst-versions .rst-current-version span:first-child,.rst-content dl dt .rst-versions .rst-current-version .headerlink,.rst-content h1 .rst-versions .rst-current-version .headerlink,.rst-content h2 .rst-versions .rst-current-version .headerlink,.rst-content h3 .rst-versions .rst-current-version .headerlink,.rst-content h4 .rst-versions .rst-current-version .headerlink,.rst-content h5 .rst-versions .rst-current-version .headerlink,.rst-content h6 .rst-versions .rst-current-version .headerlink,.rst-content p .rst-versions .rst-current-version .headerlink,.rst-content table>caption .rst-versions .rst-current-version .headerlink,.rst-content tt.download .rst-versions .rst-current-version span:first-child,.rst-versions .rst-current-version .fa,.rst-versions .rst-current-version .icon,.rst-versions .rst-current-version .rst-content .admonition-title,.rst-versions .rst-current-version .rst-content .code-block-caption .headerlink,.rst-versions .rst-current-version .rst-content .eqno .headerlink,.rst-versions .rst-current-version .rst-content code.download span:first-child,.rst-versions .rst-current-version .rst-content dl dt .headerlink,.rst-versions .rst-current-version .rst-content h1 .headerlink,.rst-versions .rst-current-version .rst-content h2 .headerlink,.rst-versions .rst-current-version .rst-content h3 .headerlink,.rst-versions .rst-current-version .rst-content h4 .headerlink,.rst-versions .rst-current-version .rst-content h5 .headerlink,.rst-versions .rst-current-version .rst-content h6 .headerlink,.rst-versions .rst-current-version .rst-content p .headerlink,.rst-versions .rst-current-version .rst-content table>caption .headerlink,.rst-versions .rst-current-version .rst-content tt.download span:first-child,.rst-versions .rst-current-version .wy-menu-vertical li button.toctree-expand,.wy-menu-vertical li .rst-versions .rst-current-version button.toctree-expand{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px}.rst-content .toctree-wrapper>p.caption,.rst-content h1,.rst-content h2,.rst-content h3,.rst-content h4,.rst-content h5,.rst-content h6{margin-bottom:24px}.rst-content img{max-width:100%;height:auto}.rst-content div.figure,.rst-content figure{margin-bottom:24px}.rst-content div.figure .caption-text,.rst-content figure .caption-text{font-style:italic}.rst-content div.figure p:last-child.caption,.rst-content figure p:last-child.caption{margin-bottom:0}.rst-content div.figure.align-center,.rst-content figure.align-center{text-align:center}.rst-content .section>a>img,.rst-content .section>img,.rst-content section>a>img,.rst-content section>img{margin-bottom:24px}.rst-content abbr[title]{text-decoration:none}.rst-content.style-external-links a.reference.external:after{font-family:FontAwesome;content:"\f08e";color:#b3b3b3;vertical-align:super;font-size:60%;margin:0 .2em}.rst-content blockquote{margin-left:24px;line-height:24px;margin-bottom:24px}.rst-content pre.literal-block{white-space:pre;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;display:block;overflow:auto}.rst-content div[class^=highlight],.rst-content pre.literal-block{border:1px solid #e1e4e5;overflow-x:auto;margin:1px 0 24px}.rst-content div[class^=highlight] div[class^=highlight],.rst-content pre.literal-block div[class^=highlight]{padding:0;border:none;margin:0}.rst-content div[class^=highlight] td.code{width:100%}.rst-content .linenodiv pre{border-right:1px solid #e6e9ea;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;user-select:none;pointer-events:none}.rst-content div[class^=highlight] pre{white-space:pre;margin:0;padding:12px;display:block;overflow:auto}.rst-content div[class^=highlight] pre .hll{display:block;margin:0 -12px;padding:0 12px}.rst-content .linenodiv pre,.rst-content div[class^=highlight] pre,.rst-content pre.literal-block{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:12px;line-height:1.4}.rst-content div.highlight .gp,.rst-content div.highlight span.linenos{user-select:none;pointer-events:none}.rst-content div.highlight span.linenos{display:inline-block;padding-left:0;padding-right:12px;margin-right:12px;border-right:1px solid #e6e9ea}.rst-content .code-block-caption{font-style:italic;font-size:85%;line-height:1;padding:1em 0;text-align:center}@media print{.rst-content .codeblock,.rst-content div[class^=highlight],.rst-content div[class^=highlight] pre{white-space:pre-wrap}}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning{clear:both}.rst-content .admonition-todo .last,.rst-content .admonition-todo>:last-child,.rst-content .admonition .last,.rst-content .admonition>:last-child,.rst-content .attention .last,.rst-content .attention>:last-child,.rst-content .caution .last,.rst-content .caution>:last-child,.rst-content .danger .last,.rst-content .danger>:last-child,.rst-content .error .last,.rst-content .error>:last-child,.rst-content .hint .last,.rst-content .hint>:last-child,.rst-content .important .last,.rst-content .important>:last-child,.rst-content .note .last,.rst-content .note>:last-child,.rst-content .seealso .last,.rst-content .seealso>:last-child,.rst-content .tip .last,.rst-content .tip>:last-child,.rst-content .warning .last,.rst-content .warning>:last-child{margin-bottom:0}.rst-content .admonition-title:before{margin-right:4px}.rst-content .admonition table{border-color:rgba(0,0,0,.1)}.rst-content .admonition table td,.rst-content .admonition table th{background:transparent!important;border-color:rgba(0,0,0,.1)!important}.rst-content .section ol.loweralpha,.rst-content .section ol.loweralpha>li,.rst-content .toctree-wrapper ol.loweralpha,.rst-content .toctree-wrapper ol.loweralpha>li,.rst-content section ol.loweralpha,.rst-content section ol.loweralpha>li{list-style:lower-alpha}.rst-content .section ol.upperalpha,.rst-content .section ol.upperalpha>li,.rst-content .toctree-wrapper ol.upperalpha,.rst-content .toctree-wrapper ol.upperalpha>li,.rst-content section ol.upperalpha,.rst-content section ol.upperalpha>li{list-style:upper-alpha}.rst-content .section ol li>*,.rst-content .section ul li>*,.rst-content .toctree-wrapper ol li>*,.rst-content .toctree-wrapper ul li>*,.rst-content section ol li>*,.rst-content section ul li>*{margin-top:12px;margin-bottom:12px}.rst-content .section ol li>:first-child,.rst-content .section ul li>:first-child,.rst-content .toctree-wrapper ol li>:first-child,.rst-content .toctree-wrapper ul li>:first-child,.rst-content section ol li>:first-child,.rst-content section ul li>:first-child{margin-top:0}.rst-content .section ol li>p,.rst-content .section ol li>p:last-child,.rst-content .section ul li>p,.rst-content .section ul li>p:last-child,.rst-content .toctree-wrapper ol li>p,.rst-content .toctree-wrapper ol li>p:last-child,.rst-content .toctree-wrapper ul li>p,.rst-content .toctree-wrapper ul li>p:last-child,.rst-content section ol li>p,.rst-content section ol li>p:last-child,.rst-content section ul li>p,.rst-content section ul li>p:last-child{margin-bottom:12px}.rst-content .section ol li>p:only-child,.rst-content .section ol li>p:only-child:last-child,.rst-content .section ul li>p:only-child,.rst-content .section ul li>p:only-child:last-child,.rst-content .toctree-wrapper ol li>p:only-child,.rst-content .toctree-wrapper ol li>p:only-child:last-child,.rst-content .toctree-wrapper ul li>p:only-child,.rst-content .toctree-wrapper ul li>p:only-child:last-child,.rst-content section ol li>p:only-child,.rst-content section ol li>p:only-child:last-child,.rst-content section ul li>p:only-child,.rst-content section ul li>p:only-child:last-child{margin-bottom:0}.rst-content .section ol li>ol,.rst-content .section ol li>ul,.rst-content .section ul li>ol,.rst-content .section ul li>ul,.rst-content .toctree-wrapper ol li>ol,.rst-content .toctree-wrapper ol li>ul,.rst-content .toctree-wrapper ul li>ol,.rst-content .toctree-wrapper ul li>ul,.rst-content section ol li>ol,.rst-content section ol li>ul,.rst-content section ul li>ol,.rst-content section ul li>ul{margin-bottom:12px}.rst-content .section ol.simple li>*,.rst-content .section ol.simple li ol,.rst-content .section ol.simple li ul,.rst-content .section ul.simple li>*,.rst-content .section ul.simple li ol,.rst-content .section ul.simple li ul,.rst-content .toctree-wrapper ol.simple li>*,.rst-content .toctree-wrapper ol.simple li ol,.rst-content .toctree-wrapper ol.simple li ul,.rst-content .toctree-wrapper ul.simple li>*,.rst-content .toctree-wrapper ul.simple li ol,.rst-content .toctree-wrapper ul.simple li ul,.rst-content section ol.simple li>*,.rst-content section ol.simple li ol,.rst-content section ol.simple li ul,.rst-content section ul.simple li>*,.rst-content section ul.simple li ol,.rst-content section ul.simple li ul{margin-top:0;margin-bottom:0}.rst-content .line-block{margin-left:0;margin-bottom:24px;line-height:24px}.rst-content .line-block .line-block{margin-left:24px;margin-bottom:0}.rst-content .topic-title{font-weight:700;margin-bottom:12px}.rst-content .toc-backref{color:#404040}.rst-content .align-right{float:right;margin:0 0 24px 24px}.rst-content .align-left{float:left;margin:0 24px 24px 0}.rst-content .align-center{margin:auto}.rst-content .align-center:not(table){display:block}.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink{opacity:0;font-size:14px;font-family:FontAwesome;margin-left:.5em}.rst-content .code-block-caption .headerlink:focus,.rst-content .code-block-caption:hover .headerlink,.rst-content .eqno .headerlink:focus,.rst-content .eqno:hover .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink:focus,.rst-content .toctree-wrapper>p.caption:hover .headerlink,.rst-content dl dt .headerlink:focus,.rst-content dl dt:hover .headerlink,.rst-content h1 .headerlink:focus,.rst-content h1:hover .headerlink,.rst-content h2 .headerlink:focus,.rst-content h2:hover .headerlink,.rst-content h3 .headerlink:focus,.rst-content h3:hover .headerlink,.rst-content h4 .headerlink:focus,.rst-content h4:hover .headerlink,.rst-content h5 .headerlink:focus,.rst-content h5:hover .headerlink,.rst-content h6 .headerlink:focus,.rst-content h6:hover .headerlink,.rst-content p.caption .headerlink:focus,.rst-content p.caption:hover .headerlink,.rst-content p .headerlink:focus,.rst-content p:hover .headerlink,.rst-content table>caption .headerlink:focus,.rst-content table>caption:hover .headerlink{opacity:1}.rst-content p a{overflow-wrap:anywhere}.rst-content .wy-table td p,.rst-content .wy-table td ul,.rst-content .wy-table th p,.rst-content .wy-table th ul,.rst-content table.docutils td p,.rst-content table.docutils td ul,.rst-content table.docutils th p,.rst-content table.docutils th ul,.rst-content table.field-list td p,.rst-content table.field-list td ul,.rst-content table.field-list th p,.rst-content table.field-list th ul{font-size:inherit}.rst-content .btn:focus{outline:2px solid}.rst-content table>caption .headerlink:after{font-size:12px}.rst-content .centered{text-align:center}.rst-content .sidebar{float:right;width:40%;display:block;margin:0 0 24px 24px;padding:24px;background:#f3f6f6;border:1px solid #e1e4e5}.rst-content .sidebar dl,.rst-content .sidebar p,.rst-content .sidebar ul{font-size:90%}.rst-content .sidebar .last,.rst-content .sidebar>:last-child{margin-bottom:0}.rst-content .sidebar .sidebar-title{display:block;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif;font-weight:700;background:#e1e4e5;padding:6px 12px;margin:-24px -24px 24px;font-size:100%}.rst-content .highlighted{background:#f1c40f;box-shadow:0 0 0 2px #f1c40f;display:inline;font-weight:700}.rst-content .citation-reference,.rst-content .footnote-reference{vertical-align:baseline;position:relative;top:-.4em;line-height:0;font-size:90%}.rst-content .citation-reference>span.fn-bracket,.rst-content .footnote-reference>span.fn-bracket{display:none}.rst-content .hlist{width:100%}.rst-content dl dt span.classifier:before{content:" : "}.rst-content dl dt span.classifier-delimiter{display:none!important}html.writer-html4 .rst-content table.docutils.citation,html.writer-html4 .rst-content table.docutils.footnote{background:none;border:none}html.writer-html4 .rst-content table.docutils.citation td,html.writer-html4 .rst-content table.docutils.citation tr,html.writer-html4 .rst-content table.docutils.footnote td,html.writer-html4 .rst-content table.docutils.footnote tr{border:none;background-color:transparent!important;white-space:normal}html.writer-html4 .rst-content table.docutils.citation td.label,html.writer-html4 .rst-content table.docutils.footnote td.label{padding-left:0;padding-right:0;vertical-align:top}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{display:grid;grid-template-columns:auto minmax(80%,95%)}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{display:inline-grid;grid-template-columns:max-content auto}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{display:grid;grid-template-columns:auto auto minmax(.65rem,auto) minmax(40%,95%)}html.writer-html5 .rst-content aside.citation>span.label,html.writer-html5 .rst-content aside.footnote>span.label,html.writer-html5 .rst-content div.citation>span.label{grid-column-start:1;grid-column-end:2}html.writer-html5 .rst-content aside.citation>span.backrefs,html.writer-html5 .rst-content aside.footnote>span.backrefs,html.writer-html5 .rst-content div.citation>span.backrefs{grid-column-start:2;grid-column-end:3;grid-row-start:1;grid-row-end:3}html.writer-html5 .rst-content aside.citation>p,html.writer-html5 .rst-content aside.footnote>p,html.writer-html5 .rst-content div.citation>p{grid-column-start:4;grid-column-end:5}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{margin-bottom:24px}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{padding-left:1rem}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dd,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dd,html.writer-html5 .rst-content dl.footnote>dt{margin-bottom:0}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{font-size:.9rem}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.footnote>dt{margin:0 .5rem .5rem 0;line-height:1.2rem;word-break:break-all;font-weight:400}html.writer-html5 .rst-content dl.citation>dt>span.brackets:before,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:before{content:"["}html.writer-html5 .rst-content dl.citation>dt>span.brackets:after,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:after{content:"]"}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a{word-break:keep-all}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a:not(:first-child):before,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.footnote>dd{margin:0 0 .5rem;line-height:1.2rem}html.writer-html5 .rst-content dl.citation>dd p,html.writer-html5 .rst-content dl.footnote>dd p{font-size:.9rem}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{padding-left:1rem;padding-right:1rem;font-size:.9rem;line-height:1.2rem}html.writer-html5 .rst-content aside.citation p,html.writer-html5 .rst-content aside.footnote p,html.writer-html5 .rst-content div.citation p{font-size:.9rem;line-height:1.2rem;margin-bottom:12px}html.writer-html5 .rst-content aside.citation span.backrefs,html.writer-html5 .rst-content aside.footnote span.backrefs,html.writer-html5 .rst-content div.citation span.backrefs{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content aside.citation span.backrefs>a,html.writer-html5 .rst-content aside.footnote span.backrefs>a,html.writer-html5 .rst-content div.citation span.backrefs>a{word-break:keep-all}html.writer-html5 .rst-content aside.citation span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content aside.footnote span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content div.citation span.backrefs>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content aside.citation span.label,html.writer-html5 .rst-content aside.footnote span.label,html.writer-html5 .rst-content div.citation span.label{line-height:1.2rem}html.writer-html5 .rst-content aside.citation-list,html.writer-html5 .rst-content aside.footnote-list,html.writer-html5 .rst-content div.citation-list{margin-bottom:24px}html.writer-html5 .rst-content dl.option-list kbd{font-size:.9rem}.rst-content table.docutils.footnote,html.writer-html4 .rst-content table.docutils.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content aside.footnote-list aside.footnote,html.writer-html5 .rst-content div.citation-list>div.citation,html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{color:grey}.rst-content table.docutils.footnote code,.rst-content table.docutils.footnote tt,html.writer-html4 .rst-content table.docutils.citation code,html.writer-html4 .rst-content table.docutils.citation tt,html.writer-html5 .rst-content aside.footnote-list aside.footnote code,html.writer-html5 .rst-content aside.footnote-list aside.footnote tt,html.writer-html5 .rst-content aside.footnote code,html.writer-html5 .rst-content aside.footnote tt,html.writer-html5 .rst-content div.citation-list>div.citation code,html.writer-html5 .rst-content div.citation-list>div.citation tt,html.writer-html5 .rst-content dl.citation code,html.writer-html5 .rst-content dl.citation tt,html.writer-html5 .rst-content dl.footnote code,html.writer-html5 .rst-content dl.footnote tt{color:#555}.rst-content .wy-table-responsive.citation,.rst-content .wy-table-responsive.footnote{margin-bottom:0}.rst-content .wy-table-responsive.citation+:not(.citation),.rst-content .wy-table-responsive.footnote+:not(.footnote){margin-top:24px}.rst-content .wy-table-responsive.citation:last-child,.rst-content .wy-table-responsive.footnote:last-child{margin-bottom:24px}.rst-content table.docutils th{border-color:#e1e4e5}html.writer-html5 .rst-content table.docutils th{border:1px solid #e1e4e5}html.writer-html5 .rst-content table.docutils td>p,html.writer-html5 .rst-content table.docutils th>p{line-height:1rem;margin-bottom:0;font-size:.9rem}.rst-content table.docutils td .last,.rst-content table.docutils td .last>:last-child{margin-bottom:0}.rst-content table.field-list,.rst-content table.field-list td{border:none}.rst-content table.field-list td p{line-height:inherit}.rst-content table.field-list td>strong{display:inline-block}.rst-content table.field-list .field-name{padding-right:10px;text-align:left;white-space:nowrap}.rst-content table.field-list .field-body{text-align:left}.rst-content code,.rst-content tt{color:#000;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;padding:2px 5px}.rst-content code big,.rst-content code em,.rst-content tt big,.rst-content tt em{font-size:100%!important;line-height:normal}.rst-content code.literal,.rst-content tt.literal{color:#e74c3c;white-space:normal}.rst-content code.xref,.rst-content tt.xref,a .rst-content code,a .rst-content tt{font-weight:700;color:#404040;overflow-wrap:normal}.rst-content kbd,.rst-content pre,.rst-content samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace}.rst-content a code,.rst-content a tt{color:#2980b9}.rst-content dl{margin-bottom:24px}.rst-content dl dt{font-weight:700;margin-bottom:12px}.rst-content dl ol,.rst-content dl p,.rst-content dl table,.rst-content dl ul{margin-bottom:12px}.rst-content dl dd{margin:0 0 12px 24px;line-height:24px}.rst-content dl dd>ol:last-child,.rst-content dl dd>p:last-child,.rst-content dl dd>table:last-child,.rst-content dl dd>ul:last-child{margin-bottom:0}html.writer-html4 .rst-content dl:not(.docutils),html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple){margin-bottom:24px}html.writer-html4 .rst-content dl:not(.docutils)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{display:table;margin:6px 0;font-size:90%;line-height:normal;background:#e7f2fa;color:#2980b9;border-top:3px solid #6ab0de;padding:6px;position:relative}html.writer-html4 .rst-content dl:not(.docutils)>dt:before,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:before{color:#6ab0de}html.writer-html4 .rst-content dl:not(.docutils)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{margin-bottom:6px;border:none;border-left:3px solid #ccc;background:#f0f0f0;color:#555}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils)>dt:first-child,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:first-child{margin-top:0}html.writer-html4 .rst-content dl:not(.docutils) code.descclassname,html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descclassname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{background-color:transparent;border:none;padding:0;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .optional,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .optional{display:inline-block;padding:0 4px;color:#000;font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .property,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .property{display:inline-block;padding-right:8px;max-width:100%}html.writer-html4 .rst-content dl:not(.docutils) .k,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .k{font-style:italic}html.writer-html4 .rst-content dl:not(.docutils) .descclassname,html.writer-html4 .rst-content dl:not(.docutils) .descname,html.writer-html4 .rst-content dl:not(.docutils) .sig-name,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .sig-name{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#000}.rst-content .viewcode-back,.rst-content .viewcode-link{display:inline-block;color:#27ae60;font-size:80%;padding-left:24px}.rst-content .viewcode-back{display:block;float:right}.rst-content p.rubric{margin-bottom:12px;font-weight:700}.rst-content code.download,.rst-content tt.download{background:inherit;padding:inherit;font-weight:400;font-family:inherit;font-size:inherit;color:inherit;border:inherit;white-space:inherit}.rst-content code.download span:first-child,.rst-content tt.download span:first-child{-webkit-font-smoothing:subpixel-antialiased}.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{margin-right:4px}.rst-content .guilabel,.rst-content .menuselection{font-size:80%;font-weight:700;border-radius:4px;padding:2.4px 6px;margin:auto 2px}.rst-content .guilabel,.rst-content .menuselection{border:1px solid #7fbbe3;background:#e7f2fa}.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>.kbd,.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>kbd{color:inherit;font-size:80%;background-color:#fff;border:1px solid #a6a6a6;border-radius:4px;box-shadow:0 2px grey;padding:2.4px 6px;margin:auto 0}.rst-content .versionmodified{font-style:italic}@media screen and (max-width:480px){.rst-content .sidebar{width:100%}}span[id*=MathJax-Span]{color:#404040}.math{text-align:center}@font-face{font-family:Lato;src:url(fonts/lato-normal.woff2?bd03a2cc277bbbc338d464e679fe9942) format("woff2"),url(fonts/lato-normal.woff?27bd77b9162d388cb8d4c4217c7c5e2a) format("woff");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold.woff2?cccb897485813c7c256901dbca54ecf2) format("woff2"),url(fonts/lato-bold.woff?d878b6c29b10beca227e9eef4246111b) format("woff");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold-italic.woff2?0b6bb6725576b072c5d0b02ecdd1900d) format("woff2"),url(fonts/lato-bold-italic.woff?9c7e4e9eb485b4a121c760e61bc3707c) format("woff");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-normal-italic.woff2?4eb103b4d12be57cb1d040ed5e162e9d) format("woff2"),url(fonts/lato-normal-italic.woff?f28f2d6482446544ef1ea1ccc6dd5892) format("woff");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:400;src:url(fonts/Roboto-Slab-Regular.woff2?7abf5b8d04d26a2cafea937019bca958) format("woff2"),url(fonts/Roboto-Slab-Regular.woff?c1be9284088d487c5e3ff0a10a92e58c) format("woff");font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:700;src:url(fonts/Roboto-Slab-Bold.woff2?9984f4a9bda09be08e83f2506954adbe) format("woff2"),url(fonts/Roboto-Slab-Bold.woff?bed5564a116b05148e3b3bea6fb1162a) format("woff");font-display:block} \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/doctools.js b/docs/0.6.4/docs/_static/doctools.js new file mode 100644 index 0000000..d06a71d --- /dev/null +++ b/docs/0.6.4/docs/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/docs/0.6.4/docs/_static/documentation_options.js b/docs/0.6.4/docs/_static/documentation_options.js new file mode 100644 index 0000000..9bf5561 --- /dev/null +++ b/docs/0.6.4/docs/_static/documentation_options.js @@ -0,0 +1,14 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), + VERSION: '0.6.4', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/file.png b/docs/0.6.4/docs/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/docs/0.6.4/docs/_static/file.png differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.eot b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.eot new file mode 100644 index 0000000..3361183 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.ttf b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.ttf new file mode 100644 index 0000000..29f691d Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff new file mode 100644 index 0000000..c6dff51 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff2 b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff2 new file mode 100644 index 0000000..bb19504 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bold.woff2 differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.eot b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.eot new file mode 100644 index 0000000..3d41549 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.ttf b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.ttf new file mode 100644 index 0000000..f402040 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff new file mode 100644 index 0000000..88ad05b Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff2 b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff2 new file mode 100644 index 0000000..c4e3d80 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-bolditalic.woff2 differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.eot b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.eot new file mode 100644 index 0000000..3f82642 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.ttf b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.ttf new file mode 100644 index 0000000..b4bfc9b Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff new file mode 100644 index 0000000..76114bc Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff2 b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff2 new file mode 100644 index 0000000..3404f37 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-italic.woff2 differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.eot b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.eot new file mode 100644 index 0000000..11e3f2a Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.ttf b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.ttf new file mode 100644 index 0000000..74decd9 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff new file mode 100644 index 0000000..ae1307f Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff2 b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff2 new file mode 100644 index 0000000..3bf9843 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/Lato/lato-regular.woff2 differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot new file mode 100644 index 0000000..79dc8ef Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf new file mode 100644 index 0000000..df5d1df Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff new file mode 100644 index 0000000..6cb6000 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 new file mode 100644 index 0000000..7059e23 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot new file mode 100644 index 0000000..2f7ca78 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf new file mode 100644 index 0000000..eb52a79 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff new file mode 100644 index 0000000..f815f63 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff differ diff --git a/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 new file mode 100644 index 0000000..f2c76e5 Binary files /dev/null and b/docs/0.6.4/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 differ diff --git a/docs/0.6.4/docs/_static/jquery.js b/docs/0.6.4/docs/_static/jquery.js new file mode 100644 index 0000000..c4c6022 --- /dev/null +++ b/docs/0.6.4/docs/_static/jquery.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0"),n("table.docutils.footnote").wrap("
"),n("table.docutils.citation").wrap("
"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each((function(){var t=n(this);expand=n(''),expand.on("click",(function(n){return e.toggleCurrent(t),n.stopPropagation(),!1})),t.prepend(expand)}))},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),t=e.find('[href="'+n+'"]');if(0===t.length){var i=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(t=e.find('[href="#'+i.attr("id")+'"]')).length&&(t=e.find('[href="#"]'))}if(t.length>0){$(".wy-menu-vertical .current").removeClass("current").attr("aria-expanded","false"),t.addClass("current").attr("aria-expanded","true"),t.closest("li.toctree-l1").parent().addClass("current").attr("aria-expanded","true");for(let n=1;n<=10;n++)t.closest("li.toctree-l"+n).addClass("current").attr("aria-expanded","true");t[0].scrollIntoView()}}catch(n){console.log("Error expanding nav for anchor",n)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,t=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(t),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",(function(){this.linkScroll=!1}))},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current").attr("aria-expanded","false"),e.siblings().find("li.current").removeClass("current").attr("aria-expanded","false");var t=e.find("> ul li");t.length&&(t.removeClass("current").attr("aria-expanded","false"),e.toggleClass("current").attr("aria-expanded",(function(n,e){return"true"==e?"false":"true"})))}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:n.exports.ThemeNav,StickyNav:n.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],t=0;t a.language.name.localeCompare(b.language.name)); + + const languagesHTML = ` +
+
Languages
+ ${languages + .map( + (translation) => ` +
+ ${translation.language.code} +
+ `, + ) + .join("\n")} +
+ `; + return languagesHTML; + } + + function renderVersions(config) { + if (!config.versions.active.length) { + return ""; + } + const versionsHTML = ` +
+
Versions
+ ${config.versions.active + .map( + (version) => ` +
+ ${version.slug} +
+ `, + ) + .join("\n")} +
+ `; + return versionsHTML; + } + + function renderDownloads(config) { + if (!Object.keys(config.versions.current.downloads).length) { + return ""; + } + const downloadsNameDisplay = { + pdf: "PDF", + epub: "Epub", + htmlzip: "HTML", + }; + + const downloadsHTML = ` +
+
Downloads
+ ${Object.entries(config.versions.current.downloads) + .map( + ([name, url]) => ` +
+ ${downloadsNameDisplay[name]} +
+ `, + ) + .join("\n")} +
+ `; + return downloadsHTML; + } + + document.addEventListener("readthedocs-addons-data-ready", function (event) { + const config = event.detail.data(); + + const flyout = ` +
+ + Read the Docs + v: ${config.versions.current.slug} + + +
+
+ ${renderLanguages(config)} + ${renderVersions(config)} + ${renderDownloads(config)} +
+
On Read the Docs
+
+ Project Home +
+
+ Builds +
+
+ Downloads +
+
+
+
Search
+
+
+ +
+
+
+
+ + Hosted by Read the Docs + +
+
+ `; + + // Inject the generated flyout into the body HTML element. + document.body.insertAdjacentHTML("beforeend", flyout); + + // Trigger the Read the Docs Addons Search modal when clicking on the "Search docs" input from inside the flyout. + document + .querySelector("#flyout-search-form") + .addEventListener("focusin", () => { + const event = new CustomEvent("readthedocs-search-show"); + document.dispatchEvent(event); + }); + }) +} + +if (themeLanguageSelector || themeVersionSelector) { + function onSelectorSwitch(event) { + const option = event.target.selectedIndex; + const item = event.target.options[option]; + window.location.href = item.dataset.url; + } + + document.addEventListener("readthedocs-addons-data-ready", function (event) { + const config = event.detail.data(); + + const versionSwitch = document.querySelector( + "div.switch-menus > div.version-switch", + ); + if (themeVersionSelector) { + let versions = config.versions.active; + if (config.versions.current.hidden || config.versions.current.type === "external") { + versions.unshift(config.versions.current); + } + const versionSelect = ` + + `; + + versionSwitch.innerHTML = versionSelect; + versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch); + } + + const languageSwitch = document.querySelector( + "div.switch-menus > div.language-switch", + ); + + if (themeLanguageSelector) { + if (config.projects.translations.length) { + // Add the current language to the options on the selector + let languages = config.projects.translations.concat( + config.projects.current, + ); + languages = languages.sort((a, b) => + a.language.name.localeCompare(b.language.name), + ); + + const languageSelect = ` + + `; + + languageSwitch.innerHTML = languageSelect; + languageSwitch.firstElementChild.addEventListener("change", onSelectorSwitch); + } + else { + languageSwitch.remove(); + } + } + }); +} + +document.addEventListener("readthedocs-addons-data-ready", function (event) { + // Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav. + document + .querySelector("[role='search'] input") + .addEventListener("focusin", () => { + const event = new CustomEvent("readthedocs-search-show"); + document.dispatchEvent(event); + }); +}); \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/language_data.js b/docs/0.6.4/docs/_static/language_data.js new file mode 100644 index 0000000..250f566 --- /dev/null +++ b/docs/0.6.4/docs/_static/language_data.js @@ -0,0 +1,199 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, is available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/docs/0.6.4/docs/_static/minus.png b/docs/0.6.4/docs/_static/minus.png new file mode 100644 index 0000000..d96755f Binary files /dev/null and b/docs/0.6.4/docs/_static/minus.png differ diff --git a/docs/0.6.4/docs/_static/plus.png b/docs/0.6.4/docs/_static/plus.png new file mode 100644 index 0000000..7107cec Binary files /dev/null and b/docs/0.6.4/docs/_static/plus.png differ diff --git a/docs/0.6.4/docs/_static/pygments.css b/docs/0.6.4/docs/_static/pygments.css new file mode 100644 index 0000000..84ab303 --- /dev/null +++ b/docs/0.6.4/docs/_static/pygments.css @@ -0,0 +1,75 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f8f8f8; } +.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #008000; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #9C6500 } /* Comment.Preproc */ +.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +.highlight .gr { color: #E40000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #008400 } /* Generic.Inserted */ +.highlight .go { color: #717171 } /* Generic.Output */ +.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008000 } /* Keyword.Pseudo */ +.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #B00040 } /* Keyword.Type */ +.highlight .m { color: #666666 } /* Literal.Number */ +.highlight .s { color: #BA2121 } /* Literal.String */ +.highlight .na { color: #687822 } /* Name.Attribute */ +.highlight .nb { color: #008000 } /* Name.Builtin */ +.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.highlight .no { color: #880000 } /* Name.Constant */ +.highlight .nd { color: #AA22FF } /* Name.Decorator */ +.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0000FF } /* Name.Function */ +.highlight .nl { color: #767600 } /* Name.Label */ +.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #19177C } /* Name.Variable */ +.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #666666 } /* Literal.Number.Bin */ +.highlight .mf { color: #666666 } /* Literal.Number.Float */ +.highlight .mh { color: #666666 } /* Literal.Number.Hex */ +.highlight .mi { color: #666666 } /* Literal.Number.Integer */ +.highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.highlight .sa { color: #BA2121 } /* Literal.String.Affix */ +.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ +.highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */ +.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #BA2121 } /* Literal.String.Double */ +.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */ +.highlight .sx { color: #008000 } /* Literal.String.Other */ +.highlight .sr { color: #A45A77 } /* Literal.String.Regex */ +.highlight .s1 { color: #BA2121 } /* Literal.String.Single */ +.highlight .ss { color: #19177C } /* Literal.String.Symbol */ +.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0000FF } /* Name.Function.Magic */ +.highlight .vc { color: #19177C } /* Name.Variable.Class */ +.highlight .vg { color: #19177C } /* Name.Variable.Global */ +.highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.highlight .vm { color: #19177C } /* Name.Variable.Magic */ +.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/docs/0.6.4/docs/_static/searchtools.js b/docs/0.6.4/docs/_static/searchtools.js new file mode 100644 index 0000000..97d56a7 --- /dev/null +++ b/docs/0.6.4/docs/_static/searchtools.js @@ -0,0 +1,566 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for the full-text search. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + + const [docName, title, anchor, descr, score, _filename] = item; + + let listItem = document.createElement("li"); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = docUrlRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = docUrlRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms) + ); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = _( + `Search finished, found ${resultCount} page(s) matching the search query.` + ); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent !== undefined) return docContent.textContent; + console.warn( + "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + /** + * execute search (requires search index to be loaded) + */ + query: (query) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + // array of [docname, title, anchor, descr, score, filename] + let results = []; + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + let score = Math.round(100 * queryLower.length / title.length) + results.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id] of foundEntries) { + let score = Math.round(100 * queryLower.length / entry.length) + results.push([ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // lookup as object + objectTerms.forEach((term) => + results.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + results.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item))); + + // now sort the results by score (in opposite order of appearance, since the + // display function below uses pop() to retrieve items) and then + // alphabetically + results.sort((a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; + }); + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + results = results.reverse(); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord) && !terms[word]) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord) && !titleTerms[word]) + arr.push({ files: titleTerms[word], score: Scorer.partialTitle }); + }); + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1) + fileMap.get(file).push(word); + else fileMap.set(file, [word]); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords) => { + const text = Search.htmlToText(htmlText); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/docs/0.6.4/docs/_static/sphinx_highlight.js b/docs/0.6.4/docs/_static/sphinx_highlight.js new file mode 100644 index 0000000..aae669d --- /dev/null +++ b/docs/0.6.4/docs/_static/sphinx_highlight.js @@ -0,0 +1,144 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + parent.insertBefore( + span, + parent.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(SphinxHighlight.highlightSearchWords); +_ready(SphinxHighlight.initEscapeListener); diff --git a/docs/0.6.4/docs/agentlib_mpc.data_structures.html b/docs/0.6.4/docs/agentlib_mpc.data_structures.html new file mode 100644 index 0000000..9e39349 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.data_structures.html @@ -0,0 +1,1241 @@ + + + + + + + + + agentlib_mpc.data_structures package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.data_structures package

+
+

Submodules

+
+
+

agentlib_mpc.data_structures.admm_datatypes module

+
+
+class agentlib_mpc.data_structures.admm_datatypes.ADMMParameters(penalty_factor: float, prediction_horizon: int, time_step: float)[source]
+

Bases: object

+

Collection of parameters which have to be shared across all agents in ADMM.

+
+
+penalty_factor: float
+
+ +
+
+prediction_horizon: int
+
+ +
+
+time_step: float
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation(source: Source, ready: bool = False, participating: bool = False)[source]
+

Bases: object

+

Helper class to organize ADMM participants.

+
+
+participating: bool = False
+
+ +
+
+ready: bool = False
+
+ +
+
+source: Source
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry(name: str, status: ~agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus = AgentStatus.pending, coup_vars: ~typing.List[str] = <factory>, exchange_vars: ~typing.List[str] = <factory>)[source]
+

Bases: AgentDictEntry

+

Holds participating coupling variables (consensus and exchange) of a single +agent in ADMM. Used in the coordinator.

+
+
+coup_vars: List[str]
+
+ +
+
+exchange_vars: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator(local_trajectory: Dict[str, numpy.ndarray], local_exchange_trajectory: Dict[str, numpy.ndarray])[source]
+

Bases: StructuredValue

+
+
+local_exchange_trajectory: Dict[str, ndarray]
+
+ +
+
+local_trajectory: Dict[str, ndarray]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable(local_trajectories: Dict[agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: numpy.ndarray = <factory>, primal_residual: numpy.ndarray = <factory>, multipliers: Dict[agentlib.core.datamodels.Source, list] = <factory>)[source]
+

Bases: CouplingVariable

+
+
+flat_multipliers(sources: Iterable[Source] = None) list[float][source]
+
+ +
+
+multipliers: Dict[Source, list]
+
+ +
+
+shift_values_by_one(horizon: int)[source]
+

Shifts the trajectories

+
+ +
+
+update_mean_trajectory(sources: Iterable[Source] = None)[source]
+

Calculates a new mean of this variable.

+
+
Parameters:
+

sources – List of sources that should be included in the update. +If none is given, use all variables.

+
+
+
+ +
+
+update_multipliers(rho: float, sources: Iterable[Source] = None)[source]
+

Performs the multiplier update.

+
+
Parameters:
+
    +
  • rho – penalty parameter

  • +
  • sources – list of sources that should be included in the update. +By default, all are included.

  • +
+
+
+

Returns:

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent(target: str, mean_trajectory: Dict[str, list], multiplier: Dict[str, list], mean_diff_trajectory: Dict[str, list], exchange_multiplier: Dict[str, list], penalty_parameter: float)[source]
+

Bases: StructuredValue

+
+
+exchange_multiplier: Dict[str, list]
+
+ +
+
+mean_diff_trajectory: Dict[str, list]
+
+ +
+
+mean_trajectory: Dict[str, list]
+
+ +
+
+multiplier: Dict[str, list]
+
+ +
+
+penalty_parameter: float
+
+ +
+
+target: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CouplingEntry(name: str)[source]
+

Bases: object

+

Holds naming conventions for different optimizatin variables / parameters +associated with a coupling variable in consensus ADMM.

+
+
+admm_variables()[source]
+
+ +
+
+property lagged
+
+ +
+
+property local
+
+ +
+
+property mean
+
+ +
+
+property multiplier
+
+ +
+
+name: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CouplingVariable(local_trajectories: ~typing.Dict[~agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: ~numpy.ndarray = <factory>, primal_residual: ~numpy.ndarray = <factory>)[source]
+

Bases: object

+

Holds information about a phy

+
+
+delta_mean: ndarray
+
+ +
+
+flat_locals(sources: Iterable[Source] = None) list[float][source]
+

Returns the flattened array of all local variables and their multipliers.

+
+
Parameters:
+

sources – list of sources that should be included in the update. +By default, all are included.

+
+
Returns:
+

flat lists of local variables and multipliers (locals, multipliers)

+
+
+
+ +
+
+get_residual(rho: float) Tuple[ndarray, ndarray][source]
+

Returns the primal and dual residual of the last iteration as a tuple +of flattened Arrays. +:param rho:

+
+
Returns:
+

(primal residual, dual residual)

+
+
+
+ +
+
+local_trajectories: Dict[Source, list]
+
+ +
+
+mean_trajectory: list
+
+ +
+
+property participants
+

Returns all agent sources that are registered to this coupling.

+
+ +
+
+primal_residual: ndarray
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry(name: str)[source]
+

Bases: object

+

Holds naming conventions for different optimizatin variables / parameters +associated with a coupling variable in exchange ADMM.

+
+
+admm_variables()[source]
+
+ +
+
+property lagged
+
+ +
+
+property local
+
+ +
+
+property mean_diff
+
+ +
+
+property multiplier
+
+ +
+
+name: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable(local_trajectories: Dict[agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: numpy.ndarray = <factory>, primal_residual: numpy.ndarray = <factory>, diff_trajectories: Dict[agentlib.core.datamodels.Source, list[float]] = <factory>, multiplier: list[float] = <factory>)[source]
+

Bases: CouplingVariable

+
+
+diff_trajectories: Dict[Source, list[float]]
+
+ +
+
+multiplier: list[float]
+
+ +
+
+shift_values_by_one(horizon: int)[source]
+

Shifts the trajectories

+
+ +
+
+update_diff_trajectories(sources: Iterable[Source] = None)[source]
+

Calculates a new mean of this variable.

+
+
Parameters:
+

sources – List of sources that should be included in the update. +If none is given, use all variables.

+
+
+
+ +
+
+update_multiplier(rho: float)[source]
+

Performs the multiplier update.

+
+
Parameters:
+

rho – penalty parameter

+
+
+

Returns:

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.StructuredValue[source]
+

Bases: object

+

Base Class to specify the structure of an AgentVariable Value. It will +be efficiently sent and deserialized.

+
+
+classmethod from_json(data: str)[source]
+
+ +
+
+to_json() str[source]
+

Serialize self to json bytes, can be used by the communicator.

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.VariableReference(states: ~typing.List[str] = <factory>, controls: ~typing.List[str] = <factory>, inputs: ~typing.List[str] = <factory>, parameters: ~typing.List[str] = <factory>, outputs: ~typing.List[str] = <factory>, couplings: list[agentlib_mpc.data_structures.admm_datatypes.CouplingEntry] = <factory>, exchange: list[agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry] = <factory>)[source]
+

Bases: FullVariableReference

+

Holds info about all variables of an MPC and their role in the optimization +problem.

+
+
+all_variables() List[str][source]
+

Returns a list of all variables registered in the var_ref

+
+ +
+
+couplings: list[agentlib_mpc.data_structures.admm_datatypes.CouplingEntry]
+
+ +
+
+exchange: list[agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry]
+
+ +
+
+classmethod from_config(config: BaseModuleConfigClass)[source]
+

Creates an instance from a pydantic values dict which includes lists of +AgentVariables with the keys corresponding to ‘states’, ‘inputs’, etc..

+
+ +
+ +
+
+agentlib_mpc.data_structures.admm_datatypes.coupling_alias(alias: str) str[source]
+

Naming convention for local variables to send and receive.

+
+ +
+
+agentlib_mpc.data_structures.admm_datatypes.exchange_alias(alias: str) str[source]
+

Naming convention for local exchange variables to send and receive.

+
+ +
+
+

agentlib_mpc.data_structures.casadi_utils module

+

Stores all sorts of Dataclasses, Enums or Factories to help with the +CasadiBackend.

+
+
+pydantic model agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions[source]
+

Bases: DiscretizationOptions

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
+
+
+field collocation_method: CollocationMethod = CollocationMethod.legendre
+
+ +
+
+field collocation_order: int = 3
+
+
Constraints:
+
    +
  • ge = 1

  • +
  • le = 9

  • +
+
+
+
+ +
+
+field integrator: Integrators = Integrators.cvodes
+
+ +
+
+field method: DiscretizationMethod = DiscretizationMethod.collocation
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.CollocationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+legendre = 'legendre'
+
+ +
+
+radau = 'radau'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Constraint(function: casadi.casadi.MX, lb: casadi.casadi.MX, ub: casadi.casadi.MX)[source]
+

Bases: object

+
+
+function: MX
+
+ +
+
+lb: MX
+
+ +
+
+ub: MX
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+collocation = 'collocation'
+
+ +
+
+multiple_shooting = 'multiple_shooting'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Integrators(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+cvodes = 'cvodes'
+
+ +
+
+euler = 'euler'
+
+ +
+
+rk = 'rk'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.ModelConstraint(lb, function, ub)[source]
+

Bases: NamedTuple

+
+
+function: MX
+

Alias for field number 1

+
+ +
+
+lb: MX | SX | Sparsity | DM | float | int
+

Alias for field number 0

+
+ +
+
+ub: MX | SX | Sparsity | DM | float | int
+

Alias for field number 2

+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.OptParMXContainer(var: ~typing.List[~casadi.casadi.MX] = <factory>, grid: ~typing.List[float] = <factory>)[source]
+

Bases: object

+

Stores the necessary MX variables created during discretization for +OptimizationParameters.

+
+
+grid: List[float]
+
+ +
+
+var: List[MX]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer(var: ~typing.List[~casadi.casadi.MX] = <factory>, grid: ~typing.List[float] = <factory>, lb: ~typing.List[~casadi.casadi.MX] = <factory>, ub: ~typing.List[~casadi.casadi.MX] = <factory>, guess: ~typing.List[~casadi.casadi.MX] = <factory>, opt: ~casadi.casadi.DM = None)[source]
+

Bases: OptParMXContainer

+

Stores the necessary MX variables created during discretization for +OptimizationVariables.

+
+
+guess: List[MX]
+
+ +
+
+lb: List[MX]
+
+ +
+
+opt: DM = None
+
+ +
+
+ub: List[MX]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.SolverFactory(do_jit: bool, bat_file: ~pathlib.Path = None, name: str = None, options: ~agentlib_mpc.data_structures.casadi_utils.SolverOptions = <factory>, logger: ~logging.Logger = None)[source]
+

Bases: object

+

Creates a solver given an NLP and an options construct.

+
+
+bat_file: Path = None
+
+ +
+
+create_solver(nlp: dict | str, discrete: List[bool] = None, equalities: list[bool] = None) Function[source]
+
+ +
+
+do_jit: bool
+
+ +
+
+logger: Logger = None
+
+ +
+
+make_casadi_nlp(problem: dict | str, solver: str, opts: dict, problem_type: Literal['nlp', 'qp'] = 'nlp')[source]
+
+ +
+
+name: str = None
+
+ +
+
+options: SolverOptions
+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.casadi_utils.SolverOptions[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
+
+
+field name: Solvers = 'ipopt'
+
+ +
+
+field options: dict = {}
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Solvers(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+bonmin = 'bonmin'
+
+ +
+
+fatrop = 'fatrop'
+
+ +
+
+gurobi = 'gurobi'
+
+ +
+
+ipopt = 'ipopt'
+
+ +
+
+osqp = 'osqp'
+
+ +
+
+proxqp = 'proxqp'
+
+ +
+
+qpoases = 'qpoases'
+
+ +
+
+sqpmethod = 'sqpmethod'
+
+ +
+ +
+
+agentlib_mpc.data_structures.casadi_utils.compile_solver(bat_file: Path, name: str, optimizer: Function) str[source]
+

Code-generates an ipopt solver and compiles it. +Currently, only works on Windows! Requires a batch file that knows +how to setup Visual Studio command line and compiles the source code.

+
+
Returns:
+

The Path to the .dll file for the compiled solver.

+
+
Raises:
+
    +
  • TypeError

  • +
  • FileNotFoundError

  • +
  • RuntimeError

  • +
+
+
+
+ +
+
+agentlib_mpc.data_structures.casadi_utils.temporary_directory(path)[source]
+
+ +
+
+

agentlib_mpc.data_structures.coordinator_datatypes module

+
+
+class agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry(name: str, status: AgentStatus = AgentStatus.pending)[source]
+

Bases: object

+

Dataclass holding the status of a participating agent in DMPC.

+
+
+name: str
+
+ +
+
+optimization_data = OptimizationData(x=array([], dtype=float64), u=array([], dtype=float64))
+
+ +
+
+status: AgentStatus = 'pending'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Enum used within a DMPC-Coordinator to keep track of the statuses of its +participating agents.

+
+
+busy = 'busy'
+
+ +
+
+pending = 'pending'
+
+ +
+
+ready = 'ready'
+
+ +
+
+standby = 'standby'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Enum used to keep track of the status of a DMPC-Coordinator.

+
+
+init_iterations = 'init_iterations'
+
+ +
+
+optimization = 'optimization'
+
+ +
+
+sleeping = 'sleeping'
+
+ +
+
+updating = 'updating'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData(x: ~numpy.array = <factory>, u: ~numpy.array = <factory>)[source]
+

Bases: object

+

Contains specific variables (or time series) of the agent

+
+
+classmethod from_dict(data: dict)[source]
+
+ +
+
+to_dict() dict[source]
+
+ +
+
+u: array
+
+ +
+
+x: array
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage(status: AgentStatus = None, opts: dict = None, agent_id: str = None, coupling: list = None)[source]
+

Bases: object

+

Dataclass structuring the communication during registration between a +participating agent and the coordinator in DMPC.

+
+
+agent_id: str = None
+
+ +
+
+coupling: list = None
+
+ +
+
+opts: dict = None
+
+ +
+
+status: AgentStatus = None
+
+ +
+ +
+
+

agentlib_mpc.data_structures.mpc_datamodels module

+
+
+class agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference[source]
+

Bases: object

+
+
+all_variables() List[str][source]
+

Returns a list of all variables registered in the var_ref

+
+ +
+
+classmethod from_config(config: BaseModuleConfigClass)[source]
+

Creates an instance from a pydantic values dict which includes lists of +AgentVariables with the keys corresponding to ‘states’, ‘inputs’, etc..

+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions[source]
+

Bases: BaseModel

+

Class defining the options to discretize an MPC. Can be extended for different +optimization implementations.

+
+
Config:
+
    +
  • extra: str = allow

  • +
+
+
Fields:
+
+
+
+
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: VariableReference

+
+
+property r_del_u: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.InitStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Keep track of the readyness status of the MPC.

+
+
+during_update = '2'
+
+ +
+
+pre_module_init = '1'
+
+ +
+
+ready = '3'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference(states: List[str] = <factory>, measured_states: List[str] = <factory>, weights_states: List[str] = <factory>, estimated_inputs: List[str] = <factory>, estimated_parameters: List[str] = <factory>, known_inputs: List[str] = <factory>, known_parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: BaseVariableReference

+
+
+all_variables() Iterable[str][source]
+

Returns a list of all variables registered in the var_ref which the MHE can +get from the config with get()

+
+ +
+
+estimated_inputs: List[str]
+
+ +
+
+estimated_parameters: List[str]
+
+ +
+
+known_inputs: List[str]
+
+ +
+
+known_parameters: List[str]
+
+ +
+
+measured_states: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+states: List[str]
+
+ +
+
+weights_states: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>, binary_controls: List[str] = <factory>)[source]
+

Bases: VariableReference

+
+
+binary_controls: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MPCVariable(*, name: str, type: str | None = None, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, alias: str = None, source: dict | Source | str = Source(agent_id=None, module_id=None), shared: bool | None = None, rdf_class: str | None = None, interpolation_method: InterpolationMethods = InterpolationMethods.linear)[source]
+

Bases: AgentVariable

+

AgentVariable used to define input variables of MPC.

+
+
+interpolation_method: InterpolationMethods
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.Results(*args, **kwargs)[source]
+

Bases: Protocol

+
+
+df: DataFrame
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.VariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: BaseVariableReference

+
+
+controls: List[str]
+
+ +
+
+inputs: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+parameters: List[str]
+
+ +
+
+states: List[str]
+
+ +
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.cia_relaxed_results_path(path: Path | str) Path[source]
+
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.r_del_u_convention(name: str) str[source]
+

Turns the name of a control variable into its weight via convention

+
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.stats_path(path: Path | str) Path[source]
+
+ +
+
+

Module contents

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.html b/docs/0.6.4/docs/agentlib_mpc.html new file mode 100644 index 0000000..27891a0 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.html @@ -0,0 +1,543 @@ + + + + + + + + + agentlib_mpc package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc package

+
+

Subpackages

+
+ +
+
+
+

Module contents

+

Plugin for the AgentLib which contains modules for MPC, distributed MPC with ADMM +and data-driven modeling.

+
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.models.html b/docs/0.6.4/docs/agentlib_mpc.models.html new file mode 100644 index 0000000..683ac6a --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.models.html @@ -0,0 +1,453 @@ + + + + + + + + + agentlib_mpc.models package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.models package

+
+

Submodules

+
+
+

agentlib_mpc.models.ann_model module

+
+
+

agentlib_mpc.models.casadi_model module

+

Holds the classes for CasADi variables and the CasADi model.

+
+
+class agentlib_mpc.models.casadi_model.CasadiInput(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of control variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiModel(**kwargs)[source]
+

Bases: Model

+

Base Class for CasADi models. To implement your own model, inherit +from this class, specify the variables (inputs, outputs, states, +parameters and override the setup_system() method.

+
+
+property auxiliaries: List[CasadiState]
+

List of all CasadiStates without an associated equation. Common +uses for this are slack variables that appear in cost functions and +constraints of optimization models.

+
+ +
+
+property differentials: List[CasadiState]
+

List of all CasadiStates with an associated differential equation.

+
+ +
+
+do_step(*, t_start, t_sample=None)[source]
+

Performing one simulation step +:param t_start: start time for integration +:param t_sample: increment of solver integration

+

Returns:

+
+ +
+
+get(name: str) CasadiVariable[source]
+

Get any variable from using name:

+
+
Parameters:
+

name (str) – The item to get from config by name of Variable. +Hence, item=ModelVariable.name

+
+
Returns:
+

The matching variable

+
+
Return type:
+

var (ModelVariable)

+
+
Raises:
+

AttributeError – If the item was not found in the variables of the + module.

+
+
+
+ +
+
+get_constraints() List[ModelConstraint][source]
+

List of constraints of the form (lower, function, upper).

+
+ +
+
+get_differential_values()[source]
+
+ +
+
+get_input_values()[source]
+
+ +
+
+initialize(**ignored)[source]
+

Initializes Casadi model. Creates the integrator to be used in +do_step(). The integrator takes the current state and input values as +input and returns the state values at the end of the interval and the +value of the cost function integrated over the interval.

+
+ +
+
+property inputs: list[agentlib_mpc.models.casadi_model.CasadiInput]
+

Get all model inputs as a list

+
+ +
+
+property output_equations: List[MX | SX | DM | Sparsity]
+

List of algebraic equations RHS in the form +0 = z - g(x, z, p, … )

+
+ +
+
+property outputs: list[agentlib_mpc.models.casadi_model.CasadiOutput]
+

Get all model outputs as a list

+
+ +
+
+property parameters: list[agentlib_mpc.models.casadi_model.CasadiParameter]
+

Get all model parameters as a list

+
+ +
+
+set_differential_values(values: List | ndarray)[source]
+

Sets the values for all differential variables. Provided values list MUST +match the order in which differentials are saved, there is no check.

+
+ +
+
+set_output_values(values: List | ndarray)[source]
+

Sets the values for all outputs. Provided values list MUST match the order +in which outputs are saved, there is no check.

+
+ +
+
+abstract setup_system()[source]
+
+ +
+
+property states: list[agentlib_mpc.models.casadi_model.CasadiState]
+

Get all model states as a list

+
+ +
+ +
+
+pydantic model agentlib_mpc.models.casadi_model.CasadiModelConfig[source]
+

Bases: ModelConfig

+
+
Config:
+
    +
  • validate_assignment: bool = True

  • +
  • arbitrary_types_allowed: bool = True

  • +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
    +
  • include_default_model_variables » inputs

  • +
  • include_default_model_variables » outputs

  • +
  • include_default_model_variables » parameters

  • +
  • include_default_model_variables » states

  • +
+
+
+
+
+field cost_function: MX | SX | DM | Sparsity = None
+
+ +
+
+field inputs: List[CasadiInput] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field outputs: List[CasadiOutput] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field parameters: List[CasadiParameter] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field states: List[CasadiState] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field system: MX | SX | DM | Sparsity = None
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiOutput(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None, _alg: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of control variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+
+json(**kwargs)[source]
+

Serializes the Variable in json format and returns a string

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiParameter(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of parameters.

+
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiState(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None, _ode: MX | SX | DM | Sparsity | None = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of CasADi differential variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+
+json(indent: int = 2, **kwargs)[source]
+

Serializes the Variable in json format and returns a string

+
+ +
+
+property ode: MX | SX | DM | Sparsity
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiVariable(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: ModelVariable

+

Base Class for variables used in Casadi Models for simulation and +optimization. Implements the standard arithmetic operations, +so CasadiVariables can be used in equations. +.. attribute:: sym

+
+

The symbolic CasADi variable used to define ode’s and +optimization problems.

+
+
+
+create_sym() MX[source]
+

Ensures a symbolic MX variable is created with each CasadiVariable +instance, and that its dimensions are consistent.

+
+ +
+
+property sym: MX
+
+ +
+ +
+
+agentlib_mpc.models.casadi_model.get_symbolic(equation)[source]
+
+ +
+
+

agentlib_mpc.models.casadi_model_ann module

+
+
+

agentlib_mpc.models.casadi_neural_network module

+
+
+

agentlib_mpc.models.serialized_ann module

+
+
+

Module contents

+

Package containing models for agentlib_mpc.

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.admm.html b/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.admm.html new file mode 100644 index 0000000..a6e1416 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.admm.html @@ -0,0 +1,887 @@ + + + + + + + + + agentlib_mpc.modules.dmpc.admm package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.dmpc.admm package

+
+

Submodules

+
+
+

agentlib_mpc.modules.dmpc.admm.admm module

+

Holds functionality for ADMM modules.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm.ADMM(config: dict, agent)[source]
+

Bases: DistributedMPC

+

This class represents a module participating in a fully decentralized +Consensus-ADMM optimization for distributed MPC. +Agents autonomously send the values of their coupling variables, register +other participants and perform update steps.

+
+
+admm_step()[source]
+

Performs an entire ADMM optimization.

+
+ +
+
+all_coupling_statuses() Iterable[ADMMParticipation][source]
+

Gives and iterator of all ADMMParticipation that are registered.

+
+ +
+
+assert_mpc_variables_are_in_model()[source]
+

Checks whether all variables of var_ref are contained in the model. +Returns names of model variables not contained in the var_ref, +sorted by keys: ‘states’, ‘inputs’, ‘outputs’, ‘parameters’.

+
+ +
+
+collect_couplings_for_optimization()[source]
+

Collects updated AgentVariables only of the coupling variables.

+
+ +
+
+collect_variables_for_optimization(var_ref: VariableReference = None) dict[str, agentlib.core.datamodels.AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary.

+
+ +
+
+property cons_and_exchange: List[ExchangeEntry | CouplingEntry]
+
+ +
+
+deregister_all_participants()[source]
+

Sets the participating status of all participating agents to +False.

+
+ +
+
+get_participants_values(coupling_alias: str) List[Series][source]
+

Get the values of all agents for a coupling variable.

+
+ +
+
+get_results() DataFrame | None[source]
+

Read the results that were saved from the optimization backend and +returns them as Dataframe.

+
+
Returns:
+

(results, stats) tuple of Dataframes.

+
+
+
+ +
+
+participant_callback(variable: AgentVariable)[source]
+

Puts received variables in the correct queue, depending on +registration status of this agent.

+
+ +
+
+property penalty_factor_var: MPCVariable
+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+receive_participant(variable: AgentVariable)[source]
+

Set the participation to true for the given coupling input.

+
+ +
+
+property registered_participants: Dict[str, Dict[str, ADMMParticipation]]
+

Dictionary containing all other agents this agent shares variables with. +Ordered in a two-layer form, with variables at the first layer and +agents at the second layer. Contains ADMMParticipation objects at +the base layer.

+

Examples

+

self.registered_participants = +{‘coupling_var_1’: {‘src_of_agent1’: status_1,

+
+
+

‘src_of_agent2’: status_2, +‘src_of_agent3’: status_3}

+
+
+
‘coupling_var_1’: {‘src_of_agent3’: status_a,

‘src_of_agent2’: status_b, +‘src_of_agent4’: status_c}

+
+
+
+

} +here, <status> refers to an ADMMParticipation object.

+
+ +
+
+reset_participants_ready()[source]
+

Sets the ready status of all participating agents to False.

+
+ +
+
+send_coupling_values(solution: Results)[source]
+

Sets the coupling outputs to the data_broker, which automatically sends them.

+
+
Parameters:
+

solution – Output dictionary from optimization_backend.solve().

+
+
+
+ +
+
+send_coupling_variable(name: str, value: int | float | list[Union[int, float]] | Series | ndarray)[source]
+

Sends an admm coupling variable through the data_broker and sets its +value locally

+
+ +
+
+update_lambda()[source]
+

Performs the update of the lagrange multipliers. +lambda^k+1 := lambda^k - rho*(z-x_i)

+
+ +
+
+var_ref: VariableReference
+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig[source]
+

Bases: DistributedMPCConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field couplings: List[MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field exchange: List[MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field iteration_timeout: float = 20
+

Maximum computation + waiting time for one iteration.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field max_iterations: float = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field registration_period: float = 2
+

Time spent on registration before each optimization

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+validator check_prefixes_of_variables  »  exchange, controls, states, couplings, outputs, inputs, parameters[source]
+

Ensures no user provided variable is named with the reserved ADMM prefix.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation(variable)[source]
+

Bases: object

+

Holds data for the status of a shared variable of another system.

+
+
+de_register()[source]
+
+ +
+
+empty_memory()[source]
+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.LocalADMM(config: dict, agent)[source]
+

Bases: ADMM

+
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+property registration_delay: float
+

Timeout value used to wait one on registration. Waits in real time +(time.sleep)

+
+ +
+
+property sync_delay: float
+

Timeout value used to sync local admm processes. Should be very +small.

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig[source]
+

Bases: ADMMConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+

+
+
+
+field registration_delay: float = 0.1
+
+ +
+
+field sync_delay: float = 0.001
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: Enum

+
+
+at_registration = 3
+
+ +
+
+not_started = 1
+
+ +
+
+optimizing = 4
+
+ +
+
+sleeping = 7
+
+ +
+
+syncing = 2
+
+ +
+
+updating = 5
+
+ +
+
+waiting_for_other_agents = 6
+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: Enum

+
+
+available = 2
+
+ +
+
+confirmed = 3
+
+ +
+
+not_available = 4
+
+ +
+
+not_participating = 1
+
+ +
+ +
+
+

agentlib_mpc.modules.dmpc.admm.admm_coordinated module

+

Module implementing the coordinated ADMM module, which works together +with a coordinator.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM(*, config: dict, agent: Agent)[source]
+

Bases: MiniEmployee, ADMM

+

Module to implement an ADMM agent, which is guided by a coordinator. +Only optimizes based on callbacks.

+
+
+get_new_measurement()[source]
+

Retrieve new measurement from relevant sensors +Returns:

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Callback that answers the coordinators init_iteration flag.

+
+ +
+
+optimize(variable: AgentVariable)[source]
+

Performs the optimization given the mean trajectories and multipliers from the +coordinator. +Replies with the local optimal trajectories. +Returns:

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+

callback for registration

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig[source]
+

Bases: MiniEmployeeConfig, ADMMConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field shared_variable_fields: list[str] = ['messages_out', 'outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+validator couplings_should_have_values  »  exchange, couplings[source]
+

Asserts that couplings and exchange have values, as they are needed for +initial guess.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+agentlib_mpc.modules.dmpc.admm.admm_coordinated.coupInput
+

alias of coup_input

+
+ +
+
+

agentlib_mpc.modules.dmpc.admm.admm_coordinator module

+

Defines classes that coordinate an ADMM process.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator(*, config: dict, agent: Agent)[source]
+

Bases: Coordinator

+
+
+cleanup_results()[source]
+

Deletes all files this module created.

+

Override this method, if your module creates e.g. results files etc.

+
+ +
+
+get_results() DataFrame[source]
+

Reads the results on iteration data if they were saved.

+
+ +
+
+optim_results_callback(variable: AgentVariable)[source]
+

Saves the results of a local optimization. +:param variable:

+

Returns:

+
+ +
+
+register_agent(variable: AgentVariable)[source]
+

Registers the agent, after it sent its initial guess with correct +vector length.

+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+
+ +
+
+trigger_optimizations()[source]
+

Triggers the optimization for all agents with status ready. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig[source]
+

Bases: CoordinatorConfig

+

Hold the config for ADMMCoordinator

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field abs_tol: float = 0.001
+

Absolute stopping criterion.

+
+ +
+
+field admm_iter_max: int = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+ +
+
+field dual_tol: float = 0.001
+

Absolute dual stopping criterion.

+
+ +
+
+field penalty_change_factor: float = 2
+

Factor to vary the penalty parameter with.

+
+ +
+
+field penalty_change_threshold: float = -1
+

When the primal residual is x times higher, vary the penalty parameter and vice versa.

+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+ +
+
+field prediction_horizon: int = 10
+

Prediction horizon of participating agents.

+
+ +
+
+field primal_tol: float = 0.001
+

Absolute primal stopping criterion.

+
+ +
+
+field registration_period: float = 5
+

Time spent on registration before each optimization

+
+ +
+
+field rel_tol: float = 0.001
+

Relative stopping criterion.

+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field save_iter_interval: int = 1000
+
+ +
+
+field save_solve_stats: bool = False
+

When True, saves the solve stats to a file.

+
+ +
+
+field solve_stats_file: str = 'admm_stats.csv'
+

File name for the solve stats.

+
+
Validated by:
+
+
+
+
+ +
+
+field time_step: float = 600
+

Sampling interval of between two control steps. Will be used in the discretization for MPC.

+
+ +
+
+field use_relative_tolerances: bool = True
+

If True, use abs_tol and rel_tol, if False us prim_tol and dual_tol.

+
+ +
+
+field wait_time_on_start_iters: float = 0.1
+

wait_on_start_iterations

+
+ +
+
+validator default_sampling_time  »  sampling_time[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+
+validator solve_stats_file_is_csv  »  solve_stats_file[source]
+
+ +
+ +
+
+

Module contents

+
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.html b/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.html new file mode 100644 index 0000000..a199e58 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.modules.dmpc.html @@ -0,0 +1,560 @@ + + + + + + + + + agentlib_mpc.modules.dmpc package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.dmpc package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.modules.dmpc.coordinator module

+
+
+class agentlib_mpc.modules.dmpc.coordinator.Coordinator(*, config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

Class implementing the base coordination for distributed MPC

+
+
+property all_finished
+

Returns: +True, if there are no busy agents, else False

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Processes and Agents InitIteration confirmation. +:param variable:

+

Returns:

+
+ +
+
+optim_results_callback(variable: AgentVariable)[source]
+

Saves the results of a local optimization. +:param variable:

+

Returns:

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+
+ +
+
+trigger_optimizations()[source]
+

Triggers the optimization for all agents with status ready. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig[source]
+

Bases: BaseModuleConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field maxIter: int = 10
+

Maximum number of iterations

+
+ +
+
+field messages_in: List[AgentVariable] = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: List[AgentVariable] = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field time_out_non_responders: float = 1
+

Maximum wait time for subsystems in seconds

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+

agentlib_mpc.modules.dmpc.employee module

+
+
+class agentlib_mpc.modules.dmpc.employee.MiniEmployee(*, config: dict, agent: Agent)[source]
+

Bases: BaseModule

+
+
+get_new_measurement()[source]
+

Retrieve new measurement from relevant sensors +Returns:

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Callback that processes the coordinators ‘startIteration’ flag. +:param variable:

+
+ +
+
+abstract optimize(variable: AgentVariable)[source]
+

Performs the optimization given the information from the coordinator. +Replies with local information. +Returns:

+
+ +
+
+pre_computation_hook()[source]
+

This method is called in every computation step before the optimization starts. +Overwrite this method in a derived subclass if you want to take some actions each time before the optimal control problem is solved.

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+abstract registration_callback(variable: AgentVariable)[source]
+

callback for registration

+
+ +
+
+shift_trajectories()[source]
+

Shifts algorithm specific trajectories. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig[source]
+

Bases: BaseModuleConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field coordinator: Source [Required]
+

Define the agents coordinator

+
+ +
+
+field messages_in: List[AgentVariable] = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: List[AgentVariable] = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field registration_interval: float = 10
+

Interval in seconds after which a registration attempt is made.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field request_frequency: float = 1
+

Wait time between signup_requests

+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+

Module contents

+
+
+class agentlib_mpc.modules.dmpc.DistributedMPC(config: dict, agent: Agent)[source]
+

Bases: MPC

+

Base class which defines common interfaces among all +distributed mpc approaches (either optimization based, +game theory based or some other).

+
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.DistributedMPCConfig[source]
+

Bases: MPCConfig

+

Base config class with common configurations

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+

+
Validators:
+

+
+
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.modules.html b/docs/0.6.4/docs/agentlib_mpc.modules.html new file mode 100644 index 0000000..b38b15d --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.modules.html @@ -0,0 +1,439 @@ + + + + + + + + + agentlib_mpc.modules package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules package

+
+

Submodules

+
+
+

agentlib_mpc.modules.mpc module

+

Holds the base class for MPCs.

+
+
+class agentlib_mpc.modules.mpc.BaseMPC(config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

A model predictive controller. +More info to follow.

+
+
+assert_mpc_variables_are_in_model() dict[str, set[str]][source]
+

Checks whether all variables of var_ref are contained in the model. +Returns names of model variables not contained in the var_ref, +sorted by keys: ‘states’, ‘inputs’, ‘outputs’, ‘parameters’.

+
+ +
+
+assert_subset(mpc_names, model_names, message_head)[source]
+

Helper function for assert assert_mpc_variables_are_in_model. Asserts +the variables of the var_ref corresponding to ref_key are a subset of +a list of names provided (usually obtained from the model) and prints +out an error if false. Returns the portion of model_names that are +not in the given var_ref.

+
+ +
+
+cleanup_results()[source]
+

Deletes all files this module created.

+

Override this method, if your module creates e.g. results files etc.

+
+ +
+
+collect_variables_for_optimization(var_ref: VariableReference = None) Dict[str, AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary.

+
+ +
+
+do_step()[source]
+

Performs an MPC step.

+
+ +
+
+get_results() DataFrame | None[source]
+

Read the results that were saved from the optimization backend and +returns them as Dataframe.

+
+
Returns:
+

(results, stats) tuple of Dataframes.

+
+
+
+ +
+
+property model: Model
+

Getter for current simulation model

+
+
Returns:
+

Current simulation model

+
+
Return type:
+

agentlib.model

+
+
+
+ +
+
+pre_computation_hook()[source]
+

This method is called in every computation step before the optimization starts. +Overwrite this method in a derived subclass if you want to take some actions +each time before the optimal control problem is solved.

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+re_init_optimization(parameter: AgentVariable)[source]
+

Re-initializes the optimization backend with new parameters.

+
+ +
+
+static read_results_file(results_file: str) Tuple[DataFrame, DataFrame][source]
+

Read the provided csv-file as an MPC results file. +:param results_file: File path

+
+
Returns:
+

results, stats +results is the Dataframe with all inputs and outputs of the MPC +optimizations. +stats is the Dataframe with matching solver stats

+
+
+
+ +
+
+register_callbacks()[source]
+

Registers the init_optimization callback to all parameters which +cannot be changed without recreating the optimization problem.

+
+ +
+
+set_actuation(solution: Results)[source]
+

Takes the solution from optimization backend and sends the first +step to AgentVariables.

+
+ +
+
+set_output(solution: Results)[source]
+

Takes the solution from optimization backend and sends it to AgentVariables.

+
+ +
+
+warn_for_missed_solves(stats: DataFrame | None)[source]
+

Read the solver information from the optimization +:returns: Warning if solver fails

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.mpc.BaseMPCConfig[source]
+

Bases: BaseModuleConfig

+

Pydantic data model for MPC configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field controls: List[MPCVariable] = []
+

List of all control variables of the MPC.

+
+ +
+
+field inputs: List[MPCVariable] = []
+

List of all input variables of the MPC. Includes predictions for disturbances, set_points, dynamic constraint boundaries etc.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field outputs: List[MPCVariable] = []
+

List of all shared outputs of the MPC.

+
+ +
+
+field parameters: List[MPCVariable] = []
+

List of model parameters of the MPC. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field set_outputs: bool = False
+

Sets the full output time series to the data broker.

+
+ +
+
+field shared_variable_fields: list[str] = ['outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field states: List[MPCVariable] = []
+

List of all differential states of the MPC. The entries can define the boundaries and the source for the measurements

+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+validator default_sampling_time  »  sampling_time[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+agentlib_mpc.modules.mpc.create_optimization_backend(optimization_backend, agent_id)[source]
+

Set up the optimization_backend

+
+ +
+
+

Module contents

+

This package contains all modules for the +distributed model predictive control using multi agent systems.

+

It contains classes for local optimization and global coordination.

+
+
+class agentlib_mpc.modules.ModuleImport(module_path: str, class_name: str)[source]
+

Bases: object

+
+
+import_class()[source]
+
+ +
+ +
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.core.html b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.core.html new file mode 100644 index 0000000..956b071 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.core.html @@ -0,0 +1,684 @@ + + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+ +
+
+ +
+

agentlib_mpc.optimization_backends.casadi_.core package

+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.casadi_.core.VariableGroup module

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool', full_with_defaults: 'ca.MX', add_default_values: 'ca.Function')[source]
+

Bases: OptimizationQuantity

+
+
+add_default_values: Function
+
+ +
+
+classmethod declare(denotation: str, variables: list[agentlib_mpc.models.casadi_model.CasadiVariable], ref_list: list[str], use_in_stage_function=True, assert_complete: bool = False)[source]
+

Declares a group of optimization parameters that serve a purpose in +the optimization problem. Typical groups are uncontrollable inputs or +physical parameters.

+
+
Parameters:
+
    +
  • denotation – The key of the variable, e.g. ‘p’, ‘d’, etc. Use this +key in the discretization function to add the parameter at +different stages of the optimization problem.

  • +
  • variables – A list of CasadiVariables including all parameters +within this category.

  • +
  • ref_list – A list of names indicating which parameters in full_list +are AgentVariables and need to be updated before each +optimization.

  • +
  • use_in_stage_function – If False, the parameter is not added to the +stage function. If True, the variable needs to be provided to +the stage function at every point in the discretization function.

  • +
  • assert_complete – If True, throws an error if the ref_list does +not contain all variables.

  • +
+
+
+
+ +
+
+full_with_defaults: MX
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool')[source]
+

Bases: object

+
+
+dim: int
+
+ +
+
+full_names: tuple[str]
+
+ +
+
+full_symbolic: MX
+
+ +
+
+name: str
+
+ +
+
+ref_names: tuple[str]
+
+ +
+
+use_in_stage_function: bool
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool', input_map: 'ca.Function', output_map: 'ca.Function', binary: 'bool')[source]
+

Bases: OptimizationQuantity

+
+
+binary: bool
+
+ +
+
+classmethod declare(denotation: str, variables: list[agentlib_mpc.models.casadi_model.CasadiVariable], ref_list: list[str], use_in_stage_function: bool = True, assert_complete: bool = False, binary: bool = False) OptimizationVariable[source]
+

Declares a group of optimization variables that serve a purpose in +the optimization problem. Typical groups are states, the control +inputs or slack variables.

+
+
Parameters:
+
    +
  • binary – Flag, whether these variables are binary

  • +
  • denotation – The key of the variable, e.g. ‘X’, ‘U’, etc. Use +this key in the discretization function to add the variable at +different stages of the optimization problem. The optimal value +of these variables will also be mapped to this key.

  • +
  • variables – A list of +CasadiVariables or an MX/SX vector including all variables +within this category.

  • +
  • ref_list – A list of names indicating which variables +in full_list are AgentVariables and need to be updated before +each optimization.

  • +
  • use_in_stage_function – If False, the variable is not +added to the stage function. If True, the variable needs to be +provided to the stage function at every point in the +discretization function.

  • +
  • assert_complete – If True, throws an error if the ref_list does +not contain all variables.

  • +
+
+
+
+ +
+
+input_map: Function
+
+ +
+
+output_map: Function
+
+ +
+
+use_in_stage_function: bool
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.casadi_backend module

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend(config: dict)[source]
+

Bases: OptimizationBackend

+

OptimizationBackend for solving the optimization problem with CasADi. +Requires the model to be a CasADi model.

+
+
+config_type
+

alias of CasadiBackendConfig

+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod, Type[DiscretizationT]]
+
+ +
+
+reset_setup_attributes()[source]
+

Cleans all attributes that are used for optimization setup.

+
+ +
+
+save_result_df(results: Results, now: float = 0)[source]
+

Save the results of solve into a dataframe at each time step.

+

Example results dataframe:

+

value_type variable … lower +variable T_0 T_0_slack … T_0_slack mDot_0 +time_step … +2 0.000000 298.160000 NaN … NaN NaN

+
+

101.431499 297.540944 -149.465942 … -inf 0.0 +450.000000 295.779780 -147.704779 … -inf 0.0 +798.568501 294.720770 -146.645769 … -inf 0.0

+
+
+
Parameters:
+
    +
  • results

  • +
  • now

  • +
+
+
+

Returns:

+
+ +
+
+setup_optimization(var_ref: VariableReference)[source]
+

Performs all necessary steps to make the solve method usable. +To do this, it calls several auxiliary functions. These functions can +be overloaded to change the resulting optimization problem.

+
+
Parameters:
+

var_ref – class with variable name lists sorted by function in the mpc.

+
+
+
+ +
+
+solve(now: float, current_vars: dict[str, agentlib_mpc.data_structures.mpc_datamodels.MPCVariable]) Results[source]
+

Solves the optimization problem given the current values of the +corresponding AgentVariables and system time. The standardization of +return values is a work in progress.

+
+
Parameters:
+
    +
  • now – Current time used for interpolation of input trajectories.

  • +
  • current_vars – Dict of AgentVariables holding the values relevant to +the optimization problem. Keys are the names

  • +
+
+
Returns:
+

A dataframe with all optimization variables over their respective +grids. Depending on discretization, can include many nan’s, so care +should be taken when using this, e.g. always use dropna() after +accessing a column.

+
+
+
Example:
+

variables mDot | T_0 | slack_T

+
+

time +0 0.1 | 298 | nan +230 nan | 297 | 3 +470 nan | 296 | 2 +588 nan | 295 | 1 +700 0.05 | 294 | nan +930 nan | 294 | 0.1

+
+
+
+

+
+
+
+ +
+
+system: SystemT
+
+ +
+
+system_type: Type[SystemT]
+
+ +
+ +
+
+pydantic model agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig[source]
+

Bases: BackendConfig

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field build_batch_bat: Path | None = None
+

Path to a batch file, which can compile C code on windows.

+
+ +
+
+field discretization_options: CasadiDiscretizationOptions [Optional]
+
+ +
+
+field do_jit: bool | None = None
+

Boolean to turn JIT of the optimization problems on or off.

+
+
Validated by:
+
+
+
+
+ +
+
+field solver: SolverOptions [Optional]
+
+ +
+
+validator validate_compile  »  do_jit[source]
+

Checks whether code compilation should be done.

+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.discretization module

+

Holds classes that implement different transcriptions of the OCP

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization(options: CasadiDiscretizationOptions)[source]
+

Bases: ABC

+

opt_vars: holds symbolic variables during problem creation +opt_vars_lb: holds symbolic variables during problem creation +opt_vars_ub: holds symbolic variables during problem creation +initial_guess: holds symbolic variables during problem creation +opt_pars: holds symbolic variables during problem creation +constraints: holds symbolic variables during problem creation +constraints_lb: holds symbolic variables during problem creation +constraints_ub: holds symbolic variables during problem creation +objective_function: cost function during problem creation +mpc_opt_vars (dict): holds the symbolic variables and grids during

+
+

problem creation sorted by type as in system_variables

+
+
+
mpc_opt_pars (dict): holds the symbolic variables and grids during

problem creation sorted by type as in system_parameters

+
+
+
+
+add_constraint(constraint_function: MX | SX | Sparsity | DM | float | int, lb: MX | SX | Sparsity | DM | float | int = None, ub: MX | SX | Sparsity | DM | float | int = None, *, gap_closing: bool = False)[source]
+

Add a constraint to the optimization problem. If no bounds are given, +adds an equality constraint.

+
+ +
+
+add_opt_par(quantity: OptimizationParameter, post_den: str = '')[source]
+

Create an optimization parameter and append to all the associated lists.

+

denotation[str]: the key of the parameter, e.g. ‘P’, ‘Q’, … +dimension[int]: the dimension of the parameter +post_den[str]: string to add to casadi MX after denotation (for debugging)

+
+ +
+
+add_opt_var(quantity: OptimizationVariable, lb: MX = None, ub: MX = None, guess: float = None, post_den: str = '')[source]
+

Create an optimization variable and append to all the associated +lists. If lb or ub are given, they override the values provided at +runtime! The usual application of this is, to fix the initial value +of a state to a parameter.

+
+
Parameters:
+
    +
  • quantity – corresponding system variable

  • +
  • lb – lower bound of the variable

  • +
  • ub – upper bound of the variable

  • +
  • guess – default for the initial guess

  • +
  • post_den – string to add to casadi MX after denotation (for debugging)

  • +
+
+
+
+ +
+
+property binary_vars: list[bool]
+

List specifying for every optimization variable, whether it is binary.

+
+ +
+
+create_nlp_in_out_mapping(system: System)[source]
+

Function creating mapping functions between the MPC variables ordered +by type (as defined in declare_quantities and the raw input/output +vector of the CasADi NLP.

+
+ +
+
+grid(var: OptimizationQuantity) list[float][source]
+
+ +
+
+initialize(system: System, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+
+property nlp: dict[str, casadi.casadi.MX]
+

The nlp dict that casadi solvers need for instantiation

+
+ +
+
+only_positive_times_in_results = True
+
+ +
+
+solve(mpc_inputs: dict[str, casadi.casadi.DM]) Results[source]
+

Solves the discretized trajectory optimization problem.

+
+
Parameters:
+

mpc_inputs – Casadi Matrices specifying the input of all different types +of optimization parameters. Matrices consist of different variable rows +and have a column for each time step in the discretization. +There are separate matrices for each input type (as defined in the +System), and also for the upper and lower boundaries of variables +respectively.

+
+
Returns:
+

+
The complete evolution of the states, inputs and boundaries of each

variable and parameter over the prediction horizon, as well as solve +statistics.

+
+
+

+
+
Return type:
+

Results

+
+
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.discretization.Results(matrix: casadi.casadi.MX, grid: list[float], columns: pandas.core.indexes.multi.MultiIndex, stats: dict, variable_grid_indices: dict[str, list[int]], _variable_name_to_index: dict[str, int] = None)[source]
+

Bases: object

+
+
+columns: MultiIndex
+
+ +
+
+property df: DataFrame
+
+ +
+
+grid: list[float]
+
+ +
+
+matrix: MX
+
+ +
+
+stats: dict
+
+ +
+
+stats_line(index: str) str[source]
+
+ +
+
+variable_grid_indices: dict[str, list[int]]
+
+ +
+
+variable_lookup() dict[str, int][source]
+

Creates a mapping from variable names to the column index in the Matrix

+
+ +
+
+write_columns(file: Path)[source]
+
+ +
+
+write_stats_columns(file: Path)[source]
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.system module

+

Holds the System class, which knows the model

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.system.System[source]
+

Bases: ABC

+

Examples

+

class MySystem(System):

+
+

# variables +states: OptimizationVariable +controls: OptimizationVariable +algebraics: OptimizationVariable +outputs: OptimizationVariable

+

# parameters +non_controlled_inputs: OptimizationParameter +model_parameters: OptimizationParameter +initial_state: OptimizationParameter

+

# dynamics +model_constraints: Constraint +cost_function: ca.MX +ode: ca.MX

+

def initialize(self, model: CasadiModel, var_ref: VariableReference):

+
+
+
self.states = OptimizationVariable.declare(

denotation=”state”, +variables=model.get_states(var_ref.states), +ref_list=var_ref.states, +assert_complete=True,

+
+
+

)

+

.

+
+
+

)

+
+
+abstract initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+property parameters: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter]
+
+ +
+
+property quantities: list[Union[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter, agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]]
+
+ +
+
+property variables: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]
+
+ +
+ +
+
+

Module contents

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.html b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.html new file mode 100644 index 0000000..fe89a08 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.casadi_.html @@ -0,0 +1,591 @@ + + + + + + + + + agentlib_mpc.optimization_backends.casadi_ package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.optimization_backends.casadi_ package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.casadi_.admm module

+
+
+class agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: MultipleShooting

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend(config: dict)[source]
+

Bases: CasADiBaseBackend, ADMMBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+property coupling_grid
+

Returns the grid on which the coupling variables are discretized.

+
+ +
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting'>}
+
+ +
+
+save_result_df(results: Results, now: float = 0)[source]
+

Save the results of solve into a dataframe at each time step.

+

Example results dataframe:

+

value_type variable … lower +variable T_0 T_0_slack … T_0_slack mDot_0 +time_step … +2 0.000000 298.160000 NaN … NaN NaN

+
+

101.431499 297.540944 -149.465942 … -inf 0.0 +450.000000 295.779780 -147.704779 … -inf 0.0 +798.568501 294.720770 -146.645769 … -inf 0.0

+
+
+
Parameters:
+
    +
  • results

  • +
  • now

  • +
+
+
+

Returns:

+
+ +
+
+system: CasadiADMMSystem
+
+ +
+
+system_type
+

alias of CasadiADMMSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem[source]
+

Bases: FullSystem

+
+
+exchange_diff: OptimizationParameter
+
+ +
+
+exchange_multipliers: OptimizationParameter
+
+ +
+
+global_couplings: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+local_couplings: OptimizationVariable
+
+ +
+
+local_exchange: OptimizationVariable
+
+ +
+
+multipliers: OptimizationParameter
+
+ +
+
+penalty_factor: OptimizationParameter
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.basic module

+
+
+class agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem[source]
+

Bases: System

+
+
+algebraics: OptimizationVariable
+
+ +
+
+controls: OptimizationVariable
+
+ +
+
+cost_function: MX
+
+ +
+
+initial_state: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+model_parameters: OptimizationParameter
+
+ +
+
+non_controlled_inputs: OptimizationParameter
+
+ +
+
+ode: MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+
+states: OptimizationVariable
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting'>}
+
+ +
+
+system: BaseSystem
+
+ +
+
+system_type
+

alias of BaseSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices(order: int, root: numpy.ndarray, B: numpy.ndarray, C: numpy.ndarray, D: numpy.ndarray)[source]
+

Bases: object

+
+
+B: ndarray
+
+ +
+
+C: ndarray
+
+ +
+
+D: ndarray
+
+ +
+
+order: int
+
+ +
+
+root: ndarray
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: Discretization

+
+
+initialize(system: BaseSystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: Discretization

+
+
+initialize(system: BaseSystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.casadi_admm_nn module

+
+
+

agentlib_mpc.optimization_backends.casadi_.casadi_nn module

+
+
+

agentlib_mpc.optimization_backends.casadi_.full module

+
+
+class agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting'>}
+
+ +
+
+system: FullSystem
+
+ +
+
+system_type
+

alias of FullSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.FullSystem[source]
+

Bases: BaseSystem

+
+
+initialize(model: CasadiModel, var_ref: FullVariableReference)[source]
+
+ +
+
+last_control: OptimizationParameter
+
+ +
+
+r_del_u: OptimizationParameter
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: MultipleShooting

+
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.minlp module

+
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation'>}
+
+ +
+
+system: CasadiMINLPSystem
+
+ +
+
+system_type
+

alias of CasadiMINLPSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem[source]
+

Bases: BaseSystem

+
+
+binary_controls: OptimizationVariable
+
+ +
+
+initialize(model: CasadiModel, var_ref: MINLPVariableReference)[source]
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+

Module contents

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.optimization_backends.html b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.html new file mode 100644 index 0000000..93c9a58 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.optimization_backends.html @@ -0,0 +1,493 @@ + + + + + + + + + agentlib_mpc.optimization_backends package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.optimization_backends package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.backend module

+
+
+class agentlib_mpc.optimization_backends.backend.ADMMBackend(config: dict)[source]
+

Bases: OptimizationBackend

+

Base class for implementations of optimization backends for ADMM +algorithms.

+
+
+abstract property coupling_grid: list[float]
+

Returns the grid on which the coupling variables are discretized.

+
+ +
+ +
+
+pydantic model agentlib_mpc.optimization_backends.backend.BackendConfig[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field discretization_options: DiscretizationOptions [Required]
+
+ +
+
+field model: dict [Required]
+
+ +
+
+field name: str | None = None
+
+ +
+
+field overwrite_result_file: bool | None = False
+
+
Validated by:
+
+
+
+
+ +
+
+field results_file: Path | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+field save_results: bool | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+validator check_csv  »  results_file[source]
+
+ +
+
+validator check_overwrite  »  overwrite_result_file[source]
+

Checks, whether the overwrite results sttings are valid, and deletes +existing result files if applicable.

+
+ +
+
+validator disable_results_if_no_file  »  save_results[source]
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.backend.OptimizationBackend(config: dict)[source]
+

Bases: ABC

+

Base class for all optimization backends. OptimizationBackends are a +plugin for the ‘mpc’ module. They provide means to setup and solve the +underlying optimization problem of the MPC. They also can save data of +the solutions.

+
+
+config_type
+

alias of BackendConfig

+
+ +
+
+get_lags_per_variable() dict[str, float][source]
+

Returns the name of variables which include lags and their lag in seconds. +The MPC module can use this information to save relevant past data of lagged +variables

+
+ +
+
+model_from_config(model: dict)[source]
+

Set the model to the backend.

+
+ +
+
+mpc_backend_parameters = ('time_step', 'prediction_horizon')
+
+ +
+
+register_logger(logger: Logger)[source]
+

Registers a logger, can be used to use the module logger

+
+ +
+
+results_file_exists() bool[source]
+

Checks if the results file already exists, and if not, creates it with +headers.

+
+ +
+
+abstract setup_optimization(var_ref: VariableReference)[source]
+

Performs all necessary steps to make the solve method usable.

+
+
Parameters:
+

var_ref – Variable Reference that specifies the role of each model variable +in the mpc

+
+
+
+ +
+
+abstract solve(now: float | datetime, current_vars: Dict[str, AgentVariable]) Results[source]
+

Solves the optimization problem given the current values of the +corresponding AgentVariables and system time. The standardization of +return values is a work in progress.

+
+
Parameters:
+
    +
  • now – Current time used for interpolation of input trajectories.

  • +
  • current_vars – Dict of AgentVariables holding the values relevant to +the optimization problem. Keys are the names

  • +
+
+
Returns:
+

A dataframe with all optimization variables over their respective +grids. Depending on discretization, can include many nan’s, so care +should be taken when using this, e.g. always use dropna() after +accessing a column.

+
+
+
Example:
+

variables mDot | T_0 | slack_T

+
+

time +0 0.1 | 298 | nan +230 nan | 297 | 3 +470 nan | 296 | 2 +588 nan | 295 | 1 +700 0.05 | 294 | nan +930 nan | 294 | 0.1

+
+
+
+

+
+
+
+ +
+
+update_discretization_options(opts: dict)[source]
+

Updates the discretization options with the new dict.

+
+ +
+
+update_model_variables(current_vars: Dict[str, AgentVariable])[source]
+

Internal method to write current data_broker to model variables. +Only update values, not other module_types.

+
+ +
+ +
+
+

Module contents

+
+
+pydantic model agentlib_mpc.optimization_backends.BackendImport[source]
+

Bases: BaseModel

+

Data-Class to import a given python file +from import_path and load the given +class_name

+
+
Fields:
+
+
+
+
+
+field class_name: str [Required]
+
+ +
+
+field import_path: str [Required]
+
+ +
+ +
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.utils.html b/docs/0.6.4/docs/agentlib_mpc.utils.html new file mode 100644 index 0000000..d169047 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.utils.html @@ -0,0 +1,352 @@ + + + + + + + + + agentlib_mpc.utils package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.utils package

+
+

Subpackages

+ +
+
+

Submodules

+
+
+

agentlib_mpc.utils.analysis module

+
+
+agentlib_mpc.utils.analysis.admm_at_time_step(data: DataFrame | Series, time_step: float = None, variable=None, iteration: float = -1, index_offset: float | Literal['auto'] | bool = True, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds') DataFrame[source]
+

Gets the results of an optimization at a time step. +:param index_offset: Determines how the index will be updated when loading the data. +:param The offset will be subtracted from the time-index. This is useful for results: +:param of realtime systems: to cut the number down to something understandable. For example, if the time

+
+

index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

+
+
+
If “auto” or True is provided as an argument, the index will be modified to

start at 0. If 0 or False are provided, no modifications will be made.

+
+
+
+
+
+
Parameters:
+
    +
  • want (where the time value with be a unix time stamp and we) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
  • data – The multi-indexed results data frame from the mpc

  • +
  • time_step – The time step from which results should be shown. +If no exact match, shows closest.

  • +
  • variable – If specified, only returns results +with regard to a certain variable.

  • +
  • iteration – Specifies, from which inner ADMM iteration data should be +from. If negative, counts from last iteration. Default -1.

  • +
  • convert_to – Whether the data should be converted to datetime, minutes etc.

  • +
+
+
Returns:
+

A single-indexed Dataframe of the optimization results +at the specified time step. If variable is not specified, +returns all variables with a double column index, if it +is specified returns only values and/or bounds with +single indexed columns.

+
+
+
+ +
+
+agentlib_mpc.utils.analysis.convert_index(convert_to: Literal['seconds', 'minutes', 'hours', 'days'] | Literal['datetime'], index: Index)[source]
+

Converts an index from seconds to datetime or another unit +:param convert_to: unit, e.g. minutes, hours, datetime +:param index: pandas index object

+

Returns:

+
+ +
+
+agentlib_mpc.utils.analysis.convert_multi_index(data: DataFrame, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] | Literal['datetime'])[source]
+

Converts an index of an MPC or ADMM results Dataframe to a different unit, +assuming it is passed in seconds.

+
+ +
+
+agentlib_mpc.utils.analysis.first_vals_at_trajectory_index(data: DataFrame | Series)[source]
+

Gets the first values at each time step of a results trajectory.

+
+ +
+
+agentlib_mpc.utils.analysis.get_number_of_iterations(data: DataFrame) dict[agentlib_mpc.utils.analysis.SimulationTime, int][source]
+

Returns the number of iterations at each time instance of the ADMM simulation.

+
+ +
+
+agentlib_mpc.utils.analysis.get_time_steps(data: DataFrame) Iterable[float][source]
+

Returns the time steps at which an MPC step was performed.

+
+ +
+
+agentlib_mpc.utils.analysis.last_vals_at_trajectory_index(data: DataFrame | Series)[source]
+

Gets the last values at each time step of a results trajectory.

+
+ +
+
+agentlib_mpc.utils.analysis.load_admm(file: Path | str) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_mpc(file: Path | str) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_mpc_stats(results_file: str | Path) DataFrame | None[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_sim(file: Path, causality=None) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.mpc_at_time_step(data: DataFrame, time_step: float, variable=None, variable_type='variable', index_offset: float | Literal['auto'] | bool = True) DataFrame[source]
+

Gets the results of an optimization at a time step.

+
+
Parameters:
+
    +
  • data – The multi-indexed results data frame from the mpc

  • +
  • time_step – The time step from which results should be shown. +If no exact match, shows closest.

  • +
  • variable – If specified, only returns results +with regard to a certain variable.

  • +
  • variable_type – The type of the variable provided (parameter, variable, lower, …)

  • +
  • index_offset – Determines how the index will be updated when loading the data.

  • +
  • results (The offset will be subtracted from the time-index. This is useful for) –

  • +
  • systems (of realtime) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
  • want (where the time value with be a unix time stamp and we) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
+
+
Returns:
+

+
A single-indexed Dataframe of the optimization results

at the specified time step. If variable is not specified, +returns all variables with a double column index, if it +is specified returns only values and/or bounds with +single indexed columns.

+
+
+

+
+
Return type:
+

pd.DataFrame

+
+
+
+ +
+
+agentlib_mpc.utils.analysis.perform_index_update(data: DataFrame, offset: float | Literal['auto'] | bool, admm: bool = False) DataFrame[source]
+

Updates the index of a raw mpc/admm result dataframe, to be offset by a desired +time value.

+
+ +
+
+

agentlib_mpc.utils.debug module

+
+
+

Module contents

+

Package containing utils for agentlib_mpc.

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/agentlib_mpc.utils.plotting.html b/docs/0.6.4/docs/agentlib_mpc.utils.plotting.html new file mode 100644 index 0000000..9245710 --- /dev/null +++ b/docs/0.6.4/docs/agentlib_mpc.utils.plotting.html @@ -0,0 +1,300 @@ + + + + + + + + + agentlib_mpc.utils.plotting package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.utils.plotting package

+
+

Submodules

+
+
+

agentlib_mpc.utils.plotting.admm_animation module

+

Modules that defines functions to be used for automatically creating animations of +ADMM convergence

+
+
+agentlib_mpc.utils.plotting.admm_animation.animate_full(i: int, lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, data: dict[str, pandas.core.frame.DataFrame], time_step: float)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.init_full(lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, ax: Axes)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_animation(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1, interval: int = 300)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_image(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_lines(labels: list[str], ax: Axes, fig: Figure) dict[str, matplotlib.lines.Line2D][source]
+
+ +
+
+

agentlib_mpc.utils.plotting.admm_residuals module

+
+
+agentlib_mpc.utils.plotting.admm_residuals.load_residuals(file: str | Path) DataFrame[source]
+

Loads a residuals csv file in the correct format.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.plot_over_time(residuals: ~pandas.core.frame.DataFrame, primal_tol: float = None, dual_tol: float = None, max_iters: int = None) -> (<class 'matplotlib.figure.Figure'>, (<class 'matplotlib.axes._axes.Axes'>, <class 'matplotlib.axes._axes.Axes'>))[source]
+

Plots the final residuals over time.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.plot_single_time_step(residuals: ~pandas.core.frame.DataFrame, time_step: float = None, primal_tol: float = None, dual_tol: float = None) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]
+

Plots the decrease of the residuals over iterations for a time step

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.residuals_over_time(residuals: DataFrame) DataFrame[source]
+

Evaluates the residuals over time. Takes a raw residuals DataFrame and returns a +Dataframe, which has for each time step the number of iterations and the final primal and dual residuals.

+
+
Returns:
+

DataFrame with float index (time in seconds) and the columns +(“primal_residual”, “dual_residual”, “iters”)

+
+
+
+ +
+
+

agentlib_mpc.utils.plotting.basic module

+

Some basic plotting utilities

+
+
+class agentlib_mpc.utils.plotting.basic.EBCColors[source]
+

Bases: object

+
+
+blue: tuple[float, float, float] = (0.0, 0.32941176470588235, 0.6235294117647059)
+
+ +
+
+dark_grey: tuple[float, float, float] = (0.3058823529411765, 0.30980392156862746, 0.3137254901960784)
+
+ +
+
+dark_red: tuple[float, float, float] = (0.6745098039215687, 0.16862745098039217, 0.10980392156862745)
+
+ +
+
+ebc_palette_sort_1: list[tuple[float, float, float]] = [(0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)]
+
+ +
+
+ebc_palette_sort_2: list[tuple[float, float, float]] = [(0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196), (0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)]
+
+ +
+
+green: tuple[float, float, float] = (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)
+
+ +
+
+grey: tuple[float, float, float] = (0.615686274509804, 0.6196078431372549, 0.6274509803921569)
+
+ +
+
+light_blue: tuple[float, float, float] = (0.615686274509804, 0.7647058823529411, 0.9019607843137255)
+
+ +
+
+light_grey: tuple[float, float, float] = (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)
+
+ +
+
+light_red: tuple[float, float, float] = (0.9215686274509803, 0.5490196078431373, 0.5058823529411764)
+
+ +
+
+red: tuple[float, float, float] = (0.8666666666666667, 0.25098039215686274, 0.17647058823529413)
+
+ +
+ +
+
+class agentlib_mpc.utils.plotting.basic.FontDict[source]
+

Bases: TypedDict

+
+
+fontsize: float
+
+ +
+ +
+
+class agentlib_mpc.utils.plotting.basic.Style(use_tex: bool = False)[source]
+

Bases: object

+
+ +
+
+class agentlib_mpc.utils.plotting.basic.ValueRange(min: float, max: float)[source]
+

Bases: object

+
+
+max: float
+
+ +
+
+min: float
+
+ +
+ +
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, rows: int = 1) tuple[matplotlib.figure.Figure, tuple[matplotlib.axes._axes.Axes, ...]][source]
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, tuple[matplotlib.axes._axes.Axes], Style], Tuple[Figure, tuple[matplotlib.axes._axes.Axes]]] = None) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]
+

Creates a figure and axes with an amount of rows. If rows is specified, return +a tuple of axes, else only an ax

+
+ +
+
+agentlib_mpc.utils.plotting.basic.make_grid(ax: Axes)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.basic.make_side_legend(ax: Axes, fig: Figure = None, right_position: float = 1)[source]
+
+ +
+
+

Module contents

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.data_structures.html b/docs/0.6.4/docs/code/agentlib_mpc.data_structures.html new file mode 100644 index 0000000..2129f18 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.data_structures.html @@ -0,0 +1,1587 @@ + + + + + + + + + agentlib_mpc.data_structures package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.data_structures package

+
+

Submodules

+
+
+

agentlib_mpc.data_structures.admm_datatypes module

+
+
+class agentlib_mpc.data_structures.admm_datatypes.ADMMParameters(penalty_factor: float, prediction_horizon: int, time_step: float)[source]
+

Bases: object

+

Collection of parameters which have to be shared across all agents in ADMM.

+
+
+penalty_factor: float
+
+ +
+
+prediction_horizon: int
+
+ +
+
+time_step: float
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation(source: Source, ready: bool = False, participating: bool = False)[source]
+

Bases: object

+

Helper class to organize ADMM participants.

+
+
+participating: bool = False
+
+ +
+
+ready: bool = False
+
+ +
+
+source: Source
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry(name: str, status: ~agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus = AgentStatus.pending, coup_vars: ~typing.List[str] = <factory>, exchange_vars: ~typing.List[str] = <factory>)[source]
+

Bases: AgentDictEntry

+

Holds participating coupling variables (consensus and exchange) of a single +agent in ADMM. Used in the coordinator.

+
+
+coup_vars: List[str]
+
+ +
+
+exchange_vars: List[str]
+
+ +
+
+name: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator(local_trajectory: Dict[str, numpy.ndarray], local_exchange_trajectory: Dict[str, numpy.ndarray])[source]
+

Bases: StructuredValue

+
+
+local_exchange_trajectory: Dict[str, ndarray]
+
+ +
+
+local_trajectory: Dict[str, ndarray]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable(local_trajectories: Dict[agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: numpy.ndarray = <factory>, primal_residual: numpy.ndarray = <factory>, multipliers: Dict[agentlib.core.datamodels.Source, list] = <factory>)[source]
+

Bases: CouplingVariable

+
+
+delta_mean: ndarray
+
+ +
+
+flat_multipliers(sources: Iterable[Source] = None) list[float][source]
+
+ +
+
+local_trajectories: Dict[Source, list]
+
+ +
+
+mean_trajectory: list
+
+ +
+
+multipliers: Dict[Source, list]
+
+ +
+
+primal_residual: ndarray
+
+ +
+
+shift_values_by_one(horizon: int)[source]
+

Shifts the trajectories

+
+ +
+
+update_mean_trajectory(sources: Iterable[Source] = None)[source]
+

Calculates a new mean of this variable.

+
+
Parameters:
+

sources – List of sources that should be included in the update. +If none is given, use all variables.

+
+
+
+ +
+
+update_multipliers(rho: float, sources: Iterable[Source] = None)[source]
+

Performs the multiplier update.

+
+
Parameters:
+
    +
  • rho – penalty parameter

  • +
  • sources – list of sources that should be included in the update. +By default, all are included.

  • +
+
+
+

Returns:

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent(target: str, mean_trajectory: Dict[str, list], multiplier: Dict[str, list], mean_diff_trajectory: Dict[str, list], exchange_multiplier: Dict[str, list], penalty_parameter: float)[source]
+

Bases: StructuredValue

+
+
+exchange_multiplier: Dict[str, list]
+
+ +
+
+mean_diff_trajectory: Dict[str, list]
+
+ +
+
+mean_trajectory: Dict[str, list]
+
+ +
+
+multiplier: Dict[str, list]
+
+ +
+
+penalty_parameter: float
+
+ +
+
+target: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CouplingEntry(name: str)[source]
+

Bases: object

+

Holds naming conventions for different optimizatin variables / parameters +associated with a coupling variable in consensus ADMM.

+
+
+admm_variables()[source]
+
+ +
+
+property lagged
+
+ +
+
+property local
+
+ +
+
+property mean
+
+ +
+
+property multiplier
+
+ +
+
+name: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.CouplingVariable(local_trajectories: ~typing.Dict[~agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: ~numpy.ndarray = <factory>, primal_residual: ~numpy.ndarray = <factory>)[source]
+

Bases: object

+

Holds information about a phy

+
+
+delta_mean: ndarray
+
+ +
+
+flat_locals(sources: Iterable[Source] = None) list[float][source]
+

Returns the flattened array of all local variables and their multipliers.

+
+
Parameters:
+

sources – list of sources that should be included in the update. +By default, all are included.

+
+
Returns:
+

flat lists of local variables and multipliers (locals, multipliers)

+
+
+
+ +
+
+get_residual(rho: float) Tuple[ndarray, ndarray][source]
+

Returns the primal and dual residual of the last iteration as a tuple +of flattened Arrays. +:param rho:

+
+
Returns:
+

(primal residual, dual residual)

+
+
+
+ +
+
+local_trajectories: Dict[Source, list]
+
+ +
+
+mean_trajectory: list
+
+ +
+
+property participants
+

Returns all agent sources that are registered to this coupling.

+
+ +
+
+primal_residual: ndarray
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry(name: str)[source]
+

Bases: object

+

Holds naming conventions for different optimizatin variables / parameters +associated with a coupling variable in exchange ADMM.

+
+
+admm_variables()[source]
+
+ +
+
+property lagged
+
+ +
+
+property local
+
+ +
+
+property mean_diff
+
+ +
+
+property multiplier
+
+ +
+
+name: str
+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable(local_trajectories: Dict[agentlib.core.datamodels.Source, list] = <factory>, mean_trajectory: list = <factory>, delta_mean: numpy.ndarray = <factory>, primal_residual: numpy.ndarray = <factory>, diff_trajectories: Dict[agentlib.core.datamodels.Source, list[float]] = <factory>, multiplier: list[float] = <factory>)[source]
+

Bases: CouplingVariable

+
+
+delta_mean: ndarray
+
+ +
+
+diff_trajectories: Dict[Source, list[float]]
+
+ +
+
+local_trajectories: Dict[Source, list]
+
+ +
+
+mean_trajectory: list
+
+ +
+
+multiplier: list[float]
+
+ +
+
+primal_residual: ndarray
+
+ +
+
+shift_values_by_one(horizon: int)[source]
+

Shifts the trajectories

+
+ +
+
+update_diff_trajectories(sources: Iterable[Source] = None)[source]
+

Calculates a new mean of this variable.

+
+
Parameters:
+

sources – List of sources that should be included in the update. +If none is given, use all variables.

+
+
+
+ +
+
+update_multiplier(rho: float)[source]
+

Performs the multiplier update.

+
+
Parameters:
+

rho – penalty parameter

+
+
+

Returns:

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.StructuredValue[source]
+

Bases: object

+

Base Class to specify the structure of an AgentVariable Value. It will +be efficiently sent and deserialized.

+
+
+classmethod from_json(data: str)[source]
+
+ +
+
+to_json() str[source]
+

Serialize self to json bytes, can be used by the communicator.

+
+ +
+ +
+
+class agentlib_mpc.data_structures.admm_datatypes.VariableReference(states: ~typing.List[str] = <factory>, controls: ~typing.List[str] = <factory>, inputs: ~typing.List[str] = <factory>, parameters: ~typing.List[str] = <factory>, outputs: ~typing.List[str] = <factory>, couplings: list[agentlib_mpc.data_structures.admm_datatypes.CouplingEntry] = <factory>, exchange: list[agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry] = <factory>)[source]
+

Bases: FullVariableReference

+

Holds info about all variables of an MPC and their role in the optimization +problem.

+
+
+all_variables() List[str][source]
+

Returns a list of all variables registered in the var_ref

+
+ +
+
+controls: List[str]
+
+ +
+
+couplings: list[agentlib_mpc.data_structures.admm_datatypes.CouplingEntry]
+
+ +
+
+exchange: list[agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry]
+
+ +
+
+classmethod from_config(config: BaseModuleConfigClass)[source]
+

Creates an instance from a pydantic values dict which includes lists of +AgentVariables with the keys corresponding to ‘states’, ‘inputs’, etc..

+
+ +
+
+inputs: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+parameters: List[str]
+
+ +
+
+states: List[str]
+
+ +
+ +
+
+agentlib_mpc.data_structures.admm_datatypes.coupling_alias(alias: str) str[source]
+

Naming convention for local variables to send and receive.

+
+ +
+
+agentlib_mpc.data_structures.admm_datatypes.exchange_alias(alias: str) str[source]
+

Naming convention for local exchange variables to send and receive.

+
+ +
+
+

agentlib_mpc.data_structures.casadi_utils module

+

Stores all sorts of Dataclasses, Enums or Factories to help with the +CasadiBackend.

+
+
+pydantic model agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions[source]
+

Bases: DiscretizationOptions

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
+
+
+field collocation_method: CollocationMethod = CollocationMethod.legendre
+
+ +
+
+field collocation_order: int = 3
+
+
Constraints:
+
    +
  • ge = 1

  • +
  • le = 9

  • +
+
+
+
+ +
+
+field integrator: Integrators = Integrators.cvodes
+
+ +
+
+field method: DiscretizationMethod = DiscretizationMethod.collocation
+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.CollocationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+legendre = 'legendre'
+
+ +
+
+radau = 'radau'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Constraint(function: casadi.casadi.MX, lb: casadi.casadi.MX, ub: casadi.casadi.MX)[source]
+

Bases: object

+
+
+function: MX
+
+ +
+
+lb: MX
+
+ +
+
+ub: MX
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+collocation = 'collocation'
+
+ +
+
+multiple_shooting = 'multiple_shooting'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Integrators(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+cvodes = 'cvodes'
+
+ +
+
+euler = 'euler'
+
+ +
+
+rk = 'rk'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.ModelConstraint(lb, function, ub)[source]
+

Bases: NamedTuple

+
+
+function: MX
+

Alias for field number 1

+
+ +
+
+lb: MX | SX | Sparsity | DM | float | int
+

Alias for field number 0

+
+ +
+
+ub: MX | SX | Sparsity | DM | float | int
+

Alias for field number 2

+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.OptParMXContainer(var: ~typing.List[~casadi.casadi.MX] = <factory>, grid: ~typing.List[float] = <factory>)[source]
+

Bases: object

+

Stores the necessary MX variables created during discretization for +OptimizationParameters.

+
+
+grid: List[float]
+
+ +
+
+var: List[MX]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer(var: ~typing.List[~casadi.casadi.MX] = <factory>, grid: ~typing.List[float] = <factory>, lb: ~typing.List[~casadi.casadi.MX] = <factory>, ub: ~typing.List[~casadi.casadi.MX] = <factory>, guess: ~typing.List[~casadi.casadi.MX] = <factory>, opt: ~casadi.casadi.DM = None)[source]
+

Bases: OptParMXContainer

+

Stores the necessary MX variables created during discretization for +OptimizationVariables.

+
+
+grid: List[float]
+
+ +
+
+guess: List[MX]
+
+ +
+
+lb: List[MX]
+
+ +
+
+opt: DM = None
+
+ +
+
+ub: List[MX]
+
+ +
+
+var: List[MX]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.SolverFactory(do_jit: bool, bat_file: ~pathlib.Path = None, name: str = None, options: ~agentlib_mpc.data_structures.casadi_utils.SolverOptions = <factory>, logger: ~logging.Logger = None)[source]
+

Bases: object

+

Creates a solver given an NLP and an options construct.

+
+
+bat_file: Path = None
+
+ +
+
+create_solver(nlp: dict | str, discrete: List[bool] = None, equalities: list[bool] = None) Function[source]
+
+ +
+
+do_jit: bool
+
+ +
+
+logger: Logger = None
+
+ +
+
+make_casadi_nlp(problem: dict | str, solver: str, opts: dict, problem_type: Literal['nlp', 'qp'] = 'nlp')[source]
+
+ +
+
+name: str = None
+
+ +
+
+options: SolverOptions
+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.casadi_utils.SolverOptions[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
+
+
+field name: Solvers = 'ipopt'
+
+ +
+
+field options: dict = {}
+
+ +
+ +
+
+class agentlib_mpc.data_structures.casadi_utils.Solvers(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+bonmin = 'bonmin'
+
+ +
+
+fatrop = 'fatrop'
+
+ +
+
+gurobi = 'gurobi'
+
+ +
+
+ipopt = 'ipopt'
+
+ +
+
+osqp = 'osqp'
+
+ +
+
+proxqp = 'proxqp'
+
+ +
+
+qpoases = 'qpoases'
+
+ +
+
+sqpmethod = 'sqpmethod'
+
+ +
+ +
+
+agentlib_mpc.data_structures.casadi_utils.compile_solver(bat_file: Path, name: str, optimizer: Function) str[source]
+

Code-generates an ipopt solver and compiles it. +Currently, only works on Windows! Requires a batch file that knows +how to setup Visual Studio command line and compiles the source code.

+
+
Returns:
+

The Path to the .dll file for the compiled solver.

+
+
Raises:
+
    +
  • TypeError

  • +
  • FileNotFoundError

  • +
  • RuntimeError

  • +
+
+
+
+ +
+
+agentlib_mpc.data_structures.casadi_utils.temporary_directory(path)[source]
+
+ +
+
+

agentlib_mpc.data_structures.coordinator_datatypes module

+
+
+class agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry(name: str, status: AgentStatus = AgentStatus.pending)[source]
+

Bases: object

+

Dataclass holding the status of a participating agent in DMPC.

+
+
+name: str
+
+ +
+
+optimization_data = OptimizationData(x=array([], dtype=float64), u=array([], dtype=float64))
+
+ +
+
+status: AgentStatus = 'pending'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Enum used within a DMPC-Coordinator to keep track of the statuses of its +participating agents.

+
+
+busy = 'busy'
+
+ +
+
+pending = 'pending'
+
+ +
+
+ready = 'ready'
+
+ +
+
+standby = 'standby'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Enum used to keep track of the status of a DMPC-Coordinator.

+
+
+init_iterations = 'init_iterations'
+
+ +
+
+optimization = 'optimization'
+
+ +
+
+sleeping = 'sleeping'
+
+ +
+
+updating = 'updating'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData(x: ~numpy.array = <factory>, u: ~numpy.array = <factory>)[source]
+

Bases: object

+

Contains specific variables (or time series) of the agent

+
+
+classmethod from_dict(data: dict)[source]
+
+ +
+
+to_dict() dict[source]
+
+ +
+
+u: array
+
+ +
+
+x: array
+
+ +
+ +
+
+class agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage(status: AgentStatus = None, opts: dict = None, agent_id: str = None, coupling: list = None)[source]
+

Bases: object

+

Dataclass structuring the communication during registration between a +participating agent and the coordinator in DMPC.

+
+
+agent_id: str = None
+
+ +
+
+coupling: list = None
+
+ +
+
+opts: dict = None
+
+ +
+
+status: AgentStatus = None
+
+ +
+ +
+
+

agentlib_mpc.data_structures.interpolation module

+
+
+class agentlib_mpc.data_structures.interpolation.InterpolationMethods(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+linear = 'linear'
+
+ +
+
+mean_over_interval = 'mean_over_interval'
+
+ +
+
+no_interpolation = 'no_interpolation'
+
+ +
+
+previous = 'previous'
+
+ +
+
+spline3 = 'spline3'
+
+ +
+ +
+
+

agentlib_mpc.data_structures.ml_model_datatypes module

+
+
+pydantic model agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback[source]
+

Bases: BaseModel

+
+
Fields:
+
+
+
+
+
+field activate: bool = False
+
+ +
+
+field patience: int = (1000,)
+
+ +
+
+field restore_best_weights: bool = True
+
+ +
+
+field verbose: Literal[0, 1] = 0
+
+ +
+
+callback()[source]
+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.ml_model_datatypes.Feature[source]
+

Bases: BaseModel

+
+
Fields:
+
+
+
+
+
+field lag: int = 1
+
+ +
+
+field name: str [Required]
+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature[source]
+

Bases: Feature

+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field output_type: OutputType [Required]
+

What kind of output this is. If ‘absolute’ an forward pass of the MLModel will yield the absolute value of the featuer at the next time step. If it is ‘difference’, the difference to the last time step will be generated, so it has to be added again.

+
+ +
+
+field recursive: bool = True
+

If the output feature is recursive, it will also be used as an input for the model. This is useful for mpc, where we want to model the evolution of states based on their previous value. If false, can be used to model algebraic relationships. Default is true.

+
+
Validated by:
+
+
+
+
+ +
+
+validator non_recursive_features_have_to_be_absolute  »  recursive[source]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.ml_model_datatypes.OutputType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+absolute = 'absolute'
+
+ +
+
+difference = 'difference'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.ml_model_datatypes.TrainingData(training_inputs: DataFrame, training_outputs: DataFrame, validation_inputs: DataFrame, validation_outputs: DataFrame, test_inputs: DataFrame, test_outputs: DataFrame)[source]
+

Bases: object

+

Stores the data which is used to train a model.

+
+
+classmethod load(path: Path)[source]
+
+ +
+
+save(path: Path)[source]
+

Saves three csv files in the path location. The csv files contain the test, +training and validation data

+
+ +
+
+test_inputs: DataFrame
+
+ +
+
+test_outputs: DataFrame
+
+ +
+
+training_inputs: DataFrame
+
+ +
+
+training_outputs: DataFrame
+
+ +
+
+validation_inputs: DataFrame
+
+ +
+
+validation_outputs: DataFrame
+
+ +
+ +
+
+agentlib_mpc.data_structures.ml_model_datatypes.column_order(inputs: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature], outputs: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature]) list[str][source]
+

Defines the order of the columns in which Training data should be passed to +keras, and saved for the Serialization.

+
+ +
+
+agentlib_mpc.data_structures.ml_model_datatypes.name_with_lag(name: str, lag: int) str[source]
+
+ +
+
+

agentlib_mpc.data_structures.mpc_datamodels module

+
+
+class agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference[source]
+

Bases: object

+
+
+all_variables() List[str][source]
+

Returns a list of all variables registered in the var_ref

+
+ +
+
+classmethod from_config(config: BaseModuleConfigClass)[source]
+

Creates an instance from a pydantic values dict which includes lists of +AgentVariables with the keys corresponding to ‘states’, ‘inputs’, etc..

+
+ +
+ +
+
+pydantic model agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions[source]
+

Bases: BaseModel

+

Class defining the options to discretize an MPC. Can be extended for different +optimization implementations.

+
+
Config:
+
    +
  • extra: str = allow

  • +
+
+
Fields:
+
+
+
+
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: VariableReference

+
+
+property r_del_u: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.InitStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+

Keep track of the readyness status of the MPC.

+
+
+during_update = '2'
+
+ +
+
+pre_module_init = '1'
+
+ +
+
+ready = '3'
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference(states: List[str] = <factory>, measured_states: List[str] = <factory>, weights_states: List[str] = <factory>, estimated_inputs: List[str] = <factory>, estimated_parameters: List[str] = <factory>, known_inputs: List[str] = <factory>, known_parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: BaseVariableReference

+
+
+all_variables() Iterable[str][source]
+

Returns a list of all variables registered in the var_ref which the MHE can +get from the config with get()

+
+ +
+
+estimated_inputs: List[str]
+
+ +
+
+estimated_parameters: List[str]
+
+ +
+
+known_inputs: List[str]
+
+ +
+
+known_parameters: List[str]
+
+ +
+
+measured_states: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+states: List[str]
+
+ +
+
+weights_states: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>, binary_controls: List[str] = <factory>)[source]
+

Bases: VariableReference

+
+
+binary_controls: List[str]
+
+ +
+
+controls: List[str]
+
+ +
+
+inputs: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+parameters: List[str]
+
+ +
+
+states: List[str]
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.MPCVariable(*, name: str, type: str | None = None, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, alias: str = None, source: dict | Source | str = Source(agent_id=None, module_id=None), shared: bool | None = None, rdf_class: str | None = None, interpolation_method: InterpolationMethods = InterpolationMethods.linear)[source]
+

Bases: AgentVariable

+

AgentVariable used to define input variables of MPC.

+
+
+interpolation_method: InterpolationMethods
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.Results(*args, **kwargs)[source]
+

Bases: Protocol

+
+
+df: DataFrame
+
+ +
+ +
+
+class agentlib_mpc.data_structures.mpc_datamodels.VariableReference(states: List[str] = <factory>, controls: List[str] = <factory>, inputs: List[str] = <factory>, parameters: List[str] = <factory>, outputs: List[str] = <factory>)[source]
+

Bases: BaseVariableReference

+
+
+controls: List[str]
+
+ +
+
+inputs: List[str]
+
+ +
+
+outputs: List[str]
+
+ +
+
+parameters: List[str]
+
+ +
+
+states: List[str]
+
+ +
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.cia_relaxed_results_path(path: Path | str) Path[source]
+
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.r_del_u_convention(name: str) str[source]
+

Turns the name of a control variable into its weight via convention

+
+ +
+
+agentlib_mpc.data_structures.mpc_datamodels.stats_path(path: Path | str) Path[source]
+
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.html b/docs/0.6.4/docs/code/agentlib_mpc.html new file mode 100644 index 0000000..cc98ea6 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.html @@ -0,0 +1,935 @@ + + + + + + + + + agentlib_mpc package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc package

+

Plugin for the AgentLib which contains modules for MPC, distributed MPC with ADMM +and data-driven modeling.

+
+

Subpackages

+
+ +
+
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.models.html b/docs/0.6.4/docs/code/agentlib_mpc.models.html new file mode 100644 index 0000000..f19b9e9 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.models.html @@ -0,0 +1,1579 @@ + + + + + + + + + agentlib_mpc.models package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.models package

+

Package containing models for agentlib_mpc.

+
+

Submodules

+
+
+

agentlib_mpc.models.casadi_ml_model module

+

Holds the classes for CasADi variables and the CasADi model.

+
+
+class agentlib_mpc.models.casadi_ml_model.CasadiMLModel(**kwargs)[source]
+

Bases: CasadiModel

+

This class is created to handle one or multiple ML models +used to predict the states. Compared to previous version, it is now +only dependent on the trained models which provides information about the lags +with the serialized_ML_Models. This way, there is no need to define the lags +again in the model class

+
+
+property auxiliaries: List[CasadiState]
+

List of all CasadiStates without an associated equation. Common +uses for this are slack variables that appear in cost functions and +constraints of optimization models.

+
+ +
+
+property bb_outputs: List[CasadiOutput]
+

List of all CasadiStates with an associated black box equation.

+
+ +
+
+property bb_states: List[CasadiState]
+

List of all CasadiStates with an associated black box equation.

+
+ +
+
+config_type: CasadiMLModelConfig
+
+ +
+
+do_step(*, t_start, t_sample=None)[source]
+

Simulates a time step of the simulation model. In CasADi MLModel model, both black- +and white-box models can be used in the simulation to be combined into a grey-box

+
+ +
+
+get_ml_model_values(time: float)[source]
+

gets the inputs values with the correct lags or all MLModels

+
+ +
+
+initialize(**ignored)[source]
+

Prepare the black- and white-box models for CasADi backend optimization and +simulation

+
+ +
+
+make_predict_function_for_mpc() Function[source]
+

Creates a prediction step function which is suitable for MPC with multiple +shooting.

+
+ +
+
+register_ml_models() tuple[dict[str, agentlib_mpc.models.serialized_ml_model.SerializedMLModel], dict[str, agentlib_mpc.models.casadi_predictor.CasadiPredictor]][source]
+

Loads a serialized MLModel and find the output states of the MLModel +Divides the differential states of the model into states determined by white-box +model (self._differentials) and by black-box model (self._differentials_network)

+
+ +
+
+set_with_timestamp(name: str, value: Any, timestamp: float)[source]
+
+ +
+
+setup_system()[source]
+
+ +
+
+update_ml_models(*ml_models: SerializedMLModel, time: float)[source]
+

Updates the internal MLModels with the passed MLModels.

+

Warning: This function does not fully check, if the result makes sense! +Consider the following case: +You have two ml_models with outputs out1 in ml_model1, and out2 and out3 in ml_model2. +You call this function with an ml_model3 that defines out2. +This function would replace ml_model2 with ml_model3, leaving the out3 undefined, causing +an error in subequent functions. Try to make sure you specify all outputs when +supplying ml_models, that make parts of other ml_models obsolete.

+
+ +
+ +
+
+pydantic model agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig[source]
+

Bases: CasadiModelConfig

+
+
Config:
+
    +
  • validate_assignment: bool = True

  • +
  • arbitrary_types_allowed: bool = True

  • +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field dt: float | int = 1
+
+
Validated by:
+
+
+
+
+ +
+
+field ml_model_sources: list[Union[agentlib_mpc.models.serialized_ml_model.SerializedMLModel, pathlib.Path]] = []
+
+
Validated by:
+
+
+
+
+ +
+
+validator check_dt  »  all fields[source]
+
+ +
+
+validator check_or_load_models  »  ml_model_sources[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+agentlib_mpc.models.casadi_ml_model.assert_recursive_outputs_are_states(serialized: SerializedMLModel, outputs: dict[str, agentlib.core.datamodels.AgentVariable])[source]
+

Raises a ConfigurationError if there are recursive ML-models for outputs.

+
+ +
+
+agentlib_mpc.models.casadi_ml_model.compute_dupes(collection: Iterable[T]) list[T][source]
+

Computes the duplicate elements in a collection

+
+ +
+
+

agentlib_mpc.models.casadi_model module

+

Holds the classes for CasADi variables and the CasADi model.

+
+
+class agentlib_mpc.models.casadi_model.CasadiInput(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of control variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiModel(**kwargs)[source]
+

Bases: Model

+

Base Class for CasADi models. To implement your own model, inherit +from this class, specify the variables (inputs, outputs, states, +parameters and override the setup_system() method.

+
+
+property auxiliaries: List[CasadiState]
+

List of all CasadiStates without an associated equation. Common +uses for this are slack variables that appear in cost functions and +constraints of optimization models.

+
+ +
+
+property differentials: List[CasadiState]
+

List of all CasadiStates with an associated differential equation.

+
+ +
+
+do_step(*, t_start, t_sample=None)[source]
+

Performing one simulation step +:param t_start: start time for integration +:param t_sample: increment of solver integration

+

Returns:

+
+ +
+
+get(name: str) CasadiVariable[source]
+

Get any variable from using name:

+
+
Parameters:
+

name (str) – The item to get from config by name of Variable. +Hence, item=ModelVariable.name

+
+
Returns:
+

The matching variable

+
+
Return type:
+

var (ModelVariable)

+
+
Raises:
+

AttributeError – If the item was not found in the variables of the + module.

+
+
+
+ +
+
+get_constraints() List[ModelConstraint][source]
+

List of constraints of the form (lower, function, upper).

+
+ +
+
+get_differential_values()[source]
+
+ +
+
+get_input_values()[source]
+
+ +
+
+initialize(**ignored)[source]
+

Initializes Casadi model. Creates the integrator to be used in +do_step(). The integrator takes the current state and input values as +input and returns the state values at the end of the interval and the +value of the cost function integrated over the interval.

+
+ +
+
+property inputs: list[agentlib_mpc.models.casadi_model.CasadiInput]
+

Get all model inputs as a list

+
+ +
+
+property output_equations: List[MX | SX | DM | Sparsity]
+

List of algebraic equations RHS in the form +0 = z - g(x, z, p, … )

+
+ +
+
+property outputs: list[agentlib_mpc.models.casadi_model.CasadiOutput]
+

Get all model outputs as a list

+
+ +
+
+property parameters: list[agentlib_mpc.models.casadi_model.CasadiParameter]
+

Get all model parameters as a list

+
+ +
+
+set_differential_values(values: List | ndarray)[source]
+

Sets the values for all differential variables. Provided values list MUST +match the order in which differentials are saved, there is no check.

+
+ +
+
+set_output_values(values: List | ndarray)[source]
+

Sets the values for all outputs. Provided values list MUST match the order +in which outputs are saved, there is no check.

+
+ +
+
+abstract setup_system()[source]
+
+ +
+
+property states: list[agentlib_mpc.models.casadi_model.CasadiState]
+

Get all model states as a list

+
+ +
+ +
+
+pydantic model agentlib_mpc.models.casadi_model.CasadiModelConfig[source]
+

Bases: ModelConfig

+
+
Config:
+
    +
  • validate_assignment: bool = True

  • +
  • arbitrary_types_allowed: bool = True

  • +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
    +
  • check_name » name

  • +
  • include_default_model_variables » inputs

  • +
  • include_default_model_variables » outputs

  • +
  • include_default_model_variables » parameters

  • +
  • include_default_model_variables » states

  • +
+
+
+
+
+field cost_function: MX | SX | DM | Sparsity = None
+
+ +
+
+field description: str = 'You forgot to document your model!'
+
+ +
+
+field dt: float | int = 1
+
+ +
+
+field inputs: List[CasadiInput] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field name: str | None = None
+
+
Validated by:
+
    +
  • check_name

  • +
+
+
+
+ +
+
+field outputs: List[CasadiOutput] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field parameters: List[CasadiParameter] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field sim_time: float = 0
+
+ +
+
+field states: List[CasadiState] = []
+
+
Validated by:
+
    +
  • include_default_model_variables

  • +
+
+
+
+ +
+
+field system: MX | SX | DM | Sparsity = None
+
+ +
+
+field user_config: dict = None
+

The config given by the user to instantiate this class.Will be stored to enable a valid overwriting of the default config and to better restart modules.Is also useful to debug validators and the general BaseModuleConfig.

+
+ +
+
+field validate_variables: bool = True
+

If true, the validator of a variables value is called whenever a new value is set. Disabled by default for performance reasons.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiOutput(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None, _alg: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of control variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+
+json(**kwargs)[source]
+

Serializes the Variable in json format and returns a string

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiParameter(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of parameters.

+
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiState(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None, _ode: MX | SX | DM | Sparsity | None = None)[source]
+

Bases: CasadiVariable

+

Class that stores various attributes of CasADi differential variables.

+
+
+property alg: MX | SX | DM | Sparsity
+
+ +
+
+json(indent: int = 2, **kwargs)[source]
+

Serializes the Variable in json format and returns a string

+
+ +
+
+property ode: MX | SX | DM | Sparsity
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_model.CasadiVariable(*, name: str, timestamp: float | None = None, unit: str = 'Not defined', description: str = 'Not defined', ub=inf, lb=-inf, clip: bool = False, allowed_values: List[Any] = [], value: Any = None, causality: Causality = None, variability: Variability = None, type: str | None = 'float', sim_time: float = 0.0, _sym: MX | SX | DM | Sparsity = None)[source]
+

Bases: ModelVariable

+

Base Class for variables used in Casadi Models for simulation and +optimization. Implements the standard arithmetic operations, +so CasadiVariables can be used in equations. +.. attribute:: sym

+
+

The symbolic CasADi variable used to define ode’s and +optimization problems.

+
+
+
+create_sym() MX[source]
+

Ensures a symbolic MX variable is created with each CasadiVariable +instance, and that its dimensions are consistent.

+
+ +
+
+property sym: MX
+
+ +
+ +
+
+agentlib_mpc.models.casadi_model.get_symbolic(equation)[source]
+
+ +
+
+

agentlib_mpc.models.casadi_predictor module

+
+
+class agentlib_mpc.models.casadi_predictor.ANNLayerTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+BATCHNORMALIZATION = 'batch_normalization'
+
+ +
+
+DENSE = 'dense'
+
+ +
+
+FLATTEN = 'flatten'
+
+ +
+
+LSTM = 'lstm'
+
+ +
+
+RESCALING = 'rescaling'
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.BatchNormalization(layer: BatchNormalization)[source]
+

Bases: Layer

+

Batch Normalizing layer. Make sure the axis setting is set to two.

+
+
+forward(input)[source]
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.CasadiANN(serialized_model: SerializedANN)[source]
+

Bases: CasadiPredictor

+

Generic implementations of sequential Keras models in CasADi.

+
+
+property input_shape: tuple[int, int]
+

Input shape of Predictor.

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.CasadiGPR(serialized_model: SerializedGPR)[source]
+

Bases: CasadiPredictor

+

Generic implementation of scikit-learn Gaussian Process Regressor.

+
+
+property input_shape: tuple[int, int]
+

Input shape of Predictor.

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.CasadiLinReg(serialized_model: SerializedLinReg)[source]
+

Bases: CasadiPredictor

+

Generic Casadi implementation of scikit-learn LinerRegression.

+
+
+property input_shape: tuple[int, int]
+

Input shape of Predictor.

+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.CasadiPredictor(serialized_model: SerializedMLModel)[source]
+

Bases: ABC

+

Protocol for generic Casadi implementation of various ML-Model-based predictors.

+
+
+serialized_model
+

Serialized model which will be translated to a casadi model.

+
+ +
+
+predictor_model
+

Predictor model from other libraries, which are translated to

+
+ +
+
+casadi syntax.
+
+ +
+
+sym_input
+

Symbolical input of predictor. Has the necessary shape of the input.

+
+ +
+
+prediction_function
+

Symbolical casadi prediction function of the given model.

+
+ +
+
+class Config[source]
+

Bases: object

+
+
+arbitrary_types_allowed = True
+
+ +
+ +
+
+classmethod from_serialized_model(serialized_model: SerializedMLModel)[source]
+

Initialize sub predictor class.

+
+ +
+
+abstract property input_shape: tuple[int, int]
+

Input shape of Predictor.

+
+ +
+
+property output_shape: tuple[int, int]
+

Output shape of Predictor.

+
+ +
+
+predict(x: ndarray | MX) DM | MX[source]
+

Evaluate prediction function with input data. +:param x: input data.

+
+
Returns:
+

results of evaluation of prediction function with input data.

+
+
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.Dense(layer: Dense)[source]
+

Bases: Layer

+

Fully connected layer.

+
+
+forward(input)[source]
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.Flatten(layer: Layer)[source]
+

Bases: Layer

+
+
+forward(input)[source]
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.LSTM(layer: LSTM)[source]
+

Bases: Layer

+

Long Short Term Memory cell.

+
+
+forward(input)[source]
+
+ +
+
+step(x_t, c_prev, h_prev)[source]
+
+ +
+ +
+
+class agentlib_mpc.models.casadi_predictor.Layer(layer: Layer)[source]
+

Bases: object

+

Single layer of an artificial neural network.

+
+
+static get_activation(function: str)[source]
+
+ +
+
+update_dimensions()[source]
+

CasADi does only work with two dimensional arrays. So the dimensions must be updated.

+
+ +
+ +
+
+

agentlib_mpc.models.serialized_ml_model module

+
+
+class agentlib_mpc.models.serialized_ml_model.CustomGPR(kernel=None, *, alpha=1e-10, optimizer='fmin_l_bfgs_b', n_restarts_optimizer=0, normalize_y=False, copy_X_train=True, random_state=None, data_handling=GPRDataHandlingParameters(normalize=False, scale=1.0, mean=None, std=None))[source]
+

Bases: GaussianProcessRegressor

+

Extends scikit-learn GaussianProcessRegressor with normalizing and scaling option +by adding the attribute data_handling, customizing the predict function accordingly +and adding a normalize function.

+
+
+predict(X, return_std=False, return_cov=False)[source]
+

Overwrite predict method of GaussianProcessRegressor to include normalization.

+
+ +
+
+set_predict_request(*, return_cov: bool | None | str = '$UNCHANGED$', return_std: bool | None | str = '$UNCHANGED$') CustomGPR
+

Request metadata passed to the predict method.

+

Note that this method is only relevant if +enable_metadata_routing=True (see sklearn.set_config()). +Please see User Guide on how the routing +mechanism works.

+

The options for each parameter are:

+
    +
  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • +
  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • +
  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • +
  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

  • +
+

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the +existing request. This allows you to change the request for some +parameters and not others.

+
+

New in version 1.3.

+
+
+

Note

+

This method is only relevant if this estimator is used as a +sub-estimator of a meta-estimator, e.g. used inside a +Pipeline. Otherwise it has no effect.

+
+
+
Parameters:
+
    +
  • return_cov (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_cov parameter in predict.

  • +
  • return_std (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_std parameter in predict.

  • +
+
+
Returns:
+

self – The updated object.

+
+
Return type:
+

object

+
+
+
+ +
+
+set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') CustomGPR
+

Request metadata passed to the score method.

+

Note that this method is only relevant if +enable_metadata_routing=True (see sklearn.set_config()). +Please see User Guide on how the routing +mechanism works.

+

The options for each parameter are:

+
    +
  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • +
  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • +
  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • +
  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

  • +
+

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the +existing request. This allows you to change the request for some +parameters and not others.

+
+

New in version 1.3.

+
+
+

Note

+

This method is only relevant if this estimator is used as a +sub-estimator of a meta-estimator, e.g. used inside a +Pipeline. Otherwise it has no effect.

+
+
+
Parameters:
+

sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for sample_weight parameter in score.

+
+
Returns:
+

self – The updated object.

+
+
Return type:
+

object

+
+
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters[source]
+

Bases: BaseModel

+
+
Fields:
+
+
+
+
+
+field mean: list | None = None
+

Mean values of input data for normalization. None if normalize equals to False.

+
+ +
+
+field normalize: bool = False
+

Boolean which defines whether the input data will be normalized or not.

+
+ +
+
+field scale: float = 1.0
+

Number by which the y vector is divided before training and multiplied after evaluation.

+
+ +
+
+field std: list | None = None
+

Standard deviation of input data for normalization. None if normalize equals to False.

+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.GPRKernelParameters[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
+
+
Fields:
+
+
+
+
+
+field constant_value: float = 1.0
+

The constant value which defines the covariance: k(x_1, x_2) = constant_value.

+
+ +
+
+field constant_value_bounds: tuple | str = (1e-05, 100000.0)
+

The lower and upper bound on constant_value. If set to “fixed”, constant_value cannot be changed during hyperparameter tuning.

+
+ +
+
+field length_scale: float | list = 1.0
+

The length scale of the kernel. If a float, an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of l defines the length-scale of the respective feature dimension.

+
+ +
+
+field length_scale_bounds: tuple | str = (1e-05, 100000.0)
+

The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.

+
+ +
+
+field noise_level: float = 1.0
+

Parameter controlling the noise level (variance).

+
+ +
+
+field noise_level_bounds: tuple | str = (1e-05, 100000.0)
+

The lower and upper bound on ‘noise_level’. If set to “fixed”, ‘noise_level’ cannot be changed during hyperparameter tuning.

+
+ +
+
+field theta: list [Required]
+

Returns the (flattened, log-transformed) non-fixed gpr_parameters.

+
+ +
+
+classmethod from_model(model: CustomGPR) GPRKernelParameters[source]
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.GPRParameters[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
+
+
Fields:
+
+
+
+
+
+field L: list [Required]
+

Lower-triangular Cholesky decomposition of the kernel in X_train.

+
+ +
+
+field X_train: list [Required]
+

Feature vectors or other representations of training data (also required for prediction).

+
+ +
+
+field alpha: float | list = 1e-10
+

Value added to the diagonal of the kernel matrix during fitting. This can prevent a potential numerical issue during fitting, by ensuring that the calculated values form a positive definite matrix. It can also be interpreted as the variance of additional Gaussian measurement noise on the training observations. Note that this is different from using a WhiteKernel. If an array is passed, it must have the same number of entries as the data used for fitting and is used as datapoint-dependent noise level. Allowing to specify the noise level directly as a parameter is mainly for convenience and for consistency with Ridge.

+
+ +
+
+field log_marginal_likelihood_value: float [Required]
+

The log-marginal-likelihood of self.kernel_.theta.

+
+ +
+
+field n_features_in: int [Required]
+

Number of features seen during fit.

+
+ +
+
+field y_train: list [Required]
+

Target values in training data (also required for prediction).

+
+ +
+
+classmethod from_model(model: CustomGPR) GPRParameters[source]
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.LinRegParameters[source]
+

Bases: BaseModel

+
+
Fields:
+
+
+
+
+
+field coef: list [Required]
+

Estimated coefficients for the linear regression problem. If multiple targets are passed during the fit (y 2D), this is a 2D array of shape (n_targets, n_features), while if only one target is passed, this is a 1D array of length n_features.

+
+ +
+
+field intercept: float | list [Required]
+

Independent term in the linear model. Set to 0.0 if fit_intercept = False.

+
+ +
+
+field n_features_in: int [Required]
+

Number of features seen during fit.

+
+ +
+
+field rank: int [Required]
+

Rank of matrix X. Only available when X is dense.

+
+ +
+
+field singular: list [Required]
+

Singular values of X. Only available when X is dense.

+
+ +
+ +
+
+class agentlib_mpc.models.serialized_ml_model.MLModels(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: str, Enum

+
+
+ANN = 'ANN'
+
+ +
+
+GPR = 'GPR'
+
+ +
+
+LINREG = 'LinReg'
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.SerializedANN[source]
+

Bases: SerializedMLModel

+

Contains Keras ANN in serialized form and offers functions to transform +Keras Sequential ANNs to SerializedANN objects (from_ANN) and vice versa (deserialize).

+
+
+structure
+

architecture/structure of ANN saved as json string.

+
+ +
+
+weights
+

weights and biases of all layers saved as lists of np.ndarrays.

+
+ +
+
Config:
+
    +
  • protected_namespaces: tuple = ()

  • +
  • arbitrary_types_allowed: bool = True

  • +
+
+
Fields:
+
+
+
+
+
+field model_type: MLModels = MLModels.ANN
+
+ +
+
+field structure: str = None
+

The structure of the ANN as json string.

+
+ +
+
+field weights: list = None
+

The weights of the ANN.

+
+ +
+
+deserialize() Sequential[source]
+

Deserializes SerializedANN object and returns a Keras Sequential ANN.

+
+ +
+
+classmethod serialize(model: Sequential, dt: float | int, input: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature], output: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature], training_info: dict | None = None)[source]
+

Serializes Keras Sequential ANN and returns SerializedANN object

+
+ +
+
+to_dict() dict[source]
+

Transforms self to a dictionary and the numpy arrays to lists, so they can +be serialized.

+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.SerializedGPR[source]
+

Bases: SerializedMLModel

+

Contains scikit-learn GaussianProcessRegressor and its Kernel and provides functions to transform +these to SerializedGPR objects and vice versa.

+

Attributes:

+
+
Config:
+
    +
  • protected_namespaces: tuple = ()

  • +
  • arbitrary_types_allowed: bool = True

  • +
+
+
Fields:
+
+
+
+
+
+field data_handling: GPRDataHandlingParameters = None
+

Information about data handling for GPR.

+
+ +
+
+field gpr_parameters: GPRParameters = None
+

GPR parameters of GPR and its Kernel and Data of fitted GPR.

+
+ +
+
+field kernel_parameters: GPRKernelParameters = None
+

Parameters of kernel of the fitted GPR.

+
+ +
+
+field model_type: MLModels = MLModels.GPR
+
+ +
+
+deserialize() CustomGPR[source]
+

Deserializes SerializedGPR object and returns a scikit learn GaussionProcessRegressor. +:returns: GPR version of the SerializedGPR +:rtype: gpr_fitted

+
+ +
+
+classmethod serialize(model: CustomGPR, dt: float | int, input: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature], output: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature], training_info: dict | None = None)[source]
+
+
Parameters:
+
    +
  • model – GaussianProcessRegressor from ScikitLearn.

  • +
  • dt – The length of time step of one prediction of GPR in seconds.

  • +
  • input – GPR input variables with their lag order.

  • +
  • output – GPR output variables (which are automatically also inputs, as +we need them recursively in MPC.) with their lag order.

  • +
  • training_info – Config of Trainer Class, which trained the Model.

  • +
+
+
Returns:
+

SerializedGPR version of the passed GPR.

+
+
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.SerializedLinReg[source]
+

Bases: SerializedMLModel

+

Contains scikit-learn LinearRegression and provides functions to transform +these to SerializedLinReg objects and vice versa.

+

Attributes:

+
+
Config:
+
    +
  • protected_namespaces: tuple = ()

  • +
  • arbitrary_types_allowed: bool = True

  • +
+
+
Fields:
+
+
+
+
+
+field model_type: MLModels = MLModels.LINREG
+
+ +
+
+field parameters: LinRegParameters [Required]
+

Parameters of kernel of the fitted linear model.

+
+ +
+
+deserialize() LinearRegression[source]
+

Deserializes SerializedLinReg object and returns a LinearRegression object of scikit-learn. +:returns: LinearRegression version of the SerializedLinReg +:rtype: linear_model_fitted

+
+ +
+
+classmethod serialize(model: LinearRegression, dt: float | int, input: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature], output: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature], training_info: dict | None = None)[source]
+
+
Parameters:
+
    +
  • model – LinearRegression from ScikitLearn.

  • +
  • dt – The length of time step of one prediction of LinReg in seconds.

  • +
  • input – LinReg input variables with their lag order.

  • +
  • output – LinReg output variables (which are automatically also inputs, as ” +“we need them recursively in MPC.) with their lag order.

  • +
  • training_info – Config of Trainer Class, which trained the Model.

  • +
+
+
Returns:
+

SerializedLinReg version of the passed linear model.

+
+
+
+ +
+ +
+
+pydantic model agentlib_mpc.models.serialized_ml_model.SerializedMLModel[source]
+

Bases: BaseModel, ABC

+
+
Config:
+
    +
  • protected_namespaces: tuple = ()

  • +
+
+
Fields:
+
+
+
+
+
+field agentlib_mpc_hash: str [Optional]
+

The commit hash of the agentlib_mpc version this was created with.

+
+ +
+
+field dt: float | int [Required]
+

The length of time step of one prediction of Model in seconds.

+
+ +
+
+field input: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature] = None
+

Model input variables with their lag order.

+
+ +
+
+field model_type: MLModels [Required]
+
+ +
+
+field output: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature] = None
+

Model output variables (which are automatically also inputs, as we need them recursively in MPC.) with their lag order.

+
+ +
+
+field training_info: dict | None = None
+

Config of Trainer class with all the meta data used for training of the Model.

+
+ +
+
+abstract deserialize()[source]
+

Deserializes SerializedMLModel object and returns a specific Machine Learning Model object. +:returns: Machine Learning Model. +:rtype: MLModel

+
+ +
+
+classmethod load_serialized_model(model_data: dict | str | Path)[source]
+

Loads the ML model from a source

+
+ +
+
+classmethod load_serialized_model_from_dict(model_data: dict)[source]
+

Loads SerializedMLModel object from a dict and creates a new specific Machine Learning Model object +which is returned.

+
+
Parameters:
+

json_string – json string which will be loaded.

+
+
Returns:
+

SerializedMLModel object with data from json file.

+
+
+
+ +
+
+classmethod load_serialized_model_from_file(path: Path)[source]
+

Loads SerializedMLModel object from a json file and creates a new specific Machine Learning Model object +which is returned.

+
+
Parameters:
+

path – relative/absolute path which determines which json file will be loaded.

+
+
Returns:
+

SerializedMLModel object with data from json file.

+
+
+
+ +
+
+classmethod load_serialized_model_from_string(json_string: str)[source]
+

Loads SerializedMLModel object from a json string and creates a new specific Machine Learning Model object +which is returned.

+
+
Parameters:
+

json_string – json string which will be loaded.

+
+
Returns:
+

SerializedMLModel object with data from json file.

+
+
+
+ +
+
+save_serialized_model(path: Path)[source]
+

Saves MLModel object as json string. +:param path: relative/absolute path which determines where the json will be saved.

+
+ +
+
+abstract classmethod serialize(model: Sequential | GaussianProcessRegressor | LinearRegression, dt: float | int, input: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.Feature], output: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature], training_info: dict | None = None)[source]
+
+
Parameters:
+
    +
  • model – Machine Learning Model.

  • +
  • dt – The length of time step of one prediction of Model in seconds.

  • +
  • input – Model input variables with their lag order.

  • +
  • output – Model output variables (which are automatically also inputs, as +we need them recursively in MPC.) with their lag order.

  • +
  • training_info – Config of Trainer Class, which trained the Model.

  • +
+
+
Returns:
+

SerializedMLModel version of the passed ML Model.

+
+
+
+ +
+ +
+
+agentlib_mpc.models.serialized_ml_model.get_git_revision_short_hash() str[source]
+
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.InputPrediction.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.InputPrediction.html new file mode 100644 index 0000000..eafc272 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.InputPrediction.html @@ -0,0 +1,176 @@ + + + + + + + + + agentlib_mpc.modules.InputPrediction package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.InputPrediction package

+
+

Submodules

+
+
+

agentlib_mpc.modules.InputPrediction.try_predictor module

+
+
+class agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor(*, config: dict, agent: Agent)[source]
+

Bases: TRYSensor

+
+
+process()[source]
+

Write the current TRY values into data_broker every other t_sample

+
+ +
+
+send_measurement()[source]
+
+ +
+
+send_prediction()[source]
+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictorConfig[source]
+

Bases: TRYSensorConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+

+
+
+
+field prediction_length: int = 24
+

prediction length in hours

+
+ +
+
+field predictions: List[AgentVariable] = [AgentVariable(name='T_oda_prediction', type=None, timestamp=None, unit='K', description='Air temperature 2m over ground [K]', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='T_oda_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='pressure_prediction', type=None, timestamp=None, unit='hPa', description='Air pressure in standard height [hPa]', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='pressure_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='wind_direction_prediction', type=None, timestamp=None, unit='°', description='Wind direction 10 m above gorund [Grad] {0..360;999}', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='wind_direction_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='wind_speed_prediction', type=None, timestamp=None, unit='m/s', description='Wind speed 10 m above ground [m/s]', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='wind_speed_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='coverage_prediction', type=None, timestamp=None, unit='eighth', description='[eighth]  {0..8;9}', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='coverage_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='absolute_humidity_prediction', type=None, timestamp=None, unit='g/kg', description='[g/kg]', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='absolute_humidity_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='relative_humidity_prediction', type=None, timestamp=None, unit='%', description='Relative humidity 2 m above ground [%] {1..100}', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='relative_humidity_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='beam_direct_prediction', type=None, timestamp=None, unit='W/m^2', description='Direct beam of sun (hor. plane) [W/m^2] downwards: positive', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='beam_direct_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='beam_diffuse_prediction', type=None, timestamp=None, unit='/m^2', description='Diffuse beam of sun (hor. plane) [W/m^2] downwards: positive', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='beam_diffuse_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='beam_atm_prediction', type=None, timestamp=None, unit='/m^2', description='Beam of atmospheric heat (hor. plane) [W/m^2] downwards: positive', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='beam_atm_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='beam_terr_prediction', type=None, timestamp=None, unit='/m^2', description='Beam of terrestrial heat [W/m^2] upwards: negative', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='beam_terr_prediction', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.admm.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.admm.html new file mode 100644 index 0000000..4e63437 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.admm.html @@ -0,0 +1,1741 @@ + + + + + + + + + agentlib_mpc.modules.dmpc.admm package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.dmpc.admm package

+
+

Submodules

+
+
+

agentlib_mpc.modules.dmpc.admm.admm module

+

Holds functionality for ADMM modules.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm.ADMM(config: dict, agent)[source]
+

Bases: DistributedMPC

+

This class represents a module participating in a fully decentralized +Consensus-ADMM optimization for distributed MPC. +Agents autonomously send the values of their coupling variables, register +other participants and perform update steps.

+
+
+admm_step()[source]
+

Performs an entire ADMM optimization.

+
+ +
+
+all_coupling_statuses() Iterable[ADMMParticipation][source]
+

Gives and iterator of all ADMMParticipation that are registered.

+
+ +
+
+assert_mpc_variables_are_in_model()[source]
+

Checks whether all variables of var_ref are contained in the model. +Returns names of model variables not contained in the var_ref, +sorted by keys: ‘states’, ‘inputs’, ‘outputs’, ‘parameters’.

+
+ +
+
+collect_couplings_for_optimization()[source]
+

Collects updated AgentVariables only of the coupling variables.

+
+ +
+
+collect_variables_for_optimization(var_ref: VariableReference = None) dict[str, agentlib.core.datamodels.AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary.

+
+ +
+
+property cons_and_exchange: List[ExchangeEntry | CouplingEntry]
+
+ +
+
+deregister_all_participants()[source]
+

Sets the participating status of all participating agents to +False.

+
+ +
+
+get_participants_values(coupling_alias: str) List[Series][source]
+

Get the values of all agents for a coupling variable.

+
+ +
+
+get_results() DataFrame | None[source]
+

Read the results that were saved from the optimization backend and +returns them as Dataframe.

+
+
Returns:
+

(results, stats) tuple of Dataframes.

+
+
+
+ +
+
+participant_callback(variable: AgentVariable)[source]
+

Puts received variables in the correct queue, depending on +registration status of this agent.

+
+ +
+
+property penalty_factor_var: MPCVariable
+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+receive_participant(variable: AgentVariable)[source]
+

Set the participation to true for the given coupling input.

+
+ +
+
+property registered_participants: Dict[str, Dict[str, ADMMParticipation]]
+

Dictionary containing all other agents this agent shares variables with. +Ordered in a two-layer form, with variables at the first layer and +agents at the second layer. Contains ADMMParticipation objects at +the base layer.

+

Examples

+

self.registered_participants = +{‘coupling_var_1’: {‘src_of_agent1’: status_1,

+
+
+

‘src_of_agent2’: status_2, +‘src_of_agent3’: status_3}

+
+
+
‘coupling_var_1’: {‘src_of_agent3’: status_a,

‘src_of_agent2’: status_b, +‘src_of_agent4’: status_c}

+
+
+
+

} +here, <status> refers to an ADMMParticipation object.

+
+ +
+
+reset_participants_ready()[source]
+

Sets the ready status of all participating agents to False.

+
+ +
+
+send_coupling_values(solution: Results)[source]
+

Sets the coupling outputs to the data_broker, which automatically sends them.

+
+
Parameters:
+

solution – Output dictionary from optimization_backend.solve().

+
+
+
+ +
+
+send_coupling_variable(name: str, value: int | float | list[Union[int, float]] | Series | ndarray)[source]
+

Sends an admm coupling variable through the data_broker and sets its +value locally

+
+ +
+
+update_lambda()[source]
+

Performs the update of the lagrange multipliers. +lambda^k+1 := lambda^k - rho*(z-x_i)

+
+ +
+
+var_ref: VariableReference
+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig[source]
+

Bases: DistributedMPCConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field controls: mpc_datamodels.MPCVariables = []
+

List of all control variables of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field couplings: List[MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field exchange: List[MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field inputs: mpc_datamodels.MPCVariables = []
+

List of all input variables of the MPC. Includes predictions for disturbances, set_points, dynamic constraint boundaries etc.

+
+
Validated by:
+
+
+
+
+ +
+
+field iteration_timeout: float = 20
+

Maximum computation + waiting time for one iteration.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field max_iterations: float = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field outputs: mpc_datamodels.MPCVariables = []
+

List of all shared outputs of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field parameters: mpc_datamodels.MPCVariables = []
+

List of model parameters of the MPC. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+
Validated by:
+
+
+
+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field r_del_u: dict[str, float] = {}
+

Weights that are applied to the change in control variables.

+
+
Validated by:
+
+
+
+
+ +
+
+field registration_period: float = 2
+

Time spent on registration before each optimization

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field set_outputs: bool = False
+

Sets the full output time series to the data broker.

+
+ +
+
+field shared_variable_fields: list[str] = ['outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field states: mpc_datamodels.MPCVariables = []
+

List of all differential states of the MPC. The entries can define the boundaries and the source for the measurements

+
+
Validated by:
+
+
+
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+validator check_prefixes_of_variables  »  exchange, controls, states, couplings, outputs, inputs, parameters[source]
+

Ensures no user provided variable is named with the reserved ADMM prefix.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation(variable)[source]
+

Bases: object

+

Holds data for the status of a shared variable of another system.

+
+
+de_register()[source]
+
+ +
+
+empty_memory()[source]
+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.LocalADMM(config: dict, agent)[source]
+

Bases: ADMM

+
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+property registration_delay: float
+

Timeout value used to wait one on registration. Waits in real time +(time.sleep)

+
+ +
+
+property sync_delay: float
+

Timeout value used to sync local admm processes. Should be very +small.

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig[source]
+

Bases: ADMMConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field controls: mpc_datamodels.MPCVariables = []
+

List of all control variables of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field couplings: List[mpc_datamodels.MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field exchange: List[mpc_datamodels.MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field inputs: mpc_datamodels.MPCVariables = []
+

List of all input variables of the MPC. Includes predictions for disturbances, set_points, dynamic constraint boundaries etc.

+
+
Validated by:
+
+
+
+
+ +
+
+field iteration_timeout: float = 20
+

Maximum computation + waiting time for one iteration.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field max_iterations: float = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field outputs: mpc_datamodels.MPCVariables = []
+

List of all shared outputs of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field parameters: mpc_datamodels.MPCVariables = []
+

List of model parameters of the MPC. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+
Validated by:
+
+
+
+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field r_del_u: dict[str, float] = {}
+

Weights that are applied to the change in control variables.

+
+
Validated by:
+
+
+
+
+ +
+
+field registration_delay: float = 0.1
+
+ +
+
+field registration_period: float = 2
+

Time spent on registration before each optimization

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field set_outputs: bool = False
+

Sets the full output time series to the data broker.

+
+ +
+
+field shared_variable_fields: list[str] = ['outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field states: mpc_datamodels.MPCVariables = []
+

List of all differential states of the MPC. The entries can define the boundaries and the source for the measurements

+
+
Validated by:
+
+
+
+
+ +
+
+field sync_delay: float = 0.001
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: Enum

+
+
+at_registration = 3
+
+ +
+
+not_started = 1
+
+ +
+
+optimizing = 4
+
+ +
+
+sleeping = 7
+
+ +
+
+syncing = 2
+
+ +
+
+updating = 5
+
+ +
+
+waiting_for_other_agents = 6
+
+ +
+ +
+
+class agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
+

Bases: Enum

+
+
+available = 2
+
+ +
+
+confirmed = 3
+
+ +
+
+not_available = 4
+
+ +
+
+not_participating = 1
+
+ +
+ +
+
+

agentlib_mpc.modules.dmpc.admm.admm_coordinated module

+

Module implementing the coordinated ADMM module, which works together +with a coordinator.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM(*, config: dict, agent: Agent)[source]
+

Bases: MiniEmployee, ADMM

+

Module to implement an ADMM agent, which is guided by a coordinator. +Only optimizes based on callbacks.

+
+
+get_new_measurement()[source]
+

Retrieve new measurement from relevant sensors +Returns:

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Callback that answers the coordinators init_iteration flag.

+
+ +
+
+optimize(variable: AgentVariable)[source]
+

Performs the optimization given the mean trajectories and multipliers from the +coordinator. +Replies with the local optimal trajectories. +Returns:

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+

callback for registration

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig[source]
+

Bases: MiniEmployeeConfig, ADMMConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field controls: mpc_datamodels.MPCVariables = []
+

List of all control variables of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field coordinator: Source [Required]
+

Define the agents coordinator

+
+ +
+
+field couplings: List[mpc_datamodels.MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field exchange: List[mpc_datamodels.MPCVariable] = []
+
+
Validated by:
+
+
+
+
+ +
+
+field inputs: mpc_datamodels.MPCVariables = []
+

List of all input variables of the MPC. Includes predictions for disturbances, set_points, dynamic constraint boundaries etc.

+
+
Validated by:
+
+
+
+
+ +
+
+field iteration_timeout: float = 20
+

Maximum computation + waiting time for one iteration.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field max_iterations: float = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field messages_in: AgentVariables = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: AgentVariables = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field outputs: mpc_datamodels.MPCVariables = []
+

List of all shared outputs of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+field parameters: mpc_datamodels.MPCVariables = []
+

List of model parameters of the MPC. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+
Validated by:
+
+
+
+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field r_del_u: dict[str, float] = {}
+

Weights that are applied to the change in control variables.

+
+
Validated by:
+
+
+
+
+ +
+
+field registration_interval: float = 10
+

Interval in seconds after which a registration attempt is made.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field registration_period: float = 2
+

Time spent on registration before each optimization

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field request_frequency: float = 1
+

Wait time between signup_requests

+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field set_outputs: bool = False
+

Sets the full output time series to the data broker.

+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out', 'outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field states: mpc_datamodels.MPCVariables = []
+

List of all differential states of the MPC. The entries can define the boundaries and the source for the measurements

+
+
Validated by:
+
+
+
+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+validator couplings_should_have_values  »  exchange, couplings[source]
+

Asserts that couplings and exchange have values, as they are needed for +initial guess.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+agentlib_mpc.modules.dmpc.admm.admm_coordinated.coupInput
+

alias of coup_input

+
+ +
+
+

agentlib_mpc.modules.dmpc.admm.admm_coordinator module

+

Defines classes that coordinate an ADMM process.

+
+
+class agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator(*, config: dict, agent: Agent)[source]
+

Bases: Coordinator

+
+
+cleanup_results()[source]
+

Deletes all files this module created.

+

Override this method, if your module creates e.g. results files etc.

+
+ +
+
+get_results() DataFrame[source]
+

Reads the results on iteration data if they were saved.

+
+ +
+
+optim_results_callback(variable: AgentVariable)[source]
+

Saves the results of a local optimization. +:param variable:

+

Returns:

+
+ +
+
+register_agent(variable: AgentVariable)[source]
+

Registers the agent, after it sent its initial guess with correct +vector length.

+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+
+ +
+
+trigger_optimizations()[source]
+

Triggers the optimization for all agents with status ready. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig[source]
+

Bases: CoordinatorConfig

+

Hold the config for ADMMCoordinator

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field abs_tol: float = 0.001
+

Absolute stopping criterion.

+
+ +
+
+field admm_iter_max: int = 20
+

Maximum number of ADMM iterations before termination of control step.

+
+ +
+
+field dual_tol: float = 0.001
+

Absolute dual stopping criterion.

+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field maxIter: int = 10
+

Maximum number of iterations

+
+ +
+
+field messages_in: AgentVariables = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: AgentVariables = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field penalty_change_factor: float = 2
+

Factor to vary the penalty parameter with.

+
+ +
+
+field penalty_change_threshold: float = -1
+

When the primal residual is x times higher, vary the penalty parameter and vice versa.

+
+ +
+
+field penalty_factor: float = 10
+

Penalty factor of the ADMM algorithm. Should be equal for all agents.

+
+ +
+
+field prediction_horizon: int = 10
+

Prediction horizon of participating agents.

+
+ +
+
+field primal_tol: float = 0.001
+

Absolute primal stopping criterion.

+
+ +
+
+field registration_period: float = 5
+

Time spent on registration before each optimization

+
+ +
+
+field rel_tol: float = 0.001
+

Relative stopping criterion.

+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field save_iter_interval: int = 1000
+
+ +
+
+field save_solve_stats: bool = False
+

When True, saves the solve stats to a file.

+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field solve_stats_file: str = 'admm_stats.csv'
+

File name for the solve stats.

+
+
Validated by:
+
+
+
+
+ +
+
+field time_out_non_responders: float = 1
+

Maximum wait time for subsystems in seconds

+
+ +
+
+field time_step: float = 600
+

Sampling interval of between two control steps. Will be used in the discretization for MPC.

+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field use_relative_tolerances: bool = True
+

If True, use abs_tol and rel_tol, if False us prim_tol and dual_tol.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+field wait_time_on_start_iters: float = 0.1
+

wait_on_start_iterations

+
+ +
+
+validator default_sampling_time  »  sampling_time[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+
+validator solve_stats_file_is_csv  »  solve_stats_file[source]
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.html new file mode 100644 index 0000000..bea1335 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.dmpc.html @@ -0,0 +1,701 @@ + + + + + + + + + agentlib_mpc.modules.dmpc package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.dmpc package

+
+
+class agentlib_mpc.modules.dmpc.DistributedMPC(config: dict, agent: Agent)[source]
+

Bases: MPC

+

Base class which defines common interfaces among all +distributed mpc approaches (either optimization based, +game theory based or some other).

+
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.DistributedMPCConfig[source]
+

Bases: MPCConfig

+

Base config class with common configurations

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+

+
Validators:
+

+
+
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.modules.dmpc.coordinator module

+
+
+class agentlib_mpc.modules.dmpc.coordinator.Coordinator(*, config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

Class implementing the base coordination for distributed MPC

+
+
+property all_finished
+

Returns: +True, if there are no busy agents, else False

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Processes and Agents InitIteration confirmation. +:param variable:

+

Returns:

+
+ +
+
+optim_results_callback(variable: AgentVariable)[source]
+

Saves the results of a local optimization. +:param variable:

+

Returns:

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+registration_callback(variable: AgentVariable)[source]
+
+ +
+
+trigger_optimizations()[source]
+

Triggers the optimization for all agents with status ready. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig[source]
+

Bases: BaseModuleConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field maxIter: int = 10
+

Maximum number of iterations

+
+ +
+
+field messages_in: List[AgentVariable] = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: List[AgentVariable] = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field time_out_non_responders: float = 1
+

Maximum wait time for subsystems in seconds

+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+

agentlib_mpc.modules.dmpc.employee module

+
+
+class agentlib_mpc.modules.dmpc.employee.MiniEmployee(*, config: dict, agent: Agent)[source]
+

Bases: BaseModule

+
+
+get_new_measurement()[source]
+

Retrieve new measurement from relevant sensors +Returns:

+
+ +
+
+init_iteration_callback(variable: AgentVariable)[source]
+

Callback that processes the coordinators ‘startIteration’ flag. +:param variable:

+
+ +
+
+abstract optimize(variable: AgentVariable)[source]
+

Performs the optimization given the information from the coordinator. +Replies with local information. +Returns:

+
+ +
+
+pre_computation_hook()[source]
+

This method is called in every computation step before the optimization starts. +Overwrite this method in a derived subclass if you want to take some actions each time before the optimal control problem is solved.

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+abstract registration_callback(variable: AgentVariable)[source]
+

callback for registration

+
+ +
+
+shift_trajectories()[source]
+

Shifts algorithm specific trajectories. +Returns:

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig[source]
+

Bases: BaseModuleConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field coordinator: Source [Required]
+

Define the agents coordinator

+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field messages_in: List[AgentVariable] = [AgentVariable(name='registration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_coordinator_to_agent', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_coordinator_to_agent', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field messages_out: List[AgentVariable] = [AgentVariable(name='registration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='registration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='startIteration_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='startIteration_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None), AgentVariable(name='optimization_agent_to_coordinator', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='optimization_agent_to_coordinator', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)]
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field registration_interval: float = 10
+

Interval in seconds after which a registration attempt is made.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field request_frequency: float = 1
+

Wait time between signup_requests

+
+ +
+
+field shared_variable_fields: list[str] = ['messages_out']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.estimation.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.estimation.html new file mode 100644 index 0000000..71970bc --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.estimation.html @@ -0,0 +1,338 @@ + + + + + + + + + agentlib_mpc.modules.estimation package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.estimation package

+
+

Submodules

+
+
+

agentlib_mpc.modules.estimation.mhe module

+
+
+class agentlib_mpc.modules.estimation.mhe.MHE(config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

A moving horizon estimator.

+
+
+cleanup_results()[source]
+

Deletes all files this module created.

+

Override this method, if your module creates e.g. results files etc.

+
+ +
+
+collect_variables_for_optimization(var_ref: MHEVariableReference = None) Dict[str, AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary. The MHE Version of this function has to perform some checks and +lookups extra, since variables come from different sources, and some need to +incorporate trajectories of past values.

+
+ +
+
+config_type
+

alias of MHEConfig

+
+ +
+
+get_results() DataFrame | None[source]
+

Read the results that were saved from the optimization backend and +returns them as Dataframe.

+
+
Returns:
+

(results, stats) tuple of Dataframes.

+
+
+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+static read_results_file(results_file: str) Tuple[DataFrame, DataFrame][source]
+

Read the provided csv-file as an MPC results file. +:param results_file: File path

+
+
Returns:
+

results, stats +results is the Dataframe with all inputs and outputs of the MPC +optimizations. +stats is the Dataframe with matching solver stats

+
+
+
+ +
+
+register_callbacks()[source]
+

Registers callbacks which listen to the variables which have to be saved as +time series. These callbacks save the values in the history for use in the +optimization.

+
+ +
+
+var_ref: MHEVariableReference
+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.estimation.mhe.MHEConfig[source]
+

Bases: BaseModuleConfig

+

Pydantic data model for MPC configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field estimated_inputs: List[MPCVariable] = []
+

List of unknown input variables of the MHE. Includes mainly disturbances.

+
+ +
+
+field estimated_parameters: List[MPCVariable] = []
+

List of unknown parameters of the MHE. They are constant over the horizon and will be estimated.

+
+ +
+
+field horizon: int = 5
+

Estimation horizon of the MHE.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field known_inputs: List[MPCVariable] = []
+

List of known input variables of the MHE. Includes controls, disturbances, setpoints, dynamic constraint boundaries etc.

+
+ +
+
+field known_parameters: List[MPCVariable] = []
+

List of known parameters of the MHE. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field shared_variable_fields: list[str] = []
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field state_weights: dict[str, float] = {}
+

Mapping of state names to their weight in the MHE problem. If you are certain with your measurement, chose a high value. If you dont have a measurement / do not trust it, choose 0. Default is 0.

+
+ +
+
+field states: List[MPCVariable] = []
+

List of all differential states of the MHE.

+
+ +
+
+field time_step: float = 60
+

Time step of the MHE.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+
+classmethod state_weights_are_in_states(state_weights: dict, info: ValidationInfo)[source]
+

Wrap a classmethod, staticmethod, property or unbound function +and act as a descriptor that allows us to detect decorated items +from the class’ attributes.

+

This class’ __get__ returns the wrapped item’s __get__ result, +which makes it transparent for classmethods and staticmethods.

+
+
+wrapped
+

The decorator that has to be wrapped.

+
+ +
+
+decorator_info
+

The decorator info.

+
+ +
+
+shim
+

A wrapper function to wrap V1 style function.

+
+ +
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.html new file mode 100644 index 0000000..0f138ca --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.html @@ -0,0 +1,999 @@ + + + + + + + + + agentlib_mpc.modules package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules package

+

This package contains all modules for the +distributed model predictive control using multi agent systems.

+

It contains classes for local optimization and global coordination.

+
+
+class agentlib_mpc.modules.ModuleImport(module_path: str, class_name: str)[source]
+

Bases: object

+
+
+import_class()[source]
+
+ +
+ +
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.modules.data_source module

+
+
+class agentlib_mpc.modules.data_source.DataSource(config: dict, agent: Agent)[source]
+

Bases: BaseModule

+
+
+process()[source]
+

Write the current data values into data_broker every t_sample

+
+ +
+
+register_callbacks()[source]
+

Don’t do anything as this module is not event-triggered

+
+ +
+
+transform_index(data: DataFrame) DataFrame[source]
+

Handles the index and ensures it is numeric, with correct offset

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.data_source.DataSourceConfig[source]
+

Bases: BaseModuleConfig

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field columns: List[str] | None = None
+

Optional list of columns of data frame that should be sent.If ommited, all datapoint in frame are sent.

+
+ +
+
+field data: DataFrame | Path = Empty DataFrame Columns: [] Index: []
+

Data that should be communicated during execution.Index should be either numeric or Datetime, numeric values are interpreted as seconds.

+
+
Validated by:
+
+
+
+
+ +
+
+field data_offset: Timedelta | float | None = 0
+

Offset will be subtracted from index.

+
+ +
+
+field interpolation_method: InterpolationMethods | None = InterpolationMethods.previous
+

Interpolation method used for resampling of data.Only ‘linear’ and ‘previous’ are allowed.

+
+
Validated by:
+
+
+
+
+ +
+
+field t_sample: float | int = 1
+

Sample time of data source. Default is 1 s.

+
+ +
+
+validator check_data  »  data[source]
+

Makes sure data is a data frame, and loads it if required.

+
+ +
+
+validator check_interpolation_method  »  interpolation_method[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+

agentlib_mpc.modules.minlp_mpc module

+
+
+class agentlib_mpc.modules.minlp_mpc.MINLPMPC(config: dict, agent: Agent)[source]
+

Bases: BaseMPC

+
+
+assert_mpc_variables_are_in_model()[source]
+

Checks whether all variables of var_ref are contained in the model. +Returns names of model variables not contained in the var_ref, +sorted by keys: ‘states’, ‘inputs’, ‘outputs’, ‘parameters’.

+
+ +
+
+set_actuation(solution)[source]
+

Takes the solution from optimization backend and sends the first +step to AgentVariables.

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.minlp_mpc.MINLPMPCConfig[source]
+

Bases: BaseMPCConfig

+

Pydantic data model for MPC configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field binary_controls: List[MPCVariable] = []
+

List of all binary control variables of the MPC.

+
+
Validated by:
+
+
+
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+
+validator validate_binary_bounds  »  binary_controls[source]
+

Assures all binary variables have 0 and 1 as boundaries.

+
+ +
+ +
+
+

agentlib_mpc.modules.ml_model_simulator module

+
+
+

agentlib_mpc.modules.mpc module

+

Holds the base class for MPCs.

+
+
+class agentlib_mpc.modules.mpc.BaseMPC(config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

A model predictive controller. +More info to follow.

+
+
+assert_mpc_variables_are_in_model() dict[str, set[str]][source]
+

Checks whether all variables of var_ref are contained in the model. +Returns names of model variables not contained in the var_ref, +sorted by keys: ‘states’, ‘inputs’, ‘outputs’, ‘parameters’.

+
+ +
+
+assert_subset(mpc_names, model_names, message_head)[source]
+

Helper function for assert assert_mpc_variables_are_in_model. Asserts +the variables of the var_ref corresponding to ref_key are a subset of +a list of names provided (usually obtained from the model) and prints +out an error if false. Returns the portion of model_names that are +not in the given var_ref.

+
+ +
+
+cleanup_results()[source]
+

Deletes all files this module created.

+

Override this method, if your module creates e.g. results files etc.

+
+ +
+
+collect_variables_for_optimization(var_ref: VariableReference = None) Dict[str, AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary.

+
+ +
+
+do_step()[source]
+

Performs an MPC step.

+
+ +
+
+get_results() DataFrame | None[source]
+

Read the results that were saved from the optimization backend and +returns them as Dataframe.

+
+
Returns:
+

(results, stats) tuple of Dataframes.

+
+
+
+ +
+
+property model: Model
+

Getter for current simulation model

+
+
Returns:
+

Current simulation model

+
+
Return type:
+

agentlib.model

+
+
+
+ +
+
+pre_computation_hook()[source]
+

This method is called in every computation step before the optimization starts. +Overwrite this method in a derived subclass if you want to take some actions +each time before the optimal control problem is solved.

+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+re_init_optimization(parameter: AgentVariable)[source]
+

Re-initializes the optimization backend with new parameters.

+
+ +
+
+static read_results_file(results_file: str) Tuple[DataFrame, DataFrame][source]
+

Read the provided csv-file as an MPC results file. +:param results_file: File path

+
+
Returns:
+

results, stats +results is the Dataframe with all inputs and outputs of the MPC +optimizations. +stats is the Dataframe with matching solver stats

+
+
+
+ +
+
+register_callbacks()[source]
+

Registers the init_optimization callback to all parameters which +cannot be changed without recreating the optimization problem.

+
+ +
+
+set_actuation(solution: Results)[source]
+

Takes the solution from optimization backend and sends the first +step to AgentVariables.

+
+ +
+
+set_output(solution: Results)[source]
+

Takes the solution from optimization backend and sends it to AgentVariables.

+
+ +
+
+warn_for_missed_solves(stats: DataFrame | None)[source]
+

Read the solver information from the optimization +:returns: Warning if solver fails

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.mpc.BaseMPCConfig[source]
+

Bases: BaseModuleConfig

+

Pydantic data model for MPC configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field controls: List[MPCVariable] = []
+

List of all control variables of the MPC.

+
+ +
+
+field inputs: List[MPCVariable] = []
+

List of all input variables of the MPC. Includes predictions for disturbances, set_points, dynamic constraint boundaries etc.

+
+ +
+
+field log_level: str | None = None
+

The log level for this Module. Default uses the root-loggers level.Options: DEBUG; INFO; WARNING; ERROR; CRITICAL

+
+
Validated by:
+
    +
  • check_valid_level

  • +
+
+
+
+ +
+
+field module_id: str [Required]
+

The unqiue id of the module within an agent, used only to communicate withing the agent.

+
+ +
+
+field optimization_backend: dict [Required]
+
+ +
+
+field outputs: List[MPCVariable] = []
+

List of all shared outputs of the MPC.

+
+ +
+
+field parameters: List[MPCVariable] = []
+

List of model parameters of the MPC. They are constant over the horizon. Parameters not listed here will have their default from the model file.

+
+ +
+
+field prediction_horizon: int = 5
+

Prediction horizon of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field sampling_time: float | None = None
+

Sampling interval for control steps. If None, will be the same as time step. Does not affect the discretization of the MPC, only the interval with which there will be optimization steps.

+
+
Validated by:
+
+
+
+
+ +
+
+field set_outputs: bool = False
+

Sets the full output time series to the data broker.

+
+ +
+
+field shared_variable_fields: list[str] = ['outputs', 'controls']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field states: List[MPCVariable] = []
+

List of all differential states of the MPC. The entries can define the boundaries and the source for the measurements

+
+ +
+
+field time_step: float = 60
+

Time step of the MPC.

+
+
Constraints:
+
    +
  • ge = 0

  • +
+
+
+
+ +
+
+field type: str | Dict[str, str] [Required]
+

The type of the Module. Used to find the Python-Object from all agentlib-core and plugin Module options. If a dict is given,it must contain the keys ‘file’ and ‘class_name’. ‘file’ is the filepath of a python file containing the Module.’class_name’ is the name of the Module class within this file.

+
+ +
+
+field validate_incoming_values: bool | None = True
+

If true, the validator of the AgentVariable value is called when receiving a new value from the DataBroker.

+
+ +
+
+validator default_sampling_time  »  sampling_time[source]
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+agentlib_mpc.modules.mpc.create_optimization_backend(optimization_backend, agent_id)[source]
+

Set up the optimization_backend

+
+ +
+
+

agentlib_mpc.modules.mpc_full module

+

Holds the class for full featured MPCs.

+
+
+class agentlib_mpc.modules.mpc_full.MPC(config: dict, agent: Agent)[source]
+

Bases: BaseMPC

+

A model predictive controller. +More info to follow.

+
+
+collect_variables_for_optimization(var_ref: VariableReference = None) dict[str, agentlib.core.datamodels.AgentVariable][source]
+

Gets all variables noted in the var ref and puts them in a flat +dictionary.

+
+ +
+
+do_step()[source]
+

Performs an MPC step.

+
+ +
+
+register_callbacks_for_lagged_variables()[source]
+

Registers callbacks which listen to the variables which have to be saved as +time series. These callbacks save the values in the history for use in the +optimization.

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.mpc_full.MPCConfig[source]
+

Bases: BaseMPCConfig

+

Pydantic data model for MPC configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field r_del_u: dict[str, float] = {}
+

Weights that are applied to the change in control variables.

+
+
Validated by:
+
+
+
+
+ +
+
+validator check_r_del_u_in_controls  »  r_del_u[source]
+

Ensures r_del_u is only set for control variables.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.modules.ml_model_training.html b/docs/0.6.4/docs/code/agentlib_mpc.modules.ml_model_training.html new file mode 100644 index 0000000..0c6b317 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.modules.ml_model_training.html @@ -0,0 +1,910 @@ + + + + + + + + + agentlib_mpc.modules.ml_model_training package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.modules.ml_model_training package

+
+

Submodules

+
+
+

agentlib_mpc.modules.ml_model_training.data_reduction module

+

Code stolen from Max Berktold

+
+
+class agentlib_mpc.modules.ml_model_training.data_reduction.InducingPoints[source]
+

Bases: ABC

+

The idea is to reduce the effective number of input data points x to the GP +from n to m, with m<n, where the set of m points are called inducing points.

+
+

Since this makes the effective covariance matrix K smaller, +many inducing point approaches reduce the computational complexity from O(n3) to O(nm2). +The smaller m is, the bigger the speed up.

+

Source: https://bwengals.github.io/inducing-point-methods-to-speed-up-gps.html

+
+
+
+abstract reduce(x: ndarray, y: ndarray, plot_distance_matrix: bool = True) tuple[numpy.ndarray, numpy.ndarray][source]
+
+ +
+ +
+
+class agentlib_mpc.modules.ml_model_training.data_reduction.NystroemReducer(n_components: int, kernel: Kernel = None)[source]
+

Bases: InducingPoints

+
+
+reduce(x: ndarray, y: ndarray, plot_distance_matrix: bool = True) tuple[numpy.ndarray, numpy.ndarray][source]
+
+ +
+ +
+
+

agentlib_mpc.modules.ml_model_training.ml_model_trainer module

+
+
+class agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer(config: dict, agent: Agent)[source]
+

Bases: MLModelTrainer

+

Module that generates ANNs based on received data.

+
+
+build_ml_model() Sequential[source]
+

Build an ANN with a one layer structure, can only create one ANN

+
+ +
+
+fit_ml_model(training_data: TrainingData)[source]
+

Fits the ML Model with the training data.

+
+ +
+
+model_type
+

alias of SerializedANN

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig[source]
+

Bases: MLModelTrainerConfig

+

Pydantic data model for ANNTrainer configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+

+
+
+
+field batch_size: int = 100
+
+ +
+
+field early_stopping: EarlyStoppingCallback = EarlyStoppingCallback(patience=(1000,), verbose=0, restore_best_weights=True, activate=False)
+

Specification of the EarlyStopping Callback for training

+
+ +
+
+field epochs: int = 100
+
+ +
+
+field layers: list[tuple[int, Literal['relu', 'sigmoid', 'softmax', 'softplus', 'softsign', 'tanh', 'selu', 'elu', 'exponential']]] = [(16, 'sigmoid')]
+

Hidden layers which should be created for the ANN. An ANN always has a BatchNormalization Layer, and an Output Layer the size of the output dimensions. Additional hidden layers can be specified here as a list of tuples: (#neurons of layer, activation function).

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer(config: dict, agent: Agent)[source]
+

Bases: MLModelTrainer

+

Module that generates ANNs based on received data.

+
+
+build_ml_model()[source]
+

Build a GPR with a constant Kernel in combination with a white kernel.

+
+ +
+
+fit_ml_model(training_data: TrainingData)[source]
+

Fits GPR to training data

+
+ +
+
+model_type
+

alias of SerializedGPR

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig[source]
+

Bases: MLModelTrainerConfig

+

Pydantic data model for GPRTrainer configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+

+
+
+
+field constant_value_bounds: tuple = (0.001, 100000.0)
+
+ +
+
+field length_scale_bounds: tuple = (0.001, 100000.0)
+
+ +
+
+field n_restarts_optimizer: int = 0
+

Defines the number of restarts of the Optimizer for the gpr_parameters of the kernel.

+
+ +
+
+field noise_level: float = 1.5
+
+ +
+
+field noise_level_bounds: tuple = (0.001, 100000.0)
+
+ +
+
+field normalize: bool = False
+

Defines whether the training data and the inputs are for predictionare normalized before given to GPR.

+
+ +
+
+field scale: float = 1.0
+

Defines by which value the output data is divided for training and multiplied after prediction.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer(config: dict, agent: Agent)[source]
+

Bases: MLModelTrainer

+

Module that generates ANNs based on received data.

+
+
+build_ml_model()[source]
+

Build a linear model.

+
+ +
+
+fit_ml_model(training_data: TrainingData)[source]
+

Fits linear model to training data

+
+ +
+
+model_type
+

alias of SerializedLinReg

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainerConfig[source]
+

Bases: MLModelTrainerConfig

+

Pydantic data model for GPRTrainer configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+

+
Validators:
+

+
+
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+class agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer(config: dict, agent: Agent)[source]
+

Bases: BaseModule, ABC

+

Abstract Base Class for all Trainer classes.

+
+
+property agent_and_time: str
+

A string that specifies id and time. Used to create save paths

+
+ +
+
+abstract build_ml_model()[source]
+

Builds and returns an ann model

+
+ +
+
+create_inputs_and_outputs(full_data_sampled: DataFrame) tuple[pandas.core.frame.DataFrame, pandas.core.frame.DataFrame][source]
+

Creates extra columns in the data which contain the shifted time-series data +which is lagged accordingly. Returns a tuple (input_data, output_data)

+
+ +
+
+divide_in_tvt(inputs: DataFrame, outputs: DataFrame)[source]
+

splits the samples into mpc, validating and testing sets

+
+ +
+
+abstract fit_ml_model(training_data: TrainingData)[source]
+

Fits the ML Model with the training data.

+
+ +
+
+property input_names
+
+ +
+
+model_type: Type[SerializedMLModel]
+
+ +
+
+property output_names
+
+ +
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+resample() DataFrame[source]
+

Samples the available time_series data to the required step size.

+
+ +
+
+retrain_model()[source]
+

Trains the model based on the current historic data.

+
+ +
+
+save_all(serialized_ml_model: SerializedMLModel, training_data: TrainingData)[source]
+

Saves all relevant data and results of the training process if desired.

+
+ +
+
+save_ml_model(serialized_ml_model: SerializedMLModel, path: Path)[source]
+

Saves the ML Model in serialized format.

+
+ +
+
+serialize_ml_model() SerializedMLModel[source]
+

Serializes the ML Model, sa that it can be saved +as json file. +:returns: SerializedMLModel version of the passed ML Model.

+
+ +
+
+property training_info: dict
+

Returns a dict with relevant config parameters regarding the training.

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig[source]
+

Bases: BaseModuleConfig, ABC

+

Abstract Base Class for all Trainer Configs.

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field MLModel: AgentVariable = AgentVariable(name='MLModel', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='MLModel', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)
+

Serialized ML Model which can be sent to other Agents.

+
+ +
+
+field data_sources: list[pathlib.Path] = []
+

List of paths to time series data, which can be loaded on initialization of the agent.

+
+
Validated by:
+
+
+
+
+ +
+
+field inputs: List[AgentVariable] = []
+

Variables which are inputs of the ML Model that should be trained.

+
+ +
+
+field interpolations: dict[str, agentlib_mpc.data_structures.interpolation.InterpolationMethods] = {}
+

Dictionary specifying the interpolation types of output variables. If not specified, will be set to ‘linear’.

+
+
Validated by:
+
+
+
+
+ +
+
+field lags: dict[str, int] = {}
+

Dictionary specifying the lags of each input and output variable. If not specified, will be set to one.

+
+
Validated by:
+
+
+
+
+ +
+
+field output_types: dict[str, agentlib_mpc.data_structures.ml_model_datatypes.OutputType] = {}
+

Dictionary specifying the output types of output variables. If not specified, will be set to ‘difference’.

+
+
Validated by:
+
+
+
+
+ +
+
+field outputs: List[AgentVariable] = []
+

Variables which are outputs of the ML Model that should be trained.

+
+ +
+
+field recursive_outputs: dict[str, bool] = {}
+

Dictionary specifying whether output variables are recursive, i.e. automatically appear as an input as well. If not specified, will be set to ‘recursive’.

+
+
Validated by:
+
+
+
+
+ +
+
+field retrain_delay: float = 10000000000
+

Time in seconds, after which retraining is triggered in regular intervals

+
+ +
+
+field save_data: bool = False
+

Whether the training data should be saved.

+
+
Validated by:
+
+
+
+
+ +
+
+field save_directory: Path = None
+

Path, where created ML Models should be saved.

+
+ +
+
+field save_ml_model: bool = False
+

Whether the created ML Models should be saved.

+
+
Validated by:
+
+
+
+
+ +
+
+field save_plots: bool = False
+

Whether a plot of the created ML Models performance should be saved.

+
+ +
+
+field shared_variable_fields: list[str] = ['MLModel']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field step_size: float [Required]
+
+ +
+
+field test_share: float = 0.15
+
+
Validated by:
+
+
+
+
+ +
+
+field time_series_length: float = 315360000
+

Maximum time window of data which is kept for the ML Model training. If saved data is older than current time minus time_series_length, it will be deleted.

+
+ +
+
+field time_series_memory_size: int = 1000000000
+

Maximum size of the data which is kept in memory for the ML Model training. If saved data exceeds this value, the oldest data is deleted.

+
+ +
+
+field train_share: float = 0.7
+
+
Validated by:
+
+
+
+
+ +
+
+field use_values_for_incomplete_data: bool = False
+

Default False. If True, the values of inputs and outputs which are defined in the config will be used for training, in case historic data has not reached the trainer. If False, an Error will be raised when the data is not sufficient.

+
+ +
+
+field validation_share: float = 0.15
+
+
Validated by:
+
+
+
+
+ +
+
+validator check_data_sources_exist  »  data_sources[source]
+

Checks if all given data sources exist

+
+ +
+
+validator check_if_save_path_is_there  »  save_data, save_ml_model[source]
+
+ +
+
+validator check_shares_amount_to_one  »  test_share, train_share, validation_share[source]
+

Makes sure, the shares amount to one.

+
+ +
+
+validator fill_interpolations  »  interpolations[source]
+

Adds interpolation method to all unspecified methods.

+
+ +
+
+validator fill_lags  »  lags[source]
+

Adds lag one to all unspecified lags.

+
+ +
+
+validator fill_output_types  »  output_types[source]
+

Adds output type one to all unspecified output types.

+
+ +
+
+validator fill_recursive_outputs  »  recursive_outputs[source]
+

Adds recursive flag to all unspecified outputs.

+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+

agentlib_mpc.modules.ml_model_training.setpoint_generator module

+

Module which generates random set points within a comfort zone. Code heavily stolen +from Max Berktold

+
+
+class agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator(config: dict, agent: Agent)[source]
+

Bases: BaseModule

+

Module that generates and sends random set points based on daytime and values.

+
+
+process()[source]
+

This abstract method must be implemented in order to sync the module +with the other processes of the agent and the whole MAS.

+
+ +
+
+register_callbacks()[source]
+
+ +
+
+update_target()[source]
+

Updates the control target for a given time

+
+ +
+ +
+
+pydantic model agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig[source]
+

Bases: BaseModuleConfig

+

Pydantic data model for ANNTrainer configuration parser

+
+
Config:
+
    +
  • arbitrary_types_allowed: bool = True

  • +
  • validate_assignment: bool = True

  • +
  • extra: str = forbid

  • +
  • frozen: bool = True

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field day_end: int = 16
+
+ +
+
+field day_lb: float = 292.15
+
+ +
+
+field day_start: int = 8
+
+ +
+
+field day_ub: float = 294.15
+
+ +
+
+field interval: int = 14400
+
+ +
+
+field night_lb: float = 289.15
+
+ +
+
+field night_ub: float = 297.15
+
+ +
+
+field shared_variable_fields: list[str] = ['target_variable']
+
+
Validated by:
+
    +
  • check_valid_fields

  • +
+
+
+
+ +
+
+field target_variable: AgentVariable = AgentVariable(name='target', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=None, alias='target', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None)
+
+ +
+
+model_post_init(context: Any, /) None
+

We need to both initialize private attributes and call the user-defined model_post_init +method.

+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.core.html b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.core.html new file mode 100644 index 0000000..bf6f486 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.core.html @@ -0,0 +1,867 @@ + + + + + + + + + agentlib_mpc.optimization_backends.casadi_.core package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • + View page source +
  • +
+
+
+
+
+ +
+

agentlib_mpc.optimization_backends.casadi_.core package

+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.casadi_.core.VariableGroup module

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool', full_with_defaults: 'ca.MX', add_default_values: 'ca.Function')[source]
+

Bases: OptimizationQuantity

+
+
+add_default_values: Function
+
+ +
+
+classmethod declare(denotation: str, variables: list[agentlib_mpc.models.casadi_model.CasadiVariable], ref_list: list[str], use_in_stage_function=True, assert_complete: bool = False)[source]
+

Declares a group of optimization parameters that serve a purpose in +the optimization problem. Typical groups are uncontrollable inputs or +physical parameters.

+
+
Parameters:
+
    +
  • denotation – The key of the variable, e.g. ‘p’, ‘d’, etc. Use this +key in the discretization function to add the parameter at +different stages of the optimization problem.

  • +
  • variables – A list of CasadiVariables including all parameters +within this category.

  • +
  • ref_list – A list of names indicating which parameters in full_list +are AgentVariables and need to be updated before each +optimization.

  • +
  • use_in_stage_function – If False, the parameter is not added to the +stage function. If True, the variable needs to be provided to +the stage function at every point in the discretization function.

  • +
  • assert_complete – If True, throws an error if the ref_list does +not contain all variables.

  • +
+
+
+
+ +
+
+dim: int
+
+ +
+
+full_names: tuple[str]
+
+ +
+
+full_symbolic: MX
+
+ +
+
+full_with_defaults: MX
+
+ +
+
+name: str
+
+ +
+
+ref_names: tuple[str]
+
+ +
+
+use_in_stage_function: bool
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool')[source]
+

Bases: object

+
+
+dim: int
+
+ +
+
+full_names: tuple[str]
+
+ +
+
+full_symbolic: MX
+
+ +
+
+name: str
+
+ +
+
+ref_names: tuple[str]
+
+ +
+
+use_in_stage_function: bool
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable(name: 'str', full_symbolic: 'ca.MX', dim: 'int', ref_names: 'tuple[str]', full_names: 'tuple[str]', use_in_stage_function: 'bool', input_map: 'ca.Function', output_map: 'ca.Function', binary: 'bool')[source]
+

Bases: OptimizationQuantity

+
+
+binary: bool
+
+ +
+
+classmethod declare(denotation: str, variables: list[agentlib_mpc.models.casadi_model.CasadiVariable], ref_list: list[str], use_in_stage_function: bool = True, assert_complete: bool = False, binary: bool = False) OptimizationVariable[source]
+

Declares a group of optimization variables that serve a purpose in +the optimization problem. Typical groups are states, the control +inputs or slack variables.

+
+
Parameters:
+
    +
  • binary – Flag, whether these variables are binary

  • +
  • denotation – The key of the variable, e.g. ‘X’, ‘U’, etc. Use +this key in the discretization function to add the variable at +different stages of the optimization problem. The optimal value +of these variables will also be mapped to this key.

  • +
  • variables – A list of +CasadiVariables or an MX/SX vector including all variables +within this category.

  • +
  • ref_list – A list of names indicating which variables +in full_list are AgentVariables and need to be updated before +each optimization.

  • +
  • use_in_stage_function – If False, the variable is not +added to the stage function. If True, the variable needs to be +provided to the stage function at every point in the +discretization function.

  • +
  • assert_complete – If True, throws an error if the ref_list does +not contain all variables.

  • +
+
+
+
+ +
+
+dim: int
+
+ +
+
+full_names: tuple[str]
+
+ +
+
+full_symbolic: MX
+
+ +
+
+input_map: Function
+
+ +
+
+name: str
+
+ +
+
+output_map: Function
+
+ +
+
+ref_names: tuple[str]
+
+ +
+
+use_in_stage_function: bool
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.casadi_backend module

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend(config: dict)[source]
+

Bases: OptimizationBackend

+

OptimizationBackend for solving the optimization problem with CasADi. +Requires the model to be a CasADi model.

+
+
+config_type
+

alias of CasadiBackendConfig

+
+ +
+
+cost_function: Callable | None
+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod, Type[DiscretizationT]]
+
+ +
+
+model: ModelT
+
+ +
+
+reset_setup_attributes()[source]
+

Cleans all attributes that are used for optimization setup.

+
+ +
+
+save_result_df(results: Results, now: float = 0)[source]
+

Save the results of solve into a dataframe at each time step.

+

Example results dataframe:

+

value_type variable … lower +variable T_0 T_0_slack … T_0_slack mDot_0 +time_step … +2 0.000000 298.160000 NaN … NaN NaN

+
+

101.431499 297.540944 -149.465942 … -inf 0.0 +450.000000 295.779780 -147.704779 … -inf 0.0 +798.568501 294.720770 -146.645769 … -inf 0.0

+
+
+
Parameters:
+
    +
  • results

  • +
  • now

  • +
+
+
+

Returns:

+
+ +
+
+setup_optimization(var_ref: VariableReference)[source]
+

Performs all necessary steps to make the solve method usable. +To do this, it calls several auxiliary functions. These functions can +be overloaded to change the resulting optimization problem.

+
+
Parameters:
+

var_ref – class with variable name lists sorted by function in the mpc.

+
+
+
+ +
+
+solve(now: float, current_vars: dict[str, agentlib_mpc.data_structures.mpc_datamodels.MPCVariable]) Results[source]
+

Solves the optimization problem given the current values of the +corresponding AgentVariables and system time. The standardization of +return values is a work in progress.

+
+
Parameters:
+
    +
  • now – Current time used for interpolation of input trajectories.

  • +
  • current_vars – Dict of AgentVariables holding the values relevant to +the optimization problem. Keys are the names

  • +
+
+
Returns:
+

A dataframe with all optimization variables over their respective +grids. Depending on discretization, can include many nan’s, so care +should be taken when using this, e.g. always use dropna() after +accessing a column.

+
+
+
Example:
+

variables mDot | T_0 | slack_T

+
+

time +0 0.1 | 298 | nan +230 nan | 297 | 3 +470 nan | 296 | 2 +588 nan | 295 | 1 +700 0.05 | 294 | nan +930 nan | 294 | 0.1

+
+
+
+

+
+
+
+ +
+
+system: SystemT
+
+ +
+
+system_type: Type[SystemT]
+
+ +
+
+var_ref: mpc_datamodels.VariableReference | None
+
+ +
+ +
+
+pydantic model agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig[source]
+

Bases: BackendConfig

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field build_batch_bat: Path | None = None
+

Path to a batch file, which can compile C code on windows.

+
+ +
+
+field discretization_options: CasadiDiscretizationOptions [Optional]
+
+ +
+
+field do_jit: bool | None = None
+

Boolean to turn JIT of the optimization problems on or off.

+
+
Validated by:
+
+
+
+
+ +
+
+field model: dict [Required]
+
+ +
+
+field name: str | None = None
+
+ +
+
+field overwrite_result_file: bool | None = False
+
+
Validated by:
+
+
+
+
+ +
+
+field results_file: Path | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+field save_results: bool | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+field solver: SolverOptions [Optional]
+
+ +
+
+validator validate_compile  »  do_jit[source]
+

Checks whether code compilation should be done.

+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.discretization module

+

Holds classes that implement different transcriptions of the OCP

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization(options: CasadiDiscretizationOptions)[source]
+

Bases: ABC

+

opt_vars: holds symbolic variables during problem creation +opt_vars_lb: holds symbolic variables during problem creation +opt_vars_ub: holds symbolic variables during problem creation +initial_guess: holds symbolic variables during problem creation +opt_pars: holds symbolic variables during problem creation +constraints: holds symbolic variables during problem creation +constraints_lb: holds symbolic variables during problem creation +constraints_ub: holds symbolic variables during problem creation +objective_function: cost function during problem creation +mpc_opt_vars (dict): holds the symbolic variables and grids during

+
+

problem creation sorted by type as in system_variables

+
+
+
mpc_opt_pars (dict): holds the symbolic variables and grids during

problem creation sorted by type as in system_parameters

+
+
+
+
+add_constraint(constraint_function: MX | SX | Sparsity | DM | float | int, lb: MX | SX | Sparsity | DM | float | int = None, ub: MX | SX | Sparsity | DM | float | int = None, *, gap_closing: bool = False)[source]
+

Add a constraint to the optimization problem. If no bounds are given, +adds an equality constraint.

+
+ +
+
+add_opt_par(quantity: OptimizationParameter, post_den: str = '')[source]
+

Create an optimization parameter and append to all the associated lists.

+

denotation[str]: the key of the parameter, e.g. ‘P’, ‘Q’, … +dimension[int]: the dimension of the parameter +post_den[str]: string to add to casadi MX after denotation (for debugging)

+
+ +
+
+add_opt_var(quantity: OptimizationVariable, lb: MX = None, ub: MX = None, guess: float = None, post_den: str = '')[source]
+

Create an optimization variable and append to all the associated +lists. If lb or ub are given, they override the values provided at +runtime! The usual application of this is, to fix the initial value +of a state to a parameter.

+
+
Parameters:
+
    +
  • quantity – corresponding system variable

  • +
  • lb – lower bound of the variable

  • +
  • ub – upper bound of the variable

  • +
  • guess – default for the initial guess

  • +
  • post_den – string to add to casadi MX after denotation (for debugging)

  • +
+
+
+
+ +
+
+property binary_vars: list[bool]
+

List specifying for every optimization variable, whether it is binary.

+
+ +
+
+constraints: list[casadi.casadi.MX] | MX
+
+ +
+
+constraints_lb: list[casadi.casadi.MX]
+
+ +
+
+constraints_ub: list[casadi.casadi.MX]
+
+ +
+
+create_nlp_in_out_mapping(system: System)[source]
+

Function creating mapping functions between the MPC variables ordered +by type (as defined in declare_quantities and the raw input/output +vector of the CasADi NLP.

+
+ +
+
+equalities: list[bool]
+
+ +
+
+grid(var: OptimizationQuantity) list[float][source]
+
+ +
+
+initial_guess: list[casadi.casadi.MX]
+
+ +
+
+initialize(system: System, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+
+k: int
+
+ +
+
+mpc_opt_pars: dict[str, agentlib_mpc.data_structures.casadi_utils.OptParMXContainer]
+
+ +
+
+mpc_opt_vars: dict[str, agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer]
+
+ +
+
+property nlp: dict[str, casadi.casadi.MX]
+

The nlp dict that casadi solvers need for instantiation

+
+ +
+
+objective_function: MX | SX | Sparsity | DM | float | int
+
+ +
+
+only_positive_times_in_results = True
+
+ +
+
+opt_pars: list[casadi.casadi.MX] | MX
+
+ +
+
+opt_vars: list[casadi.casadi.MX] | MX
+
+ +
+
+opt_vars_lb: list[casadi.casadi.MX]
+
+ +
+
+opt_vars_ub: list[casadi.casadi.MX]
+
+ +
+
+pred_time: float
+
+ +
+
+solve(mpc_inputs: dict[str, casadi.casadi.DM]) Results[source]
+

Solves the discretized trajectory optimization problem.

+
+
Parameters:
+

mpc_inputs – Casadi Matrices specifying the input of all different types +of optimization parameters. Matrices consist of different variable rows +and have a column for each time step in the discretization. +There are separate matrices for each input type (as defined in the +System), and also for the upper and lower boundaries of variables +respectively.

+
+
Returns:
+

+
The complete evolution of the states, inputs and boundaries of each

variable and parameter over the prediction horizon, as well as solve +statistics.

+
+
+

+
+
Return type:
+

Results

+
+
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.core.discretization.Results(matrix: casadi.casadi.MX, grid: list[float], columns: pandas.core.indexes.multi.MultiIndex, stats: dict, variable_grid_indices: dict[str, list[int]], _variable_name_to_index: dict[str, int] = None)[source]
+

Bases: object

+
+
+columns: MultiIndex
+
+ +
+
+property df: DataFrame
+
+ +
+
+grid: list[float]
+
+ +
+
+matrix: MX
+
+ +
+
+stats: dict
+
+ +
+
+stats_line(index: str) str[source]
+
+ +
+
+variable_grid_indices: dict[str, list[int]]
+
+ +
+
+variable_lookup() dict[str, int][source]
+

Creates a mapping from variable names to the column index in the Matrix

+
+ +
+
+write_columns(file: Path)[source]
+
+ +
+
+write_stats_columns(file: Path)[source]
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.core.system module

+

Holds the System class, which knows the model

+
+
+class agentlib_mpc.optimization_backends.casadi_.core.system.System[source]
+

Bases: ABC

+

Examples

+

class MySystem(System):

+
+

# variables +states: OptimizationVariable +controls: OptimizationVariable +algebraics: OptimizationVariable +outputs: OptimizationVariable

+

# parameters +non_controlled_inputs: OptimizationParameter +model_parameters: OptimizationParameter +initial_state: OptimizationParameter

+

# dynamics +model_constraints: Constraint +cost_function: ca.MX +ode: ca.MX

+

def initialize(self, model: CasadiModel, var_ref: VariableReference):

+
+
+
self.states = OptimizationVariable.declare(

denotation=”state”, +variables=model.get_states(var_ref.states), +ref_list=var_ref.states, +assert_complete=True,

+
+
+

)

+

.

+
+
+

)

+
+
+abstract initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+property parameters: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter]
+
+ +
+
+property quantities: list[Union[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter, agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]]
+
+ +
+
+property variables: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.html b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.html new file mode 100644 index 0000000..43233e1 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.casadi_.html @@ -0,0 +1,1227 @@ + + + + + + + + + agentlib_mpc.optimization_backends.casadi_ package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.optimization_backends.casadi_ package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.casadi_.admm module

+
+
+class agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: MultipleShooting

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend(config: dict)[source]
+

Bases: CasADiBaseBackend, ADMMBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+cost_function: Callable | None
+
+ +
+
+property coupling_grid
+

Returns the grid on which the coupling variables are discretized.

+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting'>}
+
+ +
+
+it: int
+
+ +
+
+model: ModelT
+
+ +
+
+now: float
+
+ +
+
+result_stats: list[str]
+
+ +
+
+results: list[pd.DataFrame]
+
+ +
+
+save_result_df(results: Results, now: float = 0)[source]
+

Save the results of solve into a dataframe at each time step.

+

Example results dataframe:

+

value_type variable … lower +variable T_0 T_0_slack … T_0_slack mDot_0 +time_step … +2 0.000000 298.160000 NaN … NaN NaN

+
+

101.431499 297.540944 -149.465942 … -inf 0.0 +450.000000 295.779780 -147.704779 … -inf 0.0 +798.568501 294.720770 -146.645769 … -inf 0.0

+
+
+
Parameters:
+
    +
  • results

  • +
  • now

  • +
+
+
+

Returns:

+
+ +
+
+system: CasadiADMMSystem
+
+ +
+
+system_type
+

alias of CasadiADMMSystem

+
+ +
+
+var_ref: mpc_datamodels.VariableReference | None
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem[source]
+

Bases: FullSystem

+
+
+algebraics: OptimizationVariable
+
+ +
+
+controls: OptimizationVariable
+
+ +
+
+cost_function: ca.MX
+
+ +
+
+exchange_diff: OptimizationParameter
+
+ +
+
+exchange_multipliers: OptimizationParameter
+
+ +
+
+global_couplings: OptimizationParameter
+
+ +
+
+initial_state: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+last_control: OptimizationParameter
+
+ +
+
+local_couplings: OptimizationVariable
+
+ +
+
+local_exchange: OptimizationVariable
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+model_parameters: OptimizationParameter
+
+ +
+
+multipliers: OptimizationParameter
+
+ +
+
+non_controlled_inputs: OptimizationParameter
+
+ +
+
+ode: ca.MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+
+penalty_factor: OptimizationParameter
+
+ +
+
+r_del_u: OptimizationParameter
+
+ +
+
+states: OptimizationVariable
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.basic module

+
+
+class agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem[source]
+

Bases: System

+
+
+algebraics: OptimizationVariable
+
+ +
+
+controls: OptimizationVariable
+
+ +
+
+cost_function: MX
+
+ +
+
+initial_state: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: VariableReference)[source]
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+model_parameters: OptimizationParameter
+
+ +
+
+non_controlled_inputs: OptimizationParameter
+
+ +
+
+ode: MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+
+states: OptimizationVariable
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+cost_function: Callable | None
+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting'>}
+
+ +
+
+model: ModelT
+
+ +
+
+system: BaseSystem
+
+ +
+
+system_type
+

alias of BaseSystem

+
+ +
+
+var_ref: mpc_datamodels.VariableReference | None
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices(order: int, root: numpy.ndarray, B: numpy.ndarray, C: numpy.ndarray, D: numpy.ndarray)[source]
+

Bases: object

+
+
+B: ndarray
+
+ +
+
+C: ndarray
+
+ +
+
+D: ndarray
+
+ +
+
+order: int
+
+ +
+
+root: ndarray
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: Discretization

+
+
+initialize(system: BaseSystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: Discretization

+
+
+initialize(system: BaseSystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml module

+
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN(config: dict)[source]
+

Bases: CasADiADMMBackend, CasADiBBBackend

+

Class doing optimization with an MLModel.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.MultipleShootingADMMNN'>}
+
+ +
+
+system: CasadiADMMNNSystem
+
+ +
+
+system_type
+

alias of CasadiADMMNNSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem[source]
+

Bases: CasadiADMMSystem, CasadiMLSystem

+

In this class, the lags are determined by the trainer alone and the lags are +saved in the serialized MLModel so that it doesn’t have to be defined in the +model again

+
+
+initialize(model: CasadiMLModel, var_ref: VariableReference)[source]
+
+ +
+
+property parameters: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter]
+
+ +
+
+past_couplings: OptimizationParameter
+
+ +
+
+past_exchange: OptimizationParameter
+
+ +
+
+property quantities: list[Union[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter, agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]]
+
+ +
+
+property sim_step_quantities: dict[str, Union[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter, agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]]
+
+ +
+
+property variables: list[agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable]
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.MultipleShootingADMMNN(options: CasadiDiscretizationOptions)[source]
+

Bases: ADMMMultipleShooting, MultipleShooting_ML

+
+
+max_lag: int
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.casadi_ml module

+
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend(config: dict)[source]
+

Bases: CasADiBaseBackend

+

Class doing optimization with a MLModel.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML'>}
+
+ +
+
+get_lags_per_variable() dict[str, float][source]
+

Returns the name of variables which include lags and their lag. The MPC +module can use this information to save relevant past data of lagged +variables

+
+ +
+
+lag_collection: Dict[str, deque] = {}
+
+ +
+
+max_lag: int
+
+ +
+
+system: CasadiMLSystem
+
+ +
+
+system_type
+

alias of CasadiMLSystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem[source]
+

Bases: FullSystem

+
+
+all_system_quantities() dict[str, agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity][source]
+
+ +
+
+initialize(model: CasadiMLModel, var_ref: FullVariableReference)[source]
+
+ +
+
+lags_dict: dict[str, int]
+
+ +
+
+property max_lag: int
+
+ +
+
+model: CasadiMLModel
+
+ +
+
+sim_step: Function
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML(options: CasadiDiscretizationOptions)[source]
+

Bases: MultipleShooting

+
+
+initialize(system: CasadiMLSystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+
+max_lag: int
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.full module

+
+
+class agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+cost_function: Callable | None
+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation'>, DiscretizationMethod.multiple_shooting: <class 'agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting'>}
+
+ +
+
+model: ModelT
+
+ +
+
+system: FullSystem
+
+ +
+
+system_type
+

alias of FullSystem

+
+ +
+
+var_ref: mpc_datamodels.VariableReference | None
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.FullSystem[source]
+

Bases: BaseSystem

+
+
+algebraics: OptimizationVariable
+
+ +
+
+controls: OptimizationVariable
+
+ +
+
+cost_function: ca.MX
+
+ +
+
+initial_state: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: FullVariableReference)[source]
+
+ +
+
+last_control: OptimizationParameter
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+model_parameters: OptimizationParameter
+
+ +
+
+non_controlled_inputs: OptimizationParameter
+
+ +
+
+ode: ca.MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+
+r_del_u: OptimizationParameter
+
+ +
+
+states: OptimizationVariable
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting(options: CasadiDiscretizationOptions)[source]
+

Bases: MultipleShooting

+
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.mhe module

+
+
+class agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices(order: int, root: numpy.ndarray, B: numpy.ndarray, C: numpy.ndarray, D: numpy.ndarray)[source]
+

Bases: object

+
+
+B: ndarray
+
+ +
+
+C: ndarray
+
+ +
+
+D: ndarray
+
+ +
+
+order: int
+
+ +
+
+root: ndarray
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: Discretization

+
+
+initialize(system: MHESystem, solver_factory: SolverFactory)[source]
+

Initializes the trajectory optimization problem, creating all symbolic +variables of the OCP, the mapping function and the numerical solver.

+
+ +
+
+only_positive_times_in_results: bool = False
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation'>}
+
+ +
+
+static sample(trajectory: float | int | Series | list[Union[float, int]], grid: list | ndarray, current: float = 0, method: str = 'linear') list[source]
+

Obtain the specified portion of the trajectory.

+
+
Parameters:
+
    +
  • trajectory – The trajectory to be sampled. Scalars will be +expanded onto the grid. Lists need to exactly match the provided +grid. Otherwise, a list of tuples is accepted with the form ( +timestamp, value). A dict with the keys ‘grid’ and ‘value’ is also +accepted.

  • +
  • current – start time of requested trajectory

  • +
  • grid – target interpolation grid in seconds in relative terms (i.e. +starting from 0 usually)

  • +
  • method – interpolation method, currently accepted: ‘linear’, +‘spline’, ‘previous’

  • +
+
+
Returns:
+

Sampled list of values.

+
+
+

Takes a slice of the trajectory from the current time step with the +specified length and interpolates it to match the requested sampling. +If the requested horizon is longer than the available data, the last +available value will be used for the remainder.

+
+
Raises:
+
    +
  • ValueError

  • +
  • TypeError

  • +
+
+
+
+ +
+
+system: MHESystem
+
+ +
+
+system_type
+

alias of MHESystem

+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem[source]
+

Bases: System

+
+
+algebraics: OptimizationVariable
+
+ +
+
+cost_function: MX
+
+ +
+
+estimated_inputs: OptimizationVariable
+
+ +
+
+estimated_parameters: OptimizationVariable
+
+ +
+
+estimated_states: OptimizationVariable
+
+ +
+
+initialize(model: CasadiModel, var_ref: MHEVariableReference)[source]
+
+ +
+
+known_inputs: OptimizationParameter
+
+ +
+
+known_parameters: OptimizationParameter
+
+ +
+
+measured_states: OptimizationParameter
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+ode: MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.minlp module

+
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend(config: dict)[source]
+

Bases: CasADiBackend

+

Class doing optimization of ADMM subproblems with CasADi.

+
+
+cost_function: Callable | None
+
+ +
+
+discretization: DiscretizationT
+
+ +
+
+discretization_types: dict[DiscretizationMethod, Type[DiscretizationT]] = {DiscretizationMethod.collocation: <class 'agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation'>}
+
+ +
+
+model: ModelT
+
+ +
+
+system: CasadiMINLPSystem
+
+ +
+
+system_type
+

alias of CasadiMINLPSystem

+
+ +
+
+var_ref: mpc_datamodels.VariableReference | None
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem[source]
+

Bases: BaseSystem

+
+
+algebraics: OptimizationVariable
+
+ +
+
+binary_controls: OptimizationVariable
+
+ +
+
+controls: OptimizationVariable
+
+ +
+
+cost_function: ca.MX
+
+ +
+
+initial_state: OptimizationParameter
+
+ +
+
+initialize(model: CasadiModel, var_ref: MINLPVariableReference)[source]
+
+ +
+
+model_constraints: Constraint
+
+ +
+
+model_parameters: OptimizationParameter
+
+ +
+
+non_controlled_inputs: OptimizationParameter
+
+ +
+
+ode: ca.MX
+
+ +
+
+outputs: OptimizationVariable
+
+ +
+
+states: OptimizationVariable
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation(options: CasadiDiscretizationOptions)[source]
+

Bases: DirectCollocation

+
+ +
+
+

agentlib_mpc.optimization_backends.casadi_.minlp_cia module

+
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.html b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.html new file mode 100644 index 0000000..692acfc --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.optimization_backends.html @@ -0,0 +1,635 @@ + + + + + + + + + agentlib_mpc.optimization_backends package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.optimization_backends package

+
+
+pydantic model agentlib_mpc.optimization_backends.BackendImport[source]
+

Bases: BaseModel

+

Data-Class to import a given python file +from import_path and load the given +class_name

+
+
Fields:
+
+
+
+
+
+field class_name: str [Required]
+
+ +
+
+field import_path: str [Required]
+
+ +
+ +
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.optimization_backends.backend module

+
+
+class agentlib_mpc.optimization_backends.backend.ADMMBackend(config: dict)[source]
+

Bases: OptimizationBackend

+

Base class for implementations of optimization backends for ADMM +algorithms.

+
+
+abstract property coupling_grid: list[float]
+

Returns the grid on which the coupling variables are discretized.

+
+ +
+ +
+
+pydantic model agentlib_mpc.optimization_backends.backend.BackendConfig[source]
+

Bases: BaseModel

+
+
Config:
+
    +
  • extra: str = forbid

  • +
+
+
Fields:
+
+
+
Validators:
+
+
+
+
+
+field discretization_options: DiscretizationOptions [Required]
+
+ +
+
+field model: dict [Required]
+
+ +
+
+field name: str | None = None
+
+ +
+
+field overwrite_result_file: bool | None = False
+
+
Validated by:
+
+
+
+
+ +
+
+field results_file: Path | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+field save_results: bool | None = None
+
+
Validated by:
+
+
+
+
+ +
+
+validator check_csv  »  results_file[source]
+
+ +
+
+validator check_overwrite  »  overwrite_result_file[source]
+

Checks, whether the overwrite results sttings are valid, and deletes +existing result files if applicable.

+
+ +
+
+validator disable_results_if_no_file  »  save_results[source]
+
+ +
+ +
+
+class agentlib_mpc.optimization_backends.backend.OptimizationBackend(config: dict)[source]
+

Bases: ABC

+

Base class for all optimization backends. OptimizationBackends are a +plugin for the ‘mpc’ module. They provide means to setup and solve the +underlying optimization problem of the MPC. They also can save data of +the solutions.

+
+
+config_type
+

alias of BackendConfig

+
+ +
+
+cost_function: Callable | None
+
+ +
+
+get_lags_per_variable() dict[str, float][source]
+

Returns the name of variables which include lags and their lag in seconds. +The MPC module can use this information to save relevant past data of lagged +variables

+
+ +
+
+model: ModelT
+
+ +
+
+model_from_config(model: dict)[source]
+

Set the model to the backend.

+
+ +
+
+mpc_backend_parameters = ('time_step', 'prediction_horizon')
+
+ +
+
+register_logger(logger: Logger)[source]
+

Registers a logger, can be used to use the module logger

+
+ +
+
+results_file_exists() bool[source]
+

Checks if the results file already exists, and if not, creates it with +headers.

+
+ +
+
+abstract setup_optimization(var_ref: VariableReference)[source]
+

Performs all necessary steps to make the solve method usable.

+
+
Parameters:
+

var_ref – Variable Reference that specifies the role of each model variable +in the mpc

+
+
+
+ +
+
+abstract solve(now: float | datetime, current_vars: Dict[str, AgentVariable]) Results[source]
+

Solves the optimization problem given the current values of the +corresponding AgentVariables and system time. The standardization of +return values is a work in progress.

+
+
Parameters:
+
    +
  • now – Current time used for interpolation of input trajectories.

  • +
  • current_vars – Dict of AgentVariables holding the values relevant to +the optimization problem. Keys are the names

  • +
+
+
Returns:
+

A dataframe with all optimization variables over their respective +grids. Depending on discretization, can include many nan’s, so care +should be taken when using this, e.g. always use dropna() after +accessing a column.

+
+
+
Example:
+

variables mDot | T_0 | slack_T

+
+

time +0 0.1 | 298 | nan +230 nan | 297 | 3 +470 nan | 296 | 2 +588 nan | 295 | 1 +700 0.05 | 294 | nan +930 nan | 294 | 0.1

+
+
+
+

+
+
+
+ +
+
+update_discretization_options(opts: dict)[source]
+

Updates the discretization options with the new dict.

+
+ +
+
+update_model_variables(current_vars: Dict[str, AgentVariable])[source]
+

Internal method to write current data_broker to model variables. +Only update values, not other module_types.

+
+ +
+
+var_ref: VariableReference | None
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.utils.html b/docs/0.6.4/docs/code/agentlib_mpc.utils.html new file mode 100644 index 0000000..e967b85 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.utils.html @@ -0,0 +1,453 @@ + + + + + + + + + agentlib_mpc.utils package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.utils package

+

Package containing utils for agentlib_mpc.

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

agentlib_mpc.utils.analysis module

+
+
+agentlib_mpc.utils.analysis.admm_at_time_step(data: DataFrame | Series, time_step: float = None, variable=None, iteration: float = -1, index_offset: float | Literal['auto'] | bool = True, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds') DataFrame[source]
+

Gets the results of an optimization at a time step. +:param index_offset: Determines how the index will be updated when loading the data. +:param The offset will be subtracted from the time-index. This is useful for results: +:param of realtime systems: to cut the number down to something understandable. For example, if the time

+
+

index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

+
+
+
If “auto” or True is provided as an argument, the index will be modified to

start at 0. If 0 or False are provided, no modifications will be made.

+
+
+
+
+
+
Parameters:
+
    +
  • want (where the time value with be a unix time stamp and we) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
  • data – The multi-indexed results data frame from the mpc

  • +
  • time_step – The time step from which results should be shown. +If no exact match, shows closest.

  • +
  • variable – If specified, only returns results +with regard to a certain variable.

  • +
  • iteration – Specifies, from which inner ADMM iteration data should be +from. If negative, counts from last iteration. Default -1.

  • +
  • convert_to – Whether the data should be converted to datetime, minutes etc.

  • +
+
+
Returns:
+

A single-indexed Dataframe of the optimization results +at the specified time step. If variable is not specified, +returns all variables with a double column index, if it +is specified returns only values and/or bounds with +single indexed columns.

+
+
+
+ +
+
+agentlib_mpc.utils.analysis.convert_index(convert_to: Literal['seconds', 'minutes', 'hours', 'days'] | Literal['datetime'], index: Index)[source]
+

Converts an index from seconds to datetime or another unit +:param convert_to: unit, e.g. minutes, hours, datetime +:param index: pandas index object

+

Returns:

+
+ +
+
+agentlib_mpc.utils.analysis.convert_multi_index(data: DataFrame, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] | Literal['datetime'])[source]
+

Converts an index of an MPC or ADMM results Dataframe to a different unit, +assuming it is passed in seconds.

+
+ +
+
+agentlib_mpc.utils.analysis.first_vals_at_trajectory_index(data: DataFrame | Series)[source]
+

Gets the first values at each time step of a results trajectory.

+
+ +
+
+agentlib_mpc.utils.analysis.get_number_of_iterations(data: DataFrame) dict[agentlib_mpc.utils.analysis.SimulationTime, int][source]
+

Returns the number of iterations at each time instance of the ADMM simulation.

+
+ +
+
+agentlib_mpc.utils.analysis.get_time_steps(data: DataFrame) Iterable[float][source]
+

Returns the time steps at which an MPC step was performed.

+
+ +
+
+agentlib_mpc.utils.analysis.last_vals_at_trajectory_index(data: DataFrame | Series)[source]
+

Gets the last values at each time step of a results trajectory.

+
+ +
+
+agentlib_mpc.utils.analysis.load_admm(file: Path | str) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_mpc(file: Path | str) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_mpc_stats(results_file: str | Path) DataFrame | None[source]
+
+ +
+
+agentlib_mpc.utils.analysis.load_sim(file: Path, causality=None) DataFrame[source]
+
+ +
+
+agentlib_mpc.utils.analysis.mpc_at_time_step(data: DataFrame, time_step: float, variable=None, variable_type='variable', index_offset: float | Literal['auto'] | bool = True) DataFrame[source]
+

Gets the results of an optimization at a time step.

+
+
Parameters:
+
    +
  • data – The multi-indexed results data frame from the mpc

  • +
  • time_step – The time step from which results should be shown. +If no exact match, shows closest.

  • +
  • variable – If specified, only returns results +with regard to a certain variable.

  • +
  • variable_type – The type of the variable provided (parameter, variable, lower, …)

  • +
  • index_offset – Determines how the index will be updated when loading the data.

  • +
  • results (The offset will be subtracted from the time-index. This is useful for) –

  • +
  • systems (of realtime) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
  • want (where the time value with be a unix time stamp and we) –

    to cut the number down to something understandable. For example, if the time +index (level 0 of the input Dataframe) is [105, 115, 125] and we give an +index_offset of 100, the data will be handled as if the index was [5, 15, 25].

    +
    +
    +
    If “auto” or True is provided as an argument, the index will be modified to

    start at 0. If 0 or False are provided, no modifications will be made.

    +
    +
    +
    +

  • +
+
+
Returns:
+

+
A single-indexed Dataframe of the optimization results

at the specified time step. If variable is not specified, +returns all variables with a double column index, if it +is specified returns only values and/or bounds with +single indexed columns.

+
+
+

+
+
Return type:
+

pd.DataFrame

+
+
+
+ +
+
+agentlib_mpc.utils.analysis.perform_index_update(data: DataFrame, offset: float | Literal['auto'] | bool, admm: bool = False) DataFrame[source]
+

Updates the index of a raw mpc/admm result dataframe, to be offset by a desired +time value.

+
+ +
+
+

agentlib_mpc.utils.sampling module

+
+
+agentlib_mpc.utils.sampling.earliest_index(time, arr, stop, start=0)[source]
+

Helper function for interpolate_to_previous. +Finds the current index to which we should forwardfill.

+
+ +
+
+agentlib_mpc.utils.sampling.interpolate_to_previous(target_grid: Iterable[float], original_grid: Iterable[float], values: Sequence[float]) List[float][source]
+

Interpolates to previous value of original grid, i.e. a forward fill.

+

Stand-in for the following scipy code: +tck = interpolate.interp1d(list(original_grid), values, kind=”previous”) +result = list(tck(target_grid))

+
+ +
+
+agentlib_mpc.utils.sampling.pairwise(iterable: Iterable)[source]
+

s -> (s0,s1), (s1,s2), (s2, s3), …

+
+ +
+
+agentlib_mpc.utils.sampling.sample(trajectory: Real | Series | list[numbers.Real] | dict[numbers.Real, numbers.Real], grid: list | ndarray, current: float = 0, method: str = 'linear') list[source]
+

Obtain the specified portion of the trajectory.

+
+
Parameters:
+
    +
  • trajectory

    The trajectory to be sampled. Scalars will be +expanded onto the grid. Lists need to exactly match the provided +grid. Otherwise, a pandas Series is accepted with the timestamp as index. A

    +
    +

    dict with the keys as time stamps is also accepted.

    +
    +

  • +
  • current – start time of requested trajectory

  • +
  • grid – target interpolation grid in seconds in relative terms (i.e. +starting from 0 usually)

  • +
  • method – interpolation method, currently accepted: ‘linear’, +‘spline’, ‘previous’

  • +
+
+
Returns:
+

Sampled list of values.

+
+
+

Takes a slice of the trajectory from the current time step with the +specified length and interpolates it to match the requested sampling. +If the requested horizon is longer than the available data, the last +available value will be used for the remainder.

+
+
Raises:
+
    +
  • ValueError

  • +
  • TypeError

  • +
+
+
+
+ +
+
+agentlib_mpc.utils.sampling.sample_values_to_target_grid(values: Iterable[float], original_grid: Iterable[float], target_grid: Iterable[float], method: str | InterpolationMethods) list[float][source]
+
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/agentlib_mpc.utils.plotting.html b/docs/0.6.4/docs/code/agentlib_mpc.utils.plotting.html new file mode 100644 index 0000000..1f70722 --- /dev/null +++ b/docs/0.6.4/docs/code/agentlib_mpc.utils.plotting.html @@ -0,0 +1,566 @@ + + + + + + + + + agentlib_mpc.utils.plotting package — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

agentlib_mpc.utils.plotting package

+
+

Submodules

+
+
+

agentlib_mpc.utils.plotting.admm_animation module

+

Modules that defines functions to be used for automatically creating animations of +ADMM convergence

+
+
+agentlib_mpc.utils.plotting.admm_animation.animate_full(i: int, lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, data: dict[str, pandas.core.frame.DataFrame], time_step: float)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.init_full(lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, ax: Axes)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_animation(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1, interval: int = 300)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_image(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_animation.make_lines(labels: list[str], ax: Axes, fig: Figure) dict[str, matplotlib.lines.Line2D][source]
+
+ +
+
+

agentlib_mpc.utils.plotting.admm_consensus_shades module

+
+
+agentlib_mpc.utils.plotting.admm_consensus_shades.plot_consensus_shades(results: dict[str, dict[str, pandas.core.frame.DataFrame]], data: dict[str, pandas.core.frame.DataFrame], time_step: float)[source]
+
+
Parameters:
+

series

+
+
+

Returns:

+
+ +
+
+

agentlib_mpc.utils.plotting.admm_dashboard module

+
+
+agentlib_mpc.utils.plotting.admm_dashboard.create_app(agent_data: Dict[str, DataFrame], residuals_df: DataFrame)[source]
+

Create and configure the Dash app.

+

Args: +agent_data (Dict[str, pd.DataFrame]): Dictionary containing data for each agent. +residuals_df (pd.DataFrame): DataFrame containing residuals data.

+

Returns: +dash.Dash: Configured Dash app.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.create_coupling_var_plot(plot_data: Dict[str, List[float]], prediction_grid: List[float], coupling_var: str) Figure[source]
+

Create a plotly figure for the coupling variable plot.

+

Args: +plot_data (Dict[str, List[float]]): Dictionary with agent names as keys and their values as lists. +prediction_grid (List[float]): List of prediction grid values. +coupling_var (str): Name of the coupling variable.

+

Returns: +go.Figure: Plotly figure object.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.create_residuals_plot(residuals_df: DataFrame, time_step: float) Figure[source]
+

Create a plotly figure for the residuals plot.

+

Args: +residuals_df (pd.DataFrame): DataFrame containing residuals data. +time_step (float): Selected time step.

+

Returns: +go.Figure: Plotly figure object.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.get_coupling_variables(df: DataFrame) List[str][source]
+

Identify coupling variables in the dataframe.

+

Args: +df (pd.DataFrame): The MPC data for an agent.

+

Returns: +List[str]: List of coupling variable names.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.get_data_for_plot(agent_data: Dict[str, DataFrame], time_step: float, iteration: int, coupling_var: str) Dict[str, List[float]][source]
+

Extract data for the coupling variable plot.

+

Args: +agent_data (Dict[str, pd.DataFrame]): Dictionary containing data for each agent. +time_step (float): Selected time step. +iteration (int): Selected iteration number. +coupling_var (str): Name of the selected coupling variable.

+

Returns: +Dict[str, List[float]]: Dictionary with agent names as keys and their values as lists.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.get_max_iterations_per_timestep(agent_data: Dict[str, DataFrame]) Dict[float, int][source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.load_agent_data(directory: str) Dict[str, DataFrame][source]
+

Load MPC data for multiple agents from files containing ‘admm’ in their name.

+

Args: +directory (str): Directory path containing the data files.

+

Returns: +Dict[str, pd.DataFrame]: Dictionary with agent names as keys and their data as values.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.main()[source]
+
+ +
+
+agentlib_mpc.utils.plotting.admm_dashboard.show_admm_dashboard(data: dict[str, pandas.core.frame.DataFrame], residuals: DataFrame | None = None, scale: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]
+
+ +
+
+

agentlib_mpc.utils.plotting.admm_residuals module

+
+
+agentlib_mpc.utils.plotting.admm_residuals.load_residuals(file: str | Path) DataFrame[source]
+

Loads a residuals csv file in the correct format.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.plot_over_time(residuals: ~pandas.core.frame.DataFrame, primal_tol: float = None, dual_tol: float = None, max_iters: int = None) -> (<class 'matplotlib.figure.Figure'>, (<class 'matplotlib.axes._axes.Axes'>, <class 'matplotlib.axes._axes.Axes'>))[source]
+

Plots the final residuals over time.

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.plot_single_time_step(residuals: ~pandas.core.frame.DataFrame, time_step: float = None, primal_tol: float = None, dual_tol: float = None) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]
+

Plots the decrease of the residuals over iterations for a time step

+
+ +
+
+agentlib_mpc.utils.plotting.admm_residuals.residuals_over_time(residuals: DataFrame) DataFrame[source]
+

Evaluates the residuals over time. Takes a raw residuals DataFrame and returns a +Dataframe, which has for each time step the number of iterations and the final primal and dual residuals.

+
+
Returns:
+

DataFrame with float index (time in seconds) and the columns +(“primal_residual”, “dual_residual”, “iters”)

+
+
+
+ +
+
+

agentlib_mpc.utils.plotting.basic module

+

Some basic plotting utilities

+
+
+class agentlib_mpc.utils.plotting.basic.EBCColors[source]
+

Bases: object

+
+
+blue: tuple[float, float, float] = (0.0, 0.32941176470588235, 0.6235294117647059)
+
+ +
+
+dark_grey: tuple[float, float, float] = (0.3058823529411765, 0.30980392156862746, 0.3137254901960784)
+
+ +
+
+dark_red: tuple[float, float, float] = (0.6745098039215687, 0.16862745098039217, 0.10980392156862745)
+
+ +
+
+ebc_palette_sort_1: list[tuple[float, float, float]] = [(0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)]
+
+ +
+
+ebc_palette_sort_2: list[tuple[float, float, float]] = [(0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196), (0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)]
+
+ +
+
+green: tuple[float, float, float] = (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)
+
+ +
+
+grey: tuple[float, float, float] = (0.615686274509804, 0.6196078431372549, 0.6274509803921569)
+
+ +
+
+light_blue: tuple[float, float, float] = (0.615686274509804, 0.7647058823529411, 0.9019607843137255)
+
+ +
+
+light_grey: tuple[float, float, float] = (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)
+
+ +
+
+light_red: tuple[float, float, float] = (0.9215686274509803, 0.5490196078431373, 0.5058823529411764)
+
+ +
+
+red: tuple[float, float, float] = (0.8666666666666667, 0.25098039215686274, 0.17647058823529413)
+
+ +
+ +
+
+class agentlib_mpc.utils.plotting.basic.FontDict[source]
+

Bases: TypedDict

+
+
+fontsize: float
+
+ +
+ +
+
+class agentlib_mpc.utils.plotting.basic.Style(use_tex: bool = False)[source]
+

Bases: object

+
+ +
+
+class agentlib_mpc.utils.plotting.basic.ValueRange(min: float, max: float)[source]
+

Bases: object

+
+
+max: float
+
+ +
+
+min: float
+
+ +
+ +
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, rows: int = 1) tuple[matplotlib.figure.Figure, tuple[matplotlib.axes._axes.Axes, ...]][source]
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, tuple[matplotlib.axes._axes.Axes], Style], Tuple[Figure, tuple[matplotlib.axes._axes.Axes]]] = None) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]
+
+agentlib_mpc.utils.plotting.basic.make_fig(style: Style) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]
+

Creates a figure and axes with an amount of rows. If rows is specified, return +a tuple of axes, else only an ax

+
+ +
+
+agentlib_mpc.utils.plotting.basic.make_grid(ax: Axes)[source]
+
+ +
+
+agentlib_mpc.utils.plotting.basic.make_side_legend(ax: Axes, fig: Figure = None, right_position: float = 1)[source]
+
+ +
+
+

agentlib_mpc.utils.plotting.discretization_structure module

+
+
+agentlib_mpc.utils.plotting.discretization_structure.spy_structure(df: DataFrame, customizer: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, file: Path = '')[source]
+
+ +
+
+

agentlib_mpc.utils.plotting.interactive module

+
+
+agentlib_mpc.utils.plotting.interactive.draggable_script()[source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.get_port()[source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.make_components(columns, data, convert_to, stats: DataFrame | None = None) [<class 'dash.html.Div.Div'>][source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.make_figure_plotly() Figure[source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.obj_plot(data, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds') Graph[source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.plot_admm_plotly(series: Series, plot_actual_values: bool = True, plot_predictions: bool = False, step: bool = False, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]
+
+
Parameters:
+
    +
  • series – A column of the MPC results Dataframe

  • +
  • fig – Plotly figure to plot on

  • +
  • plot_actual_values – whether the closed loop actual values at the start of each +optimization should be plotted (default True)

  • +
  • plot_predictions – whether all predicted trajectories should be plotted

  • +
  • step – whether to use a step plot or a line plot

  • +
  • convert_to – Will convert the index of the returned series to the specified unit +(seconds, minutes, hours, days)

  • +
+
+
Returns:
+

None

+
+
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.plot_mpc_plotly(series: Series, step: bool = False, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds', y_axis_label: str = '') Figure[source]
+
+
Parameters:
+
    +
  • title

  • +
  • y_axis_label

  • +
  • series – A column of the MPC results Dataframe

  • +
  • plot_actual_values – whether the closed loop actual values at the start of each +optimization should be plotted (default True)

  • +
  • plot_predictions – whether all predicted trajectories should be plotted

  • +
  • step – whether to use a step plot or a line plot

  • +
  • convert_to – Will convert the index of the returned series to the specified unit +(seconds, minutes, hours, days)

  • +
+
+
Returns:
+

Figure

+
+
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.show_dashboard(data: DataFrame, stats: DataFrame | None = None, scale: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]
+
+ +
+
+agentlib_mpc.utils.plotting.interactive.solver_return(data, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds') Graph[source]
+
+ +
+
+

agentlib_mpc.utils.plotting.ml_model_test module

+
+
+agentlib_mpc.utils.plotting.ml_model_test.calc_scores(errors: ndarray, metric: Callable) float[source]
+
+ +
+
+agentlib_mpc.utils.plotting.ml_model_test.evaluate_model(training_data: TrainingData, model: CasadiPredictor | SerializedMLModel, metric: Callable = None, show_plot: bool = True, save_path: Path | None = None)[source]
+

Tests the Model on test data

+
+ +
+
+agentlib_mpc.utils.plotting.ml_model_test.pairwise_sort(*arrays: tuple[numpy.ndarray, numpy.ndarray])[source]
+
+ +
+
+agentlib_mpc.utils.plotting.ml_model_test.predict_array(df: DataFrame, ml_model: CasadiPredictor, outputs: Index) DataFrame[source]
+
+ +
+
+

agentlib_mpc.utils.plotting.mpc module

+
+
+agentlib_mpc.utils.plotting.mpc.interpolate_colors(progress: float, colors: list[tuple[float, float, float]]) tuple[float, float, float][source]
+

Interpolates colors based on a sample number. To be used when plotting many mpc +predictions in one plot, so a fade from old to new predictions can be seen.

+

Original credit to Max Berktold.

+
+
Parameters:
+
    +
  • progress

  • +
  • colors

  • +
+
+
+

Returns:

+
+ +
+
+agentlib_mpc.utils.plotting.mpc.plot_admm(series: Series, ax: Axes, plot_actual_values: bool = True, plot_predictions: bool = False, step: bool = False, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]
+
+
Parameters:
+
    +
  • series – A column of the MPC results Dataframe

  • +
  • ax – which Axes to plot on

  • +
  • plot_actual_values – whether the closed loop actual values at the start of each +optimization should be plotted (default True)

  • +
  • plot_predictions – whether all predicted trajectories should be plotted

  • +
  • step

  • +
  • convert_to – Will convert the index of the returned series to the specified unit +(seconds, minutes, hours, days)

  • +
+
+
+

Returns:

+
+ +
+
+agentlib_mpc.utils.plotting.mpc.plot_mpc(series: Series, ax: Axes, plot_actual_values: bool = True, plot_predictions: bool = False, step: bool = False, convert_to: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]
+
+
Parameters:
+
    +
  • series – A column of the MPC results Dataframe

  • +
  • ax – which Axes to plot on

  • +
  • plot_actual_values – whether the closed loop actual values at the start of each +optimization should be plotted (default True)

  • +
  • plot_predictions – whether all predicted trajectories should be plotted

  • +
  • step

  • +
  • convert_to – Will convert the index of the returned series to the specified unit +(seconds, minutes, hours, days)

  • +
+
+
+

Returns:

+
+ +
+
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/code/modules.html b/docs/0.6.4/docs/code/modules.html new file mode 100644 index 0000000..3d542f7 --- /dev/null +++ b/docs/0.6.4/docs/code/modules.html @@ -0,0 +1,159 @@ + + + + + + + + + agentlib_mpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/doc.svg b/docs/0.6.4/docs/doc.svg new file mode 100644 index 0000000..06e33d8 --- /dev/null +++ b/docs/0.6.4/docs/doc.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + documentation + documentation + + + passing + passing + + diff --git a/docs/0.6.4/docs/genindex.html b/docs/0.6.4/docs/genindex.html new file mode 100644 index 0000000..7e8abcf --- /dev/null +++ b/docs/0.6.4/docs/genindex.html @@ -0,0 +1,3468 @@ + + + + + + + + Index — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

Index

+ +
+ A + | B + | C + | D + | E + | F + | G + | H + | I + | J + | K + | L + | M + | N + | O + | P + | Q + | R + | S + | T + | U + | V + | W + | X + | Y + +
+

A

+ + + +
+ +

B

+ + + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + + +
+ +

H

+ + +
+ +

I

+ + + +
+ +

J

+ + +
+ +

K

+ + + +
+ +

L

+ + + +
+ +

M

+ + + +
+ +

N

+ + + +
+ +

O

+ + + +
+ +

P

+ + + +
+ +

Q

+ + + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

U

+ + + +
+ +

V

+ + + +
+ +

W

+ + + +
+ +

X

+ + + +
+ +

Y

+ + +
+ + + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/index.html b/docs/0.6.4/docs/index.html new file mode 100644 index 0000000..416de39 --- /dev/null +++ b/docs/0.6.4/docs/index.html @@ -0,0 +1,190 @@ + + + + + + + + + Welcome to agentlib_mpc’s documentation! — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Welcome to agentlib_mpc’s documentation!

+
+

Content of the documentation

+ +
+
+

Readme of the agentlib

+
+
+
+

agentlib_mpc

+License +pylint +documentation +

This is a plugin for AgentLib. +Includes functions for modeling with CasADi, and using those models in nonlinear MPC, central and distributed (based on ADMM).

+

See examples and the tutorial in the docs. +Best example to start is an MPC for a single air conditioned room.

+
+

Installation

+

Install with:

+
pip install agentlib_mpc
+
+
+

To install with full dependencies (recommended), run:

+
pip install agentlib_mpc[full]
+
+
+
+
+

Optional Dependencies

+

AgentLib_MPC has a number of optional dependencies:

+
    +
  • fmu: Support simulation of FMU models (https://fmi-standard.org/).

  • +
  • ml: Use machine learning based NARX models for MPC. Currently supports neural networks, gaussian process regression and linear regression. Installs tensorflow, keras and scikit-learn.

  • +
  • interactive: Utility functions for displaying mpc results in an interactive dashboard. Installs plotly and dash.

  • +
+

Install these like

+
pip install agentlib_mpc[ml]
+
+
+
+
+

Citing AgentLib_MPC

+

For now, please cite the base framework under https://github.com/RWTH-EBC/AgentLib.

+

A preprint is available under http://dx.doi.org/10.2139/ssrn.4884846 and can be cited as:

+
+

Eser, Steffen and Storek, Thomas and Wüllhorst, Fabian and Dähling, Stefan and Gall, Jan and Stoffel, Phillip and Müller, Dirk, A Modular Python Framework for Rapid Development of Advanced Control Algorithms for Energy Systems. Available at SSRN: https://ssrn.com/abstract=4884846 or http://dx.doi.org/10.2139/ssrn.4884846

+
+

When using AgentLib-MPC, please remember to cite other tools that you are using, for example CasADi or IPOPT.

+
+
+

Acknowledgments

+

We gratefully acknowledge the financial support by Federal Ministry for Economic Affairs and Climate Action (BMWK), promotional reference 03ET1495A.

+

BMWK

+
+
+
+

Indices and tables

+ +
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/installation.html b/docs/0.6.4/docs/installation.html new file mode 100644 index 0000000..40fe01f --- /dev/null +++ b/docs/0.6.4/docs/installation.html @@ -0,0 +1,120 @@ + + + + + + + + + Installation — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Installation

+

Clone agentlib_mpc into a local directory. +Then, run:

+
pip install .\
+
+
+

If you want to contribute code and help develop this repository, first clone the repo and then install it via an .egg:

+
pip install -e .
+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/modules.html b/docs/0.6.4/docs/modules.html new file mode 100644 index 0000000..bc4c029 --- /dev/null +++ b/docs/0.6.4/docs/modules.html @@ -0,0 +1,151 @@ + + + + + + + + + agentlib_mpc — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/objects.inv b/docs/0.6.4/docs/objects.inv new file mode 100644 index 0000000..de805ae Binary files /dev/null and b/docs/0.6.4/docs/objects.inv differ diff --git a/docs/0.6.4/docs/py-modindex.html b/docs/0.6.4/docs/py-modindex.html new file mode 100644 index 0000000..dd29cc7 --- /dev/null +++ b/docs/0.6.4/docs/py-modindex.html @@ -0,0 +1,422 @@ + + + + + + + + Python Module Index — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

Python Module Index

+ +
+ a +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ a
+ agentlib_mpc +
    + agentlib_mpc.data_structures +
    + agentlib_mpc.data_structures.admm_datatypes +
    + agentlib_mpc.data_structures.casadi_utils +
    + agentlib_mpc.data_structures.coordinator_datatypes +
    + agentlib_mpc.data_structures.interpolation +
    + agentlib_mpc.data_structures.ml_model_datatypes +
    + agentlib_mpc.data_structures.mpc_datamodels +
    + agentlib_mpc.models +
    + agentlib_mpc.models.casadi_ml_model +
    + agentlib_mpc.models.casadi_model +
    + agentlib_mpc.models.casadi_predictor +
    + agentlib_mpc.models.serialized_ml_model +
    + agentlib_mpc.modules +
    + agentlib_mpc.modules.data_source +
    + agentlib_mpc.modules.dmpc +
    + agentlib_mpc.modules.dmpc.admm +
    + agentlib_mpc.modules.dmpc.admm.admm +
    + agentlib_mpc.modules.dmpc.admm.admm_coordinated +
    + agentlib_mpc.modules.dmpc.admm.admm_coordinator +
    + agentlib_mpc.modules.dmpc.coordinator +
    + agentlib_mpc.modules.dmpc.employee +
    + agentlib_mpc.modules.estimation +
    + agentlib_mpc.modules.estimation.mhe +
    + agentlib_mpc.modules.InputPrediction +
    + agentlib_mpc.modules.InputPrediction.try_predictor +
    + agentlib_mpc.modules.minlp_mpc +
    + agentlib_mpc.modules.ml_model_training +
    + agentlib_mpc.modules.ml_model_training.data_reduction +
    + agentlib_mpc.modules.ml_model_training.ml_model_trainer +
    + agentlib_mpc.modules.ml_model_training.setpoint_generator +
    + agentlib_mpc.modules.mpc +
    + agentlib_mpc.modules.mpc_full +
    + agentlib_mpc.optimization_backends +
    + agentlib_mpc.optimization_backends.backend +
    + agentlib_mpc.optimization_backends.casadi_ +
    + agentlib_mpc.optimization_backends.casadi_.admm +
    + agentlib_mpc.optimization_backends.casadi_.basic +
    + agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml +
    + agentlib_mpc.optimization_backends.casadi_.casadi_ml +
    + agentlib_mpc.optimization_backends.casadi_.core +
    + agentlib_mpc.optimization_backends.casadi_.core.casadi_backend +
    + agentlib_mpc.optimization_backends.casadi_.core.discretization +
    + agentlib_mpc.optimization_backends.casadi_.core.system +
    + agentlib_mpc.optimization_backends.casadi_.core.VariableGroup +
    + agentlib_mpc.optimization_backends.casadi_.full +
    + agentlib_mpc.optimization_backends.casadi_.mhe +
    + agentlib_mpc.optimization_backends.casadi_.minlp +
    + agentlib_mpc.utils +
    + agentlib_mpc.utils.analysis +
    + agentlib_mpc.utils.plotting +
    + agentlib_mpc.utils.plotting.admm_animation +
    + agentlib_mpc.utils.plotting.admm_consensus_shades +
    + agentlib_mpc.utils.plotting.admm_dashboard +
    + agentlib_mpc.utils.plotting.admm_residuals +
    + agentlib_mpc.utils.plotting.basic +
    + agentlib_mpc.utils.plotting.discretization_structure +
    + agentlib_mpc.utils.plotting.interactive +
    + agentlib_mpc.utils.plotting.ml_model_test +
    + agentlib_mpc.utils.plotting.mpc +
    + agentlib_mpc.utils.sampling +
+ + +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/search.html b/docs/0.6.4/docs/search.html new file mode 100644 index 0000000..a129e30 --- /dev/null +++ b/docs/0.6.4/docs/search.html @@ -0,0 +1,122 @@ + + + + + + + + Search — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + + + +
+ +
+ +
+
+
+ +
+ +
+

© Copyright 2021, AGENT-Project Associates.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/searchindex.js b/docs/0.6.4/docs/searchindex.js new file mode 100644 index 0000000..1f9ff60 --- /dev/null +++ b/docs/0.6.4/docs/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"docnames": ["PackageReference", "agentlib_mpc", "agentlib_mpc.data_structures", "agentlib_mpc.models", "agentlib_mpc.modules", "agentlib_mpc.modules.dmpc", "agentlib_mpc.modules.dmpc.admm", "agentlib_mpc.optimization_backends", "agentlib_mpc.optimization_backends.casadi_", "agentlib_mpc.optimization_backends.casadi_.core", "agentlib_mpc.utils", "agentlib_mpc.utils.plotting", "code/agentlib_mpc", "code/agentlib_mpc.data_structures", "code/agentlib_mpc.models", "code/agentlib_mpc.modules", "code/agentlib_mpc.modules.InputPrediction", "code/agentlib_mpc.modules.dmpc", "code/agentlib_mpc.modules.dmpc.admm", "code/agentlib_mpc.modules.estimation", "code/agentlib_mpc.modules.ml_model_training", "code/agentlib_mpc.optimization_backends", "code/agentlib_mpc.optimization_backends.casadi_", "code/agentlib_mpc.optimization_backends.casadi_.core", "code/agentlib_mpc.utils", "code/agentlib_mpc.utils.plotting", "code/modules", "index", "installation", "modules", "tutorials/ADMM", "tutorials/MPC", "tutorials/Trajectories", "tutorials/tutorial"], "filenames": ["PackageReference.md", "agentlib_mpc.rst", "agentlib_mpc.data_structures.rst", "agentlib_mpc.models.rst", "agentlib_mpc.modules.rst", "agentlib_mpc.modules.dmpc.rst", "agentlib_mpc.modules.dmpc.admm.rst", "agentlib_mpc.optimization_backends.rst", "agentlib_mpc.optimization_backends.casadi_.rst", "agentlib_mpc.optimization_backends.casadi_.core.rst", "agentlib_mpc.utils.rst", "agentlib_mpc.utils.plotting.rst", "code/agentlib_mpc.rst", "code/agentlib_mpc.data_structures.rst", "code/agentlib_mpc.models.rst", "code/agentlib_mpc.modules.rst", "code/agentlib_mpc.modules.InputPrediction.rst", "code/agentlib_mpc.modules.dmpc.rst", "code/agentlib_mpc.modules.dmpc.admm.rst", "code/agentlib_mpc.modules.estimation.rst", "code/agentlib_mpc.modules.ml_model_training.rst", "code/agentlib_mpc.optimization_backends.rst", "code/agentlib_mpc.optimization_backends.casadi_.rst", "code/agentlib_mpc.optimization_backends.casadi_.core.rst", "code/agentlib_mpc.utils.rst", "code/agentlib_mpc.utils.plotting.rst", "code/modules.rst", "index.rst", "installation.md", "modules.rst", "tutorials/ADMM.md", "tutorials/MPC.md", "tutorials/Trajectories.md", "tutorials/tutorial.md"], "titles": ["Package Reference", "agentlib_mpc package", "agentlib_mpc.data_structures package", "agentlib_mpc.models package", "agentlib_mpc.modules package", "agentlib_mpc.modules.dmpc package", "agentlib_mpc.modules.dmpc.admm package", "agentlib_mpc.optimization_backends package", "agentlib_mpc.optimization_backends.casadi_ package", "agentlib_mpc.optimization_backends.casadi_.core package", "agentlib_mpc.utils package", "agentlib_mpc.utils.plotting package", "agentlib_mpc package", "agentlib_mpc.data_structures package", "agentlib_mpc.models package", "agentlib_mpc.modules package", "agentlib_mpc.modules.InputPrediction package", "agentlib_mpc.modules.dmpc package", "agentlib_mpc.modules.dmpc.admm package", "agentlib_mpc.modules.estimation package", "agentlib_mpc.modules.ml_model_training package", "agentlib_mpc.optimization_backends package", "agentlib_mpc.optimization_backends.casadi_ package", "agentlib_mpc.optimization_backends.casadi_.core package", "agentlib_mpc.utils package", "agentlib_mpc.utils.plotting package", "agentlib_mpc", "Welcome to agentlib_mpc\u2019s documentation!", "Installation", "agentlib_mpc", "Alternating Direction Method of Multipliers", "Model Predictive Control", "Working with time series", "Tutorial"], "terms": {"thi": [0, 2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 27, 28, 30, 31, 33], "section": [0, 30, 31, 33], "contain": [0, 1, 2, 3, 4, 6, 9, 10, 12, 13, 14, 15, 17, 18, 20, 23, 24, 25, 31], "auto": [0, 10, 24], "gener": [0, 2, 13, 14, 20], "document": [0, 14, 30], "all": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "modul": [0, 12, 26, 27, 29, 30, 31], "function": [0, 1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, 15, 18, 19, 20, 22, 23, 24, 25, 27, 30, 31], "agentlib_mpc": [0, 28], "data_structur": [0, 1, 4, 6, 7, 9, 12, 14, 15, 18, 19, 20, 21, 23, 26, 27, 29], "submodul": [0, 1, 12, 26, 29], "admm_datatyp": [0, 1, 12, 26, 29], "casadi_util": [0, 1, 9, 12, 23, 26, 29], "coordinator_datatyp": [0, 1, 12, 26, 29], "mpc_datamodel": [0, 1, 4, 6, 7, 9, 12, 15, 18, 19, 21, 22, 23, 26, 29], "content": [0, 29], "model": [0, 1, 2, 4, 5, 6, 7, 8, 9, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 29, 33], "ann_model": [0, 1, 29], "casadi_model": [0, 1, 9, 12, 23, 26, 29, 31], "casadi_model_ann": [0, 1, 29], "casadi_neural_network": [0, 1, 29], "serialized_ann": [0, 1, 29], "mpc": [0, 1, 2, 5, 6, 7, 9, 10, 12, 13, 14, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 30, 33], "optimization_backend": [0, 1, 4, 6, 12, 15, 17, 18, 19, 26, 27, 29, 30, 31], "subpackag": [0, 26, 29], "backend": [0, 1, 4, 6, 12, 14, 15, 18, 19, 26, 29, 30, 31], "util": [0, 1, 12, 14, 26, 27, 29, 30, 31], "analysi": [0, 1, 12, 26, 29], "debug": [0, 1, 9, 14, 15, 17, 18, 23, 29], "admmparamet": [1, 2, 12, 13], "penalty_factor": [1, 2, 5, 6, 7, 8, 12, 13, 17, 18, 21, 22, 30], "prediction_horizon": [1, 2, 4, 5, 6, 7, 12, 13, 15, 17, 18, 21, 30, 31], "time_step": [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 21, 22, 23, 24, 25, 30, 31], "admmparticip": [1, 2, 5, 6, 12, 13, 17, 18], "particip": [1, 2, 6, 12, 13, 18], "readi": [1, 2, 5, 6, 12, 13, 17, 18], "sourc": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 31, 33], "agentdictentri": [1, 2, 12, 13], "coup_var": [1, 2, 12, 13], "exchange_var": [1, 2, 12, 13], "agenttocoordin": [1, 2, 12, 13], "local_exchange_trajectori": [1, 2, 12, 13], "local_trajectori": [1, 2, 12, 13], "consensusvari": [1, 2, 12, 13], "flat_multipli": [1, 2, 12, 13], "multipli": [1, 2, 6, 7, 8, 12, 13, 14, 18, 20, 21, 22, 27, 33], "shift_values_by_on": [1, 2, 12, 13], "update_mean_trajectori": [1, 2, 12, 13], "update_multipli": [1, 2, 12, 13], "coordinatortoag": [1, 2, 12, 13], "exchange_multipli": [1, 2, 7, 8, 12, 13, 21, 22], "mean_diff_trajectori": [1, 2, 12, 13], "mean_trajectori": [1, 2, 12, 13], "penalty_paramet": [1, 2, 12, 13], "target": [1, 2, 12, 13, 14, 20, 22, 24], "couplingentri": [1, 2, 6, 12, 13, 18], "admm_vari": [1, 2, 12, 13], "lag": [1, 2, 7, 12, 13, 14, 15, 20, 21, 22], "local": [1, 2, 4, 5, 6, 12, 13, 15, 17, 18, 28, 30, 31], "mean": [1, 2, 6, 7, 12, 13, 14, 18, 21, 30, 31], "name": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 30, 31], "couplingvari": [1, 2, 12, 13], "delta_mean": [1, 2, 12, 13], "flat_loc": [1, 2, 12, 13], "get_residu": [1, 2, 12, 13], "primal_residu": [1, 2, 11, 12, 13, 25], "exchangeentri": [1, 2, 6, 12, 13, 18], "mean_diff": [1, 2, 12, 13], "exchangevari": [1, 2, 12, 13], "diff_trajectori": [1, 2, 12, 13], "update_diff_trajectori": [1, 2, 12, 13], "structuredvalu": [1, 2, 12, 13], "from_json": [1, 2, 12, 13], "to_json": [1, 2, 12, 13], "variablerefer": [1, 2, 4, 6, 7, 8, 9, 12, 13, 15, 18, 21, 22, 23], "all_vari": [1, 2, 12, 13], "coupl": [1, 2, 5, 6, 7, 8, 12, 13, 17, 18, 21, 22, 25, 30], "exchang": [1, 2, 5, 6, 12, 13, 17, 18], "from_config": [1, 2, 12, 13], "coupling_alia": [1, 2, 6, 12, 13, 18], "exchange_alia": [1, 2, 12, 13], "casadidiscretizationopt": [1, 2, 8, 9, 12, 13, 22, 23], "collocation_method": [1, 2, 12, 13], "collocation_ord": [1, 2, 12, 13], "integr": [1, 2, 3, 12, 13, 14], "method": [1, 2, 3, 4, 5, 6, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 27, 31, 33], "collocationmethod": [1, 2, 12, 13], "legendr": [1, 2, 12, 13], "radau": [1, 2, 12, 13], "constraint": [1, 2, 3, 4, 5, 6, 8, 9, 12, 13, 14, 15, 17, 18, 19, 22, 23, 30], "lb": [1, 2, 3, 5, 9, 12, 13, 14, 16, 17, 18, 20, 23, 30, 31], "ub": [1, 2, 3, 5, 9, 12, 13, 14, 16, 17, 18, 20, 23, 30, 31], "discretizationmethod": [1, 2, 8, 9, 12, 13, 22, 23], "colloc": [1, 2, 8, 12, 13, 22], "multiple_shoot": [1, 2, 8, 12, 13, 22], "cvode": [1, 2, 12, 13], "euler": [1, 2, 12, 13], "rk": [1, 2, 12, 13], "modelconstraint": [1, 2, 3, 12, 13, 14], "optparmxcontain": [1, 2, 12, 13, 23], "grid": [1, 2, 7, 8, 9, 12, 13, 21, 22, 23, 24, 25], "var": [1, 2, 3, 4, 6, 9, 12, 13, 14, 15, 18, 19, 23], "optvarmxcontain": [1, 2, 12, 13, 23], "guess": [1, 2, 6, 9, 12, 13, 18, 23], "opt": [1, 2, 7, 12, 13, 21], "solverfactori": [1, 2, 8, 9, 12, 13, 22, 23], "bat_fil": [1, 2, 12, 13], "create_solv": [1, 2, 12, 13], "do_jit": [1, 2, 8, 9, 12, 13, 22, 23], "logger": [1, 2, 7, 12, 13, 15, 17, 18, 21], "make_casadi_nlp": [1, 2, 12, 13], "option": [1, 2, 7, 8, 9, 12, 13, 14, 15, 17, 18, 21, 22, 23, 30, 31], "solveropt": [1, 2, 9, 12, 13, 23], "solver": [1, 2, 3, 4, 8, 9, 12, 13, 14, 15, 19, 22, 23, 30], "bonmin": [1, 2, 12, 13], "fatrop": [1, 2, 12, 13], "gurobi": [1, 2, 12, 13], "ipopt": [1, 2, 12, 13, 27, 30], "osqp": [1, 2, 12, 13], "proxqp": [1, 2, 12, 13], "qpoas": [1, 2, 12, 13, 30], "sqpmethod": [1, 2, 12, 13, 30], "compile_solv": [1, 2, 12, 13], "temporary_directori": [1, 2, 12, 13], "optimization_data": [1, 2, 12, 13], "statu": [1, 2, 5, 6, 12, 13, 17, 18], "agentstatu": [1, 2, 12, 13], "busi": [1, 2, 5, 12, 13, 17], "pend": [1, 2, 12, 13], "standbi": [1, 2, 12, 13], "coordinatorstatu": [1, 2, 12, 13], "init_iter": [1, 2, 6, 12, 13, 18], "optim": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "sleep": [1, 2, 5, 6, 12, 13, 17, 18], "updat": [1, 2, 5, 6, 7, 9, 10, 12, 13, 14, 17, 18, 20, 21, 23, 24, 33], "optimizationdata": [1, 2, 12, 13], "from_dict": [1, 2, 12, 13], "to_dict": [1, 2, 12, 13, 14], "u": [1, 2, 6, 9, 12, 13, 18, 19, 23, 31], "x": [1, 2, 3, 6, 9, 12, 13, 14, 18, 20, 23], "registrationmessag": [1, 2, 12, 13], "agent_id": [1, 2, 4, 5, 12, 13, 15, 16, 17, 18, 20, 31], "basevariablerefer": [1, 2, 12, 13], "discretizationopt": [1, 2, 7, 12, 13, 21], "fullvariablerefer": [1, 2, 8, 12, 13, 22], "r_del_u": [1, 2, 7, 8, 12, 13, 15, 17, 18, 21, 22], "initstatu": [1, 2, 12, 13], "during_upd": [1, 2, 12, 13], "pre_module_init": [1, 2, 12, 13], "mhevariablerefer": [1, 2, 12, 13, 19, 22], "estimated_input": [1, 2, 12, 13, 15, 19, 21, 22], "estimated_paramet": [1, 2, 12, 13, 15, 19, 21, 22], "known_input": [1, 2, 12, 13, 15, 19, 21, 22], "known_paramet": [1, 2, 12, 13, 15, 19, 21, 22], "measured_st": [1, 2, 12, 13, 21, 22], "output": [1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 30, 31], "state": [1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 30, 31], "weights_stat": [1, 2, 12, 13], "minlpvariablerefer": [1, 2, 8, 12, 13, 22], "binary_control": [1, 2, 7, 8, 12, 13, 15, 21, 22], "mpcvariabl": [1, 2, 4, 6, 9, 12, 13, 15, 18, 19, 23], "interpolation_method": [1, 2, 12, 13, 15], "result": [1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 30, 31], "df": [1, 2, 8, 9, 12, 13, 22, 23, 25], "control": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 27, 30, 33], "input": [1, 2, 3, 4, 6, 7, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 30, 31], "paramet": [1, 2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "cia_relaxed_results_path": [1, 2, 12, 13], "r_del_u_convent": [1, 2, 12, 13], "stats_path": [1, 2, 12, 13], "casadiinput": [1, 3, 12, 14, 31], "alg": [1, 3, 12, 14, 31], "casadimodel": [1, 3, 8, 9, 12, 14, 22, 23, 31], "auxiliari": [1, 3, 9, 12, 14, 23], "differenti": [1, 3, 4, 12, 14, 15, 18, 19, 31], "do_step": [1, 3, 4, 12, 14, 15], "get": [1, 2, 3, 4, 6, 10, 12, 13, 14, 15, 18, 19, 24, 31, 33], "get_constraint": [1, 3, 12, 14], "get_differential_valu": [1, 3, 12, 14], "get_input_valu": [1, 3, 12, 14], "initi": [1, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 31], "output_equ": [1, 3, 12, 14], "set_differential_valu": [1, 3, 12, 14], "set_output_valu": [1, 3, 12, 14], "setup_system": [1, 3, 12, 14, 31], "casadimodelconfig": [1, 3, 12, 14, 31], "cost_funct": [1, 3, 7, 8, 9, 12, 14, 21, 22, 23], "system": [1, 3, 4, 6, 7, 8, 10, 12, 14, 15, 18, 21, 22, 24, 27, 32, 33], "model_post_init": [1, 3, 4, 5, 6, 12, 14, 15, 16, 17, 18, 19, 20], "casadioutput": [1, 3, 12, 14, 31], "json": [1, 2, 3, 12, 13, 14, 20, 30], "casadiparamet": [1, 3, 12, 14, 31], "casadist": [1, 3, 12, 14, 31], "od": [1, 3, 7, 8, 9, 12, 14, 21, 22, 23, 31], "casadivari": [1, 3, 9, 12, 14, 23, 31], "create_sym": [1, 3, 12, 14], "sym": [1, 3, 12, 14], "get_symbol": [1, 3, 12, 14], "casadi_": [1, 7, 12, 21], "admm": [1, 2, 5, 7, 10, 11, 12, 13, 15, 17, 21, 24, 25, 27, 33], "basic": [1, 7, 10, 12, 21, 24], "casadi_admm_nn": [1, 7], "casadi_nn": [1, 7], "full": [1, 4, 7, 12, 15, 18, 21, 27, 30], "minlp": [1, 7, 12, 21], "admmbackend": [1, 7, 8, 12, 21, 22], "coupling_grid": [1, 7, 8, 12, 21, 22], "backendconfig": [1, 7, 9, 12, 21, 23], "discretization_opt": [1, 7, 8, 9, 12, 21, 22, 23, 31], "overwrite_result_fil": [1, 7, 12, 21, 22, 23], "results_fil": [1, 4, 7, 10, 12, 15, 19, 21, 22, 23, 24, 30], "save_result": [1, 7, 12, 21, 22, 23], "check_csv": [1, 7, 12, 21, 23], "check_overwrit": [1, 7, 12, 21, 23], "disable_results_if_no_fil": [1, 7, 12, 21, 23], "optimizationbackend": [1, 7, 9, 12, 21, 23], "config_typ": [1, 7, 8, 9, 12, 14, 15, 19, 21, 22, 23, 31], "get_lags_per_vari": [1, 7, 12, 21, 22], "model_from_config": [1, 7, 12, 21], "mpc_backend_paramet": [1, 7, 12, 21], "register_logg": [1, 7, 12, 21], "results_file_exist": [1, 7, 12, 21], "setup_optim": [1, 7, 8, 9, 12, 21, 22, 23], "solv": [1, 4, 5, 6, 7, 8, 9, 12, 15, 17, 18, 21, 22, 23], "update_discretization_opt": [1, 7, 12, 21], "update_model_vari": [1, 7, 12, 21], "backendimport": [1, 7, 12, 21, 26], "class_nam": [1, 4, 7, 12, 15, 17, 18, 21, 30, 31], "import_path": [1, 7, 12, 21], "plot": [1, 10, 12, 20, 24, 31], "admm_anim": [1, 10, 12, 24], "admm_residu": [1, 10, 12, 24], "admm_at_time_step": [1, 10, 12, 24], "convert_index": [1, 10, 12, 24], "convert_multi_index": [1, 10, 12, 24], "first_vals_at_trajectory_index": [1, 10, 12, 24], "get_number_of_iter": [1, 10, 12, 24], "get_time_step": [1, 10, 12, 24], "last_vals_at_trajectory_index": [1, 10, 12, 24], "load_admm": [1, 10, 12, 24], "load_mpc": [1, 10, 12, 24], "load_mpc_stat": [1, 10, 12, 24], "load_sim": [1, 10, 12, 24], "mpc_at_time_step": [1, 10, 12, 24], "perform_index_upd": [1, 10, 12, 24], "plugin": [1, 7, 12, 15, 17, 18, 21, 27], "agentlib": [1, 2, 4, 5, 6, 12, 13, 14, 15, 16, 17, 18, 20, 30, 33], "which": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "distribut": [1, 4, 5, 6, 12, 15, 17, 18, 27, 30], "data": [1, 2, 4, 6, 7, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 24, 25], "driven": [1, 12], "class": [2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 31], "float": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25], "int": [2, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25], "base": [2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 27, 30, 31], "object": [2, 4, 6, 8, 9, 10, 11, 13, 14, 15, 17, 18, 22, 23, 24, 25, 31], "collect": [2, 6, 13, 14, 18, 33], "have": [2, 4, 6, 9, 13, 14, 15, 18, 19, 22, 23, 30, 31], "share": [2, 4, 5, 6, 13, 15, 16, 17, 18, 20, 30, 31], "across": [2, 13, 31], "agent": [2, 4, 5, 6, 13, 15, 16, 17, 18, 19, 20, 25, 30, 32], "bool": [2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "fals": [2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 31], "helper": [2, 4, 13, 15, 24], "organ": [2, 13], "str": [2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "type": [2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 20, 22, 23, 24, 30, 31], "list": [2, 3, 4, 5, 6, 7, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "factori": [2, 13], "hold": [2, 3, 4, 6, 7, 9, 13, 14, 15, 18, 21, 23], "variabl": [2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30], "consensu": [2, 6, 13, 18, 30], "singl": [2, 10, 13, 14, 24, 27, 30], "us": [2, 3, 4, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 30, 31], "coordin": [2, 4, 6, 12, 13, 15, 18, 30], "dict": [2, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "numpi": [2, 8, 13, 14, 20, 22, 25], "ndarrai": [2, 3, 6, 8, 13, 14, 18, 20, 22, 24, 25], "core": [2, 5, 6, 7, 8, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 25], "datamodel": [2, 5, 6, 13, 14, 15, 16, 17, 18, 20], "iter": [2, 5, 6, 10, 11, 13, 14, 17, 18, 24, 25], "none": [2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "horizon": [2, 4, 6, 9, 13, 15, 18, 19, 22, 23, 24], "shift": [2, 5, 13, 17, 20], "trajectori": [2, 5, 6, 7, 8, 9, 10, 13, 17, 18, 19, 21, 22, 23, 24, 25], "calcul": [2, 13, 14], "new": [2, 4, 5, 6, 7, 13, 14, 15, 17, 18, 21, 25, 30], "should": [2, 6, 7, 9, 10, 13, 14, 15, 18, 20, 21, 23, 24, 25, 30, 31, 33], "includ": [2, 4, 7, 9, 13, 14, 15, 18, 19, 21, 22, 23, 27, 30, 31], "If": [2, 3, 4, 6, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 22, 23, 24, 25, 28, 31], "i": [2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 30, 31, 33], "given": [2, 4, 5, 6, 7, 9, 13, 14, 15, 17, 18, 20, 21, 23, 31], "rho": [2, 6, 13, 18], "perform": [2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 30, 31], "penalti": [2, 6, 13, 18], "By": [2, 13, 31], "default": [2, 4, 9, 10, 13, 14, 15, 17, 18, 19, 20, 23, 24, 25, 30, 31], "ar": [2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 27, 30, 31, 33], "return": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 31], "convent": [2, 13], "differ": [2, 9, 10, 12, 13, 14, 19, 20, 23, 24, 30, 31], "optimizatin": [2, 13], "associ": [2, 3, 9, 13, 14, 23, 31], "properti": [2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23], "inform": [2, 4, 5, 7, 13, 14, 15, 17, 21, 22, 30, 33], "about": [2, 13, 14, 30], "phy": [2, 13], "flatten": [2, 12, 13, 14], "arrai": [2, 13, 14, 25], "flat": [2, 4, 6, 13, 15, 18, 19], "tupl": [2, 4, 6, 9, 11, 13, 14, 15, 18, 19, 20, 22, 23, 25, 31], "primal": [2, 6, 11, 13, 18, 25], "dual": [2, 6, 11, 13, 18, 25], "residu": [2, 6, 11, 13, 18, 25], "last": [2, 10, 13, 22, 24, 30, 31], "param": [2, 3, 4, 5, 6, 10, 13, 14, 15, 17, 18, 19, 24], "regist": [2, 4, 6, 7, 13, 15, 18, 19, 21], "specifi": [2, 3, 7, 9, 10, 11, 13, 14, 20, 21, 22, 23, 24, 25, 30, 31], "structur": [2, 12, 13, 14, 20, 30], "an": [2, 3, 4, 6, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 22, 23, 24, 25, 27, 28, 30, 33], "agentvari": [2, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23], "valu": [2, 3, 5, 6, 7, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "It": [2, 4, 13, 14, 15, 31], "effici": [2, 13], "sent": [2, 6, 13, 15, 18, 20, 30], "deseri": [2, 12, 13, 14], "classmethod": [2, 9, 13, 14, 19, 23], "serial": [2, 3, 12, 13, 14, 20, 22], "self": [2, 6, 9, 13, 14, 18, 23, 31], "byte": [2, 13], "can": [2, 3, 4, 7, 9, 13, 14, 15, 18, 20, 21, 22, 23, 25, 27, 30, 31], "commun": [2, 13, 15, 17, 18, 31, 33], "info": [2, 4, 13, 15, 17, 18, 19, 30], "role": [2, 7, 13, 21], "problem": [2, 3, 4, 5, 7, 8, 9, 13, 14, 15, 17, 19, 21, 22, 23, 30, 31], "var_ref": [2, 4, 5, 6, 7, 8, 9, 12, 13, 15, 17, 18, 19, 21, 22, 23], "config": [2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 31, 33], "basemoduleconfigclass": [2, 13], "creat": [2, 3, 4, 6, 7, 8, 9, 11, 13, 14, 15, 18, 19, 20, 21, 22, 23, 25, 30, 33], "instanc": [2, 3, 10, 13, 14, 24], "from": [2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "pydant": [2, 3, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23], "kei": [2, 4, 6, 7, 9, 13, 15, 17, 18, 21, 22, 23, 24, 25, 31], "correspond": [2, 4, 7, 9, 13, 15, 21, 23], "etc": [2, 4, 6, 9, 10, 13, 15, 18, 19, 23, 24], "alia": [2, 5, 6, 7, 8, 9, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 30, 31], "send": [2, 4, 6, 13, 15, 18, 20, 30, 31], "receiv": [2, 6, 13, 15, 17, 18, 20, 30, 31], "store": [2, 3, 13, 14, 30], "sort": [2, 4, 6, 9, 13, 15, 18, 23], "dataclass": [2, 13], "enum": [2, 6, 13, 14, 18], "help": [2, 13, 28, 30, 31], "casadibackend": [2, 8, 9, 13, 22, 23], "extra": [2, 3, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23], "forbid": [2, 3, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23], "field": [2, 3, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23], "3": [2, 6, 7, 9, 13, 14, 18, 21, 23, 31], "ge": [2, 4, 5, 6, 13, 15, 17, 18, 19], "1": [2, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 30, 31], "le": [2, 13], "9": [2, 13, 16], "qualnam": [2, 6, 13, 14, 18], "start": [2, 3, 4, 5, 6, 10, 13, 14, 15, 17, 18, 22, 24, 25, 27, 31, 33], "boundari": [2, 4, 6, 9, 13, 14, 15, 18, 19, 23, 30, 31], "casadi": [2, 3, 8, 9, 13, 14, 22, 23, 27, 32, 33], "mx": [2, 3, 8, 9, 13, 14, 22, 23], "namedtupl": [2, 13], "number": [2, 5, 6, 10, 11, 13, 14, 17, 18, 20, 24, 25, 27], "sx": [2, 3, 9, 13, 14, 23], "sparsiti": [2, 3, 9, 13, 14, 23], "dm": [2, 3, 9, 13, 14, 23], "0": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31], "2": [2, 3, 6, 7, 8, 9, 13, 14, 16, 18, 21, 22, 23, 31], "necessari": [2, 7, 9, 13, 14, 21, 23], "dure": [2, 9, 13, 14, 15, 23], "discret": [2, 4, 6, 7, 8, 13, 15, 18, 21, 22], "optimizationparamet": [2, 8, 9, 13, 22, 23], "optimizationvari": [2, 8, 9, 13, 22, 23], "pathlib": [2, 7, 9, 13, 14, 15, 20, 21, 23], "path": [2, 4, 7, 9, 10, 11, 13, 14, 15, 19, 20, 21, 23, 24, 25, 30], "log": [2, 13, 14, 15, 17, 18, 30, 31], "nlp": [2, 8, 9, 13, 22, 23, 30], "construct": [2, 13], "equal": [2, 6, 9, 13, 14, 18, 22, 23, 30, 31], "problem_typ": [2, 13], "liter": [2, 10, 13, 20, 24, 25], "qp": [2, 13], "basemodel": [2, 7, 13, 14, 21], "code": [2, 9, 13, 20, 23, 24, 28], "compil": [2, 9, 13, 23], "current": [2, 3, 4, 7, 9, 13, 14, 15, 16, 20, 21, 22, 23, 24, 27, 30, 31, 33], "onli": [2, 4, 6, 7, 10, 11, 13, 14, 15, 17, 18, 20, 21, 24, 25, 30, 31], "work": [2, 6, 7, 9, 13, 14, 18, 21, 23, 27, 31, 33], "window": [2, 9, 13, 20, 23], "requir": [2, 4, 5, 7, 9, 13, 14, 15, 17, 18, 19, 20, 21, 23, 30, 31], "batch": [2, 9, 13, 14, 23], "file": [2, 4, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 30, 31, 33], "know": [2, 9, 13, 23, 30], "how": [2, 10, 13, 14, 24, 30, 31, 33], "setup": [2, 7, 9, 13, 21, 23, 31], "visual": [2, 13], "studio": [2, 13], "command": [2, 13], "line": [2, 11, 13, 25], "The": [2, 3, 4, 7, 9, 10, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31, 33], "dll": [2, 13], "rais": [2, 3, 13, 14, 20, 22, 24, 30], "typeerror": [2, 13, 22, 24], "filenotfounderror": [2, 13], "runtimeerror": [2, 13, 30], "dmpc": [2, 12, 13, 15], "dtype": [2, 13], "float64": [2, 13], "within": [2, 9, 13, 15, 17, 18, 20, 23, 30, 31], "keep": [2, 13, 30], "track": [2, 13], "status": [2, 13], "its": [2, 3, 6, 13, 14, 18, 30, 31], "specif": [2, 5, 13, 14, 17, 20, 31], "time": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 30, 31, 33], "seri": [2, 4, 6, 10, 13, 15, 18, 19, 20, 22, 24, 25, 27, 31, 33], "registr": [2, 5, 6, 13, 17, 18], "between": [2, 5, 6, 9, 13, 17, 18, 23, 30, 31], "defin": [2, 3, 4, 5, 6, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 30, 31], "extend": [2, 13, 14], "implement": [2, 3, 4, 5, 6, 7, 9, 13, 14, 15, 17, 18, 19, 20, 21, 23, 30, 31], "allow": [2, 13, 14, 15, 19, 30, 31], "5": [2, 4, 6, 10, 13, 15, 18, 19, 20, 24, 31], "predict": [2, 4, 6, 9, 12, 13, 14, 15, 16, 18, 20, 23, 25, 27, 33], "60": [2, 4, 13, 15, 18, 19, 30, 31], "step": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 31], "ready": [2, 13], "mhe": [2, 12, 13, 15, 21], "timestamp": [2, 3, 5, 13, 14, 16, 17, 18, 20, 22, 24], "unit": [2, 3, 5, 10, 13, 14, 16, 17, 18, 20, 24, 25, 31], "Not": [2, 3, 5, 13, 14, 17, 18, 20], "descript": [2, 3, 5, 12, 13, 14, 16, 17, 18, 20, 31], "inf": [2, 3, 5, 8, 9, 13, 14, 16, 17, 18, 20, 22, 23], "clip": [2, 3, 5, 13, 14, 16, 17, 18, 20], "allowed_valu": [2, 3, 5, 13, 14, 16, 17, 18, 20], "ani": [2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 19, 20, 31, 33], "module_id": [2, 5, 12, 13, 15, 16, 17, 18, 20, 30, 31], "rdf_class": [2, 5, 13, 16, 17, 18, 20], "interpolationmethod": [2, 12, 13, 15, 20, 24], "linear": [2, 12, 13, 14, 15, 20, 22, 24, 27], "arg": [2, 13, 25], "kwarg": [2, 3, 13, 14], "protocol": [2, 13, 14], "datafram": [2, 4, 6, 7, 8, 9, 10, 11, 13, 15, 18, 19, 20, 21, 22, 23, 24, 25, 30], "turn": [2, 9, 13, 23, 31], "weight": [2, 12, 13, 14, 15, 18, 19, 31], "via": [2, 13, 28, 31, 33], "causal": [3, 10, 14, 24], "sim_tim": [3, 12, 14], "_sym": [3, 14], "variou": [3, 14], "attribut": [3, 4, 5, 6, 9, 14, 15, 16, 17, 18, 19, 20, 23, 31], "To": [3, 9, 14, 23, 25, 27, 30, 31], "your": [3, 4, 6, 14, 15, 18, 19, 31], "own": [3, 14], "inherit": [3, 14, 31], "overrid": [3, 4, 6, 9, 14, 15, 18, 19, 23], "without": [3, 4, 14, 15, 30, 31], "equat": [3, 14], "common": [3, 5, 14, 17, 30], "slack": [3, 9, 14, 23, 31], "appear": [3, 14, 20], "cost": [3, 9, 14, 23, 30, 31], "t_start": [3, 14], "t_sampl": [3, 12, 14, 15, 16, 30, 31], "one": [3, 6, 14, 18, 20, 25, 30, 31], "simul": [3, 4, 10, 14, 15, 24, 27, 30, 31], "increment": [3, 14], "item": [3, 14, 19], "henc": [3, 14, 31], "modelvari": [3, 14], "match": [3, 4, 10, 14, 15, 19, 22, 24, 30, 31], "attributeerror": [3, 14], "wa": [3, 10, 14, 24, 30, 31], "found": [3, 14, 30], "form": [3, 6, 14, 18, 22], "lower": [3, 8, 9, 10, 14, 22, 23, 24, 30, 31], "upper": [3, 9, 14, 23, 30, 31], "ignor": [3, 14, 31], "take": [3, 4, 5, 11, 14, 15, 17, 22, 24, 25, 30, 31], "end": [3, 14], "interv": [3, 4, 5, 6, 11, 14, 15, 17, 18, 20, 25, 30], "over": [3, 4, 7, 9, 11, 14, 15, 16, 18, 19, 21, 23, 25], "algebra": [3, 7, 8, 9, 13, 14, 21, 22, 23, 31], "rh": [3, 14], "z": [3, 6, 14, 18], "g": [3, 4, 6, 7, 9, 10, 14, 15, 16, 18, 19, 21, 23, 24, 30, 31], "p": [3, 9, 14, 23], "set": [3, 4, 6, 7, 14, 15, 18, 20, 21, 30, 31], "provid": [3, 4, 6, 7, 9, 10, 14, 15, 18, 19, 21, 22, 23, 24, 30, 31], "must": [3, 4, 5, 6, 14, 15, 17, 18, 19, 20, 30, 31], "order": [3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23], "save": [3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 30, 31], "check": [3, 4, 6, 7, 9, 14, 15, 18, 19, 20, 21, 23], "abstract": [3, 4, 5, 6, 7, 9, 14, 15, 17, 18, 19, 20, 21, 23, 27], "modelconfig": [3, 14], "validate_assign": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20], "true": [3, 4, 5, 6, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 30, 31], "arbitrary_types_allow": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20], "valid": [3, 4, 5, 6, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 30], "include_default_model_vari": [3, 14], "context": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20, 31], "we": [3, 4, 5, 6, 10, 13, 14, 15, 16, 17, 18, 19, 20, 24, 27, 30, 31], "need": [3, 4, 5, 6, 9, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 30, 31], "both": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20, 30], "privat": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20], "call": [3, 4, 5, 6, 9, 14, 15, 16, 17, 18, 19, 20, 23, 31], "user": [3, 4, 5, 6, 14, 15, 16, 17, 18, 19, 20, 31], "_alg": [3, 14], "format": [3, 11, 14, 20, 25, 30], "string": [3, 9, 14, 20, 23], "_ode": [3, 14], "indent": [3, 14], "standard": [3, 7, 9, 14, 16, 21, 23, 27, 30, 31], "arithmet": [3, 14], "oper": [3, 14, 30], "so": [3, 7, 9, 13, 14, 21, 22, 23, 25, 30, 31], "symbol": [3, 8, 9, 14, 22, 23], "": [3, 7, 9, 14, 15, 16, 19, 21, 23, 24, 30, 31], "ensur": [3, 6, 14, 15, 18], "each": [3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 17, 18, 20, 21, 22, 23, 24, 25, 30], "dimens": [3, 9, 14, 20, 23], "consist": [3, 9, 14, 23, 30, 31], "basempc": [4, 12, 15], "basemodul": [4, 5, 15, 17, 19, 20], "A": [4, 7, 9, 10, 15, 19, 20, 21, 22, 23, 24, 25, 27, 31], "more": [4, 15, 30], "follow": [4, 14, 15, 24, 30], "assert_mpc_variables_are_in_model": [4, 5, 6, 12, 15, 17, 18], "whether": [4, 6, 7, 9, 10, 14, 15, 18, 20, 21, 23, 24, 25], "assert_subset": [4, 12, 15], "mpc_name": [4, 15], "model_nam": [4, 15], "message_head": [4, 15], "assert": [4, 6, 15, 18], "ref_kei": [4, 15], "subset": [4, 15], "usual": [4, 9, 15, 22, 23, 24, 30, 31], "obtain": [4, 15, 22, 24, 30], "print": [4, 15], "out": [4, 15], "error": [4, 9, 14, 15, 17, 18, 20, 23, 25], "portion": [4, 15, 22, 24], "cleanup_result": [4, 5, 6, 12, 15, 17, 18, 19], "delet": [4, 6, 7, 15, 18, 19, 20, 21], "e": [4, 6, 7, 9, 10, 14, 15, 18, 19, 20, 21, 22, 23, 24, 28, 30, 31], "collect_variables_for_optim": [4, 5, 6, 12, 15, 17, 18, 19], "note": [4, 6, 14, 15, 18, 19, 31], "ref": [4, 6, 15, 18, 19], "put": [4, 6, 15, 18, 19, 31], "them": [4, 6, 14, 15, 18, 19, 30, 31], "dictionari": [4, 6, 14, 15, 18, 19, 20, 25, 31], "get_result": [4, 5, 6, 12, 15, 17, 18, 19, 30, 31], "read": [4, 6, 15, 18, 19, 30], "were": [4, 6, 15, 18, 19], "stat": [4, 6, 8, 9, 15, 18, 19, 22, 23, 25], "getter": [4, 15], "pre_computation_hook": [4, 5, 12, 15, 17], "everi": [4, 5, 9, 15, 16, 17, 23, 31], "comput": [4, 5, 6, 14, 15, 17, 18, 20, 31], "befor": [4, 5, 6, 9, 14, 15, 17, 18, 20, 23, 30, 31], "overwrit": [4, 5, 7, 14, 15, 17, 21, 31], "deriv": [4, 5, 15, 17], "subclass": [4, 5, 15, 17], "you": [4, 5, 14, 15, 17, 19, 27, 28, 31], "want": [4, 5, 10, 13, 15, 17, 24, 28, 31], "some": [4, 5, 11, 14, 15, 17, 19, 25, 30, 31], "action": [4, 5, 15, 17, 27], "process": [4, 5, 6, 12, 14, 15, 16, 17, 18, 19, 20, 27, 30], "sync": [4, 5, 6, 15, 17, 18, 19, 20, 30], "other": [4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 27, 30, 31], "whole": [4, 5, 6, 15, 17, 18, 19, 20], "ma": [4, 5, 6, 15, 17, 18, 19, 20, 30, 31], "re_init_optim": [4, 12, 15], "re": [4, 15], "static": [4, 14, 15, 19, 22], "read_results_fil": [4, 12, 15, 19], "csv": [4, 6, 11, 13, 15, 18, 19, 25, 30], "register_callback": [4, 5, 12, 15, 17, 19, 20], "init_optim": [4, 15], "callback": [4, 5, 6, 12, 13, 15, 17, 18, 19, 20], "cannot": [4, 14, 15, 30, 31], "chang": [4, 9, 14, 15, 18, 23, 30, 31], "recreat": [4, 15], "set_actu": [4, 12, 15], "solut": [4, 6, 7, 15, 18, 21, 30], "first": [4, 6, 10, 15, 18, 24, 28, 30, 31], "set_output": [4, 12, 15, 17, 18], "warn_for_missed_solv": [4, 12, 15], "warn": [4, 14, 15, 17, 18], "fail": [4, 15], "basempcconfig": [4, 12, 15], "basemoduleconfig": [4, 5, 14, 15, 17, 19, 20], "configur": [4, 5, 15, 17, 19, 20, 25], "parser": [4, 15, 19, 20], "frozen": [4, 5, 6, 15, 16, 17, 18, 19, 20], "sampling_tim": [4, 5, 6, 12, 15, 17, 18], "shared_variable_field": [4, 5, 6, 12, 15, 17, 18, 19, 20], "check_valid_field": [4, 5, 6, 15, 17, 18, 19, 20], "default_sampling_tim": [4, 5, 6, 12, 15, 17, 18], "disturb": [4, 15, 18, 19, 31], "set_point": [4, 15, 18], "dynam": [4, 9, 15, 18, 19, 23, 31], "thei": [4, 6, 7, 9, 14, 15, 18, 19, 21, 23, 30, 31], "constant": [4, 14, 15, 18, 19, 20, 31], "here": [4, 6, 15, 18, 19, 20, 30, 31], "sampl": [4, 6, 12, 15, 18, 20, 21, 22, 25, 26, 31], "same": [4, 6, 14, 15, 18, 30, 31], "doe": [4, 6, 9, 14, 15, 18, 23], "affect": [4, 6, 15, 18, 30, 31], "broker": [4, 15, 18], "entri": [4, 14, 15, 18], "measur": [4, 5, 6, 14, 15, 17, 18, 19], "create_optimization_backend": [4, 12, 15], "up": [4, 15, 20, 30, 31], "multi": [4, 9, 10, 15, 23, 24, 30, 32], "global": [4, 15], "moduleimport": [4, 12, 15, 26], "module_path": [4, 15], "import_class": [4, 12, 15], "admm_step": [5, 6, 17, 18], "all_coupling_status": [5, 6, 17, 18], "collect_couplings_for_optim": [5, 6, 17, 18], "cons_and_exchang": [5, 6, 17, 18], "deregister_all_particip": [5, 6, 17, 18], "get_participants_valu": [5, 6, 17, 18], "participant_callback": [5, 6, 17, 18], "penalty_factor_var": [5, 6, 17, 18], "receive_particip": [5, 6, 17, 18], "registered_particip": [5, 6, 17, 18], "reset_participants_readi": [5, 6, 17, 18], "send_coupling_valu": [5, 6, 17, 18], "send_coupling_vari": [5, 6, 17, 18], "update_lambda": [5, 6, 17, 18], "admmconfig": [5, 6, 17, 18], "iteration_timeout": [5, 6, 17, 18], "max_iter": [5, 6, 17, 18], "registration_period": [5, 6, 17, 18, 30], "check_prefixes_of_vari": [5, 6, 17, 18], "de_regist": [5, 6, 17, 18], "empty_memori": [5, 6, 17, 18], "localadmm": [5, 6, 17, 18], "registration_delai": [5, 6, 17, 18], "sync_delai": [5, 6, 17, 18], "localadmmconfig": [5, 6, 17, 18], "modulestatu": [5, 6, 17, 18], "at_registr": [5, 6, 17, 18], "not_start": [5, 6, 17, 18], "waiting_for_other_ag": [5, 6, 17, 18], "participantstatu": [5, 6, 17, 18], "avail": [5, 6, 14, 17, 18, 20, 22, 24, 27, 31], "confirm": [5, 6, 17, 18], "not_avail": [5, 6, 17, 18], "not_particip": [5, 6, 17, 18], "admm_coordin": [5, 15, 17], "coordinatedadmm": [5, 6, 17, 18], "get_new_measur": [5, 6, 15, 17, 18], "init_iteration_callback": [5, 6, 15, 17, 18], "registration_callback": [5, 6, 15, 17, 18], "coordinatedadmmconfig": [5, 6, 17, 18], "couplings_should_have_valu": [5, 6, 17, 18], "coupinput": [5, 6, 17, 18], "admmcoordin": [5, 6, 17, 18], "optim_results_callback": [5, 6, 15, 17, 18], "register_ag": [5, 6, 17, 18], "trigger_optim": [5, 6, 15, 17, 18], "admmcoordinatorconfig": [5, 6, 17, 18], "abs_tol": [5, 6, 17, 18], "admm_iter_max": [5, 6, 17, 18, 30], "dual_tol": [5, 6, 11, 17, 18, 25], "penalty_change_factor": [5, 6, 17, 18], "penalty_change_threshold": [5, 6, 17, 18], "primal_tol": [5, 6, 11, 17, 18, 25], "rel_tol": [5, 6, 17, 18], "save_iter_interv": [5, 6, 17, 18], "save_solve_stat": [5, 6, 17, 18], "solve_stats_fil": [5, 6, 17, 18], "use_relative_toler": [5, 6, 17, 18], "wait_time_on_start_it": [5, 6, 17, 18], "solve_stats_file_is_csv": [5, 6, 17, 18], "all_finish": [5, 15, 17], "els": [5, 11, 17, 25], "inititer": [5, 17], "trigger": [5, 6, 15, 17, 18, 20], "coordinatorconfig": [5, 6, 15, 17, 18], "maxit": [5, 15, 17, 18], "messages_in": [5, 15, 17, 18], "messages_out": [5, 6, 15, 17, 18], "time_out_non_respond": [5, 15, 17, 18], "10": [5, 6, 14, 16, 17, 18, 27], "maximum": [5, 6, 17, 18, 20], "registration_agent_to_coordin": [5, 17, 18], "startiteration_agent_to_coordin": [5, 17, 18], "optimization_agent_to_coordin": [5, 17, 18], "registration_coordinator_to_ag": [5, 17, 18], "startiteration_coordinator_to_ag": [5, 17, 18], "optimization_coordinator_to_ag": [5, 17, 18], "wait": [5, 6, 17, 18], "subsystem": [5, 17, 18], "second": [5, 6, 7, 10, 11, 14, 15, 17, 18, 20, 21, 22, 24, 25, 30, 31], "miniemploye": [5, 6, 15, 17, 18], "retriev": [5, 6, 17, 18, 31], "relev": [5, 6, 7, 9, 14, 17, 18, 20, 21, 22, 23, 31], "sensor": [5, 6, 17, 18], "startiter": [5, 17], "flag": [5, 6, 9, 17, 18, 20, 23], "repli": [5, 6, 17, 18], "shift_trajectori": [5, 15, 17], "algorithm": [5, 6, 7, 17, 18, 21, 27, 30], "miniemployeeconfig": [5, 6, 15, 17, 18], "registration_interv": [5, 15, 17, 18], "request_frequ": [5, 15, 17, 18], "after": [5, 6, 7, 9, 14, 17, 18, 20, 21, 23, 30, 31], "attempt": [5, 17, 18], "made": [5, 10, 17, 18, 24], "signup_request": [5, 17, 18], "distributedmpc": [5, 6, 12, 15, 17, 18], "interfac": [5, 17], "among": [5, 17], "approach": [5, 17, 20], "either": [5, 15, 17], "game": [5, 17], "theori": [5, 17], "distributedmpcconfig": [5, 6, 12, 15, 17, 18], "mpcconfig": [5, 12, 15, 17], "repres": [6, 18], "fulli": [6, 14, 18, 31], "decentr": [6, 18], "autonom": [6, 18], "entir": [6, 18], "give": [6, 10, 18, 24, 30, 31], "correct": [6, 11, 14, 15, 18, 25, 30], "queue": [6, 18], "depend": [6, 7, 9, 14, 18, 21, 23, 31], "two": [6, 14, 18, 30, 31], "layer": [6, 12, 14, 15, 18, 20], "exampl": [6, 7, 8, 9, 10, 18, 21, 22, 23, 24, 27, 30, 31, 32, 33], "coupling_var_1": [6, 18], "src_of_agent1": [6, 18], "status_1": [6, 18], "src_of_agent2": [6, 18], "status_2": [6, 18], "src_of_agent3": [6, 18], "status_3": [6, 18], "status_a": [6, 18], "status_b": [6, 18], "src_of_agent4": [6, 18], "status_c": [6, 18], "refer": [6, 7, 18, 21, 27, 30, 31, 33], "data_brok": [6, 7, 15, 16, 18, 21], "automat": [6, 11, 14, 18, 20, 25, 30], "union": [6, 9, 14, 15, 17, 18, 22, 23], "through": [6, 18, 30, 31], "lagrang": [6, 18], "lambda": [6, 18], "k": [6, 14, 16, 18, 20, 22, 23, 31], "x_i": [6, 18], "20": [6, 18], "termin": [6, 18], "factor": [6, 18, 30], "spent": [6, 18], "reserv": [6, 18], "prefix": [6, 18], "anoth": [6, 10, 18, 24, 31], "timeout": [6, 18, 30], "real": [6, 18, 24, 30], "veri": [6, 18], "small": [6, 18, 30], "001": [6, 18, 20], "4": [6, 18], "7": [6, 18, 20], "6": [6, 18], "togeth": [6, 18], "guid": [6, 14, 18], "answer": [6, 18], "coup_input": [6, 18], "vector": [6, 9, 14, 18, 23], "length": [6, 14, 16, 18, 22, 24], "absolut": [6, 12, 13, 14, 18], "stop": [6, 18, 24], "criterion": [6, 18], "vari": [6, 18], "when": [6, 7, 9, 10, 14, 15, 17, 18, 20, 21, 23, 24, 25, 27, 30, 31], "higher": [6, 18], "vice": [6, 14, 18], "versa": [6, 14, 18], "rel": [6, 14, 16, 18, 22, 24, 30], "1000": [6, 13, 18, 20, 31], "admm_stat": [6, 18], "600": [6, 18], "Will": [6, 14, 18, 25], "prim_tol": [6, 18], "wait_on_start_iter": [6, 18], "variablegroup": [7, 8, 21, 22], "casadi_backend": [7, 8, 21, 22], "admmcolloc": [7, 8, 21, 22], "admmmultipleshoot": [7, 8, 21, 22], "casadiadmmbackend": [7, 8, 21, 22], "discretization_typ": [7, 8, 9, 21, 22, 23], "save_result_df": [7, 8, 9, 21, 22, 23], "system_typ": [7, 8, 9, 21, 22, 23], "casadiadmmsystem": [7, 8, 21, 22], "exchange_diff": [7, 8, 21, 22], "global_coupl": [7, 8, 21, 22], "local_coupl": [7, 8, 21, 22], "local_exchang": [7, 8, 21, 22], "basesystem": [7, 8, 21, 22], "initial_st": [7, 8, 9, 21, 22, 23], "model_constraint": [7, 8, 9, 21, 22, 23], "model_paramet": [7, 8, 9, 21, 22, 23], "non_controlled_input": [7, 8, 9, 21, 22, 23], "casadibasebackend": [7, 8, 21, 22], "collocationmatric": [7, 8, 21, 22], "b": [7, 8, 21, 22], "c": [7, 8, 9, 21, 22, 23, 31], "d": [7, 8, 9, 21, 22, 23], "root": [7, 8, 15, 17, 18, 21, 22, 30], "directcolloc": [7, 8, 21, 22], "multipleshoot": [7, 8, 21, 22], "casadifullbackend": [7, 8, 21, 22], "fullsystem": [7, 8, 21, 22], "last_control": [7, 8, 21, 22], "casadiminlpbackend": [7, 8, 21, 22], "casadiminlpsystem": [7, 8, 21, 22], "stting": [7, 21], "exist": [7, 14, 20, 21, 30], "applic": [7, 9, 21, 23, 30], "abc": [7, 9, 14, 20, 21, 23], "underli": [7, 21], "also": [7, 9, 13, 14, 21, 22, 23, 24, 30, 31], "past": [7, 19, 21, 22], "alreadi": [7, 21, 31], "header": [7, 21], "make": [7, 9, 14, 15, 19, 20, 21, 23, 30, 31], "usabl": [7, 9, 21, 23], "now": [7, 8, 9, 14, 21, 22, 23, 27, 30, 31], "datetim": [7, 10, 15, 21, 24], "current_var": [7, 9, 21, 23], "progress": [7, 9, 21, 23, 25], "interpol": [7, 9, 12, 15, 20, 21, 22, 23, 24, 25, 26], "respect": [7, 9, 14, 21, 23, 30], "mani": [7, 9, 20, 21, 23, 25], "nan": [7, 8, 9, 21, 22, 23], "care": [7, 9, 21, 23, 30], "taken": [7, 9, 21, 23, 30, 31], "alwai": [7, 9, 20, 21, 23, 31], "dropna": [7, 9, 21, 23], "access": [7, 9, 21, 23, 31], "column": [7, 8, 9, 10, 11, 12, 13, 15, 20, 21, 22, 23, 24, 25], "mdot": [7, 9, 21, 23, 30, 31], "t_0": [7, 8, 9, 21, 22, 23, 30], "slack_t": [7, 9, 21, 23], "298": [7, 8, 9, 21, 22, 23, 30, 31], "230": [7, 9, 21, 23], "297": [7, 8, 9, 20, 21, 22, 23], "470": [7, 9, 21, 23], "296": [7, 9, 21, 23], "588": [7, 9, 21, 23], "295": [7, 8, 9, 21, 22, 23], "700": [7, 9, 21, 23], "05": [7, 9, 14, 21, 23, 30], "294": [7, 8, 9, 20, 21, 22, 23, 31], "930": [7, 9, 21, 23], "intern": [7, 14, 21, 30, 31], "write": [7, 15, 16, 21, 30, 31], "module_typ": [7, 21], "import": [7, 21, 30], "python": [7, 15, 17, 18, 21, 27, 30, 31], "load": [7, 10, 11, 12, 13, 14, 15, 20, 21, 24, 25, 31], "add_default_valu": [8, 9, 22, 23], "declar": [8, 9, 22, 23, 30], "full_with_default": [8, 9, 22, 23], "optimizationquant": [8, 9, 22, 23], "dim": [8, 9, 22, 23], "full_nam": [8, 9, 22, 23], "full_symbol": [8, 9, 22, 23], "ref_nam": [8, 9, 22, 23], "use_in_stage_funct": [8, 9, 22, 23], "binari": [8, 9, 15, 22, 23], "input_map": [8, 9, 22, 23], "output_map": [8, 9, 22, 23], "reset_setup_attribut": [8, 9, 22, 23], "casadibackendconfig": [8, 9, 22, 23], "build_batch_bat": [8, 9, 22, 23], "validate_compil": [8, 9, 22, 23], "add_constraint": [8, 9, 22, 23], "add_opt_par": [8, 9, 22, 23], "add_opt_var": [8, 9, 22, 23], "binary_var": [8, 9, 22, 23], "create_nlp_in_out_map": [8, 9, 22, 23], "only_positive_times_in_result": [8, 9, 21, 22, 23], "matrix": [8, 9, 14, 20, 22, 23], "stats_lin": [8, 9, 22, 23], "variable_grid_indic": [8, 9, 22, 23], "variable_lookup": [8, 9, 22, 23], "write_column": [8, 9, 22, 23], "write_stats_column": [8, 9, 22, 23], "quantiti": [8, 9, 21, 22, 23, 31], "do": [8, 9, 15, 19, 22, 23, 30, 31], "subproblem": [8, 22], "discretizationt": [8, 9, 22, 23], "value_typ": [8, 9, 22, 23], "t_0_slack": [8, 9, 22, 23], "mdot_0": [8, 9, 22, 23, 30], "000000": [8, 9, 22, 23], "160000": [8, 9, 22, 23], "101": [8, 9, 22, 23], "431499": [8, 9, 22, 23], "540944": [8, 9, 22, 23], "149": [8, 9, 22, 23], "465942": [8, 9, 22, 23], "450": [8, 9, 22, 23], "779780": [8, 9, 22, 23], "147": [8, 9, 22, 23], "704779": [8, 9, 22, 23], "798": [8, 9, 22, 23], "568501": [8, 9, 22, 23], "720770": [8, 9, 22, 23], "146": [8, 9, 22, 23], "645769": [8, 9, 22, 23], "solver_factori": [8, 9, 22, 23], "ocp": [8, 9, 22, 23], "map": [8, 9, 19, 22, 23], "numer": [8, 9, 14, 15, 22, 23, 30], "ca": [9, 22, 23], "denot": [9, 23], "ref_list": [9, 23], "assert_complet": [9, 23], "group": [9, 23], "serv": [9, 23, 31], "purpos": [9, 23, 30, 31], "typic": [9, 23], "uncontrol": [9, 23], "physic": [9, 23, 31], "add": [9, 20, 23, 31], "stage": [9, 23], "categori": [9, 23], "indic": [9, 23], "full_list": [9, 23], "ad": [9, 13, 14, 23, 31], "point": [9, 20, 23, 30], "throw": [9, 23], "clean": [9, 23], "sever": [9, 23], "These": [9, 15, 19, 23, 31], "overload": [9, 23], "systemt": [9, 23], "boolean": [9, 14, 23], "jit": [9, 23], "off": [9, 23], "done": [9, 23, 31], "transcript": [9, 23], "opt_var": [9, 22, 23], "creation": [9, 23], "opt_vars_lb": [9, 22, 23], "opt_vars_ub": [9, 22, 23], "initial_guess": [9, 22, 23], "opt_par": [9, 22, 23], "constraints_lb": [9, 22, 23], "constraints_ub": [9, 22, 23], "objective_funct": [9, 22, 23], "mpc_opt_var": [9, 22, 23], "system_vari": [9, 23], "mpc_opt_par": [9, 22, 23], "system_paramet": [9, 23], "constraint_funct": [9, 23], "gap_clos": [9, 23], "bound": [9, 10, 14, 23, 24, 31], "post_den": [9, 23], "append": [9, 23], "q": [9, 23], "runtim": [9, 23, 31], "fix": [9, 14, 23], "declare_quant": [9, 23], "raw": [9, 10, 11, 23, 24, 25], "instanti": [9, 14, 23], "mpc_input": [9, 23], "matric": [9, 23], "row": [9, 11, 23, 25], "There": [9, 23, 30], "separ": [9, 23, 30], "complet": [9, 23], "evolut": [9, 13, 23], "well": [9, 20, 23, 31], "statist": [9, 23], "panda": [9, 10, 11, 15, 20, 23, 24, 25, 30], "index": [9, 10, 11, 15, 23, 24, 25, 27, 30], "multiindex": [9, 23], "_variable_name_to_index": [9, 23], "mysystem": [9, 23], "def": [9, 23, 31], "get_stat": [9, 23], "animate_ful": [10, 11, 24, 25], "init_ful": [10, 11, 24, 25], "make_anim": [10, 11, 24, 25], "make_imag": [10, 11, 24, 25], "make_lin": [10, 11, 24, 25], "load_residu": [10, 11, 24, 25], "plot_over_tim": [10, 11, 24, 25], "plot_single_time_step": [10, 11, 24, 25], "residuals_over_tim": [10, 11, 24, 25], "ebccolor": [10, 11, 24, 25], "blue": [10, 11, 24, 25], "dark_grei": [10, 11, 24, 25], "dark_r": [10, 11, 24, 25], "ebc_palette_sort_1": [10, 11, 24, 25], "ebc_palette_sort_2": [10, 11, 24, 25], "green": [10, 11, 24, 25], "grei": [10, 11, 14, 24, 25], "light_blu": [10, 11, 24, 25], "light_grei": [10, 11, 24, 25], "light_r": [10, 11, 24, 25], "red": [10, 11, 24, 25], "fontdict": [10, 11, 24, 25], "fontsiz": [10, 11, 24, 25], "style": [10, 11, 19, 24, 25, 31], "valuerang": [10, 11, 24, 25], "max": [10, 11, 20, 24, 25], "min": [10, 11, 24, 25], "make_fig": [10, 11, 24, 25], "make_grid": [10, 11, 24, 25], "make_side_legend": [10, 11, 24, 25], "index_offset": [10, 24], "convert_to": [10, 24, 25], "minut": [10, 24, 25], "hour": [10, 16, 24, 25], "dai": [10, 24, 25], "determin": [10, 14, 22, 24, 30, 31], "offset": [10, 15, 24], "subtract": [10, 15, 24], "realtim": [10, 24, 30, 31], "cut": [10, 24], "down": [10, 24], "someth": [10, 24], "understand": [10, 24], "For": [10, 24, 27, 30, 31], "level": [10, 14, 15, 17, 18, 24], "105": [10, 24], "115": [10, 24], "125": [10, 24], "100": [10, 16, 20, 24], "handl": [10, 14, 15, 24, 31], "15": [10, 20, 24, 30, 31], "25": [10, 24], "argument": [10, 24], "modifi": [10, 24], "modif": [10, 24], "where": [10, 13, 14, 20, 24, 30, 31], "unix": [10, 24], "stamp": [10, 24], "frame": [10, 11, 15, 20, 24, 25], "shown": [10, 24, 31], "exact": [10, 24], "show": [10, 24], "closest": [10, 24], "regard": [10, 20, 24], "certain": [10, 19, 24], "inner": [10, 24], "neg": [10, 16, 24], "count": [10, 24, 31], "convert": [10, 24, 25, 31], "doubl": [10, 24], "assum": [10, 24], "pass": [10, 13, 14, 20, 24], "simulationtim": [10, 24], "variable_typ": [10, 24], "pd": [10, 22, 24, 25], "desir": [10, 20, 24], "anim": [11, 25], "converg": [11, 25, 30], "matplotlib": [11, 25, 30, 31], "line2d": [11, 25], "annot": [11, 25, 31], "ax": [11, 25], "file_nam": [11, 25], "custom": [11, 14, 25, 31], "callabl": [11, 21, 22, 23, 25], "figur": [11, 25], "300": [11, 25], "label": [11, 25], "fig": [11, 25], "max_it": [11, 25], "_ax": [11, 25], "final": [11, 25, 30, 31], "decreas": [11, 25], "evalu": [11, 14, 25], "ha": [11, 13, 14, 19, 20, 25, 27, 31], "dual_residu": [11, 25], "32941176470588235": [11, 25], "6235294117647059": [11, 25], "3058823529411765": [11, 25], "30980392156862746": [11, 25], "3137254901960784": [11, 25], "6745098039215687": [11, 25], "16862745098039217": [11, 25], "10980392156862745": [11, 25], "8666666666666667": [11, 25], "25098039215686274": [11, 25], "17647058823529413": [11, 25], "9215686274509803": [11, 25], "5490196078431373": [11, 25], "5058823529411764": [11, 25], "615686274509804": [11, 25], "6196078431372549": [11, 25], "6274509803921569": [11, 25], "8509803921568627": [11, 25], "7647058823529411": [11, 25], "9019607843137255": [11, 25], "4392156862745098": [11, 25], "6784313725490196": [11, 25], "2784313725490196": [11, 25], "typeddict": [11, 25], "use_tex": [11, 25], "amount": [11, 20, 25], "right_posit": [11, 25], "mean_over_interv": [12, 13], "no_interpol": [12, 13], "previou": [12, 13, 14, 15, 22, 24], "spline3": [12, 13], "ml_model_datatyp": [12, 14, 20, 26], "earlystoppingcallback": [12, 13, 20], "activ": [12, 13, 20], "patienc": [12, 13, 20], "restore_best_weight": [12, 13, 20], "verbos": [12, 13, 20], "featur": [12, 13, 14, 15], "outputfeatur": [12, 13, 14], "output_typ": [12, 13, 15, 20], "recurs": [12, 13, 14, 20], "non_recursive_features_have_to_be_absolut": [12, 13], "outputtyp": [12, 13, 20], "trainingdata": [12, 13, 20, 25], "test_input": [12, 13], "test_output": [12, 13], "training_input": [12, 13], "training_output": [12, 13], "validation_input": [12, 13], "validation_output": [12, 13], "column_ord": [12, 13], "name_with_lag": [12, 13], "casadi_ml_model": [12, 26], "casadimlmodel": [12, 14, 22], "bb_output": [12, 14], "bb_state": [12, 14], "get_ml_model_valu": [12, 14], "make_predict_function_for_mpc": [12, 14], "register_ml_model": [12, 14], "set_with_timestamp": [12, 14], "update_ml_model": [12, 14], "casadimlmodelconfig": [12, 14], "dt": [12, 14], "ml_model_sourc": [12, 14], "check_dt": [12, 14], "check_or_load_model": [12, 14], "assert_recursive_outputs_are_st": [12, 14], "compute_dup": [12, 14], "user_config": [12, 14], "validate_vari": [12, 14], "casadi_predictor": [12, 26], "annlayertyp": [12, 14], "batchnorm": [12, 14, 20], "dens": [12, 14], "lstm": [12, 14], "rescal": [12, 14], "forward": [12, 13, 14, 24], "casadiann": [12, 14], "input_shap": [12, 14], "casadigpr": [12, 14], "casadilinreg": [12, 14], "casadipredictor": [12, 14, 25], "serialized_model": [12, 14], "predictor_model": [12, 14], "sym_input": [12, 14], "prediction_funct": [12, 14], "from_serialized_model": [12, 14], "output_shap": [12, 14], "get_activ": [12, 14], "update_dimens": [12, 14], "serialized_ml_model": [12, 20, 26], "customgpr": [12, 14], "set_predict_request": [12, 14], "set_score_request": [12, 14], "gprdatahandlingparamet": [12, 14], "normal": [12, 14, 15, 20], "scale": [12, 14, 15, 20, 25], "std": [12, 14], "gprkernelparamet": [12, 14], "constant_valu": [12, 14], "constant_value_bound": [12, 14, 15, 20], "length_scal": [12, 14], "length_scale_bound": [12, 14, 15, 20], "noise_level": [12, 14, 15, 20], "noise_level_bound": [12, 14, 15, 20], "theta": [12, 14], "from_model": [12, 14], "gprparamet": [12, 14], "l": [12, 14], "x_train": [12, 14], "alpha": [12, 14], "log_marginal_likelihood_valu": [12, 14], "n_features_in": [12, 14], "y_train": [12, 14], "linregparamet": [12, 14], "coef": [12, 14], "intercept": [12, 14], "rank": [12, 14], "singular": [12, 14], "mlmodel": [12, 13, 14, 15, 20, 22], "ann": [12, 14, 20], "gpr": [12, 14, 20], "linreg": [12, 14], "serializedann": [12, 14, 20], "model_typ": [12, 14, 15, 20], "serializedgpr": [12, 14, 20], "data_handl": [12, 14], "gpr_paramet": [12, 14, 20], "kernel_paramet": [12, 14], "serializedlinreg": [12, 14, 20], "serializedmlmodel": [12, 14, 20, 25], "agentlib_mpc_hash": [12, 14], "training_info": [12, 14, 15, 20], "load_serialized_model": [12, 14], "load_serialized_model_from_dict": [12, 14], "load_serialized_model_from_fil": [12, 14], "load_serialized_model_from_str": [12, 14], "save_serialized_model": [12, 14], "get_git_revision_short_hash": [12, 14], "inputpredict": [12, 15], "try_predictor": [12, 15], "employe": [12, 15], "estim": [12, 14, 15], "ml_model_train": [12, 15], "data_reduct": [12, 15], "setpoint_gener": [12, 15], "data_sourc": [12, 20, 26], "datasourc": [12, 15], "transform_index": [12, 15], "datasourceconfig": [12, 15], "data_offset": [12, 15], "check_data": [12, 15], "check_interpolation_method": [12, 15], "minlp_mpc": [12, 26], "minlpmpc": [12, 15], "minlpmpcconfig": [12, 15], "validate_binary_bound": [12, 15], "ml_model_simul": [12, 26], "log_level": [12, 15, 17, 18], "validate_incoming_valu": [12, 15, 17, 18], "mpc_full": [12, 26], "register_callbacks_for_lagged_vari": [12, 15], "check_r_del_u_in_control": [12, 15, 18], "casadi_admm_ml": [12, 21], "casadi_ml": [12, 21], "minlp_cia": [12, 21], "admm_consensus_shad": [12, 24], "admm_dashboard": [12, 24], "discretization_structur": [12, 24], "interact": [12, 24, 27], "ml_model_test": [12, 24], "earliest_index": [12, 24], "interpolate_to_previ": [12, 24], "pairwis": [12, 24], "sample_values_to_target_grid": [12, 24], "what": [13, 30, 31], "kind": [13, 24], "yield": 13, "featuer": 13, "next": [13, 31], "again": [13, 14, 22], "relationship": 13, "train": [13, 14, 20], "three": [13, 30], "locat": [13, 30], "test": [13, 20, 25, 30], "kera": [13, 14, 27], "multipl": [14, 25], "ml": [14, 20, 27], "compar": 14, "version": [14, 19, 20, 30], "wai": [14, 30, 31], "black": 14, "box": 14, "In": [14, 22, 30, 31], "white": [14, 20], "combin": [14, 20, 31], "prepar": 14, "suitabl": 14, "shoot": 14, "find": [14, 15, 17, 18, 24], "divid": [14, 20, 30, 31], "_differenti": 14, "_differentials_network": 14, "ml_model": [14, 25], "sens": 14, "consid": [14, 31, 33], "case": [14, 20, 30, 31], "out1": 14, "ml_model1": 14, "out2": 14, "out3": 14, "ml_model2": 14, "ml_model3": 14, "would": [14, 30, 31], "replac": 14, "leav": 14, "undefin": 14, "caus": 14, "subequ": 14, "try": [14, 16], "sure": [14, 15, 20, 30], "suppli": 14, "part": [14, 30, 31], "obsolet": 14, "configurationerror": 14, "t": [14, 15, 22, 31], "duplic": 14, "element": 14, "check_nam": 14, "forgot": 14, "enabl": 14, "better": [14, 30], "restart": [14, 20], "whenev": 14, "disabl": 14, "reason": 14, "batch_norm": 14, "axi": 14, "sequenti": [14, 20], "shape": 14, "predictor": 14, "scikit": [14, 27], "learn": [14, 27, 30], "gaussian": [14, 27], "regressor": 14, "linerregress": 14, "translat": 14, "librari": 14, "syntax": [14, 31], "sub": 14, "connect": 14, "long": [14, 31], "short": 14, "term": [14, 22, 24, 30], "memori": [14, 20], "cell": 14, "x_t": 14, "c_prev": 14, "h_prev": 14, "artifici": 14, "neural": [14, 27], "network": [14, 27], "dimension": 14, "kernel": [14, 20], "1e": 14, "fmin_l_bfgs_b": 14, "n_restarts_optim": [14, 15, 20], "normalize_i": 14, "copy_x_train": 14, "random_st": 14, "gaussianprocessregressor": 14, "accordingli": [14, 20], "return_std": 14, "return_cov": 14, "unchang": 14, "request": [14, 22, 24], "metadata": 14, "enable_metadata_rout": 14, "see": [14, 27, 30, 31], "sklearn": 14, "set_config": 14, "pleas": [14, 27, 30, 33], "rout": 14, "mechan": 14, "meta": 14, "instead": [14, 30], "origin": [14, 24, 25], "metadata_rout": 14, "retain": 14, "insid": 14, "pipelin": 14, "otherwis": [14, 22, 24], "effect": [14, 20], "sample_weight": 14, "score": 14, "y": [14, 20], "deviat": 14, "covari": [14, 20], "x_1": 14, "x_2": 14, "100000": [14, 20, 31], "hyperparamet": 14, "tune": 14, "isotrop": 14, "anisotrop": 14, "nois": 14, "varianc": 14, "transform": 14, "non": 14, "triangular": 14, "choleski": 14, "decomposit": 14, "represent": 14, "diagon": 14, "fit": [14, 20], "prevent": 14, "potenti": 14, "issu": 14, "posit": [14, 16], "definit": [14, 31], "interpret": [14, 15], "addit": [14, 20, 31], "observ": 14, "whitekernel": 14, "datapoint": [14, 15], "directli": 14, "mainli": [14, 19], "conveni": [14, 31], "ridg": 14, "margin": 14, "likelihood": 14, "kernel_": 14, "seen": [14, 25, 30], "coeffici": 14, "regress": [14, 27], "2d": 14, "n_target": 14, "n_featur": 14, "while": [14, 30], "1d": 14, "independ": [14, 31], "fit_intercept": 14, "offer": 14, "from_ann": 14, "architectur": 14, "bias": 14, "np": 14, "protected_namespac": 14, "gaussionprocessregressor": 14, "rtype": 14, "gpr_fit": 14, "scikitlearn": 14, "trainer": [14, 20, 22], "linearregress": 14, "linear_model_fit": 14, "commit": 14, "hash": 14, "machin": [14, 27], "model_data": 14, "json_str": 14, "trypredictor": [15, 16], "send_measur": [15, 16], "send_predict": [15, 16], "trypredictorconfig": [15, 16], "prediction_length": [15, 16], "mheconfig": [15, 19], "state_weight": [15, 19], "state_weights_are_in_st": [15, 19], "wrap": [15, 19], "decorator_info": [15, 19], "shim": [15, 19], "inducingpoint": [15, 20], "reduc": [15, 20], "nystroemreduc": [15, 20], "anntrain": [15, 20], "build_ml_model": [15, 20], "fit_ml_model": [15, 20], "anntrainerconfig": [15, 20], "batch_siz": [15, 20], "early_stop": [15, 20], "epoch": [15, 20], "gprtrainer": [15, 20], "gprtrainerconfig": [15, 20], "linregtrain": [15, 20], "linregtrainerconfig": [15, 20], "mlmodeltrain": [15, 20], "agent_and_tim": [15, 20], "create_inputs_and_output": [15, 20], "divide_in_tvt": [15, 20], "input_nam": [15, 20], "output_nam": [15, 20], "resampl": [15, 20], "retrain_model": [15, 20], "save_al": [15, 20], "save_ml_model": [15, 20], "serialize_ml_model": [15, 20], "mlmodeltrainerconfig": [15, 20], "recursive_output": [15, 20], "retrain_delai": [15, 20], "save_data": [15, 20], "save_directori": [15, 20], "save_plot": [15, 20], "step_siz": [15, 20], "test_shar": [15, 20], "time_series_length": [15, 20], "time_series_memory_s": [15, 20], "train_shar": [15, 20], "use_values_for_incomplete_data": [15, 20], "validation_shar": [15, 20], "check_data_sources_exist": [15, 20], "check_if_save_path_is_ther": [15, 20], "check_shares_amount_to_on": [15, 20], "fill_interpol": [15, 20], "fill_lag": [15, 20], "fill_output_typ": [15, 20], "fill_recursive_output": [15, 20], "setpointgener": [15, 20], "update_target": [15, 20], "setpointgeneratorconfig": [15, 20], "day_end": [15, 20], "day_lb": [15, 20], "day_start": [15, 20], "day_ub": [15, 20], "night_lb": [15, 20], "night_ub": [15, 20], "target_vari": [15, 20], "don": 15, "anyth": 15, "event": 15, "_lib": 15, "tslib": 15, "timedelta": 15, "ommit": 15, "empti": [15, 30], "execut": 15, "assur": 15, "check_valid_level": [15, 17, 18], "critic": [15, 17, 18], "unqiu": [15, 17, 18], "id": [15, 17, 18, 20, 30, 31], "withing": [15, 17, 18], "filepath": [15, 17, 18, 30], "databrok": [15, 17, 18], "listen": [15, 19], "histori": [15, 19], "appli": [15, 18], "trysensor": 16, "trysensorconfig": 16, "24": 16, "t_oda_predict": 16, "air": [16, 27, 30, 31], "temperatur": [16, 31], "2m": 16, "ground": 16, "pressure_predict": 16, "hpa": 16, "pressur": 16, "height": 16, "wind_direction_predict": 16, "wind": 16, "direct": [16, 27, 33], "m": [16, 20], "abov": [16, 30, 31], "gorund": 16, "grad": 16, "360": 16, "999": 16, "wind_speed_predict": 16, "speed": [16, 20, 30], "coverage_predict": 16, "eighth": 16, "8": [16, 20], "absolute_humidity_predict": 16, "kg": [16, 31], "relative_humidity_predict": 16, "humid": 16, "beam_direct_predict": 16, "w": [16, 31], "beam": 16, "sun": 16, "hor": 16, "plane": 16, "downward": 16, "beam_diffuse_predict": 16, "diffus": 16, "beam_atm_predict": 16, "atmospher": 16, "heat": [16, 31], "beam_terr_predict": 16, "terrestri": 16, "upward": 16, "move": 19, "lookup": 19, "sinc": [19, 20, 30, 31], "come": [19, 31], "incorpor": 19, "unknown": 19, "known": 19, "setpoint": [19, 30, 31], "chose": 19, "high": 19, "dont": 19, "trust": 19, "choos": [19, 30], "validationinfo": 19, "staticmethod": 19, "unbound": 19, "act": 19, "descriptor": 19, "detect": 19, "decor": 19, "__get__": 19, "transpar": 19, "wrapper": 19, "v1": 19, "stolen": 20, "berktold": [20, 25], "idea": 20, "gp": 20, "n": 20, "induc": 20, "smaller": 20, "complex": [20, 30], "o": 20, "n3": 20, "nm2": 20, "bigger": 20, "http": [20, 27], "bwengal": 20, "github": [20, 27], "io": 20, "html": [20, 25], "plot_distance_matrix": 20, "n_compon": 20, "build": 20, "training_data": [20, 25], "relu": 20, "sigmoid": 20, "softmax": 20, "softplu": 20, "softsign": 20, "tanh": 20, "selu": 20, "elu": 20, "exponenti": 20, "earlystop": 20, "16": [20, 30, 31], "hidden": 20, "size": 20, "neuron": 20, "predictionar": 20, "full_data_sampl": 20, "input_data": 20, "output_data": 20, "split": 20, "time_seri": 20, "histor": 20, "sa": 20, "10000000000": 20, "retrain": 20, "regular": 20, "315360000": 20, "kept": 20, "older": 20, "than": [20, 22, 24, 30], "minu": 20, "1000000000": 20, "exce": 20, "oldest": 20, "reach": 20, "suffici": 20, "unspecifi": 20, "random": 20, "comfort": 20, "zone": [20, 31], "heavili": 20, "daytim": 20, "292": 20, "14400": 20, "289": 20, "result_stat": [21, 22], "casadiadmmbackend_nn": [21, 22], "casadiadmmnnsystem": [21, 22], "past_coupl": [21, 22], "past_exchang": [21, 22], "sim_step_quant": [21, 22], "multipleshootingadmmnn": [21, 22], "max_lag": [21, 22], "casadibbbackend": [21, 22], "lag_collect": [21, 22], "casadimlsystem": [21, 22], "all_system_quant": [21, 22], "lags_dict": [21, 22], "sim_step": [21, 22], "multipleshooting_ml": [21, 22], "mhebackend": [21, 22], "mhesystem": [21, 22], "estimated_st": [21, 22], "modelt": [21, 22, 23], "pred_tim": [22, 23], "alon": 22, "doesn": 22, "dequ": 22, "scalar": [22, 24], "expand": [22, 24], "onto": [22, 24, 30], "exactli": [22, 24], "accept": [22, 24], "spline": [22, 24], "slice": [22, 24], "longer": [22, 24], "remaind": [22, 24], "valueerror": [22, 24], "plot_consensus_shad": [24, 25], "create_app": [24, 25], "create_coupling_var_plot": [24, 25], "create_residuals_plot": [24, 25], "get_coupling_vari": [24, 25], "get_data_for_plot": [24, 25], "get_max_iterations_per_timestep": [24, 25], "load_agent_data": [24, 25], "main": [24, 25, 33], "show_admm_dashboard": [24, 25], "spy_structur": [24, 25], "draggable_script": [24, 25], "get_port": [24, 25], "make_compon": [24, 25], "make_figure_plotli": [24, 25], "obj_plot": [24, 25], "plot_admm_plotli": [24, 25], "plot_mpc_plotli": [24, 25], "show_dashboard": [24, 25], "solver_return": [24, 25], "calc_scor": [24, 25], "evaluate_model": [24, 25], "pairwise_sort": [24, 25], "predict_arrai": [24, 25], "interpolate_color": [24, 25], "plot_admm": [24, 25], "plot_mpc": [24, 25], "arr": 24, "forwardfil": 24, "target_grid": 24, "original_grid": 24, "sequenc": 24, "fill": 24, "stand": 24, "scipi": 24, "tck": 24, "interp1d": 24, "s0": 24, "s1": 24, "s2": 24, "s3": 24, "agent_data": 25, "residuals_df": 25, "dash": [25, 27], "app": 25, "plot_data": 25, "prediction_grid": 25, "coupling_var": 25, "plotli": [25, 27], "go": 25, "select": 25, "identifi": [25, 30], "extract": 25, "directori": [25, 28, 30], "div": 25, "graph": 25, "plot_actual_valu": 25, "plot_predict": 25, "close": 25, "loop": 25, "actual": [25, 30, 33], "y_axis_label": 25, "titl": 25, "metric": 25, "show_plot": 25, "save_path": 25, "color": 25, "fade": 25, "old": 25, "credit": 25, "packag": [26, 27, 29], "tutori": 27, "altern": [27, 33], "those": 27, "nonlinear": 27, "central": [27, 30, 31], "doc": 27, "best": 27, "condit": [27, 30], "room": [27, 30, 31], "pip": [27, 28], "recommend": 27, "run": [27, 28, 30], "fmu": [27, 30, 31], "support": [27, 30], "fmi": 27, "org": [27, 30], "narx": 27, "tensorflow": 27, "displai": 27, "dashboard": 27, "like": [27, 31], "framework": 27, "under": [27, 30, 31], "com": 27, "rwth": 27, "ebc": 27, "preprint": 27, "dx": 27, "doi": 27, "2139": 27, "ssrn": 27, "4884846": 27, "eser": 27, "steffen": 27, "storek": 27, "thoma": 27, "w\u00fcllhorst": 27, "fabian": 27, "d\u00e4hling": 27, "stefan": 27, "gall": 27, "jan": 27, "stoffel": 27, "phillip": 27, "m\u00fcller": 27, "dirk": 27, "modular": 27, "rapid": 27, "develop": [27, 28], "advanc": 27, "energi": 27, "rememb": 27, "tool": 27, "gratefulli": 27, "financi": 27, "feder": 27, "ministri": 27, "econom": 27, "affair": 27, "climat": 27, "bmwk": 27, "promot": 27, "03et1495a": 27, "search": 27, "page": 27, "clone": 28, "Then": [28, 30, 31], "contribut": 28, "repositori": [28, 33], "repo": 28, "egg": 28, "howev": [30, 31], "ahu": [30, 31], "mass": [30, 31], "flow": [30, 31], "behaviour": 30, "One": 30, "thread": 30, "suit": 30, "unifi": 30, "criteria": 30, "look": [30, 31], "multiprocess": 30, "multi_agent_system": [30, 31], "multiprocessingma": 30, "pyplot": [30, 31], "plt": [30, 31], "unlik": 30, "localmasag": [30, 31], "spawn": 30, "parallel": 30, "place": 30, "world": 30, "env_config": [30, 31], "rt": [30, 31], "strict": 30, "agent_config": [30, 31], "cooler": 30, "cooled_room": 30, "env": [30, 31], "variable_log": [30, 31], "until": [30, 31], "As": [30, 31], "explain": [30, 31], "environ": [30, 31], "too": 30, "slow": 30, "our": [30, 31], "similar": [30, 31], "being": [30, 31], "omit": [30, 31], "relat": 30, "miss": 30, "hand": [30, 31], "simpl": [30, 31], "remov": 30, "therefor": 30, "situat": [30, 31], "explicitli": 30, "penal": 30, "usag": 30, "anymor": 30, "itself": [30, 31], "let": [30, 31], "cooled_room_mqtt": 30, "local_broadcast": [30, 31], "comminc": 30, "bit": 30, "complic": 30, "url": 30, "subscript": 30, "snippet": 30, "below": [30, 31], "ag1com": [30, 31], "mosquitto": 30, "subscrib": 30, "topic": 30, "visit": 30, "messag": 30, "wildcard": 30, "imag": 30, "tbd": [30, 32], "begin": 30, "cooledroom": 30, "admm_modul": 30, "casadi_admm": 30, "ca_room_model": 30, "py": [30, 31, 32], "cacooledroom": 30, "print_level": 30, "admm_opt": 30, "chosen": [30, 31], "most": [30, 33], "choic": 30, "overview": 30, "offici": 30, "site": 30, "avoid": [30, 31], "clutter": 30, "consol": 30, "detail": 30, "readabl": [30, 31], "strucutur": 30, "ident": 30, "303": [30, 31], "288": [30, 31], "mdotcoolair": 30, "partial": 30, "agre": 30, "side": 30, "02": [30, 31], "mdot_out": 30, "interest": 30, "actuat": 30, "assign": [30, 31], "why": [30, 31], "thing": 30, "becaus": 30, "produc": 30, "might": [30, 31], "pid": [30, 31], "open": 31, "one_room_mpc": 31, "simple_mpc": 31, "optimz": 31, "cool": 31, "configclass": 31, "clash": 31, "builtin": 31, "mycasadimodelconfig": 31, "0225": 31, "150": 31, "t_in": 31, "290": 31, "inflow": 31, "t_upper": 31, "soft": 31, "293": 31, "t_slack": 31, "cp": 31, "j": 31, "thermal": 31, "capac": 31, "s_t": 31, "r_mdot": 31, "t_out": 31, "four": 31, "limit": 31, "settabl": 31, "occup": 31, "reader": 31, "enforc": 31, "adequ": 31, "containt": 31, "referenc": 31, "mycasadimodel": 31, "ae": 31, "sum": 31, "explicit": 31, "implicit": 31, "natur": 31, "intuit": 31, "tell": 31, "did": 31, "__get_attr__": 31, "written": 31, "improv": 31, "fast": 31, "possibl": 31, "inter": 31, "clock": 31, "tick": 31, "classic": 31, "_optim": 31, "pingpong": 31, "later": 31, "agent_mpc": 31, "mympcag": 31, "mympc": 31, "__file__": 31, "900": 31, "asid": 31, "confus": 31, "counterpart": 31, "expect": 31, "extern": 31, "hard": 31, "variant": 31, "easiest": 31, "agent_sim": 31, "simag": 31, "manner": 31, "rate": 31, "addition": 31, "keyword": 31, "duo": 31, "uniqu": 31, "shoudld": 31, "think": 31, "modelica": 31, "redund": 31, "per": 31, "goe": 31, "With": 31, "manual": 31, "present": 31, "run_exampl": 31, "with_plot": 31, "10000": 31, "explan": 32, "mpc_trajectori": 32, "period": 33, "accur": 33, "authorit": 33, "discrep": 33, "script": 33, "mqtt": 33}, "objects": {"": [[12, 0, 0, "-", "agentlib_mpc"]], "agentlib_mpc": [[13, 0, 0, "-", "data_structures"], [14, 0, 0, "-", "models"], [15, 0, 0, "-", "modules"], [21, 0, 0, "-", "optimization_backends"], [24, 0, 0, "-", "utils"]], "agentlib_mpc.data_structures": [[13, 0, 0, "-", "admm_datatypes"], [13, 0, 0, "-", "casadi_utils"], [13, 0, 0, "-", "coordinator_datatypes"], [13, 0, 0, "-", "interpolation"], [13, 0, 0, "-", "ml_model_datatypes"], [13, 0, 0, "-", "mpc_datamodels"]], "agentlib_mpc.data_structures.admm_datatypes": [[13, 1, 1, "", "ADMMParameters"], [13, 1, 1, "", "ADMMParticipation"], [13, 1, 1, "", "AgentDictEntry"], [13, 1, 1, "", "AgentToCoordinator"], [13, 1, 1, "", "ConsensusVariable"], [13, 1, 1, "", "CoordinatorToAgent"], [13, 1, 1, "", "CouplingEntry"], [13, 1, 1, "", "CouplingVariable"], [13, 1, 1, "", "ExchangeEntry"], [13, 1, 1, "", "ExchangeVariable"], [13, 1, 1, "", "StructuredValue"], [13, 1, 1, "", "VariableReference"], [13, 5, 1, "", "coupling_alias"], [13, 5, 1, "", "exchange_alias"]], "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters": [[13, 2, 1, "", "penalty_factor"], [13, 2, 1, "", "prediction_horizon"], [13, 2, 1, "", "time_step"]], "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation": [[13, 2, 1, "", "participating"], [13, 2, 1, "", "ready"], [13, 2, 1, "", "source"]], "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry": [[13, 2, 1, "", "coup_vars"], [13, 2, 1, "", "exchange_vars"], [13, 2, 1, "", "name"]], "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator": [[13, 2, 1, "", "local_exchange_trajectory"], [13, 2, 1, "", "local_trajectory"]], "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable": [[13, 2, 1, "", "delta_mean"], [13, 3, 1, "", "flat_multipliers"], [13, 2, 1, "", "local_trajectories"], [13, 2, 1, "", "mean_trajectory"], [13, 2, 1, "", "multipliers"], [13, 2, 1, "", "primal_residual"], [13, 3, 1, "", "shift_values_by_one"], [13, 3, 1, "", "update_mean_trajectory"], [13, 3, 1, "", "update_multipliers"]], "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent": [[13, 2, 1, "", "exchange_multiplier"], [13, 2, 1, "", "mean_diff_trajectory"], [13, 2, 1, "", "mean_trajectory"], [13, 2, 1, "", "multiplier"], [13, 2, 1, "", "penalty_parameter"], [13, 2, 1, "", "target"]], "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry": [[13, 3, 1, "", "admm_variables"], [13, 4, 1, "", "lagged"], [13, 4, 1, "", "local"], [13, 4, 1, "", "mean"], [13, 4, 1, "", "multiplier"], [13, 2, 1, "", "name"]], "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable": [[13, 2, 1, "", "delta_mean"], [13, 3, 1, "", "flat_locals"], [13, 3, 1, "", "get_residual"], [13, 2, 1, "", "local_trajectories"], [13, 2, 1, "", "mean_trajectory"], [13, 4, 1, "", "participants"], [13, 2, 1, "", "primal_residual"]], "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry": [[13, 3, 1, "", "admm_variables"], [13, 4, 1, "", "lagged"], [13, 4, 1, "", "local"], [13, 4, 1, "", "mean_diff"], [13, 4, 1, "", "multiplier"], [13, 2, 1, "", "name"]], "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable": [[13, 2, 1, "", "delta_mean"], [13, 2, 1, "", "diff_trajectories"], [13, 2, 1, "", "local_trajectories"], [13, 2, 1, "", "mean_trajectory"], [13, 2, 1, "", "multiplier"], [13, 2, 1, "", "primal_residual"], [13, 3, 1, "", "shift_values_by_one"], [13, 3, 1, "", "update_diff_trajectories"], [13, 3, 1, "", "update_multiplier"]], "agentlib_mpc.data_structures.admm_datatypes.StructuredValue": [[13, 3, 1, "", "from_json"], [13, 3, 1, "", "to_json"]], "agentlib_mpc.data_structures.admm_datatypes.VariableReference": [[13, 3, 1, "", "all_variables"], [13, 2, 1, "", "controls"], [13, 2, 1, "", "couplings"], [13, 2, 1, "", "exchange"], [13, 3, 1, "", "from_config"], [13, 2, 1, "", "inputs"], [13, 2, 1, "", "outputs"], [13, 2, 1, "", "parameters"], [13, 2, 1, "", "states"]], "agentlib_mpc.data_structures.casadi_utils": [[13, 6, 1, "", "CasadiDiscretizationOptions"], [13, 1, 1, "", "CollocationMethod"], [13, 1, 1, "", "Constraint"], [13, 1, 1, "", "DiscretizationMethod"], [13, 1, 1, "", "Integrators"], [13, 1, 1, "", "ModelConstraint"], [13, 1, 1, "", "OptParMXContainer"], [13, 1, 1, "", "OptVarMXContainer"], [13, 1, 1, "", "SolverFactory"], [13, 6, 1, "", "SolverOptions"], [13, 1, 1, "", "Solvers"], [13, 5, 1, "", "compile_solver"], [13, 5, 1, "", "temporary_directory"]], "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions": [[13, 7, 1, "", "collocation_method"], [13, 7, 1, "", "collocation_order"], [13, 7, 1, "", "integrator"], [13, 7, 1, "", "method"], [13, 7, 1, "", "prediction_horizon"], [13, 7, 1, "", "time_step"]], "agentlib_mpc.data_structures.casadi_utils.CollocationMethod": [[13, 2, 1, "", "legendre"], [13, 2, 1, "", "radau"]], "agentlib_mpc.data_structures.casadi_utils.Constraint": [[13, 2, 1, "", "function"], [13, 2, 1, "", "lb"], [13, 2, 1, "", "ub"]], "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod": [[13, 2, 1, "", "collocation"], [13, 2, 1, "", "multiple_shooting"]], "agentlib_mpc.data_structures.casadi_utils.Integrators": [[13, 2, 1, "", "cvodes"], [13, 2, 1, "", "euler"], [13, 2, 1, "", "rk"]], "agentlib_mpc.data_structures.casadi_utils.ModelConstraint": [[13, 2, 1, "", "function"], [13, 2, 1, "", "lb"], [13, 2, 1, "", "ub"]], "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer": [[13, 2, 1, "", "grid"], [13, 2, 1, "", "var"]], "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer": [[13, 2, 1, "", "grid"], [13, 2, 1, "", "guess"], [13, 2, 1, "", "lb"], [13, 2, 1, "", "opt"], [13, 2, 1, "", "ub"], [13, 2, 1, "", "var"]], "agentlib_mpc.data_structures.casadi_utils.SolverFactory": [[13, 2, 1, "", "bat_file"], [13, 3, 1, "", "create_solver"], [13, 2, 1, "", "do_jit"], [13, 2, 1, "", "logger"], [13, 3, 1, "", "make_casadi_nlp"], [13, 2, 1, "", "name"], [13, 2, 1, "", "options"]], "agentlib_mpc.data_structures.casadi_utils.SolverOptions": [[13, 7, 1, "", "name"], [13, 7, 1, "", "options"]], "agentlib_mpc.data_structures.casadi_utils.Solvers": [[13, 2, 1, "", "bonmin"], [13, 2, 1, "", "fatrop"], [13, 2, 1, "", "gurobi"], [13, 2, 1, "", "ipopt"], [13, 2, 1, "", "osqp"], [13, 2, 1, "", "proxqp"], [13, 2, 1, "", "qpoases"], [13, 2, 1, "", "sqpmethod"]], "agentlib_mpc.data_structures.coordinator_datatypes": [[13, 1, 1, "", "AgentDictEntry"], [13, 1, 1, "", "AgentStatus"], [13, 1, 1, "", "CoordinatorStatus"], [13, 1, 1, "", "OptimizationData"], [13, 1, 1, "", "RegistrationMessage"]], "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry": [[13, 2, 1, "", "name"], [13, 2, 1, "", "optimization_data"], [13, 2, 1, "", "status"]], "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus": [[13, 2, 1, "", "busy"], [13, 2, 1, "", "pending"], [13, 2, 1, "", "ready"], [13, 2, 1, "", "standby"]], "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus": [[13, 2, 1, "", "init_iterations"], [13, 2, 1, "", "optimization"], [13, 2, 1, "", "sleeping"], [13, 2, 1, "", "updating"]], "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData": [[13, 3, 1, "", "from_dict"], [13, 3, 1, "", "to_dict"], [13, 2, 1, "", "u"], [13, 2, 1, "", "x"]], "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage": [[13, 2, 1, "", "agent_id"], [13, 2, 1, "", "coupling"], [13, 2, 1, "", "opts"], [13, 2, 1, "", "status"]], "agentlib_mpc.data_structures.interpolation": [[13, 1, 1, "", "InterpolationMethods"]], "agentlib_mpc.data_structures.interpolation.InterpolationMethods": [[13, 2, 1, "", "linear"], [13, 2, 1, "", "mean_over_interval"], [13, 2, 1, "", "no_interpolation"], [13, 2, 1, "", "previous"], [13, 2, 1, "", "spline3"]], "agentlib_mpc.data_structures.ml_model_datatypes": [[13, 6, 1, "", "EarlyStoppingCallback"], [13, 6, 1, "", "Feature"], [13, 6, 1, "", "OutputFeature"], [13, 1, 1, "", "OutputType"], [13, 1, 1, "", "TrainingData"], [13, 5, 1, "", "column_order"], [13, 5, 1, "", "name_with_lag"]], "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback": [[13, 7, 1, "", "activate"], [13, 3, 1, "", "callback"], [13, 7, 1, "", "patience"], [13, 7, 1, "", "restore_best_weights"], [13, 7, 1, "", "verbose"]], "agentlib_mpc.data_structures.ml_model_datatypes.Feature": [[13, 7, 1, "", "lag"], [13, 7, 1, "", "name"]], "agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature": [[13, 8, 1, "", "non_recursive_features_have_to_be_absolute"], [13, 7, 1, "", "output_type"], [13, 7, 1, "", "recursive"]], "agentlib_mpc.data_structures.ml_model_datatypes.OutputType": [[13, 2, 1, "", "absolute"], [13, 2, 1, "", "difference"]], "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData": [[13, 3, 1, "", "load"], [13, 3, 1, "", "save"], [13, 2, 1, "", "test_inputs"], [13, 2, 1, "", "test_outputs"], [13, 2, 1, "", "training_inputs"], [13, 2, 1, "", "training_outputs"], [13, 2, 1, "", "validation_inputs"], [13, 2, 1, "", "validation_outputs"]], "agentlib_mpc.data_structures.mpc_datamodels": [[13, 1, 1, "", "BaseVariableReference"], [13, 6, 1, "", "DiscretizationOptions"], [13, 1, 1, "", "FullVariableReference"], [13, 1, 1, "", "InitStatus"], [13, 1, 1, "", "MHEVariableReference"], [13, 1, 1, "", "MINLPVariableReference"], [13, 1, 1, "", "MPCVariable"], [13, 1, 1, "", "Results"], [13, 1, 1, "", "VariableReference"], [13, 5, 1, "", "cia_relaxed_results_path"], [13, 5, 1, "", "r_del_u_convention"], [13, 5, 1, "", "stats_path"]], "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference": [[13, 3, 1, "", "all_variables"], [13, 3, 1, "", "from_config"]], "agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions": [[13, 7, 1, "", "prediction_horizon"], [13, 7, 1, "", "time_step"]], "agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference": [[13, 4, 1, "", "r_del_u"]], "agentlib_mpc.data_structures.mpc_datamodels.InitStatus": [[13, 2, 1, "", "during_update"], [13, 2, 1, "", "pre_module_init"], [13, 2, 1, "", "ready"]], "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference": [[13, 3, 1, "", "all_variables"], [13, 2, 1, "", "estimated_inputs"], [13, 2, 1, "", "estimated_parameters"], [13, 2, 1, "", "known_inputs"], [13, 2, 1, "", "known_parameters"], [13, 2, 1, "", "measured_states"], [13, 2, 1, "", "outputs"], [13, 2, 1, "", "states"], [13, 2, 1, "", "weights_states"]], "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference": [[13, 2, 1, "", "binary_controls"], [13, 2, 1, "", "controls"], [13, 2, 1, "", "inputs"], [13, 2, 1, "", "outputs"], [13, 2, 1, "", "parameters"], [13, 2, 1, "", "states"]], "agentlib_mpc.data_structures.mpc_datamodels.MPCVariable": [[13, 2, 1, "", "interpolation_method"]], "agentlib_mpc.data_structures.mpc_datamodels.Results": [[13, 2, 1, "", "df"]], "agentlib_mpc.data_structures.mpc_datamodels.VariableReference": [[13, 2, 1, "", "controls"], [13, 2, 1, "", "inputs"], [13, 2, 1, "", "outputs"], [13, 2, 1, "", "parameters"], [13, 2, 1, "", "states"]], "agentlib_mpc.models": [[14, 0, 0, "-", "casadi_ml_model"], [14, 0, 0, "-", "casadi_model"], [14, 0, 0, "-", "casadi_predictor"], [14, 0, 0, "-", "serialized_ml_model"]], "agentlib_mpc.models.casadi_ml_model": [[14, 1, 1, "", "CasadiMLModel"], [14, 6, 1, "", "CasadiMLModelConfig"], [14, 5, 1, "", "assert_recursive_outputs_are_states"], [14, 5, 1, "", "compute_dupes"]], "agentlib_mpc.models.casadi_ml_model.CasadiMLModel": [[14, 4, 1, "", "auxiliaries"], [14, 4, 1, "", "bb_outputs"], [14, 4, 1, "", "bb_states"], [14, 2, 1, "", "config_type"], [14, 3, 1, "", "do_step"], [14, 3, 1, "", "get_ml_model_values"], [14, 3, 1, "", "initialize"], [14, 3, 1, "", "make_predict_function_for_mpc"], [14, 3, 1, "", "register_ml_models"], [14, 3, 1, "", "set_with_timestamp"], [14, 3, 1, "", "setup_system"], [14, 3, 1, "", "update_ml_models"]], "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig": [[14, 8, 1, "", "check_dt"], [14, 8, 1, "", "check_or_load_models"], [14, 7, 1, "", "dt"], [14, 7, 1, "", "ml_model_sources"], [14, 3, 1, "", "model_post_init"]], "agentlib_mpc.models.casadi_model": [[14, 1, 1, "", "CasadiInput"], [14, 1, 1, "", "CasadiModel"], [14, 6, 1, "", "CasadiModelConfig"], [14, 1, 1, "", "CasadiOutput"], [14, 1, 1, "", "CasadiParameter"], [14, 1, 1, "", "CasadiState"], [14, 1, 1, "", "CasadiVariable"], [14, 5, 1, "", "get_symbolic"]], "agentlib_mpc.models.casadi_model.CasadiInput": [[14, 4, 1, "", "alg"]], "agentlib_mpc.models.casadi_model.CasadiModel": [[14, 4, 1, "", "auxiliaries"], [14, 4, 1, "", "differentials"], [14, 3, 1, "", "do_step"], [14, 3, 1, "", "get"], [14, 3, 1, "", "get_constraints"], [14, 3, 1, "", "get_differential_values"], [14, 3, 1, "", "get_input_values"], [14, 3, 1, "", "initialize"], [14, 4, 1, "", "inputs"], [14, 4, 1, "", "output_equations"], [14, 4, 1, "", "outputs"], [14, 4, 1, "", "parameters"], [14, 3, 1, "", "set_differential_values"], [14, 3, 1, "", "set_output_values"], [14, 3, 1, "", "setup_system"], [14, 4, 1, "", "states"]], "agentlib_mpc.models.casadi_model.CasadiModelConfig": [[14, 7, 1, "", "cost_function"], [14, 7, 1, "", "description"], [14, 7, 1, "", "dt"], [14, 7, 1, "", "inputs"], [14, 3, 1, "", "model_post_init"], [14, 7, 1, "", "name"], [14, 7, 1, "", "outputs"], [14, 7, 1, "", "parameters"], [14, 7, 1, "", "sim_time"], [14, 7, 1, "", "states"], [14, 7, 1, "", "system"], [14, 7, 1, "", "user_config"], [14, 7, 1, "", "validate_variables"]], "agentlib_mpc.models.casadi_model.CasadiOutput": [[14, 4, 1, "", "alg"], [14, 3, 1, "", "json"]], "agentlib_mpc.models.casadi_model.CasadiState": [[14, 4, 1, "", "alg"], [14, 3, 1, "", "json"], [14, 4, 1, "", "ode"]], "agentlib_mpc.models.casadi_model.CasadiVariable": [[14, 3, 1, "", "create_sym"], [14, 4, 1, "", "sym"]], "agentlib_mpc.models.casadi_predictor": [[14, 1, 1, "", "ANNLayerTypes"], [14, 1, 1, "", "BatchNormalization"], [14, 1, 1, "", "CasadiANN"], [14, 1, 1, "", "CasadiGPR"], [14, 1, 1, "", "CasadiLinReg"], [14, 1, 1, "", "CasadiPredictor"], [14, 1, 1, "", "Dense"], [14, 1, 1, "", "Flatten"], [14, 1, 1, "", "LSTM"], [14, 1, 1, "", "Layer"]], "agentlib_mpc.models.casadi_predictor.ANNLayerTypes": [[14, 2, 1, "", "BATCHNORMALIZATION"], [14, 2, 1, "", "DENSE"], [14, 2, 1, "", "FLATTEN"], [14, 2, 1, "", "LSTM"], [14, 2, 1, "", "RESCALING"]], "agentlib_mpc.models.casadi_predictor.BatchNormalization": [[14, 3, 1, "", "forward"]], "agentlib_mpc.models.casadi_predictor.CasadiANN": [[14, 4, 1, "", "input_shape"]], "agentlib_mpc.models.casadi_predictor.CasadiGPR": [[14, 4, 1, "", "input_shape"]], "agentlib_mpc.models.casadi_predictor.CasadiLinReg": [[14, 4, 1, "", "input_shape"]], "agentlib_mpc.models.casadi_predictor.CasadiPredictor": [[14, 1, 1, "", "Config"], [14, 3, 1, "", "from_serialized_model"], [14, 4, 1, "", "input_shape"], [14, 4, 1, "", "output_shape"], [14, 3, 1, "", "predict"], [14, 2, 1, "", "prediction_function"], [14, 2, 1, "", "predictor_model"], [14, 2, 1, "", "serialized_model"], [14, 2, 1, "", "sym_input"]], "agentlib_mpc.models.casadi_predictor.CasadiPredictor.Config": [[14, 2, 1, "", "arbitrary_types_allowed"]], "agentlib_mpc.models.casadi_predictor.Dense": [[14, 3, 1, "", "forward"]], "agentlib_mpc.models.casadi_predictor.Flatten": [[14, 3, 1, "", "forward"]], "agentlib_mpc.models.casadi_predictor.LSTM": [[14, 3, 1, "", "forward"], [14, 3, 1, "", "step"]], "agentlib_mpc.models.casadi_predictor.Layer": [[14, 3, 1, "", "get_activation"], [14, 3, 1, "", "update_dimensions"]], "agentlib_mpc.models.serialized_ml_model": [[14, 1, 1, "", "CustomGPR"], [14, 6, 1, "", "GPRDataHandlingParameters"], [14, 6, 1, "", "GPRKernelParameters"], [14, 6, 1, "", "GPRParameters"], [14, 6, 1, "", "LinRegParameters"], [14, 1, 1, "", "MLModels"], [14, 6, 1, "", "SerializedANN"], [14, 6, 1, "", "SerializedGPR"], [14, 6, 1, "", "SerializedLinReg"], [14, 6, 1, "", "SerializedMLModel"], [14, 5, 1, "", "get_git_revision_short_hash"]], "agentlib_mpc.models.serialized_ml_model.CustomGPR": [[14, 3, 1, "", "predict"], [14, 3, 1, "", "set_predict_request"], [14, 3, 1, "", "set_score_request"]], "agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters": [[14, 7, 1, "", "mean"], [14, 7, 1, "", "normalize"], [14, 7, 1, "", "scale"], [14, 7, 1, "", "std"]], "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters": [[14, 7, 1, "", "constant_value"], [14, 7, 1, "", "constant_value_bounds"], [14, 3, 1, "", "from_model"], [14, 7, 1, "", "length_scale"], [14, 7, 1, "", "length_scale_bounds"], [14, 7, 1, "", "noise_level"], [14, 7, 1, "", "noise_level_bounds"], [14, 7, 1, "", "theta"]], "agentlib_mpc.models.serialized_ml_model.GPRParameters": [[14, 7, 1, "", "L"], [14, 7, 1, "", "X_train"], [14, 7, 1, "", "alpha"], [14, 3, 1, "", "from_model"], [14, 7, 1, "", "log_marginal_likelihood_value"], [14, 7, 1, "", "n_features_in"], [14, 7, 1, "", "y_train"]], "agentlib_mpc.models.serialized_ml_model.LinRegParameters": [[14, 7, 1, "", "coef"], [14, 7, 1, "", "intercept"], [14, 7, 1, "", "n_features_in"], [14, 7, 1, "", "rank"], [14, 7, 1, "", "singular"]], "agentlib_mpc.models.serialized_ml_model.MLModels": [[14, 2, 1, "", "ANN"], [14, 2, 1, "", "GPR"], [14, 2, 1, "", "LINREG"]], "agentlib_mpc.models.serialized_ml_model.SerializedANN": [[14, 3, 1, "", "deserialize"], [14, 7, 1, "", "model_type"], [14, 3, 1, "", "serialize"], [14, 7, 1, "id0", "structure"], [14, 3, 1, "", "to_dict"], [14, 7, 1, "id1", "weights"]], "agentlib_mpc.models.serialized_ml_model.SerializedGPR": [[14, 7, 1, "", "data_handling"], [14, 3, 1, "", "deserialize"], [14, 7, 1, "", "gpr_parameters"], [14, 7, 1, "", "kernel_parameters"], [14, 7, 1, "", "model_type"], [14, 3, 1, "", "serialize"]], "agentlib_mpc.models.serialized_ml_model.SerializedLinReg": [[14, 3, 1, "", "deserialize"], [14, 7, 1, "", "model_type"], [14, 7, 1, "", "parameters"], [14, 3, 1, "", "serialize"]], "agentlib_mpc.models.serialized_ml_model.SerializedMLModel": [[14, 7, 1, "", "agentlib_mpc_hash"], [14, 3, 1, "", "deserialize"], [14, 7, 1, "", "dt"], [14, 7, 1, "", "input"], [14, 3, 1, "", "load_serialized_model"], [14, 3, 1, "", "load_serialized_model_from_dict"], [14, 3, 1, "", "load_serialized_model_from_file"], [14, 3, 1, "", "load_serialized_model_from_string"], [14, 7, 1, "", "model_type"], [14, 7, 1, "", "output"], [14, 3, 1, "", "save_serialized_model"], [14, 3, 1, "", "serialize"], [14, 7, 1, "", "training_info"]], "agentlib_mpc.modules": [[16, 0, 0, "-", "InputPrediction"], [15, 1, 1, "", "ModuleImport"], [15, 0, 0, "-", "data_source"], [17, 0, 0, "-", "dmpc"], [19, 0, 0, "-", "estimation"], [15, 0, 0, "-", "minlp_mpc"], [20, 0, 0, "-", "ml_model_training"], [15, 0, 0, "-", "mpc"], [15, 0, 0, "-", "mpc_full"]], "agentlib_mpc.modules.InputPrediction": [[16, 0, 0, "-", "try_predictor"]], "agentlib_mpc.modules.InputPrediction.try_predictor": [[16, 1, 1, "", "TRYPredictor"], [16, 6, 1, "", "TRYPredictorConfig"]], "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor": [[16, 3, 1, "", "process"], [16, 3, 1, "", "send_measurement"], [16, 3, 1, "", "send_prediction"]], "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictorConfig": [[16, 3, 1, "", "model_post_init"], [16, 7, 1, "", "prediction_length"], [16, 7, 1, "", "predictions"]], "agentlib_mpc.modules.ModuleImport": [[15, 3, 1, "", "import_class"]], "agentlib_mpc.modules.data_source": [[15, 1, 1, "", "DataSource"], [15, 6, 1, "", "DataSourceConfig"]], "agentlib_mpc.modules.data_source.DataSource": [[15, 3, 1, "", "process"], [15, 3, 1, "", "register_callbacks"], [15, 3, 1, "", "transform_index"]], "agentlib_mpc.modules.data_source.DataSourceConfig": [[15, 8, 1, "", "check_data"], [15, 8, 1, "", "check_interpolation_method"], [15, 7, 1, "", "columns"], [15, 7, 1, "", "data"], [15, 7, 1, "", "data_offset"], [15, 7, 1, "", "interpolation_method"], [15, 3, 1, "", "model_post_init"], [15, 7, 1, "", "t_sample"]], "agentlib_mpc.modules.dmpc": [[17, 1, 1, "", "DistributedMPC"], [17, 6, 1, "", "DistributedMPCConfig"], [18, 0, 0, "-", "admm"], [17, 0, 0, "-", "coordinator"], [17, 0, 0, "-", "employee"]], "agentlib_mpc.modules.dmpc.DistributedMPCConfig": [[17, 3, 1, "", "model_post_init"]], "agentlib_mpc.modules.dmpc.admm": [[18, 0, 0, "-", "admm"], [18, 0, 0, "-", "admm_coordinated"], [18, 0, 0, "-", "admm_coordinator"]], "agentlib_mpc.modules.dmpc.admm.admm": [[18, 1, 1, "", "ADMM"], [18, 6, 1, "", "ADMMConfig"], [18, 1, 1, "", "ADMMParticipation"], [18, 1, 1, "", "LocalADMM"], [18, 6, 1, "", "LocalADMMConfig"], [18, 1, 1, "", "ModuleStatus"], [18, 1, 1, "", "ParticipantStatus"]], "agentlib_mpc.modules.dmpc.admm.admm.ADMM": [[18, 3, 1, "", "admm_step"], [18, 3, 1, "", "all_coupling_statuses"], [18, 3, 1, "", "assert_mpc_variables_are_in_model"], [18, 3, 1, "", "collect_couplings_for_optimization"], [18, 3, 1, "", "collect_variables_for_optimization"], [18, 4, 1, "", "cons_and_exchange"], [18, 3, 1, "", "deregister_all_participants"], [18, 3, 1, "", "get_participants_values"], [18, 3, 1, "", "get_results"], [18, 3, 1, "", "participant_callback"], [18, 4, 1, "", "penalty_factor_var"], [18, 3, 1, "", "process"], [18, 3, 1, "", "receive_participant"], [18, 4, 1, "", "registered_participants"], [18, 3, 1, "", "reset_participants_ready"], [18, 3, 1, "", "send_coupling_values"], [18, 3, 1, "", "send_coupling_variable"], [18, 3, 1, "", "update_lambda"], [18, 2, 1, "", "var_ref"]], "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig": [[18, 8, 1, "", "check_prefixes_of_variables"], [18, 7, 1, "", "controls"], [18, 7, 1, "", "couplings"], [18, 7, 1, "", "exchange"], [18, 7, 1, "", "inputs"], [18, 7, 1, "", "iteration_timeout"], [18, 7, 1, "", "log_level"], [18, 7, 1, "", "max_iterations"], [18, 3, 1, "", "model_post_init"], [18, 7, 1, "", "module_id"], [18, 7, 1, "", "optimization_backend"], [18, 7, 1, "", "outputs"], [18, 7, 1, "", "parameters"], [18, 7, 1, "", "penalty_factor"], [18, 7, 1, "", "prediction_horizon"], [18, 7, 1, "", "r_del_u"], [18, 7, 1, "", "registration_period"], [18, 7, 1, "", "sampling_time"], [18, 7, 1, "", "set_outputs"], [18, 7, 1, "", "shared_variable_fields"], [18, 7, 1, "", "states"], [18, 7, 1, "", "time_step"], [18, 7, 1, "", "type"], [18, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation": [[18, 3, 1, "", "de_register"], [18, 3, 1, "", "empty_memory"]], "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM": [[18, 3, 1, "", "process"], [18, 4, 1, "", "registration_delay"], [18, 4, 1, "", "sync_delay"]], "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig": [[18, 7, 1, "", "controls"], [18, 7, 1, "", "couplings"], [18, 7, 1, "", "exchange"], [18, 7, 1, "", "inputs"], [18, 7, 1, "", "iteration_timeout"], [18, 7, 1, "", "log_level"], [18, 7, 1, "", "max_iterations"], [18, 3, 1, "", "model_post_init"], [18, 7, 1, "", "module_id"], [18, 7, 1, "", "optimization_backend"], [18, 7, 1, "", "outputs"], [18, 7, 1, "", "parameters"], [18, 7, 1, "", "penalty_factor"], [18, 7, 1, "", "prediction_horizon"], [18, 7, 1, "", "r_del_u"], [18, 7, 1, "", "registration_delay"], [18, 7, 1, "", "registration_period"], [18, 7, 1, "", "sampling_time"], [18, 7, 1, "", "set_outputs"], [18, 7, 1, "", "shared_variable_fields"], [18, 7, 1, "", "states"], [18, 7, 1, "", "sync_delay"], [18, 7, 1, "", "time_step"], [18, 7, 1, "", "type"], [18, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus": [[18, 2, 1, "", "at_registration"], [18, 2, 1, "", "not_started"], [18, 2, 1, "", "optimizing"], [18, 2, 1, "", "sleeping"], [18, 2, 1, "", "syncing"], [18, 2, 1, "", "updating"], [18, 2, 1, "", "waiting_for_other_agents"]], "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus": [[18, 2, 1, "", "available"], [18, 2, 1, "", "confirmed"], [18, 2, 1, "", "not_available"], [18, 2, 1, "", "not_participating"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinated": [[18, 1, 1, "", "CoordinatedADMM"], [18, 6, 1, "", "CoordinatedADMMConfig"], [18, 2, 1, "", "coupInput"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM": [[18, 3, 1, "", "get_new_measurement"], [18, 3, 1, "", "init_iteration_callback"], [18, 3, 1, "", "optimize"], [18, 3, 1, "", "process"], [18, 3, 1, "", "registration_callback"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig": [[18, 7, 1, "", "controls"], [18, 7, 1, "", "coordinator"], [18, 7, 1, "", "couplings"], [18, 8, 1, "", "couplings_should_have_values"], [18, 7, 1, "", "exchange"], [18, 7, 1, "", "inputs"], [18, 7, 1, "", "iteration_timeout"], [18, 7, 1, "", "log_level"], [18, 7, 1, "", "max_iterations"], [18, 7, 1, "", "messages_in"], [18, 7, 1, "", "messages_out"], [18, 3, 1, "", "model_post_init"], [18, 7, 1, "", "module_id"], [18, 7, 1, "", "optimization_backend"], [18, 7, 1, "", "outputs"], [18, 7, 1, "", "parameters"], [18, 7, 1, "", "penalty_factor"], [18, 7, 1, "", "prediction_horizon"], [18, 7, 1, "", "r_del_u"], [18, 7, 1, "", "registration_interval"], [18, 7, 1, "", "registration_period"], [18, 7, 1, "", "request_frequency"], [18, 7, 1, "", "sampling_time"], [18, 7, 1, "", "set_outputs"], [18, 7, 1, "", "shared_variable_fields"], [18, 7, 1, "", "states"], [18, 7, 1, "", "time_step"], [18, 7, 1, "", "type"], [18, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinator": [[18, 1, 1, "", "ADMMCoordinator"], [18, 6, 1, "", "ADMMCoordinatorConfig"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator": [[18, 3, 1, "", "cleanup_results"], [18, 3, 1, "", "get_results"], [18, 3, 1, "", "optim_results_callback"], [18, 3, 1, "", "register_agent"], [18, 3, 1, "", "registration_callback"], [18, 3, 1, "", "trigger_optimizations"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig": [[18, 7, 1, "", "abs_tol"], [18, 7, 1, "", "admm_iter_max"], [18, 8, 1, "", "default_sampling_time"], [18, 7, 1, "", "dual_tol"], [18, 7, 1, "", "log_level"], [18, 7, 1, "", "maxIter"], [18, 7, 1, "", "messages_in"], [18, 7, 1, "", "messages_out"], [18, 3, 1, "", "model_post_init"], [18, 7, 1, "", "module_id"], [18, 7, 1, "", "penalty_change_factor"], [18, 7, 1, "", "penalty_change_threshold"], [18, 7, 1, "", "penalty_factor"], [18, 7, 1, "", "prediction_horizon"], [18, 7, 1, "", "primal_tol"], [18, 7, 1, "", "registration_period"], [18, 7, 1, "", "rel_tol"], [18, 7, 1, "", "sampling_time"], [18, 7, 1, "", "save_iter_interval"], [18, 7, 1, "", "save_solve_stats"], [18, 7, 1, "", "shared_variable_fields"], [18, 7, 1, "", "solve_stats_file"], [18, 8, 1, "", "solve_stats_file_is_csv"], [18, 7, 1, "", "time_out_non_responders"], [18, 7, 1, "", "time_step"], [18, 7, 1, "", "type"], [18, 7, 1, "", "use_relative_tolerances"], [18, 7, 1, "", "validate_incoming_values"], [18, 7, 1, "", "wait_time_on_start_iters"]], "agentlib_mpc.modules.dmpc.coordinator": [[17, 1, 1, "", "Coordinator"], [17, 6, 1, "", "CoordinatorConfig"]], "agentlib_mpc.modules.dmpc.coordinator.Coordinator": [[17, 4, 1, "", "all_finished"], [17, 3, 1, "", "init_iteration_callback"], [17, 3, 1, "", "optim_results_callback"], [17, 3, 1, "", "process"], [17, 3, 1, "", "register_callbacks"], [17, 3, 1, "", "registration_callback"], [17, 3, 1, "", "trigger_optimizations"]], "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig": [[17, 7, 1, "", "log_level"], [17, 7, 1, "", "maxIter"], [17, 7, 1, "", "messages_in"], [17, 7, 1, "", "messages_out"], [17, 3, 1, "", "model_post_init"], [17, 7, 1, "", "module_id"], [17, 7, 1, "", "shared_variable_fields"], [17, 7, 1, "", "time_out_non_responders"], [17, 7, 1, "", "type"], [17, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.dmpc.employee": [[17, 1, 1, "", "MiniEmployee"], [17, 6, 1, "", "MiniEmployeeConfig"]], "agentlib_mpc.modules.dmpc.employee.MiniEmployee": [[17, 3, 1, "", "get_new_measurement"], [17, 3, 1, "", "init_iteration_callback"], [17, 3, 1, "", "optimize"], [17, 3, 1, "", "pre_computation_hook"], [17, 3, 1, "", "process"], [17, 3, 1, "", "register_callbacks"], [17, 3, 1, "", "registration_callback"], [17, 3, 1, "", "shift_trajectories"]], "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig": [[17, 7, 1, "", "coordinator"], [17, 7, 1, "", "log_level"], [17, 7, 1, "", "messages_in"], [17, 7, 1, "", "messages_out"], [17, 3, 1, "", "model_post_init"], [17, 7, 1, "", "module_id"], [17, 7, 1, "", "registration_interval"], [17, 7, 1, "", "request_frequency"], [17, 7, 1, "", "shared_variable_fields"], [17, 7, 1, "", "type"], [17, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.estimation": [[19, 0, 0, "-", "mhe"]], "agentlib_mpc.modules.estimation.mhe": [[19, 1, 1, "", "MHE"], [19, 6, 1, "", "MHEConfig"]], "agentlib_mpc.modules.estimation.mhe.MHE": [[19, 3, 1, "", "cleanup_results"], [19, 3, 1, "", "collect_variables_for_optimization"], [19, 2, 1, "", "config_type"], [19, 3, 1, "", "get_results"], [19, 3, 1, "", "process"], [19, 3, 1, "", "read_results_file"], [19, 3, 1, "", "register_callbacks"], [19, 2, 1, "", "var_ref"]], "agentlib_mpc.modules.estimation.mhe.MHEConfig": [[19, 2, 1, "", "decorator_info"], [19, 7, 1, "", "estimated_inputs"], [19, 7, 1, "", "estimated_parameters"], [19, 7, 1, "", "horizon"], [19, 7, 1, "", "known_inputs"], [19, 7, 1, "", "known_parameters"], [19, 3, 1, "", "model_post_init"], [19, 7, 1, "", "optimization_backend"], [19, 7, 1, "", "shared_variable_fields"], [19, 2, 1, "", "shim"], [19, 7, 1, "", "state_weights"], [19, 3, 1, "", "state_weights_are_in_states"], [19, 7, 1, "", "states"], [19, 7, 1, "", "time_step"], [19, 2, 1, "", "wrapped"]], "agentlib_mpc.modules.minlp_mpc": [[15, 1, 1, "", "MINLPMPC"], [15, 6, 1, "", "MINLPMPCConfig"]], "agentlib_mpc.modules.minlp_mpc.MINLPMPC": [[15, 3, 1, "", "assert_mpc_variables_are_in_model"], [15, 3, 1, "", "set_actuation"]], "agentlib_mpc.modules.minlp_mpc.MINLPMPCConfig": [[15, 7, 1, "", "binary_controls"], [15, 3, 1, "", "model_post_init"], [15, 8, 1, "", "validate_binary_bounds"]], "agentlib_mpc.modules.ml_model_training": [[20, 0, 0, "-", "data_reduction"], [20, 0, 0, "-", "ml_model_trainer"], [20, 0, 0, "-", "setpoint_generator"]], "agentlib_mpc.modules.ml_model_training.data_reduction": [[20, 1, 1, "", "InducingPoints"], [20, 1, 1, "", "NystroemReducer"]], "agentlib_mpc.modules.ml_model_training.data_reduction.InducingPoints": [[20, 3, 1, "", "reduce"]], "agentlib_mpc.modules.ml_model_training.data_reduction.NystroemReducer": [[20, 3, 1, "", "reduce"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer": [[20, 1, 1, "", "ANNTrainer"], [20, 6, 1, "", "ANNTrainerConfig"], [20, 1, 1, "", "GPRTrainer"], [20, 6, 1, "", "GPRTrainerConfig"], [20, 1, 1, "", "LinRegTrainer"], [20, 6, 1, "", "LinRegTrainerConfig"], [20, 1, 1, "", "MLModelTrainer"], [20, 6, 1, "", "MLModelTrainerConfig"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer": [[20, 3, 1, "", "build_ml_model"], [20, 3, 1, "", "fit_ml_model"], [20, 2, 1, "", "model_type"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig": [[20, 7, 1, "", "batch_size"], [20, 7, 1, "", "early_stopping"], [20, 7, 1, "", "epochs"], [20, 7, 1, "", "layers"], [20, 3, 1, "", "model_post_init"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer": [[20, 3, 1, "", "build_ml_model"], [20, 3, 1, "", "fit_ml_model"], [20, 2, 1, "", "model_type"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig": [[20, 7, 1, "", "constant_value_bounds"], [20, 7, 1, "", "length_scale_bounds"], [20, 3, 1, "", "model_post_init"], [20, 7, 1, "", "n_restarts_optimizer"], [20, 7, 1, "", "noise_level"], [20, 7, 1, "", "noise_level_bounds"], [20, 7, 1, "", "normalize"], [20, 7, 1, "", "scale"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer": [[20, 3, 1, "", "build_ml_model"], [20, 3, 1, "", "fit_ml_model"], [20, 2, 1, "", "model_type"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainerConfig": [[20, 3, 1, "", "model_post_init"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer": [[20, 4, 1, "", "agent_and_time"], [20, 3, 1, "", "build_ml_model"], [20, 3, 1, "", "create_inputs_and_outputs"], [20, 3, 1, "", "divide_in_tvt"], [20, 3, 1, "", "fit_ml_model"], [20, 4, 1, "", "input_names"], [20, 2, 1, "", "model_type"], [20, 4, 1, "", "output_names"], [20, 3, 1, "", "process"], [20, 3, 1, "", "register_callbacks"], [20, 3, 1, "", "resample"], [20, 3, 1, "", "retrain_model"], [20, 3, 1, "", "save_all"], [20, 3, 1, "", "save_ml_model"], [20, 3, 1, "", "serialize_ml_model"], [20, 4, 1, "", "training_info"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig": [[20, 7, 1, "", "MLModel"], [20, 8, 1, "", "check_data_sources_exist"], [20, 8, 1, "", "check_if_save_path_is_there"], [20, 8, 1, "", "check_shares_amount_to_one"], [20, 7, 1, "", "data_sources"], [20, 8, 1, "", "fill_interpolations"], [20, 8, 1, "", "fill_lags"], [20, 8, 1, "", "fill_output_types"], [20, 8, 1, "", "fill_recursive_outputs"], [20, 7, 1, "", "inputs"], [20, 7, 1, "", "interpolations"], [20, 7, 1, "", "lags"], [20, 3, 1, "", "model_post_init"], [20, 7, 1, "", "output_types"], [20, 7, 1, "", "outputs"], [20, 7, 1, "", "recursive_outputs"], [20, 7, 1, "", "retrain_delay"], [20, 7, 1, "", "save_data"], [20, 7, 1, "", "save_directory"], [20, 7, 1, "", "save_ml_model"], [20, 7, 1, "", "save_plots"], [20, 7, 1, "", "shared_variable_fields"], [20, 7, 1, "", "step_size"], [20, 7, 1, "", "test_share"], [20, 7, 1, "", "time_series_length"], [20, 7, 1, "", "time_series_memory_size"], [20, 7, 1, "", "train_share"], [20, 7, 1, "", "use_values_for_incomplete_data"], [20, 7, 1, "", "validation_share"]], "agentlib_mpc.modules.ml_model_training.setpoint_generator": [[20, 1, 1, "", "SetPointGenerator"], [20, 6, 1, "", "SetPointGeneratorConfig"]], "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator": [[20, 3, 1, "", "process"], [20, 3, 1, "", "register_callbacks"], [20, 3, 1, "", "update_target"]], "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig": [[20, 7, 1, "", "day_end"], [20, 7, 1, "", "day_lb"], [20, 7, 1, "", "day_start"], [20, 7, 1, "", "day_ub"], [20, 7, 1, "", "interval"], [20, 3, 1, "", "model_post_init"], [20, 7, 1, "", "night_lb"], [20, 7, 1, "", "night_ub"], [20, 7, 1, "", "shared_variable_fields"], [20, 7, 1, "", "target_variable"]], "agentlib_mpc.modules.mpc": [[15, 1, 1, "", "BaseMPC"], [15, 6, 1, "", "BaseMPCConfig"], [15, 5, 1, "", "create_optimization_backend"]], "agentlib_mpc.modules.mpc.BaseMPC": [[15, 3, 1, "", "assert_mpc_variables_are_in_model"], [15, 3, 1, "", "assert_subset"], [15, 3, 1, "", "cleanup_results"], [15, 3, 1, "", "collect_variables_for_optimization"], [15, 3, 1, "", "do_step"], [15, 3, 1, "", "get_results"], [15, 4, 1, "", "model"], [15, 3, 1, "", "pre_computation_hook"], [15, 3, 1, "", "process"], [15, 3, 1, "", "re_init_optimization"], [15, 3, 1, "", "read_results_file"], [15, 3, 1, "", "register_callbacks"], [15, 3, 1, "", "set_actuation"], [15, 3, 1, "", "set_output"], [15, 3, 1, "", "warn_for_missed_solves"]], "agentlib_mpc.modules.mpc.BaseMPCConfig": [[15, 7, 1, "", "controls"], [15, 8, 1, "", "default_sampling_time"], [15, 7, 1, "", "inputs"], [15, 7, 1, "", "log_level"], [15, 3, 1, "", "model_post_init"], [15, 7, 1, "", "module_id"], [15, 7, 1, "", "optimization_backend"], [15, 7, 1, "", "outputs"], [15, 7, 1, "", "parameters"], [15, 7, 1, "", "prediction_horizon"], [15, 7, 1, "", "sampling_time"], [15, 7, 1, "", "set_outputs"], [15, 7, 1, "", "shared_variable_fields"], [15, 7, 1, "", "states"], [15, 7, 1, "", "time_step"], [15, 7, 1, "", "type"], [15, 7, 1, "", "validate_incoming_values"]], "agentlib_mpc.modules.mpc_full": [[15, 1, 1, "", "MPC"], [15, 6, 1, "", "MPCConfig"]], "agentlib_mpc.modules.mpc_full.MPC": [[15, 3, 1, "", "collect_variables_for_optimization"], [15, 3, 1, "", "do_step"], [15, 3, 1, "", "register_callbacks_for_lagged_variables"]], "agentlib_mpc.modules.mpc_full.MPCConfig": [[15, 8, 1, "", "check_r_del_u_in_controls"], [15, 3, 1, "", "model_post_init"], [15, 7, 1, "", "r_del_u"]], "agentlib_mpc.optimization_backends": [[21, 6, 1, "", "BackendImport"], [21, 0, 0, "-", "backend"], [22, 0, 0, "-", "casadi_"]], "agentlib_mpc.optimization_backends.BackendImport": [[21, 7, 1, "", "class_name"], [21, 7, 1, "", "import_path"]], "agentlib_mpc.optimization_backends.backend": [[21, 1, 1, "", "ADMMBackend"], [21, 6, 1, "", "BackendConfig"], [21, 1, 1, "", "OptimizationBackend"]], "agentlib_mpc.optimization_backends.backend.ADMMBackend": [[21, 4, 1, "", "coupling_grid"]], "agentlib_mpc.optimization_backends.backend.BackendConfig": [[21, 8, 1, "", "check_csv"], [21, 8, 1, "", "check_overwrite"], [21, 8, 1, "", "disable_results_if_no_file"], [21, 7, 1, "", "discretization_options"], [21, 7, 1, "", "model"], [21, 7, 1, "", "name"], [21, 7, 1, "", "overwrite_result_file"], [21, 7, 1, "", "results_file"], [21, 7, 1, "", "save_results"]], "agentlib_mpc.optimization_backends.backend.OptimizationBackend": [[21, 2, 1, "", "config_type"], [21, 2, 1, "", "cost_function"], [21, 3, 1, "", "get_lags_per_variable"], [21, 2, 1, "", "model"], [21, 3, 1, "", "model_from_config"], [21, 2, 1, "", "mpc_backend_parameters"], [21, 3, 1, "", "register_logger"], [21, 3, 1, "", "results_file_exists"], [21, 3, 1, "", "setup_optimization"], [21, 3, 1, "", "solve"], [21, 3, 1, "", "update_discretization_options"], [21, 3, 1, "", "update_model_variables"], [21, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_": [[22, 0, 0, "-", "admm"], [22, 0, 0, "-", "basic"], [22, 0, 0, "-", "casadi_admm_ml"], [22, 0, 0, "-", "casadi_ml"], [23, 0, 0, "-", "core"], [22, 0, 0, "-", "full"], [22, 0, 0, "-", "mhe"], [22, 0, 0, "-", "minlp"]], "agentlib_mpc.optimization_backends.casadi_.admm": [[22, 1, 1, "", "ADMMCollocation"], [22, 1, 1, "", "ADMMMultipleShooting"], [22, 1, 1, "", "CasADiADMMBackend"], [22, 1, 1, "", "CasadiADMMSystem"]], "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend": [[22, 2, 1, "", "cost_function"], [22, 4, 1, "", "coupling_grid"], [22, 2, 1, "", "discretization"], [22, 2, 1, "", "discretization_types"], [22, 2, 1, "", "it"], [22, 2, 1, "", "model"], [22, 2, 1, "", "now"], [22, 2, 1, "", "result_stats"], [22, 2, 1, "", "results"], [22, 3, 1, "", "save_result_df"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"], [22, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem": [[22, 2, 1, "", "algebraics"], [22, 2, 1, "", "controls"], [22, 2, 1, "", "cost_function"], [22, 2, 1, "", "exchange_diff"], [22, 2, 1, "", "exchange_multipliers"], [22, 2, 1, "", "global_couplings"], [22, 2, 1, "", "initial_state"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "last_control"], [22, 2, 1, "", "local_couplings"], [22, 2, 1, "", "local_exchange"], [22, 2, 1, "", "model_constraints"], [22, 2, 1, "", "model_parameters"], [22, 2, 1, "", "multipliers"], [22, 2, 1, "", "non_controlled_inputs"], [22, 2, 1, "", "ode"], [22, 2, 1, "", "outputs"], [22, 2, 1, "", "penalty_factor"], [22, 2, 1, "", "r_del_u"], [22, 2, 1, "", "states"]], "agentlib_mpc.optimization_backends.casadi_.basic": [[22, 1, 1, "", "BaseSystem"], [22, 1, 1, "", "CasADiBaseBackend"], [22, 1, 1, "", "CollocationMatrices"], [22, 1, 1, "", "DirectCollocation"], [22, 1, 1, "", "MultipleShooting"]], "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem": [[22, 2, 1, "", "algebraics"], [22, 2, 1, "", "controls"], [22, 2, 1, "", "cost_function"], [22, 2, 1, "", "initial_state"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "model_constraints"], [22, 2, 1, "", "model_parameters"], [22, 2, 1, "", "non_controlled_inputs"], [22, 2, 1, "", "ode"], [22, 2, 1, "", "outputs"], [22, 2, 1, "", "states"]], "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend": [[22, 2, 1, "", "cost_function"], [22, 2, 1, "", "discretization"], [22, 2, 1, "", "discretization_types"], [22, 2, 1, "", "model"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"], [22, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices": [[22, 2, 1, "", "B"], [22, 2, 1, "", "C"], [22, 2, 1, "", "D"], [22, 2, 1, "", "order"], [22, 2, 1, "", "root"]], "agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation": [[22, 3, 1, "", "initialize"]], "agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting": [[22, 3, 1, "", "initialize"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml": [[22, 1, 1, "", "CasADiADMMBackend_NN"], [22, 1, 1, "", "CasadiADMMNNSystem"], [22, 1, 1, "", "MultipleShootingADMMNN"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN": [[22, 2, 1, "", "discretization_types"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem": [[22, 3, 1, "", "initialize"], [22, 4, 1, "", "parameters"], [22, 2, 1, "", "past_couplings"], [22, 2, 1, "", "past_exchange"], [22, 4, 1, "", "quantities"], [22, 4, 1, "", "sim_step_quantities"], [22, 4, 1, "", "variables"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.MultipleShootingADMMNN": [[22, 2, 1, "", "max_lag"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml": [[22, 1, 1, "", "CasADiBBBackend"], [22, 1, 1, "", "CasadiMLSystem"], [22, 1, 1, "", "MultipleShooting_ML"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend": [[22, 2, 1, "", "discretization_types"], [22, 3, 1, "", "get_lags_per_variable"], [22, 2, 1, "", "lag_collection"], [22, 2, 1, "", "max_lag"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem": [[22, 3, 1, "", "all_system_quantities"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "lags_dict"], [22, 4, 1, "", "max_lag"], [22, 2, 1, "", "model"], [22, 2, 1, "", "sim_step"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML": [[22, 3, 1, "", "initialize"], [22, 2, 1, "", "max_lag"]], "agentlib_mpc.optimization_backends.casadi_.core": [[23, 0, 0, "-", "VariableGroup"], [23, 0, 0, "-", "casadi_backend"], [23, 0, 0, "-", "discretization"], [23, 0, 0, "-", "system"]], "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup": [[23, 1, 1, "", "OptimizationParameter"], [23, 1, 1, "", "OptimizationQuantity"], [23, 1, 1, "", "OptimizationVariable"]], "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter": [[23, 2, 1, "", "add_default_values"], [23, 3, 1, "", "declare"], [23, 2, 1, "", "dim"], [23, 2, 1, "", "full_names"], [23, 2, 1, "", "full_symbolic"], [23, 2, 1, "", "full_with_defaults"], [23, 2, 1, "", "name"], [23, 2, 1, "", "ref_names"], [23, 2, 1, "", "use_in_stage_function"]], "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity": [[23, 2, 1, "", "dim"], [23, 2, 1, "", "full_names"], [23, 2, 1, "", "full_symbolic"], [23, 2, 1, "", "name"], [23, 2, 1, "", "ref_names"], [23, 2, 1, "", "use_in_stage_function"]], "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable": [[23, 2, 1, "", "binary"], [23, 3, 1, "", "declare"], [23, 2, 1, "", "dim"], [23, 2, 1, "", "full_names"], [23, 2, 1, "", "full_symbolic"], [23, 2, 1, "", "input_map"], [23, 2, 1, "", "name"], [23, 2, 1, "", "output_map"], [23, 2, 1, "", "ref_names"], [23, 2, 1, "", "use_in_stage_function"]], "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend": [[23, 1, 1, "", "CasADiBackend"], [23, 6, 1, "", "CasadiBackendConfig"]], "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend": [[23, 2, 1, "", "config_type"], [23, 2, 1, "", "cost_function"], [23, 2, 1, "", "discretization"], [23, 2, 1, "", "discretization_types"], [23, 2, 1, "", "model"], [23, 3, 1, "", "reset_setup_attributes"], [23, 3, 1, "", "save_result_df"], [23, 3, 1, "", "setup_optimization"], [23, 3, 1, "", "solve"], [23, 2, 1, "", "system"], [23, 2, 1, "", "system_type"], [23, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig": [[23, 7, 1, "", "build_batch_bat"], [23, 7, 1, "", "discretization_options"], [23, 7, 1, "", "do_jit"], [23, 7, 1, "", "model"], [23, 7, 1, "", "name"], [23, 7, 1, "", "overwrite_result_file"], [23, 7, 1, "", "results_file"], [23, 7, 1, "", "save_results"], [23, 7, 1, "", "solver"], [23, 8, 1, "", "validate_compile"]], "agentlib_mpc.optimization_backends.casadi_.core.discretization": [[23, 1, 1, "", "Discretization"], [23, 1, 1, "", "Results"]], "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization": [[23, 3, 1, "", "add_constraint"], [23, 3, 1, "", "add_opt_par"], [23, 3, 1, "", "add_opt_var"], [23, 4, 1, "", "binary_vars"], [23, 2, 1, "", "constraints"], [23, 2, 1, "", "constraints_lb"], [23, 2, 1, "", "constraints_ub"], [23, 3, 1, "", "create_nlp_in_out_mapping"], [23, 2, 1, "", "equalities"], [23, 3, 1, "", "grid"], [23, 2, 1, "", "initial_guess"], [23, 3, 1, "", "initialize"], [23, 2, 1, "", "k"], [23, 2, 1, "", "mpc_opt_pars"], [23, 2, 1, "", "mpc_opt_vars"], [23, 4, 1, "", "nlp"], [23, 2, 1, "", "objective_function"], [23, 2, 1, "", "only_positive_times_in_results"], [23, 2, 1, "", "opt_pars"], [23, 2, 1, "", "opt_vars"], [23, 2, 1, "", "opt_vars_lb"], [23, 2, 1, "", "opt_vars_ub"], [23, 2, 1, "", "pred_time"], [23, 3, 1, "", "solve"]], "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results": [[23, 2, 1, "", "columns"], [23, 4, 1, "", "df"], [23, 2, 1, "", "grid"], [23, 2, 1, "", "matrix"], [23, 2, 1, "", "stats"], [23, 3, 1, "", "stats_line"], [23, 2, 1, "", "variable_grid_indices"], [23, 3, 1, "", "variable_lookup"], [23, 3, 1, "", "write_columns"], [23, 3, 1, "", "write_stats_columns"]], "agentlib_mpc.optimization_backends.casadi_.core.system": [[23, 1, 1, "", "System"]], "agentlib_mpc.optimization_backends.casadi_.core.system.System": [[23, 3, 1, "", "initialize"], [23, 4, 1, "", "parameters"], [23, 4, 1, "", "quantities"], [23, 4, 1, "", "variables"]], "agentlib_mpc.optimization_backends.casadi_.full": [[22, 1, 1, "", "CasADiFullBackend"], [22, 1, 1, "", "DirectCollocation"], [22, 1, 1, "", "FullSystem"], [22, 1, 1, "", "MultipleShooting"]], "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend": [[22, 2, 1, "", "cost_function"], [22, 2, 1, "", "discretization"], [22, 2, 1, "", "discretization_types"], [22, 2, 1, "", "model"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"], [22, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_.full.FullSystem": [[22, 2, 1, "", "algebraics"], [22, 2, 1, "", "controls"], [22, 2, 1, "", "cost_function"], [22, 2, 1, "", "initial_state"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "last_control"], [22, 2, 1, "", "model_constraints"], [22, 2, 1, "", "model_parameters"], [22, 2, 1, "", "non_controlled_inputs"], [22, 2, 1, "", "ode"], [22, 2, 1, "", "outputs"], [22, 2, 1, "", "r_del_u"], [22, 2, 1, "", "states"]], "agentlib_mpc.optimization_backends.casadi_.mhe": [[22, 1, 1, "", "CollocationMatrices"], [22, 1, 1, "", "DirectCollocation"], [22, 1, 1, "", "MHEBackend"], [22, 1, 1, "", "MHESystem"]], "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices": [[22, 2, 1, "", "B"], [22, 2, 1, "", "C"], [22, 2, 1, "", "D"], [22, 2, 1, "", "order"], [22, 2, 1, "", "root"]], "agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation": [[22, 3, 1, "", "initialize"], [22, 2, 1, "", "only_positive_times_in_results"]], "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend": [[22, 2, 1, "", "discretization_types"], [22, 3, 1, "", "sample"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"]], "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem": [[22, 2, 1, "", "algebraics"], [22, 2, 1, "", "cost_function"], [22, 2, 1, "", "estimated_inputs"], [22, 2, 1, "", "estimated_parameters"], [22, 2, 1, "", "estimated_states"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "known_inputs"], [22, 2, 1, "", "known_parameters"], [22, 2, 1, "", "measured_states"], [22, 2, 1, "", "model_constraints"], [22, 2, 1, "", "ode"], [22, 2, 1, "", "outputs"]], "agentlib_mpc.optimization_backends.casadi_.minlp": [[22, 1, 1, "", "CasADiMINLPBackend"], [22, 1, 1, "", "CasadiMINLPSystem"], [22, 1, 1, "", "DirectCollocation"]], "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend": [[22, 2, 1, "", "cost_function"], [22, 2, 1, "", "discretization"], [22, 2, 1, "", "discretization_types"], [22, 2, 1, "", "model"], [22, 2, 1, "", "system"], [22, 2, 1, "", "system_type"], [22, 2, 1, "", "var_ref"]], "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem": [[22, 2, 1, "", "algebraics"], [22, 2, 1, "", "binary_controls"], [22, 2, 1, "", "controls"], [22, 2, 1, "", "cost_function"], [22, 2, 1, "", "initial_state"], [22, 3, 1, "", "initialize"], [22, 2, 1, "", "model_constraints"], [22, 2, 1, "", "model_parameters"], [22, 2, 1, "", "non_controlled_inputs"], [22, 2, 1, "", "ode"], [22, 2, 1, "", "outputs"], [22, 2, 1, "", "states"]], "agentlib_mpc.utils": [[24, 0, 0, "-", "analysis"], [25, 0, 0, "-", "plotting"], [24, 0, 0, "-", "sampling"]], "agentlib_mpc.utils.analysis": [[24, 5, 1, "", "admm_at_time_step"], [24, 5, 1, "", "convert_index"], [24, 5, 1, "", "convert_multi_index"], [24, 5, 1, "", "first_vals_at_trajectory_index"], [24, 5, 1, "", "get_number_of_iterations"], [24, 5, 1, "", "get_time_steps"], [24, 5, 1, "", "last_vals_at_trajectory_index"], [24, 5, 1, "", "load_admm"], [24, 5, 1, "", "load_mpc"], [24, 5, 1, "", "load_mpc_stats"], [24, 5, 1, "", "load_sim"], [24, 5, 1, "", "mpc_at_time_step"], [24, 5, 1, "", "perform_index_update"]], "agentlib_mpc.utils.plotting": [[25, 0, 0, "-", "admm_animation"], [25, 0, 0, "-", "admm_consensus_shades"], [25, 0, 0, "-", "admm_dashboard"], [25, 0, 0, "-", "admm_residuals"], [25, 0, 0, "-", "basic"], [25, 0, 0, "-", "discretization_structure"], [25, 0, 0, "-", "interactive"], [25, 0, 0, "-", "ml_model_test"], [25, 0, 0, "-", "mpc"]], "agentlib_mpc.utils.plotting.admm_animation": [[25, 5, 1, "", "animate_full"], [25, 5, 1, "", "init_full"], [25, 5, 1, "", "make_animation"], [25, 5, 1, "", "make_image"], [25, 5, 1, "", "make_lines"]], "agentlib_mpc.utils.plotting.admm_consensus_shades": [[25, 5, 1, "", "plot_consensus_shades"]], "agentlib_mpc.utils.plotting.admm_dashboard": [[25, 5, 1, "", "create_app"], [25, 5, 1, "", "create_coupling_var_plot"], [25, 5, 1, "", "create_residuals_plot"], [25, 5, 1, "", "get_coupling_variables"], [25, 5, 1, "", "get_data_for_plot"], [25, 5, 1, "", "get_max_iterations_per_timestep"], [25, 5, 1, "", "load_agent_data"], [25, 5, 1, "", "main"], [25, 5, 1, "", "show_admm_dashboard"]], "agentlib_mpc.utils.plotting.admm_residuals": [[25, 5, 1, "", "load_residuals"], [25, 5, 1, "", "plot_over_time"], [25, 5, 1, "", "plot_single_time_step"], [25, 5, 1, "", "residuals_over_time"]], "agentlib_mpc.utils.plotting.basic": [[25, 1, 1, "", "EBCColors"], [25, 1, 1, "", "FontDict"], [25, 1, 1, "", "Style"], [25, 1, 1, "", "ValueRange"], [25, 5, 1, "", "make_fig"], [25, 5, 1, "", "make_grid"], [25, 5, 1, "", "make_side_legend"]], "agentlib_mpc.utils.plotting.basic.EBCColors": [[25, 2, 1, "", "blue"], [25, 2, 1, "", "dark_grey"], [25, 2, 1, "", "dark_red"], [25, 2, 1, "", "ebc_palette_sort_1"], [25, 2, 1, "", "ebc_palette_sort_2"], [25, 2, 1, "", "green"], [25, 2, 1, "", "grey"], [25, 2, 1, "", "light_blue"], [25, 2, 1, "", "light_grey"], [25, 2, 1, "", "light_red"], [25, 2, 1, "", "red"]], "agentlib_mpc.utils.plotting.basic.FontDict": [[25, 2, 1, "", "fontsize"]], "agentlib_mpc.utils.plotting.basic.ValueRange": [[25, 2, 1, "", "max"], [25, 2, 1, "", "min"]], "agentlib_mpc.utils.plotting.discretization_structure": [[25, 5, 1, "", "spy_structure"]], "agentlib_mpc.utils.plotting.interactive": [[25, 5, 1, "", "draggable_script"], [25, 5, 1, "", "get_port"], [25, 5, 1, "", "make_components"], [25, 5, 1, "", "make_figure_plotly"], [25, 5, 1, "", "obj_plot"], [25, 5, 1, "", "plot_admm_plotly"], [25, 5, 1, "", "plot_mpc_plotly"], [25, 5, 1, "", "show_dashboard"], [25, 5, 1, "", "solver_return"]], "agentlib_mpc.utils.plotting.ml_model_test": [[25, 5, 1, "", "calc_scores"], [25, 5, 1, "", "evaluate_model"], [25, 5, 1, "", "pairwise_sort"], [25, 5, 1, "", "predict_array"]], "agentlib_mpc.utils.plotting.mpc": [[25, 5, 1, "", "interpolate_colors"], [25, 5, 1, "", "plot_admm"], [25, 5, 1, "", "plot_mpc"]], "agentlib_mpc.utils.sampling": [[24, 5, 1, "", "earliest_index"], [24, 5, 1, "", "interpolate_to_previous"], [24, 5, 1, "", "pairwise"], [24, 5, 1, "", "sample"], [24, 5, 1, "", "sample_values_to_target_grid"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:attribute", "3": "py:method", "4": "py:property", "5": "py:function", "6": "py:pydantic_model", "7": "py:pydantic_field", "8": "py:pydantic_validator"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "attribute", "Python attribute"], "3": ["py", "method", "Python method"], "4": ["py", "property", "Python property"], "5": ["py", "function", "Python function"], "6": ["py", "pydantic_model", "Python model"], "7": ["py", "pydantic_field", "Python field"], "8": ["py", "pydantic_validator", "Python validator"]}, "titleterms": {"packag": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "refer": 0, "agentlib_mpc": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29], "subpackag": [1, 5, 7, 8, 10, 12, 15, 17, 21, 22, 24], "modul": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "content": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 27], "data_structur": [2, 13], "submodul": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "admm_datatyp": [2, 13], "casadi_util": [2, 13], "coordinator_datatyp": [2, 13], "mpc_datamodel": [2, 13], "model": [3, 14, 30, 31], "ann_model": 3, "casadi_model": [3, 14], "casadi_model_ann": 3, "casadi_neural_network": 3, "serialized_ann": 3, "mpc": [4, 15, 25, 31], "dmpc": [5, 6, 17, 18], "coordin": [5, 17], "employe": [5, 17], "admm": [6, 8, 18, 22, 30], "admm_coordin": [6, 18], "optimization_backend": [7, 8, 9, 21, 22, 23], "backend": [7, 21], "casadi_": [8, 9, 22, 23], "basic": [8, 11, 22, 25], "casadi_admm_nn": 8, "casadi_nn": 8, "full": [8, 22], "minlp": [8, 22], "core": [9, 23], "variablegroup": [9, 23], "casadi_backend": [9, 23], "discret": [9, 23], "system": [9, 23, 30, 31], "util": [10, 11, 24, 25], "analysi": [10, 24], "debug": 10, "plot": [11, 25], "admm_anim": [11, 25], "admm_residu": [11, 25], "interpol": 13, "ml_model_datatyp": 13, "casadi_ml_model": 14, "casadi_predictor": 14, "serialized_ml_model": 14, "data_sourc": 15, "minlp_mpc": 15, "ml_model_simul": 15, "mpc_full": 15, "inputpredict": 16, "try_predictor": 16, "estim": 19, "mhe": [19, 22], "ml_model_train": 20, "data_reduct": 20, "setpoint_gener": 20, "casadi_admm_ml": 22, "casadi_ml": 22, "minlp_cia": 22, "sampl": 24, "admm_consensus_shad": 25, "admm_dashboard": 25, "discretization_structur": 25, "interact": 25, "ml_model_test": 25, "welcom": 27, "": 27, "document": 27, "readm": 27, "agentlib": [27, 31], "instal": [27, 28], "option": 27, "depend": 27, "cite": 27, "acknowledg": 27, "indic": 27, "tabl": 27, "altern": 30, "direct": 30, "method": 30, "multipli": 30, "main": 30, "script": 30, "commun": 30, "via": 30, "mqtt": 30, "config": 30, "predict": 31, "control": 31, "creat": 31, "an": 31, "casadi": 31, "import": 31, "creation": 31, "variabl": 31, "declar": 31, "equat": 31, "constraint": 31, "configur": 31, "multi": 31, "agent": 31, "run": 31, "work": 32, "time": 32, "seri": 32, "tutori": 33}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 8, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.intersphinx": 1, "sphinx.ext.viewcode": 1, "sphinx": 57}, "alltitles": {"Package Reference": [[0, "package-reference"]], "agentlib_mpc package": [[1, "agentlib-mpc-package"], [12, "module-agentlib_mpc"]], "Subpackages": [[1, "subpackages"], [5, "subpackages"], [7, "subpackages"], [8, "subpackages"], [10, "subpackages"], [12, "subpackages"], [15, "subpackages"], [17, "subpackages"], [21, "subpackages"], [22, "subpackages"], [24, "subpackages"]], "Module contents": [[1, "module-agentlib_mpc"], [2, "module-agentlib_mpc.data_structures"], [3, "module-agentlib_mpc.models"], [4, "module-agentlib_mpc.modules"], [5, "module-agentlib_mpc.modules.dmpc"], [6, "module-agentlib_mpc.modules.dmpc.admm"], [7, "module-agentlib_mpc.optimization_backends"], [8, "module-agentlib_mpc.optimization_backends.casadi_"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core"], [10, "module-agentlib_mpc.utils"], [11, "module-agentlib_mpc.utils.plotting"]], "agentlib_mpc.data_structures package": [[2, "agentlib-mpc-data-structures-package"], [13, "module-agentlib_mpc.data_structures"]], "Submodules": [[2, "submodules"], [3, "submodules"], [4, "submodules"], [5, "submodules"], [6, "submodules"], [7, "submodules"], [8, "submodules"], [9, "submodules"], [10, "submodules"], [11, "submodules"], [13, "submodules"], [14, "submodules"], [15, "submodules"], [16, "submodules"], [17, "submodules"], [18, "submodules"], [19, "submodules"], [20, "submodules"], [21, "submodules"], [22, "submodules"], [23, "submodules"], [24, "submodules"], [25, "submodules"]], "agentlib_mpc.data_structures.admm_datatypes module": [[2, "module-agentlib_mpc.data_structures.admm_datatypes"], [13, "module-agentlib_mpc.data_structures.admm_datatypes"]], "agentlib_mpc.data_structures.casadi_utils module": [[2, "module-agentlib_mpc.data_structures.casadi_utils"], [13, "module-agentlib_mpc.data_structures.casadi_utils"]], "agentlib_mpc.data_structures.coordinator_datatypes module": [[2, "module-agentlib_mpc.data_structures.coordinator_datatypes"], [13, "module-agentlib_mpc.data_structures.coordinator_datatypes"]], "agentlib_mpc.data_structures.mpc_datamodels module": [[2, "module-agentlib_mpc.data_structures.mpc_datamodels"], [13, "module-agentlib_mpc.data_structures.mpc_datamodels"]], "agentlib_mpc.models package": [[3, "agentlib-mpc-models-package"], [14, "module-agentlib_mpc.models"]], "agentlib_mpc.models.ann_model module": [[3, "agentlib-mpc-models-ann-model-module"]], "agentlib_mpc.models.casadi_model module": [[3, "module-agentlib_mpc.models.casadi_model"], [14, "module-agentlib_mpc.models.casadi_model"]], "agentlib_mpc.models.casadi_model_ann module": [[3, "agentlib-mpc-models-casadi-model-ann-module"]], "agentlib_mpc.models.casadi_neural_network module": [[3, "agentlib-mpc-models-casadi-neural-network-module"]], "agentlib_mpc.models.serialized_ann module": [[3, "agentlib-mpc-models-serialized-ann-module"]], "agentlib_mpc.modules package": [[4, "agentlib-mpc-modules-package"], [15, "module-agentlib_mpc.modules"]], "agentlib_mpc.modules.mpc module": [[4, "module-agentlib_mpc.modules.mpc"], [15, "module-agentlib_mpc.modules.mpc"]], "agentlib_mpc.modules.dmpc package": [[5, "agentlib-mpc-modules-dmpc-package"], [17, "module-agentlib_mpc.modules.dmpc"]], "agentlib_mpc.modules.dmpc.coordinator module": [[5, "module-agentlib_mpc.modules.dmpc.coordinator"], [17, "module-agentlib_mpc.modules.dmpc.coordinator"]], "agentlib_mpc.modules.dmpc.employee module": [[5, "module-agentlib_mpc.modules.dmpc.employee"], [17, "module-agentlib_mpc.modules.dmpc.employee"]], "agentlib_mpc.modules.dmpc.admm package": [[6, "agentlib-mpc-modules-dmpc-admm-package"], [18, "module-agentlib_mpc.modules.dmpc.admm"]], "agentlib_mpc.modules.dmpc.admm.admm module": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinated module": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinator module": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"]], "agentlib_mpc.optimization_backends package": [[7, "agentlib-mpc-optimization-backends-package"], [21, "module-agentlib_mpc.optimization_backends"]], "agentlib_mpc.optimization_backends.backend module": [[7, "module-agentlib_mpc.optimization_backends.backend"], [21, "module-agentlib_mpc.optimization_backends.backend"]], "agentlib_mpc.optimization_backends.casadi_ package": [[8, "agentlib-mpc-optimization-backends-casadi-package"], [22, "module-agentlib_mpc.optimization_backends.casadi_"]], "agentlib_mpc.optimization_backends.casadi_.admm module": [[8, "module-agentlib_mpc.optimization_backends.casadi_.admm"], [22, "module-agentlib_mpc.optimization_backends.casadi_.admm"]], "agentlib_mpc.optimization_backends.casadi_.basic module": [[8, "module-agentlib_mpc.optimization_backends.casadi_.basic"], [22, "module-agentlib_mpc.optimization_backends.casadi_.basic"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_nn module": [[8, "agentlib-mpc-optimization-backends-casadi-casadi-admm-nn-module"]], "agentlib_mpc.optimization_backends.casadi_.casadi_nn module": [[8, "agentlib-mpc-optimization-backends-casadi-casadi-nn-module"]], "agentlib_mpc.optimization_backends.casadi_.full module": [[8, "module-agentlib_mpc.optimization_backends.casadi_.full"], [22, "module-agentlib_mpc.optimization_backends.casadi_.full"]], "agentlib_mpc.optimization_backends.casadi_.minlp module": [[8, "agentlib-mpc-optimization-backends-casadi-minlp-module"], [22, "module-agentlib_mpc.optimization_backends.casadi_.minlp"]], "agentlib_mpc.optimization_backends.casadi_.core package": [[9, "agentlib-mpc-optimization-backends-casadi-core-package"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core"]], "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup module": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"]], "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend module": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"]], "agentlib_mpc.optimization_backends.casadi_.core.discretization module": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"]], "agentlib_mpc.optimization_backends.casadi_.core.system module": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.system"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.system"]], "agentlib_mpc.utils package": [[10, "agentlib-mpc-utils-package"], [24, "module-agentlib_mpc.utils"]], "agentlib_mpc.utils.analysis module": [[10, "module-agentlib_mpc.utils.analysis"], [24, "module-agentlib_mpc.utils.analysis"]], "agentlib_mpc.utils.debug module": [[10, "agentlib-mpc-utils-debug-module"]], "agentlib_mpc.utils.plotting package": [[11, "agentlib-mpc-utils-plotting-package"], [25, "module-agentlib_mpc.utils.plotting"]], "agentlib_mpc.utils.plotting.admm_animation module": [[11, "module-agentlib_mpc.utils.plotting.admm_animation"], [25, "module-agentlib_mpc.utils.plotting.admm_animation"]], "agentlib_mpc.utils.plotting.admm_residuals module": [[11, "module-agentlib_mpc.utils.plotting.admm_residuals"], [25, "module-agentlib_mpc.utils.plotting.admm_residuals"]], "agentlib_mpc.utils.plotting.basic module": [[11, "module-agentlib_mpc.utils.plotting.basic"], [25, "module-agentlib_mpc.utils.plotting.basic"]], "agentlib_mpc.data_structures.interpolation module": [[13, "module-agentlib_mpc.data_structures.interpolation"]], "agentlib_mpc.data_structures.ml_model_datatypes module": [[13, "module-agentlib_mpc.data_structures.ml_model_datatypes"]], "agentlib_mpc.models.casadi_ml_model module": [[14, "module-agentlib_mpc.models.casadi_ml_model"]], "agentlib_mpc.models.casadi_predictor module": [[14, "module-agentlib_mpc.models.casadi_predictor"]], "agentlib_mpc.models.serialized_ml_model module": [[14, "module-agentlib_mpc.models.serialized_ml_model"]], "agentlib_mpc.modules.data_source module": [[15, "module-agentlib_mpc.modules.data_source"]], "agentlib_mpc.modules.minlp_mpc module": [[15, "module-agentlib_mpc.modules.minlp_mpc"]], "agentlib_mpc.modules.ml_model_simulator module": [[15, "agentlib-mpc-modules-ml-model-simulator-module"]], "agentlib_mpc.modules.mpc_full module": [[15, "module-agentlib_mpc.modules.mpc_full"]], "agentlib_mpc.modules.InputPrediction package": [[16, "module-agentlib_mpc.modules.InputPrediction"]], "agentlib_mpc.modules.InputPrediction.try_predictor module": [[16, "module-agentlib_mpc.modules.InputPrediction.try_predictor"]], "agentlib_mpc.modules.estimation package": [[19, "module-agentlib_mpc.modules.estimation"]], "agentlib_mpc.modules.estimation.mhe module": [[19, "module-agentlib_mpc.modules.estimation.mhe"]], "agentlib_mpc.modules.ml_model_training package": [[20, "module-agentlib_mpc.modules.ml_model_training"]], "agentlib_mpc.modules.ml_model_training.data_reduction module": [[20, "module-agentlib_mpc.modules.ml_model_training.data_reduction"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer module": [[20, "module-agentlib_mpc.modules.ml_model_training.ml_model_trainer"]], "agentlib_mpc.modules.ml_model_training.setpoint_generator module": [[20, "module-agentlib_mpc.modules.ml_model_training.setpoint_generator"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml module": [[22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml module": [[22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_ml"]], "agentlib_mpc.optimization_backends.casadi_.mhe module": [[22, "module-agentlib_mpc.optimization_backends.casadi_.mhe"]], "agentlib_mpc.optimization_backends.casadi_.minlp_cia module": [[22, "agentlib-mpc-optimization-backends-casadi-minlp-cia-module"]], "agentlib_mpc.utils.sampling module": [[24, "module-agentlib_mpc.utils.sampling"]], "agentlib_mpc.utils.plotting.admm_consensus_shades module": [[25, "module-agentlib_mpc.utils.plotting.admm_consensus_shades"]], "agentlib_mpc.utils.plotting.admm_dashboard module": [[25, "module-agentlib_mpc.utils.plotting.admm_dashboard"]], "agentlib_mpc.utils.plotting.discretization_structure module": [[25, "module-agentlib_mpc.utils.plotting.discretization_structure"]], "agentlib_mpc.utils.plotting.interactive module": [[25, "module-agentlib_mpc.utils.plotting.interactive"]], "agentlib_mpc.utils.plotting.ml_model_test module": [[25, "module-agentlib_mpc.utils.plotting.ml_model_test"]], "agentlib_mpc.utils.plotting.mpc module": [[25, "module-agentlib_mpc.utils.plotting.mpc"]], "agentlib_mpc": [[26, "agentlib-mpc"], [27, "agentlib-mpc"], [29, "agentlib-mpc"]], "Welcome to agentlib_mpc\u2019s documentation!": [[27, "welcome-to-agentlib-mpc-s-documentation"]], "Content of the documentation": [[27, "content-of-the-documentation"]], "Readme of the agentlib": [[27, "readme-of-the-agentlib"]], "Installation": [[27, "installation"], [28, "installation"]], "Optional Dependencies": [[27, "optional-dependencies"]], "Citing AgentLib_MPC": [[27, "citing-agentlib-mpc"]], "Acknowledgments": [[27, "acknowledgments"]], "Indices and tables": [[27, "indices-and-tables"]], "Alternating Direction Method of Multipliers": [[30, "alternating-direction-method-of-multipliers"]], "Main script": [[30, "main-script"]], "System models": [[30, "system-models"]], "Communication via MQTT": [[30, "communication-via-mqtt"]], "ADMM config": [[30, "admm-config"]], "Model Predictive Control": [[31, "model-predictive-control"]], "Creating an MPC in agentlib with CasADi": [[31, "creating-an-mpc-in-agentlib-with-casadi"]], "Imports": [[31, "imports"]], "Model creation": [[31, "model-creation"]], "Variable declaration": [[31, "variable-declaration"]], "Equation and constraints": [[31, "equation-and-constraints"]], "Configuration of the multi-agent-system": [[31, "configuration-of-the-multi-agent-system"]], "Running the multi-agent-system": [[31, "running-the-multi-agent-system"]], "Working with time series": [[32, "working-with-time-series"]], "Tutorial": [[33, "tutorial"]]}, "indexentries": {"agentlib_mpc": [[1, "module-agentlib_mpc"], [12, "module-agentlib_mpc"]], "module": [[1, "module-agentlib_mpc"], [2, "module-agentlib_mpc.data_structures"], [2, "module-agentlib_mpc.data_structures.admm_datatypes"], [2, "module-agentlib_mpc.data_structures.casadi_utils"], [2, "module-agentlib_mpc.data_structures.coordinator_datatypes"], [2, "module-agentlib_mpc.data_structures.mpc_datamodels"], [3, "module-agentlib_mpc.models"], [3, "module-agentlib_mpc.models.casadi_model"], [4, "module-agentlib_mpc.modules"], [4, "module-agentlib_mpc.modules.mpc"], [5, "module-agentlib_mpc.modules.dmpc"], [5, "module-agentlib_mpc.modules.dmpc.coordinator"], [5, "module-agentlib_mpc.modules.dmpc.employee"], [6, "module-agentlib_mpc.modules.dmpc.admm"], [6, "module-agentlib_mpc.modules.dmpc.admm.admm"], [6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"], [6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"], [7, "module-agentlib_mpc.optimization_backends"], [7, "module-agentlib_mpc.optimization_backends.backend"], [8, "module-agentlib_mpc.optimization_backends.casadi_"], [8, "module-agentlib_mpc.optimization_backends.casadi_.admm"], [8, "module-agentlib_mpc.optimization_backends.casadi_.basic"], [8, "module-agentlib_mpc.optimization_backends.casadi_.full"], [8, "module-agentlib_mpc.optimization_backends.casadi_.minlp"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"], [9, "module-agentlib_mpc.optimization_backends.casadi_.core.system"], [10, "module-agentlib_mpc.utils"], [10, "module-agentlib_mpc.utils.analysis"], [11, "module-agentlib_mpc.utils.plotting"], [11, "module-agentlib_mpc.utils.plotting.admm_animation"], [11, "module-agentlib_mpc.utils.plotting.admm_residuals"], [11, "module-agentlib_mpc.utils.plotting.basic"], [12, "module-agentlib_mpc"], [13, "module-agentlib_mpc.data_structures"], [13, "module-agentlib_mpc.data_structures.admm_datatypes"], [13, "module-agentlib_mpc.data_structures.casadi_utils"], [13, "module-agentlib_mpc.data_structures.coordinator_datatypes"], [13, "module-agentlib_mpc.data_structures.interpolation"], [13, "module-agentlib_mpc.data_structures.ml_model_datatypes"], [13, "module-agentlib_mpc.data_structures.mpc_datamodels"], [14, "module-agentlib_mpc.models"], [14, "module-agentlib_mpc.models.casadi_ml_model"], [14, "module-agentlib_mpc.models.casadi_model"], [14, "module-agentlib_mpc.models.casadi_predictor"], [14, "module-agentlib_mpc.models.serialized_ml_model"], [15, "module-agentlib_mpc.modules"], [15, "module-agentlib_mpc.modules.data_source"], [15, "module-agentlib_mpc.modules.minlp_mpc"], [15, "module-agentlib_mpc.modules.mpc"], [15, "module-agentlib_mpc.modules.mpc_full"], [16, "module-agentlib_mpc.modules.InputPrediction"], [16, "module-agentlib_mpc.modules.InputPrediction.try_predictor"], [17, "module-agentlib_mpc.modules.dmpc"], [17, "module-agentlib_mpc.modules.dmpc.coordinator"], [17, "module-agentlib_mpc.modules.dmpc.employee"], [18, "module-agentlib_mpc.modules.dmpc.admm"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"], [19, "module-agentlib_mpc.modules.estimation"], [19, "module-agentlib_mpc.modules.estimation.mhe"], [20, "module-agentlib_mpc.modules.ml_model_training"], [20, "module-agentlib_mpc.modules.ml_model_training.data_reduction"], [20, "module-agentlib_mpc.modules.ml_model_training.ml_model_trainer"], [20, "module-agentlib_mpc.modules.ml_model_training.setpoint_generator"], [21, "module-agentlib_mpc.optimization_backends"], [21, "module-agentlib_mpc.optimization_backends.backend"], [22, "module-agentlib_mpc.optimization_backends.casadi_"], [22, "module-agentlib_mpc.optimization_backends.casadi_.admm"], [22, "module-agentlib_mpc.optimization_backends.casadi_.basic"], [22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml"], [22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_ml"], [22, "module-agentlib_mpc.optimization_backends.casadi_.full"], [22, "module-agentlib_mpc.optimization_backends.casadi_.mhe"], [22, "module-agentlib_mpc.optimization_backends.casadi_.minlp"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.system"], [24, "module-agentlib_mpc.utils"], [24, "module-agentlib_mpc.utils.analysis"], [24, "module-agentlib_mpc.utils.sampling"], [25, "module-agentlib_mpc.utils.plotting"], [25, "module-agentlib_mpc.utils.plotting.admm_animation"], [25, "module-agentlib_mpc.utils.plotting.admm_consensus_shades"], [25, "module-agentlib_mpc.utils.plotting.admm_dashboard"], [25, "module-agentlib_mpc.utils.plotting.admm_residuals"], [25, "module-agentlib_mpc.utils.plotting.basic"], [25, "module-agentlib_mpc.utils.plotting.discretization_structure"], [25, "module-agentlib_mpc.utils.plotting.interactive"], [25, "module-agentlib_mpc.utils.plotting.ml_model_test"], [25, "module-agentlib_mpc.utils.plotting.mpc"]], "admmparameters (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters"]], "admmparticipation (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation"]], "agentdictentry (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry"]], "agentdictentry (class in agentlib_mpc.data_structures.coordinator_datatypes)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry"]], "agentstatus (class in agentlib_mpc.data_structures.coordinator_datatypes)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus"]], "agenttocoordinator (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator"]], "basevariablereference (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference"], [13, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference"]], "collocationmethod (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod"], [13, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod"]], "consensusvariable (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable"]], "constraint (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.Constraint"], [13, "agentlib_mpc.data_structures.casadi_utils.Constraint"]], "coordinatorstatus (class in agentlib_mpc.data_structures.coordinator_datatypes)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus"]], "coordinatortoagent (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent"]], "couplingentry (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry"]], "couplingvariable (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable"]], "discretizationmethod (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod"], [13, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod"]], "exchangeentry (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry"]], "exchangevariable (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable"]], "fullvariablereference (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference"], [13, "agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference"]], "initstatus (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus"], [13, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus"]], "integrators (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.Integrators"], [13, "agentlib_mpc.data_structures.casadi_utils.Integrators"]], "mhevariablereference (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference"]], "minlpvariablereference (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference"]], "mpcvariable (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MPCVariable"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MPCVariable"]], "modelconstraint (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint"], [13, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint"]], "optparmxcontainer (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer"], [13, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer"]], "optvarmxcontainer (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer"], [13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer"]], "optimizationdata (class in agentlib_mpc.data_structures.coordinator_datatypes)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData"]], "registrationmessage (class in agentlib_mpc.data_structures.coordinator_datatypes)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage"]], "results (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.Results"], [13, "agentlib_mpc.data_structures.mpc_datamodels.Results"]], "solverfactory (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory"]], "solvers (class in agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers"]], "structuredvalue (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue"], [13, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue"]], "variablereference (class in agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.VariableReference"], [13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference"]], "variablereference (class in agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference"]], "admm_variables() (agentlib_mpc.data_structures.admm_datatypes.couplingentry method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.admm_variables"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.admm_variables"]], "admm_variables() (agentlib_mpc.data_structures.admm_datatypes.exchangeentry method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.admm_variables"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.admm_variables"]], "agent_id (agentlib_mpc.data_structures.coordinator_datatypes.registrationmessage attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.agent_id"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.agent_id"]], "agentlib_mpc.data_structures": [[2, "module-agentlib_mpc.data_structures"], [13, "module-agentlib_mpc.data_structures"]], "agentlib_mpc.data_structures.admm_datatypes": [[2, "module-agentlib_mpc.data_structures.admm_datatypes"], [13, "module-agentlib_mpc.data_structures.admm_datatypes"]], "agentlib_mpc.data_structures.casadi_utils": [[2, "module-agentlib_mpc.data_structures.casadi_utils"], [13, "module-agentlib_mpc.data_structures.casadi_utils"]], "agentlib_mpc.data_structures.coordinator_datatypes": [[2, "module-agentlib_mpc.data_structures.coordinator_datatypes"], [13, "module-agentlib_mpc.data_structures.coordinator_datatypes"]], "agentlib_mpc.data_structures.mpc_datamodels": [[2, "module-agentlib_mpc.data_structures.mpc_datamodels"], [13, "module-agentlib_mpc.data_structures.mpc_datamodels"]], "all_variables() (agentlib_mpc.data_structures.admm_datatypes.variablereference method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.all_variables"], [13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.all_variables"]], "all_variables() (agentlib_mpc.data_structures.mpc_datamodels.basevariablereference method)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference.all_variables"], [13, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference.all_variables"]], "all_variables() (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference method)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.all_variables"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.all_variables"]], "bat_file (agentlib_mpc.data_structures.casadi_utils.solverfactory attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.bat_file"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.bat_file"]], "binary_controls (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.binary_controls"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.binary_controls"]], "bonmin (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.bonmin"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.bonmin"]], "busy (agentlib_mpc.data_structures.coordinator_datatypes.agentstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.busy"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.busy"]], "cia_relaxed_results_path() (in module agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.cia_relaxed_results_path"], [13, "agentlib_mpc.data_structures.mpc_datamodels.cia_relaxed_results_path"]], "collocation (agentlib_mpc.data_structures.casadi_utils.discretizationmethod attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod.collocation"], [13, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod.collocation"]], "collocation_method (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.collocation_method"], [13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.collocation_method"]], "collocation_order (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.collocation_order"], [13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.collocation_order"]], "compile_solver() (in module agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.compile_solver"], [13, "agentlib_mpc.data_structures.casadi_utils.compile_solver"]], "controls (agentlib_mpc.data_structures.mpc_datamodels.variablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.controls"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.controls"]], "coup_vars (agentlib_mpc.data_structures.admm_datatypes.agentdictentry attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry.coup_vars"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry.coup_vars"]], "coupling (agentlib_mpc.data_structures.coordinator_datatypes.registrationmessage attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.coupling"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.coupling"]], "coupling_alias() (in module agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.coupling_alias"], [13, "agentlib_mpc.data_structures.admm_datatypes.coupling_alias"]], "couplings (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.couplings"], [13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.couplings"]], "create_solver() (agentlib_mpc.data_structures.casadi_utils.solverfactory method)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.create_solver"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.create_solver"]], "cvodes (agentlib_mpc.data_structures.casadi_utils.integrators attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Integrators.cvodes"], [13, "agentlib_mpc.data_structures.casadi_utils.Integrators.cvodes"]], "delta_mean (agentlib_mpc.data_structures.admm_datatypes.couplingvariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.delta_mean"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.delta_mean"]], "df (agentlib_mpc.data_structures.mpc_datamodels.results attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.Results.df"], [13, "agentlib_mpc.data_structures.mpc_datamodels.Results.df"]], "diff_trajectories (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.diff_trajectories"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.diff_trajectories"]], "do_jit (agentlib_mpc.data_structures.casadi_utils.solverfactory attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.do_jit"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.do_jit"]], "during_update (agentlib_mpc.data_structures.mpc_datamodels.initstatus attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.during_update"], [13, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.during_update"]], "estimated_inputs (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.estimated_inputs"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.estimated_inputs"]], "estimated_parameters (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.estimated_parameters"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.estimated_parameters"]], "euler (agentlib_mpc.data_structures.casadi_utils.integrators attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Integrators.euler"], [13, "agentlib_mpc.data_structures.casadi_utils.Integrators.euler"]], "exchange (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.exchange"], [13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.exchange"]], "exchange_alias() (in module agentlib_mpc.data_structures.admm_datatypes)": [[2, "agentlib_mpc.data_structures.admm_datatypes.exchange_alias"], [13, "agentlib_mpc.data_structures.admm_datatypes.exchange_alias"]], "exchange_multiplier (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.exchange_multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.exchange_multiplier"]], "exchange_vars (agentlib_mpc.data_structures.admm_datatypes.agentdictentry attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry.exchange_vars"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry.exchange_vars"]], "fatrop (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.fatrop"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.fatrop"]], "flat_locals() (agentlib_mpc.data_structures.admm_datatypes.couplingvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.flat_locals"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.flat_locals"]], "flat_multipliers() (agentlib_mpc.data_structures.admm_datatypes.consensusvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.flat_multipliers"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.flat_multipliers"]], "from_config() (agentlib_mpc.data_structures.admm_datatypes.variablereference class method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.from_config"], [13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.from_config"]], "from_config() (agentlib_mpc.data_structures.mpc_datamodels.basevariablereference class method)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference.from_config"], [13, "agentlib_mpc.data_structures.mpc_datamodels.BaseVariableReference.from_config"]], "from_dict() (agentlib_mpc.data_structures.coordinator_datatypes.optimizationdata class method)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.from_dict"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.from_dict"]], "from_json() (agentlib_mpc.data_structures.admm_datatypes.structuredvalue class method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue.from_json"], [13, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue.from_json"]], "function (agentlib_mpc.data_structures.casadi_utils.constraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Constraint.function"], [13, "agentlib_mpc.data_structures.casadi_utils.Constraint.function"]], "function (agentlib_mpc.data_structures.casadi_utils.modelconstraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.function"], [13, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.function"]], "get_residual() (agentlib_mpc.data_structures.admm_datatypes.couplingvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.get_residual"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.get_residual"]], "grid (agentlib_mpc.data_structures.casadi_utils.optparmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer.grid"], [13, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer.grid"]], "guess (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.guess"], [13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.guess"]], "gurobi (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.gurobi"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.gurobi"]], "init_iterations (agentlib_mpc.data_structures.coordinator_datatypes.coordinatorstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.init_iterations"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.init_iterations"]], "inputs (agentlib_mpc.data_structures.mpc_datamodels.variablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.inputs"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.inputs"]], "integrator (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.integrator"], [13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.integrator"]], "interpolation_method (agentlib_mpc.data_structures.mpc_datamodels.mpcvariable attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MPCVariable.interpolation_method"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MPCVariable.interpolation_method"]], "ipopt (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.ipopt"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.ipopt"]], "known_inputs (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.known_inputs"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.known_inputs"]], "known_parameters (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.known_parameters"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.known_parameters"]], "lagged (agentlib_mpc.data_structures.admm_datatypes.couplingentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.lagged"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.lagged"]], "lagged (agentlib_mpc.data_structures.admm_datatypes.exchangeentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.lagged"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.lagged"]], "lb (agentlib_mpc.data_structures.casadi_utils.constraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Constraint.lb"], [13, "agentlib_mpc.data_structures.casadi_utils.Constraint.lb"]], "lb (agentlib_mpc.data_structures.casadi_utils.modelconstraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.lb"], [13, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.lb"]], "lb (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.lb"], [13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.lb"]], "legendre (agentlib_mpc.data_structures.casadi_utils.collocationmethod attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod.legendre"], [13, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod.legendre"]], "local (agentlib_mpc.data_structures.admm_datatypes.couplingentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.local"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.local"]], "local (agentlib_mpc.data_structures.admm_datatypes.exchangeentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.local"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.local"]], "local_exchange_trajectory (agentlib_mpc.data_structures.admm_datatypes.agenttocoordinator attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator.local_exchange_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator.local_exchange_trajectory"]], "local_trajectories (agentlib_mpc.data_structures.admm_datatypes.couplingvariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.local_trajectories"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.local_trajectories"]], "local_trajectory (agentlib_mpc.data_structures.admm_datatypes.agenttocoordinator attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator.local_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.AgentToCoordinator.local_trajectory"]], "logger (agentlib_mpc.data_structures.casadi_utils.solverfactory attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.logger"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.logger"]], "make_casadi_nlp() (agentlib_mpc.data_structures.casadi_utils.solverfactory method)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.make_casadi_nlp"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.make_casadi_nlp"]], "mean (agentlib_mpc.data_structures.admm_datatypes.couplingentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.mean"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.mean"]], "mean_diff (agentlib_mpc.data_structures.admm_datatypes.exchangeentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.mean_diff"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.mean_diff"]], "mean_diff_trajectory (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.mean_diff_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.mean_diff_trajectory"]], "mean_trajectory (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.mean_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.mean_trajectory"]], "mean_trajectory (agentlib_mpc.data_structures.admm_datatypes.couplingvariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.mean_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.mean_trajectory"]], "measured_states (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.measured_states"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.measured_states"]], "method (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.method"], [13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.method"]], "multiple_shooting (agentlib_mpc.data_structures.casadi_utils.discretizationmethod attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod.multiple_shooting"], [13, "agentlib_mpc.data_structures.casadi_utils.DiscretizationMethod.multiple_shooting"]], "multiplier (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.multiplier"]], "multiplier (agentlib_mpc.data_structures.admm_datatypes.couplingentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.multiplier"]], "multiplier (agentlib_mpc.data_structures.admm_datatypes.exchangeentry property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.multiplier"]], "multiplier (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.multiplier"]], "multipliers (agentlib_mpc.data_structures.admm_datatypes.consensusvariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.multipliers"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.multipliers"]], "name (agentlib_mpc.data_structures.admm_datatypes.couplingentry attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.name"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingEntry.name"]], "name (agentlib_mpc.data_structures.admm_datatypes.exchangeentry attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.name"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeEntry.name"]], "name (agentlib_mpc.data_structures.casadi_utils.solverfactory attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.name"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.name"]], "name (agentlib_mpc.data_structures.casadi_utils.solveroptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverOptions.name"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverOptions.name"]], "name (agentlib_mpc.data_structures.coordinator_datatypes.agentdictentry attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.name"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.name"]], "opt (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.opt"], [13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.opt"]], "optimization (agentlib_mpc.data_structures.coordinator_datatypes.coordinatorstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.optimization"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.optimization"]], "optimization_data (agentlib_mpc.data_structures.coordinator_datatypes.agentdictentry attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.optimization_data"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.optimization_data"]], "options (agentlib_mpc.data_structures.casadi_utils.solverfactory attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.options"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverFactory.options"]], "options (agentlib_mpc.data_structures.casadi_utils.solveroptions attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.SolverOptions.options"], [13, "agentlib_mpc.data_structures.casadi_utils.SolverOptions.options"]], "opts (agentlib_mpc.data_structures.coordinator_datatypes.registrationmessage attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.opts"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.opts"]], "osqp (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.osqp"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.osqp"]], "outputs (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.outputs"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.outputs"]], "outputs (agentlib_mpc.data_structures.mpc_datamodels.variablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.outputs"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.outputs"]], "parameters (agentlib_mpc.data_structures.mpc_datamodels.variablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.parameters"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.parameters"]], "participants (agentlib_mpc.data_structures.admm_datatypes.couplingvariable property)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.participants"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.participants"]], "participating (agentlib_mpc.data_structures.admm_datatypes.admmparticipation attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.participating"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.participating"]], "penalty_factor (agentlib_mpc.data_structures.admm_datatypes.admmparameters attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.penalty_factor"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.penalty_factor"]], "penalty_parameter (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.penalty_parameter"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.penalty_parameter"]], "pending (agentlib_mpc.data_structures.coordinator_datatypes.agentstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.pending"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.pending"]], "pre_module_init (agentlib_mpc.data_structures.mpc_datamodels.initstatus attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.pre_module_init"], [13, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.pre_module_init"]], "prediction_horizon (agentlib_mpc.data_structures.admm_datatypes.admmparameters attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.prediction_horizon"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.prediction_horizon"]], "prediction_horizon (agentlib_mpc.data_structures.mpc_datamodels.discretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions.prediction_horizon"], [13, "agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions.prediction_horizon"]], "primal_residual (agentlib_mpc.data_structures.admm_datatypes.couplingvariable attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.primal_residual"], [13, "agentlib_mpc.data_structures.admm_datatypes.CouplingVariable.primal_residual"]], "proxqp (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.proxqp"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.proxqp"]], "qpoases (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.qpoases"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.qpoases"]], "r_del_u (agentlib_mpc.data_structures.mpc_datamodels.fullvariablereference property)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference.r_del_u"], [13, "agentlib_mpc.data_structures.mpc_datamodels.FullVariableReference.r_del_u"]], "r_del_u_convention() (in module agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.r_del_u_convention"], [13, "agentlib_mpc.data_structures.mpc_datamodels.r_del_u_convention"]], "radau (agentlib_mpc.data_structures.casadi_utils.collocationmethod attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod.radau"], [13, "agentlib_mpc.data_structures.casadi_utils.CollocationMethod.radau"]], "ready (agentlib_mpc.data_structures.admm_datatypes.admmparticipation attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.ready"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.ready"]], "ready (agentlib_mpc.data_structures.coordinator_datatypes.agentstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.ready"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.ready"]], "ready (agentlib_mpc.data_structures.mpc_datamodels.initstatus attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.ready"], [13, "agentlib_mpc.data_structures.mpc_datamodels.InitStatus.ready"]], "rk (agentlib_mpc.data_structures.casadi_utils.integrators attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Integrators.rk"], [13, "agentlib_mpc.data_structures.casadi_utils.Integrators.rk"]], "shift_values_by_one() (agentlib_mpc.data_structures.admm_datatypes.consensusvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.shift_values_by_one"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.shift_values_by_one"]], "shift_values_by_one() (agentlib_mpc.data_structures.admm_datatypes.exchangevariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.shift_values_by_one"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.shift_values_by_one"]], "sleeping (agentlib_mpc.data_structures.coordinator_datatypes.coordinatorstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.sleeping"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.sleeping"]], "source (agentlib_mpc.data_structures.admm_datatypes.admmparticipation attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.source"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParticipation.source"]], "sqpmethod (agentlib_mpc.data_structures.casadi_utils.solvers attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Solvers.sqpmethod"], [13, "agentlib_mpc.data_structures.casadi_utils.Solvers.sqpmethod"]], "standby (agentlib_mpc.data_structures.coordinator_datatypes.agentstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.standby"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentStatus.standby"]], "states (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.states"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.states"]], "states (agentlib_mpc.data_structures.mpc_datamodels.variablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.states"], [13, "agentlib_mpc.data_structures.mpc_datamodels.VariableReference.states"]], "stats_path() (in module agentlib_mpc.data_structures.mpc_datamodels)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.stats_path"], [13, "agentlib_mpc.data_structures.mpc_datamodels.stats_path"]], "status (agentlib_mpc.data_structures.coordinator_datatypes.agentdictentry attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.status"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.AgentDictEntry.status"]], "status (agentlib_mpc.data_structures.coordinator_datatypes.registrationmessage attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.status"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.RegistrationMessage.status"]], "target (agentlib_mpc.data_structures.admm_datatypes.coordinatortoagent attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.target"], [13, "agentlib_mpc.data_structures.admm_datatypes.CoordinatorToAgent.target"]], "temporary_directory() (in module agentlib_mpc.data_structures.casadi_utils)": [[2, "agentlib_mpc.data_structures.casadi_utils.temporary_directory"], [13, "agentlib_mpc.data_structures.casadi_utils.temporary_directory"]], "time_step (agentlib_mpc.data_structures.admm_datatypes.admmparameters attribute)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.time_step"], [13, "agentlib_mpc.data_structures.admm_datatypes.ADMMParameters.time_step"]], "time_step (agentlib_mpc.data_structures.mpc_datamodels.discretizationoptions attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions.time_step"], [13, "agentlib_mpc.data_structures.mpc_datamodels.DiscretizationOptions.time_step"]], "to_dict() (agentlib_mpc.data_structures.coordinator_datatypes.optimizationdata method)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.to_dict"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.to_dict"]], "to_json() (agentlib_mpc.data_structures.admm_datatypes.structuredvalue method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue.to_json"], [13, "agentlib_mpc.data_structures.admm_datatypes.StructuredValue.to_json"]], "u (agentlib_mpc.data_structures.coordinator_datatypes.optimizationdata attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.u"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.u"]], "ub (agentlib_mpc.data_structures.casadi_utils.constraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.Constraint.ub"], [13, "agentlib_mpc.data_structures.casadi_utils.Constraint.ub"]], "ub (agentlib_mpc.data_structures.casadi_utils.modelconstraint attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.ub"], [13, "agentlib_mpc.data_structures.casadi_utils.ModelConstraint.ub"]], "ub (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.ub"], [13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.ub"]], "update_diff_trajectories() (agentlib_mpc.data_structures.admm_datatypes.exchangevariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.update_diff_trajectories"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.update_diff_trajectories"]], "update_mean_trajectory() (agentlib_mpc.data_structures.admm_datatypes.consensusvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.update_mean_trajectory"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.update_mean_trajectory"]], "update_multiplier() (agentlib_mpc.data_structures.admm_datatypes.exchangevariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.update_multiplier"], [13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.update_multiplier"]], "update_multipliers() (agentlib_mpc.data_structures.admm_datatypes.consensusvariable method)": [[2, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.update_multipliers"], [13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.update_multipliers"]], "updating (agentlib_mpc.data_structures.coordinator_datatypes.coordinatorstatus attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.updating"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.CoordinatorStatus.updating"]], "var (agentlib_mpc.data_structures.casadi_utils.optparmxcontainer attribute)": [[2, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer.var"], [13, "agentlib_mpc.data_structures.casadi_utils.OptParMXContainer.var"]], "weights_states (agentlib_mpc.data_structures.mpc_datamodels.mhevariablereference attribute)": [[2, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.weights_states"], [13, "agentlib_mpc.data_structures.mpc_datamodels.MHEVariableReference.weights_states"]], "x (agentlib_mpc.data_structures.coordinator_datatypes.optimizationdata attribute)": [[2, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.x"], [13, "agentlib_mpc.data_structures.coordinator_datatypes.OptimizationData.x"]], "casadiinput (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiInput"], [14, "agentlib_mpc.models.casadi_model.CasadiInput"]], "casadimodel (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel"], [14, "agentlib_mpc.models.casadi_model.CasadiModel"]], "casadioutput (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiOutput"], [14, "agentlib_mpc.models.casadi_model.CasadiOutput"]], "casadiparameter (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiParameter"], [14, "agentlib_mpc.models.casadi_model.CasadiParameter"]], "casadistate (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiState"], [14, "agentlib_mpc.models.casadi_model.CasadiState"]], "casadivariable (class in agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.CasadiVariable"], [14, "agentlib_mpc.models.casadi_model.CasadiVariable"]], "agentlib_mpc.models": [[3, "module-agentlib_mpc.models"], [14, "module-agentlib_mpc.models"]], "agentlib_mpc.models.casadi_model": [[3, "module-agentlib_mpc.models.casadi_model"], [14, "module-agentlib_mpc.models.casadi_model"]], "alg (agentlib_mpc.models.casadi_model.casadiinput property)": [[3, "agentlib_mpc.models.casadi_model.CasadiInput.alg"], [14, "agentlib_mpc.models.casadi_model.CasadiInput.alg"]], "alg (agentlib_mpc.models.casadi_model.casadioutput property)": [[3, "agentlib_mpc.models.casadi_model.CasadiOutput.alg"], [14, "agentlib_mpc.models.casadi_model.CasadiOutput.alg"]], "alg (agentlib_mpc.models.casadi_model.casadistate property)": [[3, "agentlib_mpc.models.casadi_model.CasadiState.alg"], [14, "agentlib_mpc.models.casadi_model.CasadiState.alg"]], "auxiliaries (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.auxiliaries"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.auxiliaries"]], "cost_function (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.cost_function"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.cost_function"]], "create_sym() (agentlib_mpc.models.casadi_model.casadivariable method)": [[3, "agentlib_mpc.models.casadi_model.CasadiVariable.create_sym"], [14, "agentlib_mpc.models.casadi_model.CasadiVariable.create_sym"]], "differentials (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.differentials"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.differentials"]], "do_step() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.do_step"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.do_step"]], "get() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.get"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.get"]], "get_constraints() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.get_constraints"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.get_constraints"]], "get_differential_values() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.get_differential_values"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.get_differential_values"]], "get_input_values() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.get_input_values"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.get_input_values"]], "get_symbolic() (in module agentlib_mpc.models.casadi_model)": [[3, "agentlib_mpc.models.casadi_model.get_symbolic"], [14, "agentlib_mpc.models.casadi_model.get_symbolic"]], "initialize() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.initialize"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.initialize"]], "inputs (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.inputs"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.inputs"]], "inputs (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.inputs"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.inputs"]], "json() (agentlib_mpc.models.casadi_model.casadioutput method)": [[3, "agentlib_mpc.models.casadi_model.CasadiOutput.json"], [14, "agentlib_mpc.models.casadi_model.CasadiOutput.json"]], "json() (agentlib_mpc.models.casadi_model.casadistate method)": [[3, "agentlib_mpc.models.casadi_model.CasadiState.json"], [14, "agentlib_mpc.models.casadi_model.CasadiState.json"]], "model_post_init() (agentlib_mpc.models.casadi_model.casadimodelconfig method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.model_post_init"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.model_post_init"]], "ode (agentlib_mpc.models.casadi_model.casadistate property)": [[3, "agentlib_mpc.models.casadi_model.CasadiState.ode"], [14, "agentlib_mpc.models.casadi_model.CasadiState.ode"]], "output_equations (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.output_equations"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.output_equations"]], "outputs (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.outputs"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.outputs"]], "outputs (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.outputs"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.outputs"]], "parameters (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.parameters"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.parameters"]], "parameters (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.parameters"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.parameters"]], "set_differential_values() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.set_differential_values"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.set_differential_values"]], "set_output_values() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.set_output_values"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.set_output_values"]], "setup_system() (agentlib_mpc.models.casadi_model.casadimodel method)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.setup_system"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.setup_system"]], "states (agentlib_mpc.models.casadi_model.casadimodel property)": [[3, "agentlib_mpc.models.casadi_model.CasadiModel.states"], [14, "agentlib_mpc.models.casadi_model.CasadiModel.states"]], "states (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.states"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.states"]], "sym (agentlib_mpc.models.casadi_model.casadivariable property)": [[3, "agentlib_mpc.models.casadi_model.CasadiVariable.sym"], [14, "agentlib_mpc.models.casadi_model.CasadiVariable.sym"]], "system (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[3, "agentlib_mpc.models.casadi_model.CasadiModelConfig.system"], [14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.system"]], "basempc (class in agentlib_mpc.modules.mpc)": [[4, "agentlib_mpc.modules.mpc.BaseMPC"], [15, "agentlib_mpc.modules.mpc.BaseMPC"]], "moduleimport (class in agentlib_mpc.modules)": [[4, "agentlib_mpc.modules.ModuleImport"], [15, "agentlib_mpc.modules.ModuleImport"]], "agentlib_mpc.modules": [[4, "module-agentlib_mpc.modules"], [15, "module-agentlib_mpc.modules"]], "agentlib_mpc.modules.mpc": [[4, "module-agentlib_mpc.modules.mpc"], [15, "module-agentlib_mpc.modules.mpc"]], "assert_mpc_variables_are_in_model() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.assert_mpc_variables_are_in_model"], [15, "agentlib_mpc.modules.mpc.BaseMPC.assert_mpc_variables_are_in_model"]], "assert_subset() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.assert_subset"], [15, "agentlib_mpc.modules.mpc.BaseMPC.assert_subset"]], "cleanup_results() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.cleanup_results"], [15, "agentlib_mpc.modules.mpc.BaseMPC.cleanup_results"]], "collect_variables_for_optimization() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.collect_variables_for_optimization"], [15, "agentlib_mpc.modules.mpc.BaseMPC.collect_variables_for_optimization"]], "controls (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.controls"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.controls"]], "create_optimization_backend() (in module agentlib_mpc.modules.mpc)": [[4, "agentlib_mpc.modules.mpc.create_optimization_backend"], [15, "agentlib_mpc.modules.mpc.create_optimization_backend"]], "default_sampling_time() (agentlib_mpc.modules.mpc.basempcconfig class method)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.default_sampling_time"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.default_sampling_time"]], "do_step() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.do_step"], [15, "agentlib_mpc.modules.mpc.BaseMPC.do_step"]], "get_results() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.get_results"], [15, "agentlib_mpc.modules.mpc.BaseMPC.get_results"]], "import_class() (agentlib_mpc.modules.moduleimport method)": [[4, "agentlib_mpc.modules.ModuleImport.import_class"], [15, "agentlib_mpc.modules.ModuleImport.import_class"]], "inputs (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.inputs"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.inputs"]], "model (agentlib_mpc.modules.mpc.basempc property)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.model"], [15, "agentlib_mpc.modules.mpc.BaseMPC.model"]], "model_post_init() (agentlib_mpc.modules.mpc.basempcconfig method)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.model_post_init"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.model_post_init"]], "optimization_backend (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.optimization_backend"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.optimization_backend"]], "outputs (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.outputs"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.outputs"]], "parameters (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.parameters"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.parameters"]], "pre_computation_hook() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.pre_computation_hook"], [15, "agentlib_mpc.modules.mpc.BaseMPC.pre_computation_hook"]], "prediction_horizon (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.prediction_horizon"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.prediction_horizon"]], "process() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.process"], [15, "agentlib_mpc.modules.mpc.BaseMPC.process"]], "re_init_optimization() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.re_init_optimization"], [15, "agentlib_mpc.modules.mpc.BaseMPC.re_init_optimization"]], "read_results_file() (agentlib_mpc.modules.mpc.basempc static method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.read_results_file"], [15, "agentlib_mpc.modules.mpc.BaseMPC.read_results_file"]], "register_callbacks() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.register_callbacks"], [15, "agentlib_mpc.modules.mpc.BaseMPC.register_callbacks"]], "sampling_time (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.sampling_time"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.sampling_time"]], "set_actuation() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.set_actuation"], [15, "agentlib_mpc.modules.mpc.BaseMPC.set_actuation"]], "set_output() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.set_output"], [15, "agentlib_mpc.modules.mpc.BaseMPC.set_output"]], "set_outputs (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.set_outputs"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.set_outputs"]], "shared_variable_fields (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.shared_variable_fields"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.shared_variable_fields"]], "states (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.states"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.states"]], "time_step (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[4, "agentlib_mpc.modules.mpc.BaseMPCConfig.time_step"], [15, "agentlib_mpc.modules.mpc.BaseMPCConfig.time_step"]], "warn_for_missed_solves() (agentlib_mpc.modules.mpc.basempc method)": [[4, "agentlib_mpc.modules.mpc.BaseMPC.warn_for_missed_solves"], [15, "agentlib_mpc.modules.mpc.BaseMPC.warn_for_missed_solves"]], "coordinator (class in agentlib_mpc.modules.dmpc.coordinator)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator"]], "distributedmpc (class in agentlib_mpc.modules.dmpc)": [[5, "agentlib_mpc.modules.dmpc.DistributedMPC"], [17, "agentlib_mpc.modules.dmpc.DistributedMPC"]], "miniemployee (class in agentlib_mpc.modules.dmpc.employee)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee"]], "agentlib_mpc.modules.dmpc": [[5, "module-agentlib_mpc.modules.dmpc"], [17, "module-agentlib_mpc.modules.dmpc"]], "agentlib_mpc.modules.dmpc.coordinator": [[5, "module-agentlib_mpc.modules.dmpc.coordinator"], [17, "module-agentlib_mpc.modules.dmpc.coordinator"]], "agentlib_mpc.modules.dmpc.employee": [[5, "module-agentlib_mpc.modules.dmpc.employee"], [17, "module-agentlib_mpc.modules.dmpc.employee"]], "all_finished (agentlib_mpc.modules.dmpc.coordinator.coordinator property)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.all_finished"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.all_finished"]], "coordinator (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.coordinator"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.coordinator"]], "get_new_measurement() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.get_new_measurement"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.get_new_measurement"]], "init_iteration_callback() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.init_iteration_callback"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.init_iteration_callback"]], "init_iteration_callback() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.init_iteration_callback"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.init_iteration_callback"]], "maxiter (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.maxIter"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.maxIter"]], "messages_in (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.messages_in"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.messages_in"]], "messages_in (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.messages_in"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.messages_in"]], "messages_out (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.messages_out"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.messages_out"]], "messages_out (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.messages_out"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.messages_out"]], "model_post_init() (agentlib_mpc.modules.dmpc.distributedmpcconfig method)": [[5, "agentlib_mpc.modules.dmpc.DistributedMPCConfig.model_post_init"], [17, "agentlib_mpc.modules.dmpc.DistributedMPCConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.model_post_init"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.model_post_init"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.model_post_init"]], "optim_results_callback() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.optim_results_callback"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.optim_results_callback"]], "optimize() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.optimize"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.optimize"]], "pre_computation_hook() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.pre_computation_hook"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.pre_computation_hook"]], "process() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.process"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.process"]], "process() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.process"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.process"]], "register_callbacks() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.register_callbacks"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.register_callbacks"]], "register_callbacks() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.register_callbacks"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.register_callbacks"]], "registration_callback() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.registration_callback"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.registration_callback"]], "registration_callback() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.registration_callback"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.registration_callback"]], "registration_interval (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.registration_interval"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.registration_interval"]], "request_frequency (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.request_frequency"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.request_frequency"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.shared_variable_fields"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.shared_variable_fields"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.shared_variable_fields"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.shared_variable_fields"]], "shift_trajectories() (agentlib_mpc.modules.dmpc.employee.miniemployee method)": [[5, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.shift_trajectories"], [17, "agentlib_mpc.modules.dmpc.employee.MiniEmployee.shift_trajectories"]], "time_out_non_responders (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[5, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.time_out_non_responders"], [17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.time_out_non_responders"]], "trigger_optimizations() (agentlib_mpc.modules.dmpc.coordinator.coordinator method)": [[5, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.trigger_optimizations"], [17, "agentlib_mpc.modules.dmpc.coordinator.Coordinator.trigger_optimizations"]], "admm (class in agentlib_mpc.modules.dmpc.admm.admm)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM"]], "admmcoordinator (class in agentlib_mpc.modules.dmpc.admm.admm_coordinator)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator"]], "admmparticipation (class in agentlib_mpc.modules.dmpc.admm.admm)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation"]], "coordinatedadmm (class in agentlib_mpc.modules.dmpc.admm.admm_coordinated)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM"]], "localadmm (class in agentlib_mpc.modules.dmpc.admm.admm)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM"]], "modulestatus (class in agentlib_mpc.modules.dmpc.admm.admm)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus"]], "participantstatus (class in agentlib_mpc.modules.dmpc.admm.admm)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus"]], "abs_tol (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.abs_tol"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.abs_tol"]], "admm_iter_max (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.admm_iter_max"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.admm_iter_max"]], "admm_step() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.admm_step"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.admm_step"]], "agentlib_mpc.modules.dmpc.admm": [[6, "module-agentlib_mpc.modules.dmpc.admm"], [18, "module-agentlib_mpc.modules.dmpc.admm"]], "agentlib_mpc.modules.dmpc.admm.admm": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinated": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinated"]], "agentlib_mpc.modules.dmpc.admm.admm_coordinator": [[6, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"], [18, "module-agentlib_mpc.modules.dmpc.admm.admm_coordinator"]], "all_coupling_statuses() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.all_coupling_statuses"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.all_coupling_statuses"]], "assert_mpc_variables_are_in_model() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.assert_mpc_variables_are_in_model"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.assert_mpc_variables_are_in_model"]], "at_registration (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.at_registration"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.at_registration"]], "available (agentlib_mpc.modules.dmpc.admm.admm.participantstatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.available"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.available"]], "check_prefixes_of_variables() (agentlib_mpc.modules.dmpc.admm.admm.admmconfig class method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.check_prefixes_of_variables"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.check_prefixes_of_variables"]], "cleanup_results() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.cleanup_results"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.cleanup_results"]], "collect_couplings_for_optimization() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.collect_couplings_for_optimization"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.collect_couplings_for_optimization"]], "collect_variables_for_optimization() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.collect_variables_for_optimization"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.collect_variables_for_optimization"]], "confirmed (agentlib_mpc.modules.dmpc.admm.admm.participantstatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.confirmed"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.confirmed"]], "cons_and_exchange (agentlib_mpc.modules.dmpc.admm.admm.admm property)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.cons_and_exchange"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.cons_and_exchange"]], "coupinput (in module agentlib_mpc.modules.dmpc.admm.admm_coordinated)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.coupInput"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.coupInput"]], "couplings (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.couplings"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.couplings"]], "couplings_should_have_values() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig class method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.couplings_should_have_values"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.couplings_should_have_values"]], "de_register() (agentlib_mpc.modules.dmpc.admm.admm.admmparticipation method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation.de_register"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation.de_register"]], "default_sampling_time() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig class method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.default_sampling_time"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.default_sampling_time"]], "deregister_all_participants() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.deregister_all_participants"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.deregister_all_participants"]], "dual_tol (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.dual_tol"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.dual_tol"]], "empty_memory() (agentlib_mpc.modules.dmpc.admm.admm.admmparticipation method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation.empty_memory"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMParticipation.empty_memory"]], "exchange (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.exchange"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.exchange"]], "get_new_measurement() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.get_new_measurement"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.get_new_measurement"]], "get_participants_values() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.get_participants_values"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.get_participants_values"]], "get_results() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.get_results"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.get_results"]], "get_results() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.get_results"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.get_results"]], "init_iteration_callback() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.init_iteration_callback"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.init_iteration_callback"]], "iteration_timeout (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.iteration_timeout"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.iteration_timeout"]], "max_iterations (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.max_iterations"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.max_iterations"]], "model_post_init() (agentlib_mpc.modules.dmpc.admm.admm.admmconfig method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.model_post_init"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.model_post_init"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.model_post_init"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.model_post_init"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.model_post_init"]], "not_available (agentlib_mpc.modules.dmpc.admm.admm.participantstatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.not_available"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.not_available"]], "not_participating (agentlib_mpc.modules.dmpc.admm.admm.participantstatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.not_participating"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ParticipantStatus.not_participating"]], "not_started (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.not_started"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.not_started"]], "optim_results_callback() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.optim_results_callback"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.optim_results_callback"]], "optimize() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.optimize"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.optimize"]], "optimizing (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.optimizing"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.optimizing"]], "participant_callback() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.participant_callback"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.participant_callback"]], "penalty_change_factor (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_change_factor"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_change_factor"]], "penalty_change_threshold (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_change_threshold"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_change_threshold"]], "penalty_factor (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.penalty_factor"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.penalty_factor"]], "penalty_factor (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_factor"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.penalty_factor"]], "penalty_factor_var (agentlib_mpc.modules.dmpc.admm.admm.admm property)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.penalty_factor_var"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.penalty_factor_var"]], "prediction_horizon (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.prediction_horizon"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.prediction_horizon"]], "primal_tol (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.primal_tol"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.primal_tol"]], "process() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.process"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.process"]], "process() (agentlib_mpc.modules.dmpc.admm.admm.localadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.process"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.process"]], "process() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.process"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.process"]], "receive_participant() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.receive_participant"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.receive_participant"]], "register_agent() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.register_agent"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.register_agent"]], "registered_participants (agentlib_mpc.modules.dmpc.admm.admm.admm property)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.registered_participants"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.registered_participants"]], "registration_callback() (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.registration_callback"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMM.registration_callback"]], "registration_callback() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.registration_callback"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.registration_callback"]], "registration_delay (agentlib_mpc.modules.dmpc.admm.admm.localadmm property)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.registration_delay"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.registration_delay"]], "registration_delay (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.registration_delay"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.registration_delay"]], "registration_period (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.registration_period"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.registration_period"]], "registration_period (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.registration_period"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.registration_period"]], "rel_tol (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.rel_tol"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.rel_tol"]], "reset_participants_ready() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.reset_participants_ready"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.reset_participants_ready"]], "sampling_time (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.sampling_time"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.sampling_time"]], "save_iter_interval (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.save_iter_interval"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.save_iter_interval"]], "save_solve_stats (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.save_solve_stats"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.save_solve_stats"]], "send_coupling_values() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.send_coupling_values"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.send_coupling_values"]], "send_coupling_variable() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.send_coupling_variable"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.send_coupling_variable"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.shared_variable_fields"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.shared_variable_fields"]], "sleeping (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.sleeping"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.sleeping"]], "solve_stats_file (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.solve_stats_file"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.solve_stats_file"]], "solve_stats_file_is_csv() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig class method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.solve_stats_file_is_csv"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.solve_stats_file_is_csv"]], "sync_delay (agentlib_mpc.modules.dmpc.admm.admm.localadmm property)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.sync_delay"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMM.sync_delay"]], "sync_delay (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.sync_delay"], [18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.sync_delay"]], "syncing (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.syncing"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.syncing"]], "time_step (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.time_step"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.time_step"]], "trigger_optimizations() (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinator method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.trigger_optimizations"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinator.trigger_optimizations"]], "update_lambda() (agentlib_mpc.modules.dmpc.admm.admm.admm method)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.update_lambda"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.update_lambda"]], "updating (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.updating"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.updating"]], "use_relative_tolerances (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.use_relative_tolerances"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.use_relative_tolerances"]], "var_ref (agentlib_mpc.modules.dmpc.admm.admm.admm attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.var_ref"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ADMM.var_ref"]], "wait_time_on_start_iters (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.wait_time_on_start_iters"], [18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.wait_time_on_start_iters"]], "waiting_for_other_agents (agentlib_mpc.modules.dmpc.admm.admm.modulestatus attribute)": [[6, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.waiting_for_other_agents"], [18, "agentlib_mpc.modules.dmpc.admm.admm.ModuleStatus.waiting_for_other_agents"]], "admmbackend (class in agentlib_mpc.optimization_backends.backend)": [[7, "agentlib_mpc.optimization_backends.backend.ADMMBackend"], [21, "agentlib_mpc.optimization_backends.backend.ADMMBackend"]], "optimizationbackend (class in agentlib_mpc.optimization_backends.backend)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend"]], "agentlib_mpc.optimization_backends": [[7, "module-agentlib_mpc.optimization_backends"], [21, "module-agentlib_mpc.optimization_backends"]], "agentlib_mpc.optimization_backends.backend": [[7, "module-agentlib_mpc.optimization_backends.backend"], [21, "module-agentlib_mpc.optimization_backends.backend"]], "check_csv() (agentlib_mpc.optimization_backends.backend.backendconfig class method)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.check_csv"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.check_csv"]], "check_overwrite() (agentlib_mpc.optimization_backends.backend.backendconfig class method)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.check_overwrite"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.check_overwrite"]], "class_name (agentlib_mpc.optimization_backends.backendimport attribute)": [[7, "agentlib_mpc.optimization_backends.BackendImport.class_name"], [21, "agentlib_mpc.optimization_backends.BackendImport.class_name"]], "config_type (agentlib_mpc.optimization_backends.backend.optimizationbackend attribute)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.config_type"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.config_type"]], "coupling_grid (agentlib_mpc.optimization_backends.backend.admmbackend property)": [[7, "agentlib_mpc.optimization_backends.backend.ADMMBackend.coupling_grid"], [21, "agentlib_mpc.optimization_backends.backend.ADMMBackend.coupling_grid"]], "disable_results_if_no_file() (agentlib_mpc.optimization_backends.backend.backendconfig class method)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.disable_results_if_no_file"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.disable_results_if_no_file"]], "discretization_options (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.discretization_options"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.discretization_options"]], "get_lags_per_variable() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.get_lags_per_variable"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.get_lags_per_variable"]], "import_path (agentlib_mpc.optimization_backends.backendimport attribute)": [[7, "agentlib_mpc.optimization_backends.BackendImport.import_path"], [21, "agentlib_mpc.optimization_backends.BackendImport.import_path"]], "model (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.model"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.model"]], "model_from_config() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.model_from_config"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.model_from_config"]], "mpc_backend_parameters (agentlib_mpc.optimization_backends.backend.optimizationbackend attribute)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.mpc_backend_parameters"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.mpc_backend_parameters"]], "name (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.name"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.name"]], "overwrite_result_file (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.overwrite_result_file"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.overwrite_result_file"]], "register_logger() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.register_logger"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.register_logger"]], "results_file (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.results_file"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.results_file"]], "results_file_exists() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.results_file_exists"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.results_file_exists"]], "save_results (agentlib_mpc.optimization_backends.backend.backendconfig attribute)": [[7, "agentlib_mpc.optimization_backends.backend.BackendConfig.save_results"], [21, "agentlib_mpc.optimization_backends.backend.BackendConfig.save_results"]], "setup_optimization() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.setup_optimization"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.setup_optimization"]], "solve() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.solve"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.solve"]], "update_discretization_options() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.update_discretization_options"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.update_discretization_options"]], "update_model_variables() (agentlib_mpc.optimization_backends.backend.optimizationbackend method)": [[7, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.update_model_variables"], [21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.update_model_variables"]], "admmcollocation (class in agentlib_mpc.optimization_backends.casadi_.admm)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.ADMMCollocation"]], "admmmultipleshooting (class in agentlib_mpc.optimization_backends.casadi_.admm)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.ADMMMultipleShooting"]], "b (agentlib_mpc.optimization_backends.casadi_.basic.collocationmatrices attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.B"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.B"]], "basesystem (class in agentlib_mpc.optimization_backends.casadi_.basic)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem"]], "c (agentlib_mpc.optimization_backends.casadi_.basic.collocationmatrices attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.C"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.C"]], "casadiadmmbackend (class in agentlib_mpc.optimization_backends.casadi_.admm)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend"]], "casadibasebackend (class in agentlib_mpc.optimization_backends.casadi_.basic)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend"]], "casadifullbackend (class in agentlib_mpc.optimization_backends.casadi_.full)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend"], [22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend"]], "casadiminlpbackend (class in agentlib_mpc.optimization_backends.casadi_.minlp)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend"]], "casadiadmmsystem (class in agentlib_mpc.optimization_backends.casadi_.admm)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem"]], "casadiminlpsystem (class in agentlib_mpc.optimization_backends.casadi_.minlp)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem"]], "collocationmatrices (class in agentlib_mpc.optimization_backends.casadi_.basic)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices"]], "d (agentlib_mpc.optimization_backends.casadi_.basic.collocationmatrices attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.D"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.D"]], "directcollocation (class in agentlib_mpc.optimization_backends.casadi_.basic)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation"]], "directcollocation (class in agentlib_mpc.optimization_backends.casadi_.full)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation"], [22, "agentlib_mpc.optimization_backends.casadi_.full.DirectCollocation"]], "directcollocation (class in agentlib_mpc.optimization_backends.casadi_.minlp)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.DirectCollocation"]], "fullsystem (class in agentlib_mpc.optimization_backends.casadi_.full)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem"], [22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem"]], "multipleshooting (class in agentlib_mpc.optimization_backends.casadi_.basic)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting"]], "multipleshooting (class in agentlib_mpc.optimization_backends.casadi_.full)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting"], [22, "agentlib_mpc.optimization_backends.casadi_.full.MultipleShooting"]], "agentlib_mpc.optimization_backends.casadi_": [[8, "module-agentlib_mpc.optimization_backends.casadi_"], [22, "module-agentlib_mpc.optimization_backends.casadi_"]], "agentlib_mpc.optimization_backends.casadi_.admm": [[8, "module-agentlib_mpc.optimization_backends.casadi_.admm"], [22, "module-agentlib_mpc.optimization_backends.casadi_.admm"]], "agentlib_mpc.optimization_backends.casadi_.basic": [[8, "module-agentlib_mpc.optimization_backends.casadi_.basic"], [22, "module-agentlib_mpc.optimization_backends.casadi_.basic"]], "agentlib_mpc.optimization_backends.casadi_.full": [[8, "module-agentlib_mpc.optimization_backends.casadi_.full"], [22, "module-agentlib_mpc.optimization_backends.casadi_.full"]], "agentlib_mpc.optimization_backends.casadi_.minlp": [[8, "module-agentlib_mpc.optimization_backends.casadi_.minlp"], [22, "module-agentlib_mpc.optimization_backends.casadi_.minlp"]], "algebraics (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.algebraics"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.algebraics"]], "binary_controls (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.binary_controls"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.binary_controls"]], "controls (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.controls"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.controls"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.cost_function"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.cost_function"]], "coupling_grid (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend property)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.coupling_grid"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.coupling_grid"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.discretization_types"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.discretization_types"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.discretization_types"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.discretization_types"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.discretization_types"], [22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.discretization_types"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.discretization_types"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.discretization_types"]], "exchange_diff (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.exchange_diff"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.exchange_diff"]], "exchange_multipliers (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.exchange_multipliers"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.exchange_multipliers"]], "global_couplings (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.global_couplings"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.global_couplings"]], "initial_state (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.initial_state"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.initial_state"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem method)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.basic.basesystem method)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.basic.directcollocation method)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.DirectCollocation.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.basic.multipleshooting method)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.MultipleShooting.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.full.fullsystem method)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem method)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.initialize"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.initialize"]], "last_control (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.last_control"], [22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.last_control"]], "local_couplings (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.local_couplings"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.local_couplings"]], "local_exchange (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.local_exchange"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.local_exchange"]], "model_constraints (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.model_constraints"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.model_constraints"]], "model_parameters (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.model_parameters"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.model_parameters"]], "multipliers (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.multipliers"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.multipliers"]], "non_controlled_inputs (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.non_controlled_inputs"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.non_controlled_inputs"]], "ode (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.ode"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.ode"]], "order (agentlib_mpc.optimization_backends.casadi_.basic.collocationmatrices attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.order"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.order"]], "outputs (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.outputs"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.outputs"]], "penalty_factor (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.penalty_factor"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.penalty_factor"]], "r_del_u (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.r_del_u"], [22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.r_del_u"]], "root (agentlib_mpc.optimization_backends.casadi_.basic.collocationmatrices attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.root"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CollocationMatrices.root"]], "save_result_df() (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend method)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.save_result_df"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.save_result_df"]], "states (agentlib_mpc.optimization_backends.casadi_.basic.basesystem attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.states"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.BaseSystem.states"]], "system (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.system"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.system"]], "system (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.system"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.system"]], "system (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.system"], [22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.system"]], "system (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.system"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.system"]], "system_type (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.system_type"], [22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.system_type"]], "system_type (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.system_type"], [22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.system_type"]], "system_type (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.system_type"], [22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.system_type"]], "system_type (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[8, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.system_type"], [22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.system_type"]], "casadibackend (class in agentlib_mpc.optimization_backends.casadi_.core.casadi_backend)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend"]], "discretization (class in agentlib_mpc.optimization_backends.casadi_.core.discretization)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization"]], "optimizationparameter (class in agentlib_mpc.optimization_backends.casadi_.core.variablegroup)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter"]], "optimizationquantity (class in agentlib_mpc.optimization_backends.casadi_.core.variablegroup)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity"]], "optimizationvariable (class in agentlib_mpc.optimization_backends.casadi_.core.variablegroup)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable"]], "results (class in agentlib_mpc.optimization_backends.casadi_.core.discretization)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results"]], "system (class in agentlib_mpc.optimization_backends.casadi_.core.system)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.system.System"], [23, "agentlib_mpc.optimization_backends.casadi_.core.system.System"]], "add_constraint() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_constraint"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_constraint"]], "add_default_values (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.add_default_values"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.add_default_values"]], "add_opt_par() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_opt_par"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_opt_par"]], "add_opt_var() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_opt_var"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.add_opt_var"]], "agentlib_mpc.optimization_backends.casadi_.core": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core"]], "agentlib_mpc.optimization_backends.casadi_.core.variablegroup": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.VariableGroup"]], "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.casadi_backend"]], "agentlib_mpc.optimization_backends.casadi_.core.discretization": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.discretization"]], "agentlib_mpc.optimization_backends.casadi_.core.system": [[9, "module-agentlib_mpc.optimization_backends.casadi_.core.system"], [23, "module-agentlib_mpc.optimization_backends.casadi_.core.system"]], "binary (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.binary"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.binary"]], "binary_vars (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.binary_vars"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.binary_vars"]], "build_batch_bat (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.build_batch_bat"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.build_batch_bat"]], "columns (agentlib_mpc.optimization_backends.casadi_.core.discretization.results attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.columns"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.columns"]], "config_type (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.config_type"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.config_type"]], "create_nlp_in_out_mapping() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.create_nlp_in_out_mapping"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.create_nlp_in_out_mapping"]], "declare() (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter class method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.declare"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.declare"]], "declare() (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable class method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.declare"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.declare"]], "df (agentlib_mpc.optimization_backends.casadi_.core.discretization.results property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.df"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.df"]], "dim (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.dim"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.dim"]], "discretization (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.discretization"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.discretization"]], "discretization_options (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.discretization_options"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.discretization_options"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.discretization_types"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.discretization_types"]], "do_jit (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.do_jit"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.do_jit"]], "full_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.full_names"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.full_names"]], "full_symbolic (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.full_symbolic"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.full_symbolic"]], "full_with_defaults (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.full_with_defaults"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.full_with_defaults"]], "grid (agentlib_mpc.optimization_backends.casadi_.core.discretization.results attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.grid"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.grid"]], "grid() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.grid"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.grid"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.initialize"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.core.system.system method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.system.System.initialize"], [23, "agentlib_mpc.optimization_backends.casadi_.core.system.System.initialize"]], "input_map (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.input_map"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.input_map"]], "matrix (agentlib_mpc.optimization_backends.casadi_.core.discretization.results attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.matrix"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.matrix"]], "name (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.name"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.name"]], "nlp (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.nlp"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.nlp"]], "only_positive_times_in_results (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.only_positive_times_in_results"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.only_positive_times_in_results"]], "output_map (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.output_map"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.output_map"]], "parameters (agentlib_mpc.optimization_backends.casadi_.core.system.system property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.system.System.parameters"], [23, "agentlib_mpc.optimization_backends.casadi_.core.system.System.parameters"]], "quantities (agentlib_mpc.optimization_backends.casadi_.core.system.system property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.system.System.quantities"], [23, "agentlib_mpc.optimization_backends.casadi_.core.system.System.quantities"]], "ref_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.ref_names"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.ref_names"]], "reset_setup_attributes() (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.reset_setup_attributes"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.reset_setup_attributes"]], "save_result_df() (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.save_result_df"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.save_result_df"]], "setup_optimization() (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.setup_optimization"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.setup_optimization"]], "solve() (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.solve"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.solve"]], "solve() (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.solve"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.solve"]], "solver (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.solver"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.solver"]], "stats (agentlib_mpc.optimization_backends.casadi_.core.discretization.results attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.stats"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.stats"]], "stats_line() (agentlib_mpc.optimization_backends.casadi_.core.discretization.results method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.stats_line"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.stats_line"]], "system (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.system"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.system"]], "system_type (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.system_type"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.system_type"]], "use_in_stage_function (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationquantity attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.use_in_stage_function"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationQuantity.use_in_stage_function"]], "use_in_stage_function (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.use_in_stage_function"], [23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.use_in_stage_function"]], "validate_compile() (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig class method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.validate_compile"], [23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.validate_compile"]], "variable_grid_indices (agentlib_mpc.optimization_backends.casadi_.core.discretization.results attribute)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.variable_grid_indices"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.variable_grid_indices"]], "variable_lookup() (agentlib_mpc.optimization_backends.casadi_.core.discretization.results method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.variable_lookup"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.variable_lookup"]], "variables (agentlib_mpc.optimization_backends.casadi_.core.system.system property)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.system.System.variables"], [23, "agentlib_mpc.optimization_backends.casadi_.core.system.System.variables"]], "write_columns() (agentlib_mpc.optimization_backends.casadi_.core.discretization.results method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.write_columns"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.write_columns"]], "write_stats_columns() (agentlib_mpc.optimization_backends.casadi_.core.discretization.results method)": [[9, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.write_stats_columns"], [23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Results.write_stats_columns"]], "admm_at_time_step() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.admm_at_time_step"], [24, "agentlib_mpc.utils.analysis.admm_at_time_step"]], "agentlib_mpc.utils": [[10, "module-agentlib_mpc.utils"], [24, "module-agentlib_mpc.utils"]], "agentlib_mpc.utils.analysis": [[10, "module-agentlib_mpc.utils.analysis"], [24, "module-agentlib_mpc.utils.analysis"]], "convert_index() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.convert_index"], [24, "agentlib_mpc.utils.analysis.convert_index"]], "convert_multi_index() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.convert_multi_index"], [24, "agentlib_mpc.utils.analysis.convert_multi_index"]], "first_vals_at_trajectory_index() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.first_vals_at_trajectory_index"], [24, "agentlib_mpc.utils.analysis.first_vals_at_trajectory_index"]], "get_number_of_iterations() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.get_number_of_iterations"], [24, "agentlib_mpc.utils.analysis.get_number_of_iterations"]], "get_time_steps() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.get_time_steps"], [24, "agentlib_mpc.utils.analysis.get_time_steps"]], "last_vals_at_trajectory_index() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.last_vals_at_trajectory_index"], [24, "agentlib_mpc.utils.analysis.last_vals_at_trajectory_index"]], "load_admm() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.load_admm"], [24, "agentlib_mpc.utils.analysis.load_admm"]], "load_mpc() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.load_mpc"], [24, "agentlib_mpc.utils.analysis.load_mpc"]], "load_mpc_stats() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.load_mpc_stats"], [24, "agentlib_mpc.utils.analysis.load_mpc_stats"]], "load_sim() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.load_sim"], [24, "agentlib_mpc.utils.analysis.load_sim"]], "mpc_at_time_step() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.mpc_at_time_step"], [24, "agentlib_mpc.utils.analysis.mpc_at_time_step"]], "perform_index_update() (in module agentlib_mpc.utils.analysis)": [[10, "agentlib_mpc.utils.analysis.perform_index_update"], [24, "agentlib_mpc.utils.analysis.perform_index_update"]], "ebccolors (class in agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors"]], "fontdict (class in agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.FontDict"], [25, "agentlib_mpc.utils.plotting.basic.FontDict"]], "style (class in agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.Style"], [25, "agentlib_mpc.utils.plotting.basic.Style"]], "valuerange (class in agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.ValueRange"], [25, "agentlib_mpc.utils.plotting.basic.ValueRange"]], "agentlib_mpc.utils.plotting": [[11, "module-agentlib_mpc.utils.plotting"], [25, "module-agentlib_mpc.utils.plotting"]], "agentlib_mpc.utils.plotting.admm_animation": [[11, "module-agentlib_mpc.utils.plotting.admm_animation"], [25, "module-agentlib_mpc.utils.plotting.admm_animation"]], "agentlib_mpc.utils.plotting.admm_residuals": [[11, "module-agentlib_mpc.utils.plotting.admm_residuals"], [25, "module-agentlib_mpc.utils.plotting.admm_residuals"]], "agentlib_mpc.utils.plotting.basic": [[11, "module-agentlib_mpc.utils.plotting.basic"], [25, "module-agentlib_mpc.utils.plotting.basic"]], "animate_full() (in module agentlib_mpc.utils.plotting.admm_animation)": [[11, "agentlib_mpc.utils.plotting.admm_animation.animate_full"], [25, "agentlib_mpc.utils.plotting.admm_animation.animate_full"]], "blue (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.blue"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.blue"]], "dark_grey (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.dark_grey"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.dark_grey"]], "dark_red (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.dark_red"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.dark_red"]], "ebc_palette_sort_1 (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.ebc_palette_sort_1"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.ebc_palette_sort_1"]], "ebc_palette_sort_2 (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.ebc_palette_sort_2"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.ebc_palette_sort_2"]], "fontsize (agentlib_mpc.utils.plotting.basic.fontdict attribute)": [[11, "agentlib_mpc.utils.plotting.basic.FontDict.fontsize"], [25, "agentlib_mpc.utils.plotting.basic.FontDict.fontsize"]], "green (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.green"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.green"]], "grey (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.grey"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.grey"]], "init_full() (in module agentlib_mpc.utils.plotting.admm_animation)": [[11, "agentlib_mpc.utils.plotting.admm_animation.init_full"], [25, "agentlib_mpc.utils.plotting.admm_animation.init_full"]], "light_blue (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.light_blue"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.light_blue"]], "light_grey (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.light_grey"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.light_grey"]], "light_red (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.light_red"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.light_red"]], "load_residuals() (in module agentlib_mpc.utils.plotting.admm_residuals)": [[11, "agentlib_mpc.utils.plotting.admm_residuals.load_residuals"], [25, "agentlib_mpc.utils.plotting.admm_residuals.load_residuals"]], "make_animation() (in module agentlib_mpc.utils.plotting.admm_animation)": [[11, "agentlib_mpc.utils.plotting.admm_animation.make_animation"], [25, "agentlib_mpc.utils.plotting.admm_animation.make_animation"]], "make_fig() (in module agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.make_fig"], [25, "agentlib_mpc.utils.plotting.basic.make_fig"]], "make_grid() (in module agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.make_grid"], [25, "agentlib_mpc.utils.plotting.basic.make_grid"]], "make_image() (in module agentlib_mpc.utils.plotting.admm_animation)": [[11, "agentlib_mpc.utils.plotting.admm_animation.make_image"], [25, "agentlib_mpc.utils.plotting.admm_animation.make_image"]], "make_lines() (in module agentlib_mpc.utils.plotting.admm_animation)": [[11, "agentlib_mpc.utils.plotting.admm_animation.make_lines"], [25, "agentlib_mpc.utils.plotting.admm_animation.make_lines"]], "make_side_legend() (in module agentlib_mpc.utils.plotting.basic)": [[11, "agentlib_mpc.utils.plotting.basic.make_side_legend"], [25, "agentlib_mpc.utils.plotting.basic.make_side_legend"]], "max (agentlib_mpc.utils.plotting.basic.valuerange attribute)": [[11, "agentlib_mpc.utils.plotting.basic.ValueRange.max"], [25, "agentlib_mpc.utils.plotting.basic.ValueRange.max"]], "min (agentlib_mpc.utils.plotting.basic.valuerange attribute)": [[11, "agentlib_mpc.utils.plotting.basic.ValueRange.min"], [25, "agentlib_mpc.utils.plotting.basic.ValueRange.min"]], "plot_over_time() (in module agentlib_mpc.utils.plotting.admm_residuals)": [[11, "agentlib_mpc.utils.plotting.admm_residuals.plot_over_time"], [25, "agentlib_mpc.utils.plotting.admm_residuals.plot_over_time"]], "plot_single_time_step() (in module agentlib_mpc.utils.plotting.admm_residuals)": [[11, "agentlib_mpc.utils.plotting.admm_residuals.plot_single_time_step"], [25, "agentlib_mpc.utils.plotting.admm_residuals.plot_single_time_step"]], "red (agentlib_mpc.utils.plotting.basic.ebccolors attribute)": [[11, "agentlib_mpc.utils.plotting.basic.EBCColors.red"], [25, "agentlib_mpc.utils.plotting.basic.EBCColors.red"]], "residuals_over_time() (in module agentlib_mpc.utils.plotting.admm_residuals)": [[11, "agentlib_mpc.utils.plotting.admm_residuals.residuals_over_time"], [25, "agentlib_mpc.utils.plotting.admm_residuals.residuals_over_time"]], "interpolationmethods (class in agentlib_mpc.data_structures.interpolation)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods"]], "outputtype (class in agentlib_mpc.data_structures.ml_model_datatypes)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputType"]], "trainingdata (class in agentlib_mpc.data_structures.ml_model_datatypes)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData"]], "absolute (agentlib_mpc.data_structures.ml_model_datatypes.outputtype attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputType.absolute"]], "activate (agentlib_mpc.data_structures.ml_model_datatypes.earlystoppingcallback attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback.activate"]], "agentlib_mpc.data_structures.interpolation": [[13, "module-agentlib_mpc.data_structures.interpolation"]], "agentlib_mpc.data_structures.ml_model_datatypes": [[13, "module-agentlib_mpc.data_structures.ml_model_datatypes"]], "callback() (agentlib_mpc.data_structures.ml_model_datatypes.earlystoppingcallback method)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback.callback"]], "column_order() (in module agentlib_mpc.data_structures.ml_model_datatypes)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.column_order"]], "controls (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.controls"]], "controls (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.controls"]], "delta_mean (agentlib_mpc.data_structures.admm_datatypes.consensusvariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.delta_mean"]], "delta_mean (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.delta_mean"]], "difference (agentlib_mpc.data_structures.ml_model_datatypes.outputtype attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputType.difference"]], "grid (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.grid"]], "inputs (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.inputs"]], "inputs (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.inputs"]], "lag (agentlib_mpc.data_structures.ml_model_datatypes.feature attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.Feature.lag"]], "linear (agentlib_mpc.data_structures.interpolation.interpolationmethods attribute)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods.linear"]], "load() (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata class method)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.load"]], "local_trajectories (agentlib_mpc.data_structures.admm_datatypes.consensusvariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.local_trajectories"]], "local_trajectories (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.local_trajectories"]], "mean_over_interval (agentlib_mpc.data_structures.interpolation.interpolationmethods attribute)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods.mean_over_interval"]], "mean_trajectory (agentlib_mpc.data_structures.admm_datatypes.consensusvariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.mean_trajectory"]], "mean_trajectory (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.mean_trajectory"]], "name (agentlib_mpc.data_structures.admm_datatypes.agentdictentry attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.AgentDictEntry.name"]], "name (agentlib_mpc.data_structures.ml_model_datatypes.feature attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.Feature.name"]], "name_with_lag() (in module agentlib_mpc.data_structures.ml_model_datatypes)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.name_with_lag"]], "no_interpolation (agentlib_mpc.data_structures.interpolation.interpolationmethods attribute)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods.no_interpolation"]], "non_recursive_features_have_to_be_absolute() (agentlib_mpc.data_structures.ml_model_datatypes.outputfeature class method)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature.non_recursive_features_have_to_be_absolute"]], "output_type (agentlib_mpc.data_structures.ml_model_datatypes.outputfeature attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature.output_type"]], "outputs (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.outputs"]], "outputs (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.outputs"]], "parameters (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.parameters"]], "parameters (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.parameters"]], "patience (agentlib_mpc.data_structures.ml_model_datatypes.earlystoppingcallback attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback.patience"]], "prediction_horizon (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.prediction_horizon"]], "previous (agentlib_mpc.data_structures.interpolation.interpolationmethods attribute)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods.previous"]], "primal_residual (agentlib_mpc.data_structures.admm_datatypes.consensusvariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ConsensusVariable.primal_residual"]], "primal_residual (agentlib_mpc.data_structures.admm_datatypes.exchangevariable attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.ExchangeVariable.primal_residual"]], "recursive (agentlib_mpc.data_structures.ml_model_datatypes.outputfeature attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.OutputFeature.recursive"]], "restore_best_weights (agentlib_mpc.data_structures.ml_model_datatypes.earlystoppingcallback attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback.restore_best_weights"]], "save() (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata method)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.save"]], "spline3 (agentlib_mpc.data_structures.interpolation.interpolationmethods attribute)": [[13, "agentlib_mpc.data_structures.interpolation.InterpolationMethods.spline3"]], "states (agentlib_mpc.data_structures.admm_datatypes.variablereference attribute)": [[13, "agentlib_mpc.data_structures.admm_datatypes.VariableReference.states"]], "states (agentlib_mpc.data_structures.mpc_datamodels.minlpvariablereference attribute)": [[13, "agentlib_mpc.data_structures.mpc_datamodels.MINLPVariableReference.states"]], "test_inputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.test_inputs"]], "test_outputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.test_outputs"]], "time_step (agentlib_mpc.data_structures.casadi_utils.casadidiscretizationoptions attribute)": [[13, "agentlib_mpc.data_structures.casadi_utils.CasadiDiscretizationOptions.time_step"]], "training_inputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.training_inputs"]], "training_outputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.training_outputs"]], "validation_inputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.validation_inputs"]], "validation_outputs (agentlib_mpc.data_structures.ml_model_datatypes.trainingdata attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.TrainingData.validation_outputs"]], "var (agentlib_mpc.data_structures.casadi_utils.optvarmxcontainer attribute)": [[13, "agentlib_mpc.data_structures.casadi_utils.OptVarMXContainer.var"]], "verbose (agentlib_mpc.data_structures.ml_model_datatypes.earlystoppingcallback attribute)": [[13, "agentlib_mpc.data_structures.ml_model_datatypes.EarlyStoppingCallback.verbose"]], "ann (agentlib_mpc.models.serialized_ml_model.mlmodels attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.MLModels.ANN"]], "annlayertypes (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes"]], "batchnormalization (agentlib_mpc.models.casadi_predictor.annlayertypes attribute)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes.BATCHNORMALIZATION"]], "batchnormalization (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.BatchNormalization"]], "casadiann (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiANN"]], "casadigpr (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiGPR"]], "casadilinreg (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiLinReg"]], "casadimlmodel (class in agentlib_mpc.models.casadi_ml_model)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel"]], "casadipredictor (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor"]], "casadipredictor.config (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.Config"]], "customgpr (class in agentlib_mpc.models.serialized_ml_model)": [[14, "agentlib_mpc.models.serialized_ml_model.CustomGPR"]], "dense (agentlib_mpc.models.casadi_predictor.annlayertypes attribute)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes.DENSE"]], "dense (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.Dense"]], "flatten (agentlib_mpc.models.casadi_predictor.annlayertypes attribute)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes.FLATTEN"]], "flatten (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.Flatten"]], "gpr (agentlib_mpc.models.serialized_ml_model.mlmodels attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.MLModels.GPR"]], "l (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.L"]], "linreg (agentlib_mpc.models.serialized_ml_model.mlmodels attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.MLModels.LINREG"]], "lstm (agentlib_mpc.models.casadi_predictor.annlayertypes attribute)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes.LSTM"]], "lstm (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.LSTM"]], "layer (class in agentlib_mpc.models.casadi_predictor)": [[14, "agentlib_mpc.models.casadi_predictor.Layer"]], "mlmodels (class in agentlib_mpc.models.serialized_ml_model)": [[14, "agentlib_mpc.models.serialized_ml_model.MLModels"]], "rescaling (agentlib_mpc.models.casadi_predictor.annlayertypes attribute)": [[14, "agentlib_mpc.models.casadi_predictor.ANNLayerTypes.RESCALING"]], "x_train (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.X_train"]], "agentlib_mpc.models.casadi_ml_model": [[14, "module-agentlib_mpc.models.casadi_ml_model"]], "agentlib_mpc.models.casadi_predictor": [[14, "module-agentlib_mpc.models.casadi_predictor"]], "agentlib_mpc.models.serialized_ml_model": [[14, "module-agentlib_mpc.models.serialized_ml_model"]], "agentlib_mpc_hash (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.agentlib_mpc_hash"]], "alpha (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.alpha"]], "arbitrary_types_allowed (agentlib_mpc.models.casadi_predictor.casadipredictor.config attribute)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.Config.arbitrary_types_allowed"]], "assert_recursive_outputs_are_states() (in module agentlib_mpc.models.casadi_ml_model)": [[14, "agentlib_mpc.models.casadi_ml_model.assert_recursive_outputs_are_states"]], "auxiliaries (agentlib_mpc.models.casadi_ml_model.casadimlmodel property)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.auxiliaries"]], "bb_outputs (agentlib_mpc.models.casadi_ml_model.casadimlmodel property)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.bb_outputs"]], "bb_states (agentlib_mpc.models.casadi_ml_model.casadimlmodel property)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.bb_states"]], "check_dt() (agentlib_mpc.models.casadi_ml_model.casadimlmodelconfig class method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig.check_dt"]], "check_or_load_models() (agentlib_mpc.models.casadi_ml_model.casadimlmodelconfig class method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig.check_or_load_models"]], "coef (agentlib_mpc.models.serialized_ml_model.linregparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.LinRegParameters.coef"]], "compute_dupes() (in module agentlib_mpc.models.casadi_ml_model)": [[14, "agentlib_mpc.models.casadi_ml_model.compute_dupes"]], "config_type (agentlib_mpc.models.casadi_ml_model.casadimlmodel attribute)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.config_type"]], "constant_value (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.constant_value"]], "constant_value_bounds (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.constant_value_bounds"]], "data_handling (agentlib_mpc.models.serialized_ml_model.serializedgpr attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.data_handling"]], "description (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.description"]], "deserialize() (agentlib_mpc.models.serialized_ml_model.serializedann method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.deserialize"]], "deserialize() (agentlib_mpc.models.serialized_ml_model.serializedgpr method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.deserialize"]], "deserialize() (agentlib_mpc.models.serialized_ml_model.serializedlinreg method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedLinReg.deserialize"]], "deserialize() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.deserialize"]], "do_step() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.do_step"]], "dt (agentlib_mpc.models.casadi_ml_model.casadimlmodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig.dt"]], "dt (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.dt"]], "dt (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.dt"]], "forward() (agentlib_mpc.models.casadi_predictor.batchnormalization method)": [[14, "agentlib_mpc.models.casadi_predictor.BatchNormalization.forward"]], "forward() (agentlib_mpc.models.casadi_predictor.dense method)": [[14, "agentlib_mpc.models.casadi_predictor.Dense.forward"]], "forward() (agentlib_mpc.models.casadi_predictor.flatten method)": [[14, "agentlib_mpc.models.casadi_predictor.Flatten.forward"]], "forward() (agentlib_mpc.models.casadi_predictor.lstm method)": [[14, "agentlib_mpc.models.casadi_predictor.LSTM.forward"]], "from_model() (agentlib_mpc.models.serialized_ml_model.gprkernelparameters class method)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.from_model"]], "from_model() (agentlib_mpc.models.serialized_ml_model.gprparameters class method)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.from_model"]], "from_serialized_model() (agentlib_mpc.models.casadi_predictor.casadipredictor class method)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.from_serialized_model"]], "get_activation() (agentlib_mpc.models.casadi_predictor.layer static method)": [[14, "agentlib_mpc.models.casadi_predictor.Layer.get_activation"]], "get_git_revision_short_hash() (in module agentlib_mpc.models.serialized_ml_model)": [[14, "agentlib_mpc.models.serialized_ml_model.get_git_revision_short_hash"]], "get_ml_model_values() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.get_ml_model_values"]], "gpr_parameters (agentlib_mpc.models.serialized_ml_model.serializedgpr attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.gpr_parameters"]], "initialize() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.initialize"]], "input (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.input"]], "input_shape (agentlib_mpc.models.casadi_predictor.casadiann property)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiANN.input_shape"]], "input_shape (agentlib_mpc.models.casadi_predictor.casadigpr property)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiGPR.input_shape"]], "input_shape (agentlib_mpc.models.casadi_predictor.casadilinreg property)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiLinReg.input_shape"]], "input_shape (agentlib_mpc.models.casadi_predictor.casadipredictor property)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.input_shape"]], "intercept (agentlib_mpc.models.serialized_ml_model.linregparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.LinRegParameters.intercept"]], "kernel_parameters (agentlib_mpc.models.serialized_ml_model.serializedgpr attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.kernel_parameters"]], "length_scale (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.length_scale"]], "length_scale_bounds (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.length_scale_bounds"]], "load_serialized_model() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.load_serialized_model"]], "load_serialized_model_from_dict() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.load_serialized_model_from_dict"]], "load_serialized_model_from_file() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.load_serialized_model_from_file"]], "load_serialized_model_from_string() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.load_serialized_model_from_string"]], "log_marginal_likelihood_value (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.log_marginal_likelihood_value"]], "make_predict_function_for_mpc() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.make_predict_function_for_mpc"]], "mean (agentlib_mpc.models.serialized_ml_model.gprdatahandlingparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters.mean"]], "ml_model_sources (agentlib_mpc.models.casadi_ml_model.casadimlmodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig.ml_model_sources"]], "model_post_init() (agentlib_mpc.models.casadi_ml_model.casadimlmodelconfig method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModelConfig.model_post_init"]], "model_type (agentlib_mpc.models.serialized_ml_model.serializedann attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.model_type"]], "model_type (agentlib_mpc.models.serialized_ml_model.serializedgpr attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.model_type"]], "model_type (agentlib_mpc.models.serialized_ml_model.serializedlinreg attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedLinReg.model_type"]], "model_type (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.model_type"]], "n_features_in (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.n_features_in"]], "n_features_in (agentlib_mpc.models.serialized_ml_model.linregparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.LinRegParameters.n_features_in"]], "name (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.name"]], "noise_level (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.noise_level"]], "noise_level_bounds (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.noise_level_bounds"]], "normalize (agentlib_mpc.models.serialized_ml_model.gprdatahandlingparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters.normalize"]], "output (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.output"]], "output_shape (agentlib_mpc.models.casadi_predictor.casadipredictor property)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.output_shape"]], "parameters (agentlib_mpc.models.serialized_ml_model.serializedlinreg attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedLinReg.parameters"]], "predict() (agentlib_mpc.models.casadi_predictor.casadipredictor method)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.predict"]], "predict() (agentlib_mpc.models.serialized_ml_model.customgpr method)": [[14, "agentlib_mpc.models.serialized_ml_model.CustomGPR.predict"]], "prediction_function (agentlib_mpc.models.casadi_predictor.casadipredictor attribute)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.prediction_function"]], "predictor_model (agentlib_mpc.models.casadi_predictor.casadipredictor attribute)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.predictor_model"]], "rank (agentlib_mpc.models.serialized_ml_model.linregparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.LinRegParameters.rank"]], "register_ml_models() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.register_ml_models"]], "save_serialized_model() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.save_serialized_model"]], "scale (agentlib_mpc.models.serialized_ml_model.gprdatahandlingparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters.scale"]], "serialize() (agentlib_mpc.models.serialized_ml_model.serializedann class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.serialize"]], "serialize() (agentlib_mpc.models.serialized_ml_model.serializedgpr class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedGPR.serialize"]], "serialize() (agentlib_mpc.models.serialized_ml_model.serializedlinreg class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedLinReg.serialize"]], "serialize() (agentlib_mpc.models.serialized_ml_model.serializedmlmodel class method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.serialize"]], "serialized_model (agentlib_mpc.models.casadi_predictor.casadipredictor attribute)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.serialized_model"]], "set_predict_request() (agentlib_mpc.models.serialized_ml_model.customgpr method)": [[14, "agentlib_mpc.models.serialized_ml_model.CustomGPR.set_predict_request"]], "set_score_request() (agentlib_mpc.models.serialized_ml_model.customgpr method)": [[14, "agentlib_mpc.models.serialized_ml_model.CustomGPR.set_score_request"]], "set_with_timestamp() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.set_with_timestamp"]], "setup_system() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.setup_system"]], "sim_time (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.sim_time"]], "singular (agentlib_mpc.models.serialized_ml_model.linregparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.LinRegParameters.singular"]], "std (agentlib_mpc.models.serialized_ml_model.gprdatahandlingparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRDataHandlingParameters.std"]], "step() (agentlib_mpc.models.casadi_predictor.lstm method)": [[14, "agentlib_mpc.models.casadi_predictor.LSTM.step"]], "structure (agentlib_mpc.models.serialized_ml_model.serializedann attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.structure"], [14, "id0"]], "sym_input (agentlib_mpc.models.casadi_predictor.casadipredictor attribute)": [[14, "agentlib_mpc.models.casadi_predictor.CasadiPredictor.sym_input"]], "theta (agentlib_mpc.models.serialized_ml_model.gprkernelparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRKernelParameters.theta"]], "to_dict() (agentlib_mpc.models.serialized_ml_model.serializedann method)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.to_dict"]], "training_info (agentlib_mpc.models.serialized_ml_model.serializedmlmodel attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedMLModel.training_info"]], "update_dimensions() (agentlib_mpc.models.casadi_predictor.layer method)": [[14, "agentlib_mpc.models.casadi_predictor.Layer.update_dimensions"]], "update_ml_models() (agentlib_mpc.models.casadi_ml_model.casadimlmodel method)": [[14, "agentlib_mpc.models.casadi_ml_model.CasadiMLModel.update_ml_models"]], "user_config (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.user_config"]], "validate_variables (agentlib_mpc.models.casadi_model.casadimodelconfig attribute)": [[14, "agentlib_mpc.models.casadi_model.CasadiModelConfig.validate_variables"]], "weights (agentlib_mpc.models.serialized_ml_model.serializedann attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.SerializedANN.weights"], [14, "id1"]], "y_train (agentlib_mpc.models.serialized_ml_model.gprparameters attribute)": [[14, "agentlib_mpc.models.serialized_ml_model.GPRParameters.y_train"]], "datasource (class in agentlib_mpc.modules.data_source)": [[15, "agentlib_mpc.modules.data_source.DataSource"]], "minlpmpc (class in agentlib_mpc.modules.minlp_mpc)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPC"]], "mpc (class in agentlib_mpc.modules.mpc_full)": [[15, "agentlib_mpc.modules.mpc_full.MPC"]], "agentlib_mpc.modules.data_source": [[15, "module-agentlib_mpc.modules.data_source"]], "agentlib_mpc.modules.minlp_mpc": [[15, "module-agentlib_mpc.modules.minlp_mpc"]], "agentlib_mpc.modules.mpc_full": [[15, "module-agentlib_mpc.modules.mpc_full"]], "assert_mpc_variables_are_in_model() (agentlib_mpc.modules.minlp_mpc.minlpmpc method)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPC.assert_mpc_variables_are_in_model"]], "binary_controls (agentlib_mpc.modules.minlp_mpc.minlpmpcconfig attribute)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPCConfig.binary_controls"]], "check_data() (agentlib_mpc.modules.data_source.datasourceconfig class method)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.check_data"]], "check_interpolation_method() (agentlib_mpc.modules.data_source.datasourceconfig class method)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.check_interpolation_method"]], "check_r_del_u_in_controls() (agentlib_mpc.modules.mpc_full.mpcconfig class method)": [[15, "agentlib_mpc.modules.mpc_full.MPCConfig.check_r_del_u_in_controls"]], "collect_variables_for_optimization() (agentlib_mpc.modules.mpc_full.mpc method)": [[15, "agentlib_mpc.modules.mpc_full.MPC.collect_variables_for_optimization"]], "columns (agentlib_mpc.modules.data_source.datasourceconfig attribute)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.columns"]], "data (agentlib_mpc.modules.data_source.datasourceconfig attribute)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.data"]], "data_offset (agentlib_mpc.modules.data_source.datasourceconfig attribute)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.data_offset"]], "do_step() (agentlib_mpc.modules.mpc_full.mpc method)": [[15, "agentlib_mpc.modules.mpc_full.MPC.do_step"]], "interpolation_method (agentlib_mpc.modules.data_source.datasourceconfig attribute)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.interpolation_method"]], "log_level (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[15, "agentlib_mpc.modules.mpc.BaseMPCConfig.log_level"]], "model_post_init() (agentlib_mpc.modules.data_source.datasourceconfig method)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.minlp_mpc.minlpmpcconfig method)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPCConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.mpc_full.mpcconfig method)": [[15, "agentlib_mpc.modules.mpc_full.MPCConfig.model_post_init"]], "module_id (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[15, "agentlib_mpc.modules.mpc.BaseMPCConfig.module_id"]], "process() (agentlib_mpc.modules.data_source.datasource method)": [[15, "agentlib_mpc.modules.data_source.DataSource.process"]], "r_del_u (agentlib_mpc.modules.mpc_full.mpcconfig attribute)": [[15, "agentlib_mpc.modules.mpc_full.MPCConfig.r_del_u"]], "register_callbacks() (agentlib_mpc.modules.data_source.datasource method)": [[15, "agentlib_mpc.modules.data_source.DataSource.register_callbacks"]], "register_callbacks_for_lagged_variables() (agentlib_mpc.modules.mpc_full.mpc method)": [[15, "agentlib_mpc.modules.mpc_full.MPC.register_callbacks_for_lagged_variables"]], "set_actuation() (agentlib_mpc.modules.minlp_mpc.minlpmpc method)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPC.set_actuation"]], "t_sample (agentlib_mpc.modules.data_source.datasourceconfig attribute)": [[15, "agentlib_mpc.modules.data_source.DataSourceConfig.t_sample"]], "transform_index() (agentlib_mpc.modules.data_source.datasource method)": [[15, "agentlib_mpc.modules.data_source.DataSource.transform_index"]], "type (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[15, "agentlib_mpc.modules.mpc.BaseMPCConfig.type"]], "validate_binary_bounds() (agentlib_mpc.modules.minlp_mpc.minlpmpcconfig class method)": [[15, "agentlib_mpc.modules.minlp_mpc.MINLPMPCConfig.validate_binary_bounds"]], "validate_incoming_values (agentlib_mpc.modules.mpc.basempcconfig attribute)": [[15, "agentlib_mpc.modules.mpc.BaseMPCConfig.validate_incoming_values"]], "trypredictor (class in agentlib_mpc.modules.inputprediction.try_predictor)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor"]], "agentlib_mpc.modules.inputprediction": [[16, "module-agentlib_mpc.modules.InputPrediction"]], "agentlib_mpc.modules.inputprediction.try_predictor": [[16, "module-agentlib_mpc.modules.InputPrediction.try_predictor"]], "model_post_init() (agentlib_mpc.modules.inputprediction.try_predictor.trypredictorconfig method)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictorConfig.model_post_init"]], "prediction_length (agentlib_mpc.modules.inputprediction.try_predictor.trypredictorconfig attribute)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictorConfig.prediction_length"]], "predictions (agentlib_mpc.modules.inputprediction.try_predictor.trypredictorconfig attribute)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictorConfig.predictions"]], "process() (agentlib_mpc.modules.inputprediction.try_predictor.trypredictor method)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor.process"]], "send_measurement() (agentlib_mpc.modules.inputprediction.try_predictor.trypredictor method)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor.send_measurement"]], "send_prediction() (agentlib_mpc.modules.inputprediction.try_predictor.trypredictor method)": [[16, "agentlib_mpc.modules.InputPrediction.try_predictor.TRYPredictor.send_prediction"]], "log_level (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.log_level"]], "log_level (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.log_level"]], "module_id (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.module_id"]], "module_id (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.module_id"]], "type (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.type"]], "type (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.type"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.coordinator.coordinatorconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.coordinator.CoordinatorConfig.validate_incoming_values"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.employee.miniemployeeconfig attribute)": [[17, "agentlib_mpc.modules.dmpc.employee.MiniEmployeeConfig.validate_incoming_values"]], "controls (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.controls"]], "controls (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.controls"]], "controls (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.controls"]], "coordinator (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.coordinator"]], "couplings (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.couplings"]], "couplings (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.couplings"]], "exchange (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.exchange"]], "exchange (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.exchange"]], "inputs (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.inputs"]], "inputs (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.inputs"]], "inputs (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.inputs"]], "iteration_timeout (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.iteration_timeout"]], "iteration_timeout (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.iteration_timeout"]], "log_level (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.log_level"]], "log_level (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.log_level"]], "log_level (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.log_level"]], "log_level (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.log_level"]], "maxiter (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.maxIter"]], "max_iterations (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.max_iterations"]], "max_iterations (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.max_iterations"]], "messages_in (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.messages_in"]], "messages_in (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.messages_in"]], "messages_out (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.messages_out"]], "messages_out (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.messages_out"]], "module_id (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.module_id"]], "module_id (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.module_id"]], "module_id (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.module_id"]], "module_id (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.module_id"]], "optimization_backend (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.optimization_backend"]], "optimization_backend (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.optimization_backend"]], "optimization_backend (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.optimization_backend"]], "outputs (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.outputs"]], "outputs (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.outputs"]], "outputs (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.outputs"]], "parameters (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.parameters"]], "parameters (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.parameters"]], "parameters (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.parameters"]], "penalty_factor (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.penalty_factor"]], "penalty_factor (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.penalty_factor"]], "prediction_horizon (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.prediction_horizon"]], "prediction_horizon (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.prediction_horizon"]], "prediction_horizon (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.prediction_horizon"]], "r_del_u (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.r_del_u"]], "r_del_u (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.r_del_u"]], "r_del_u (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.r_del_u"]], "registration_interval (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.registration_interval"]], "registration_period (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.registration_period"]], "registration_period (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.registration_period"]], "request_frequency (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.request_frequency"]], "sampling_time (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.sampling_time"]], "sampling_time (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.sampling_time"]], "sampling_time (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.sampling_time"]], "set_outputs (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.set_outputs"]], "set_outputs (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.set_outputs"]], "set_outputs (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.set_outputs"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.shared_variable_fields"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.shared_variable_fields"]], "shared_variable_fields (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.shared_variable_fields"]], "states (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.states"]], "states (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.states"]], "states (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.states"]], "time_out_non_responders (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.time_out_non_responders"]], "time_step (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.time_step"]], "time_step (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.time_step"]], "time_step (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.time_step"]], "type (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.type"]], "type (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.type"]], "type (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.type"]], "type (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.type"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.admm.admm.admmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.ADMMConfig.validate_incoming_values"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.admm.admm.localadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm.LocalADMMConfig.validate_incoming_values"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.admm.admm_coordinated.coordinatedadmmconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinated.CoordinatedADMMConfig.validate_incoming_values"]], "validate_incoming_values (agentlib_mpc.modules.dmpc.admm.admm_coordinator.admmcoordinatorconfig attribute)": [[18, "agentlib_mpc.modules.dmpc.admm.admm_coordinator.ADMMCoordinatorConfig.validate_incoming_values"]], "mhe (class in agentlib_mpc.modules.estimation.mhe)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE"]], "agentlib_mpc.modules.estimation": [[19, "module-agentlib_mpc.modules.estimation"]], "agentlib_mpc.modules.estimation.mhe": [[19, "module-agentlib_mpc.modules.estimation.mhe"]], "cleanup_results() (agentlib_mpc.modules.estimation.mhe.mhe method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.cleanup_results"]], "collect_variables_for_optimization() (agentlib_mpc.modules.estimation.mhe.mhe method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.collect_variables_for_optimization"]], "config_type (agentlib_mpc.modules.estimation.mhe.mhe attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.config_type"]], "decorator_info (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.decorator_info"]], "estimated_inputs (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.estimated_inputs"]], "estimated_parameters (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.estimated_parameters"]], "get_results() (agentlib_mpc.modules.estimation.mhe.mhe method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.get_results"]], "horizon (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.horizon"]], "known_inputs (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.known_inputs"]], "known_parameters (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.known_parameters"]], "model_post_init() (agentlib_mpc.modules.estimation.mhe.mheconfig method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.model_post_init"]], "optimization_backend (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.optimization_backend"]], "process() (agentlib_mpc.modules.estimation.mhe.mhe method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.process"]], "read_results_file() (agentlib_mpc.modules.estimation.mhe.mhe static method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.read_results_file"]], "register_callbacks() (agentlib_mpc.modules.estimation.mhe.mhe method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.register_callbacks"]], "shared_variable_fields (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.shared_variable_fields"]], "shim (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.shim"]], "state_weights (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.state_weights"]], "state_weights_are_in_states() (agentlib_mpc.modules.estimation.mhe.mheconfig class method)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.state_weights_are_in_states"]], "states (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.states"]], "time_step (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.time_step"]], "var_ref (agentlib_mpc.modules.estimation.mhe.mhe attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHE.var_ref"]], "wrapped (agentlib_mpc.modules.estimation.mhe.mheconfig attribute)": [[19, "agentlib_mpc.modules.estimation.mhe.MHEConfig.wrapped"]], "anntrainer (class in agentlib_mpc.modules.ml_model_training.ml_model_trainer)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer"]], "gprtrainer (class in agentlib_mpc.modules.ml_model_training.ml_model_trainer)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer"]], "inducingpoints (class in agentlib_mpc.modules.ml_model_training.data_reduction)": [[20, "agentlib_mpc.modules.ml_model_training.data_reduction.InducingPoints"]], "linregtrainer (class in agentlib_mpc.modules.ml_model_training.ml_model_trainer)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer"]], "mlmodel (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.MLModel"]], "mlmodeltrainer (class in agentlib_mpc.modules.ml_model_training.ml_model_trainer)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer"]], "nystroemreducer (class in agentlib_mpc.modules.ml_model_training.data_reduction)": [[20, "agentlib_mpc.modules.ml_model_training.data_reduction.NystroemReducer"]], "setpointgenerator (class in agentlib_mpc.modules.ml_model_training.setpoint_generator)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator"]], "agent_and_time (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer property)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.agent_and_time"]], "agentlib_mpc.modules.ml_model_training": [[20, "module-agentlib_mpc.modules.ml_model_training"]], "agentlib_mpc.modules.ml_model_training.data_reduction": [[20, "module-agentlib_mpc.modules.ml_model_training.data_reduction"]], "agentlib_mpc.modules.ml_model_training.ml_model_trainer": [[20, "module-agentlib_mpc.modules.ml_model_training.ml_model_trainer"]], "agentlib_mpc.modules.ml_model_training.setpoint_generator": [[20, "module-agentlib_mpc.modules.ml_model_training.setpoint_generator"]], "batch_size (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig.batch_size"]], "build_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer.build_ml_model"]], "build_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer.build_ml_model"]], "build_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.linregtrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer.build_ml_model"]], "build_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.build_ml_model"]], "check_data_sources_exist() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.check_data_sources_exist"]], "check_if_save_path_is_there() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.check_if_save_path_is_there"]], "check_shares_amount_to_one() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.check_shares_amount_to_one"]], "constant_value_bounds (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.constant_value_bounds"]], "create_inputs_and_outputs() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.create_inputs_and_outputs"]], "data_sources (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.data_sources"]], "day_end (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.day_end"]], "day_lb (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.day_lb"]], "day_start (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.day_start"]], "day_ub (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.day_ub"]], "divide_in_tvt() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.divide_in_tvt"]], "early_stopping (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig.early_stopping"]], "epochs (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig.epochs"]], "fill_interpolations() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.fill_interpolations"]], "fill_lags() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.fill_lags"]], "fill_output_types() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.fill_output_types"]], "fill_recursive_outputs() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig class method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.fill_recursive_outputs"]], "fit_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer.fit_ml_model"]], "fit_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer.fit_ml_model"]], "fit_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.linregtrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer.fit_ml_model"]], "fit_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.fit_ml_model"]], "input_names (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer property)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.input_names"]], "inputs (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.inputs"]], "interpolations (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.interpolations"]], "interval (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.interval"]], "lags (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.lags"]], "layers (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig.layers"]], "length_scale_bounds (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.length_scale_bounds"]], "model_post_init() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainerconfig method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainerConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.linregtrainerconfig method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainerConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.model_post_init"]], "model_post_init() (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig method)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.model_post_init"]], "model_type (agentlib_mpc.modules.ml_model_training.ml_model_trainer.anntrainer attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.ANNTrainer.model_type"]], "model_type (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainer attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainer.model_type"]], "model_type (agentlib_mpc.modules.ml_model_training.ml_model_trainer.linregtrainer attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.LinRegTrainer.model_type"]], "model_type (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.model_type"]], "n_restarts_optimizer (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.n_restarts_optimizer"]], "night_lb (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.night_lb"]], "night_ub (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.night_ub"]], "noise_level (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.noise_level"]], "noise_level_bounds (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.noise_level_bounds"]], "normalize (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.normalize"]], "output_names (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer property)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.output_names"]], "output_types (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.output_types"]], "outputs (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.outputs"]], "process() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.process"]], "process() (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgenerator method)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator.process"]], "recursive_outputs (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.recursive_outputs"]], "reduce() (agentlib_mpc.modules.ml_model_training.data_reduction.inducingpoints method)": [[20, "agentlib_mpc.modules.ml_model_training.data_reduction.InducingPoints.reduce"]], "reduce() (agentlib_mpc.modules.ml_model_training.data_reduction.nystroemreducer method)": [[20, "agentlib_mpc.modules.ml_model_training.data_reduction.NystroemReducer.reduce"]], "register_callbacks() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.register_callbacks"]], "register_callbacks() (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgenerator method)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator.register_callbacks"]], "resample() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.resample"]], "retrain_delay (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.retrain_delay"]], "retrain_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.retrain_model"]], "save_all() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.save_all"]], "save_data (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.save_data"]], "save_directory (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.save_directory"]], "save_ml_model (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.save_ml_model"]], "save_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.save_ml_model"]], "save_plots (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.save_plots"]], "scale (agentlib_mpc.modules.ml_model_training.ml_model_trainer.gprtrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.GPRTrainerConfig.scale"]], "serialize_ml_model() (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer method)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.serialize_ml_model"]], "shared_variable_fields (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.shared_variable_fields"]], "shared_variable_fields (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.shared_variable_fields"]], "step_size (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.step_size"]], "target_variable (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgeneratorconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGeneratorConfig.target_variable"]], "test_share (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.test_share"]], "time_series_length (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.time_series_length"]], "time_series_memory_size (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.time_series_memory_size"]], "train_share (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.train_share"]], "training_info (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainer property)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainer.training_info"]], "update_target() (agentlib_mpc.modules.ml_model_training.setpoint_generator.setpointgenerator method)": [[20, "agentlib_mpc.modules.ml_model_training.setpoint_generator.SetPointGenerator.update_target"]], "use_values_for_incomplete_data (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.use_values_for_incomplete_data"]], "validation_share (agentlib_mpc.modules.ml_model_training.ml_model_trainer.mlmodeltrainerconfig attribute)": [[20, "agentlib_mpc.modules.ml_model_training.ml_model_trainer.MLModelTrainerConfig.validation_share"]], "cost_function (agentlib_mpc.optimization_backends.backend.optimizationbackend attribute)": [[21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.cost_function"]], "model (agentlib_mpc.optimization_backends.backend.optimizationbackend attribute)": [[21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.model"]], "var_ref (agentlib_mpc.optimization_backends.backend.optimizationbackend attribute)": [[21, "agentlib_mpc.optimization_backends.backend.OptimizationBackend.var_ref"]], "b (agentlib_mpc.optimization_backends.casadi_.mhe.collocationmatrices attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices.B"]], "c (agentlib_mpc.optimization_backends.casadi_.mhe.collocationmatrices attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices.C"]], "casadiadmmbackend_nn (class in agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN"]], "casadibbbackend (class in agentlib_mpc.optimization_backends.casadi_.casadi_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend"]], "casadiadmmnnsystem (class in agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem"]], "casadimlsystem (class in agentlib_mpc.optimization_backends.casadi_.casadi_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem"]], "collocationmatrices (class in agentlib_mpc.optimization_backends.casadi_.mhe)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices"]], "d (agentlib_mpc.optimization_backends.casadi_.mhe.collocationmatrices attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices.D"]], "directcollocation (class in agentlib_mpc.optimization_backends.casadi_.mhe)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation"]], "mhebackend (class in agentlib_mpc.optimization_backends.casadi_.mhe)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend"]], "mhesystem (class in agentlib_mpc.optimization_backends.casadi_.mhe)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem"]], "multipleshootingadmmnn (class in agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.MultipleShootingADMMNN"]], "multipleshooting_ml (class in agentlib_mpc.optimization_backends.casadi_.casadi_ml)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML"]], "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml": [[22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml"]], "agentlib_mpc.optimization_backends.casadi_.casadi_ml": [[22, "module-agentlib_mpc.optimization_backends.casadi_.casadi_ml"]], "agentlib_mpc.optimization_backends.casadi_.mhe": [[22, "module-agentlib_mpc.optimization_backends.casadi_.mhe"]], "algebraics (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.algebraics"]], "algebraics (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.algebraics"]], "algebraics (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.algebraics"]], "algebraics (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.algebraics"]], "all_system_quantities() (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem method)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.all_system_quantities"]], "controls (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.controls"]], "controls (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.controls"]], "controls (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.controls"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.cost_function"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.cost_function"]], "discretization (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.discretization"]], "discretization (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.discretization"]], "discretization (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.discretization"]], "discretization (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.discretization"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmbackend_nn attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN.discretization_types"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.discretization_types"]], "discretization_types (agentlib_mpc.optimization_backends.casadi_.mhe.mhebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend.discretization_types"]], "estimated_inputs (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.estimated_inputs"]], "estimated_parameters (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.estimated_parameters"]], "estimated_states (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.estimated_states"]], "get_lags_per_variable() (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend method)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.get_lags_per_variable"]], "initial_state (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.initial_state"]], "initial_state (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.initial_state"]], "initial_state (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.initial_state"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem method)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem method)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.casadi_ml.multipleshooting_ml method)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.mhe.directcollocation method)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation.initialize"]], "initialize() (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem method)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.initialize"]], "it (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.it"]], "known_inputs (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.known_inputs"]], "known_parameters (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.known_parameters"]], "lag_collection (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.lag_collection"]], "lags_dict (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.lags_dict"]], "last_control (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.last_control"]], "max_lag (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.multipleshootingadmmnn attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.MultipleShootingADMMNN.max_lag"]], "max_lag (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.max_lag"]], "max_lag (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem property)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.max_lag"]], "max_lag (agentlib_mpc.optimization_backends.casadi_.casadi_ml.multipleshooting_ml attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.MultipleShooting_ML.max_lag"]], "measured_states (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.measured_states"]], "model (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.model"]], "model (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.model"]], "model (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.model"]], "model (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.model"]], "model (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.model"]], "model_constraints (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.model_constraints"]], "model_constraints (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.model_constraints"]], "model_constraints (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.model_constraints"]], "model_constraints (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.model_constraints"]], "model_parameters (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.model_parameters"]], "model_parameters (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.model_parameters"]], "model_parameters (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.model_parameters"]], "non_controlled_inputs (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.non_controlled_inputs"]], "non_controlled_inputs (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.non_controlled_inputs"]], "non_controlled_inputs (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.non_controlled_inputs"]], "now (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.now"]], "ode (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.ode"]], "ode (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.ode"]], "ode (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.ode"]], "ode (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.ode"]], "only_positive_times_in_results (agentlib_mpc.optimization_backends.casadi_.mhe.directcollocation attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.DirectCollocation.only_positive_times_in_results"]], "order (agentlib_mpc.optimization_backends.casadi_.mhe.collocationmatrices attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices.order"]], "outputs (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.outputs"]], "outputs (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.outputs"]], "outputs (agentlib_mpc.optimization_backends.casadi_.mhe.mhesystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHESystem.outputs"]], "outputs (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.outputs"]], "parameters (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem property)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.parameters"]], "past_couplings (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.past_couplings"]], "past_exchange (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.past_exchange"]], "quantities (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem property)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.quantities"]], "r_del_u (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.r_del_u"]], "result_stats (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.result_stats"]], "results (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.results"]], "root (agentlib_mpc.optimization_backends.casadi_.mhe.collocationmatrices attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.CollocationMatrices.root"]], "sample() (agentlib_mpc.optimization_backends.casadi_.mhe.mhebackend static method)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend.sample"]], "sim_step (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadimlsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasadiMLSystem.sim_step"]], "sim_step_quantities (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem property)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.sim_step_quantities"]], "states (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasadiADMMSystem.states"]], "states (agentlib_mpc.optimization_backends.casadi_.full.fullsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.FullSystem.states"]], "states (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpsystem attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasadiMINLPSystem.states"]], "system (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmbackend_nn attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN.system"]], "system (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.system"]], "system (agentlib_mpc.optimization_backends.casadi_.mhe.mhebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend.system"]], "system_type (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmbackend_nn attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasADiADMMBackend_NN.system_type"]], "system_type (agentlib_mpc.optimization_backends.casadi_.casadi_ml.casadibbbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_ml.CasADiBBBackend.system_type"]], "system_type (agentlib_mpc.optimization_backends.casadi_.mhe.mhebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.mhe.MHEBackend.system_type"]], "var_ref (agentlib_mpc.optimization_backends.casadi_.admm.casadiadmmbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.admm.CasADiADMMBackend.var_ref"]], "var_ref (agentlib_mpc.optimization_backends.casadi_.basic.casadibasebackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.basic.CasADiBaseBackend.var_ref"]], "var_ref (agentlib_mpc.optimization_backends.casadi_.full.casadifullbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.full.CasADiFullBackend.var_ref"]], "var_ref (agentlib_mpc.optimization_backends.casadi_.minlp.casadiminlpbackend attribute)": [[22, "agentlib_mpc.optimization_backends.casadi_.minlp.CasADiMINLPBackend.var_ref"]], "variables (agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.casadiadmmnnsystem property)": [[22, "agentlib_mpc.optimization_backends.casadi_.casadi_admm_ml.CasadiADMMNNSystem.variables"]], "constraints (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.constraints"]], "constraints_lb (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.constraints_lb"]], "constraints_ub (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.constraints_ub"]], "cost_function (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.cost_function"]], "dim (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.dim"]], "dim (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.dim"]], "equalities (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.equalities"]], "full_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.full_names"]], "full_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.full_names"]], "full_symbolic (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.full_symbolic"]], "full_symbolic (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.full_symbolic"]], "initial_guess (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.initial_guess"]], "k (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.k"]], "model (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.model"]], "model (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.model"]], "mpc_opt_pars (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.mpc_opt_pars"]], "mpc_opt_vars (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.mpc_opt_vars"]], "name (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.name"]], "name (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.name"]], "name (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.name"]], "objective_function (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.objective_function"]], "opt_pars (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.opt_pars"]], "opt_vars (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.opt_vars"]], "opt_vars_lb (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.opt_vars_lb"]], "opt_vars_ub (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.opt_vars_ub"]], "overwrite_result_file (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.overwrite_result_file"]], "pred_time (agentlib_mpc.optimization_backends.casadi_.core.discretization.discretization attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.discretization.Discretization.pred_time"]], "ref_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.ref_names"]], "ref_names (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationvariable attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationVariable.ref_names"]], "results_file (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.results_file"]], "save_results (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackendconfig attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasadiBackendConfig.save_results"]], "use_in_stage_function (agentlib_mpc.optimization_backends.casadi_.core.variablegroup.optimizationparameter attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup.OptimizationParameter.use_in_stage_function"]], "var_ref (agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.casadibackend attribute)": [[23, "agentlib_mpc.optimization_backends.casadi_.core.casadi_backend.CasADiBackend.var_ref"]], "agentlib_mpc.utils.sampling": [[24, "module-agentlib_mpc.utils.sampling"]], "earliest_index() (in module agentlib_mpc.utils.sampling)": [[24, "agentlib_mpc.utils.sampling.earliest_index"]], "interpolate_to_previous() (in module agentlib_mpc.utils.sampling)": [[24, "agentlib_mpc.utils.sampling.interpolate_to_previous"]], "pairwise() (in module agentlib_mpc.utils.sampling)": [[24, "agentlib_mpc.utils.sampling.pairwise"]], "sample() (in module agentlib_mpc.utils.sampling)": [[24, "agentlib_mpc.utils.sampling.sample"]], "sample_values_to_target_grid() (in module agentlib_mpc.utils.sampling)": [[24, "agentlib_mpc.utils.sampling.sample_values_to_target_grid"]], "agentlib_mpc.utils.plotting.admm_consensus_shades": [[25, "module-agentlib_mpc.utils.plotting.admm_consensus_shades"]], "agentlib_mpc.utils.plotting.admm_dashboard": [[25, "module-agentlib_mpc.utils.plotting.admm_dashboard"]], "agentlib_mpc.utils.plotting.discretization_structure": [[25, "module-agentlib_mpc.utils.plotting.discretization_structure"]], "agentlib_mpc.utils.plotting.interactive": [[25, "module-agentlib_mpc.utils.plotting.interactive"]], "agentlib_mpc.utils.plotting.ml_model_test": [[25, "module-agentlib_mpc.utils.plotting.ml_model_test"]], "agentlib_mpc.utils.plotting.mpc": [[25, "module-agentlib_mpc.utils.plotting.mpc"]], "calc_scores() (in module agentlib_mpc.utils.plotting.ml_model_test)": [[25, "agentlib_mpc.utils.plotting.ml_model_test.calc_scores"]], "create_app() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.create_app"]], "create_coupling_var_plot() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.create_coupling_var_plot"]], "create_residuals_plot() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.create_residuals_plot"]], "draggable_script() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.draggable_script"]], "evaluate_model() (in module agentlib_mpc.utils.plotting.ml_model_test)": [[25, "agentlib_mpc.utils.plotting.ml_model_test.evaluate_model"]], "get_coupling_variables() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.get_coupling_variables"]], "get_data_for_plot() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.get_data_for_plot"]], "get_max_iterations_per_timestep() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.get_max_iterations_per_timestep"]], "get_port() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.get_port"]], "interpolate_colors() (in module agentlib_mpc.utils.plotting.mpc)": [[25, "agentlib_mpc.utils.plotting.mpc.interpolate_colors"]], "load_agent_data() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.load_agent_data"]], "main() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.main"]], "make_components() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.make_components"]], "make_figure_plotly() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.make_figure_plotly"]], "obj_plot() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.obj_plot"]], "pairwise_sort() (in module agentlib_mpc.utils.plotting.ml_model_test)": [[25, "agentlib_mpc.utils.plotting.ml_model_test.pairwise_sort"]], "plot_admm() (in module agentlib_mpc.utils.plotting.mpc)": [[25, "agentlib_mpc.utils.plotting.mpc.plot_admm"]], "plot_admm_plotly() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.plot_admm_plotly"]], "plot_consensus_shades() (in module agentlib_mpc.utils.plotting.admm_consensus_shades)": [[25, "agentlib_mpc.utils.plotting.admm_consensus_shades.plot_consensus_shades"]], "plot_mpc() (in module agentlib_mpc.utils.plotting.mpc)": [[25, "agentlib_mpc.utils.plotting.mpc.plot_mpc"]], "plot_mpc_plotly() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.plot_mpc_plotly"]], "predict_array() (in module agentlib_mpc.utils.plotting.ml_model_test)": [[25, "agentlib_mpc.utils.plotting.ml_model_test.predict_array"]], "show_admm_dashboard() (in module agentlib_mpc.utils.plotting.admm_dashboard)": [[25, "agentlib_mpc.utils.plotting.admm_dashboard.show_admm_dashboard"]], "show_dashboard() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.show_dashboard"]], "solver_return() (in module agentlib_mpc.utils.plotting.interactive)": [[25, "agentlib_mpc.utils.plotting.interactive.solver_return"]], "spy_structure() (in module agentlib_mpc.utils.plotting.discretization_structure)": [[25, "agentlib_mpc.utils.plotting.discretization_structure.spy_structure"]]}}) \ No newline at end of file diff --git a/docs/0.6.4/docs/tutorials/ADMM.html b/docs/0.6.4/docs/tutorials/ADMM.html new file mode 100644 index 0000000..91479ce --- /dev/null +++ b/docs/0.6.4/docs/tutorials/ADMM.html @@ -0,0 +1,342 @@ + + + + + + + + + Alternating Direction Method of Multipliers — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Alternating Direction Method of Multipliers

+

In this section, we will learn how to use agentlib for distributed MPC using +the alternating direction method of multipliers (ADMM). The required example +files are located in ‘examples/admm/’. They include two +main scripts and two directories with models and config files respectively. +We simulate the same system as before, however this time the AHU determines +its mass flow without knowing the system behaviour of the room, creating the +need for coordination.

+
+

Main script

+

There are three main scripts. One runs a local version of the ADMM algorithm, which +operates within a single thread and is suited for simulation and testing. The other +one runs the agents in separate python processes and communicates through MQTT. +The last one implements a coordinated ADMM, which can be useful, since it helps +unify parameter setting and provides better convergence criteria. +Here, we will look at the Realtime implementation using multiprocessing.

+
from agentlib.utils.multi_agent_system import MultiProcessingMAS
+import logging
+import matplotlib.pyplot as plt
+
+
+

The only new import this time is the +MultiProcessingMAS utility. Unlike the LocalMASAgency we used before, +the MultiprocessingMAS spawns a separate python process for each agent, +allowing +for the true parallelism that would take place in a real-world MAS. However, +this also requires the condition that simulations are performed in Realtime, +since time is now the common variable between systems that keeps them in sync. +Now onto the main script.

+
env_config = {"rt": True,
+              "strict": True,
+              "factor": 0.1,
+              "t_sample": 60}
+
+mas = MultiProcessingMAS(agent_configs=['configs\\cooler.json',
+                                        'configs\\cooled_room.json',
+                                        'configs\\simulator.json'],
+                         env=env_config,
+                         variable_logging=True)
+mas.run(until=until)
+results = mas.get_results()
+
+
+

As explained, we choose a Realtime environment, set it to strict +(RuntimeError will be raised if simulation is too slow), and give it a +factor of 0.1 to speed it up. Finally, we set t_sample to 60, so we +will save our results in an interval of 60 seconds. Then, we provide our MAS +three configs - one for the room controller, one for the AHU controller and +one to simulate the full system.

+
+
+

System models

+

There are three models. The simulation model and the room model are similar to +the models we used in the MPC examples before, with the main difference +being in the constraints and cost function. The simulation model omits the +MPC-related parts of the model, while the room model is the same as before, +with only the air mass flow term missing from the cost function. The cooler +model on the other hand is a simple input equals output model of the mass +flow, including the cost function term that was removed from the room model. +Therefore, we created a situation, where the room is not explicitly +penalized for usage of the mass flow anymore, but instead a separate system is.

+
+
+

Communication via MQTT

+

For this example, we are not providing the configs in the python script +itself, but store them separately as json. Both agent configs and configs of +single modules can be stored in separate json. Let’s look at the config file +configs/communicators/cooled_room_mqtt.json. +Since the agents are now using separate processes, we cannot use the +local_broadcast communicator anymore. Instead, we are using the MQTT +communicator from the agentlib. The config for an MQTT commincator is a bit +more complicated than the local_broadcast. After providing +an id and specifying the type to “mqtt”, there are some parameters to provide:“url” and “subscriptions”. For small test scripts, the url from the snippet +below will do.

+
{
+  "module_id": "Ag1Com",
+  "type": "mqtt",
+  "url": "mqtt://test.mosquitto.org",
+  "subscriptions": ["Cooler", "Simulation"]
+}
+
+
+

The subscriptions are a list of agent ids the agent is subscribed to. For more info +on MQTT topics visit e.g. +here. +In agentlib, the mqtt communicator sends messages under a topic consisting of +“/agentlib/“. The # is a wildcard, so by specifying the topics +in the way above, the agent will receive all messages from the Cooler agent +and the Simulation agent. The resulting communication structure can be seen +in the image below:

+images/tutorials/admm_comm.png +
+
+

ADMM config

+

tbd +Let’s look at the beginning of the config for the room agent. First of all, +we see a file path in the list of modules, which points to our communicator +config. The root of relative filepaths is the directory, where the main +script is run.

+
{
+  "id": "CooledRoom",
+  "modules": [
+            "configs/communicators/cooled_room_mqtt.json",
+    {
+      "module_id": "admm_module",
+      "type": "admm",
+      "optimization_backend": {
+        "type": "casadi_admm",
+        "model": {
+          "type": {
+            "file": "models/ca_room_model.py",
+            "class_name": "CaCooledRoom"
+          }
+        },
+        "solver": {
+          "name": "ipopt",
+          "options": {
+            "print_level": 0
+          }
+        },
+        "results_file": "admm_opt.csv"
+      },
+
+
+

We can see, that the module type for the controller now reads “admm”, and the +optimization backend type is “casadi_admm”. We can also see, that there are +some new options set for the optimization_backend, namely the solver option. +The numerical solver name can be chosen from a list of supported solvers +(currently supported are ipopt, sqpmethod, qpoases). For most purposes, +IPOPT will be the solver of choice. However, we can change the default +options for the chosen solver. To see applicable options, please refer to +the documentation of the solver. For IPOPT, an overview of all the options +can be found on the official site. +In our +case, we set the print_level to 0 to avoid clutter in the console output. +We also specify a results_file, so we save detailed information about each +NLP solution in csv format, readable e.g. as a multi-indexed pandas +Dataframe.

+

After providing parameters and inputs in the usual way, let’s +have a look at what changed between the central MPC and the ADMM.

+
+

Note

+

The prediction_horizon, time_step and penalty_factor parameters of +the ADMM module affect the strucuture of the optimization problem and +need to be identical for all modules taking part in the ADMM algorithm. +Currently, this is not validated automatically, so care should be taken when +writing the config. The timeout, registration_period and +admm_iter_max parameters should also be the same our similar.

+
+
"controls": [
+],
+"states": [
+  {
+    "name": "T_0",
+    "value": 298.16,
+    "ub": 303.15,
+    "lb": 288.15
+  }
+],
+"couplings": [
+  {
+    "name": "mDot_0",
+    "alias": "mDotCoolAir",
+    "value": 0.05,
+    "ub": 0.1,
+    "lb": 0}
+
+
+

The controls list is now empty, as the air mass flow is not determined by +the room anymore. Instead, it is now listed under the new type couplings. +The couplings are optimization variables, so they should also have upper and +lower boundaries. ADMM with agentlib is based on consensus, meaning partial +systems that have to agree on shared variables are optimized. The shared +variables are identified through their alias. In this +example, all agents that define a coupling with alias “mDotCoolAir” share +this variable. The value for the state “T_0” is obtained from the Simulation +agent, so care should be taken to make sure the alias matches. In this case, +the default alias of “T_0” will match, since the name exists in the +simulation model.

+

Now let’s see the config on the side of the cooler:

+
  "controls": [
+    {
+      "name": "mDot",
+      "value": 0.02,
+      "ub": 0.1,
+      "lb": 0
+    }
+  ],
+  "states": [
+  ],
+  "couplings": [
+    {
+      "name": "mDot_out",
+      "alias": "mDotCoolAir",
+      "value": 0.05
+    }
+  ]
+},
+
+
+

We can see, that there are two variables of interest, one in controls and +one in couplings. The control “mDot” is the actuation that is sent to the +simulator after optimization. Therefore, the alias of the mass flow in the +Simulation agent must match “mDot”. The coupling “mDot_out” is assigned with +the alias “mDotCoolAir”, which matches the coupling in the room agent.

+
+ + Why do I have to declare two variables, if they mean the same thing? + +
+Because the models follow the FMU standard, where variables are divided +between inputs, outputs, locals/states and parameters. In this case, our +cooler model takes a mass flow as an input ("mDot" in this case) and +produces the same mass flow as an output to other systems ("mDot_out" in +this case). In a more complex setting, the cooler might have an internal PID +controller to set the mass flow to its correct value. In that case, "mDot" +would be setpoint of the mass flow, and "mDot_out" would be the actual mass +flow. +
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/tutorials/MPC.html b/docs/0.6.4/docs/tutorials/MPC.html new file mode 100644 index 0000000..ed0a7fe --- /dev/null +++ b/docs/0.6.4/docs/tutorials/MPC.html @@ -0,0 +1,471 @@ + + + + + + + + + Model Predictive Control — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Model Predictive Control

+
+

Creating an MPC in agentlib with CasADi

+

To run a model predictive controller, a system model for use in optimization +is required. What model types are available depends on the chosen +optimization backend. In this section, creating an MPC with a CasADi backend +is explained. Open the ‘examples/one_room_mpc/physical/simple_mpc.py’ example.

+
+

Imports

+

As usual, let’s look at the imports first.

+
import logging
+from typing import List
+import matplotlib.pyplot as plt
+from agentlib.models.casadi_model import CasadiModel, CasadiInput, CasadiState, \
+    CasadiParameter, CasadiOutput
+from agentlib.utils.multi_agent_system import LocalMASAgency
+
+
+

We import logging as usual and +typing is used to annotate the optimzation model we will be creating, +and matplotlib is used to plot the results. Next, we import the CasadiModel and +some CasadiVariables. We will use these to specify an agentlib-style +CasadiModel. Finally, we import the LocalMASAgency utility. This can be used +to conveniently create and run your local MAS, without creating the agents +and their environment by hand.

+
+
+

Model creation

+

Now let’s see how we can create an optimization model. The model contains +the physical system dynamics, as well as the cost function and additional +constraints on the system.

+

In this example, we will create a model of a room, which is under a constant +heat load and can be controlled by changing the mass flow of cool air from +an air handling unit.

+

Creating a custom CasadiModel is similar to creating a module.

+
    +
  1. Creating a class that inherits from CasadiModelConfig

    +
      +
    • Declare the model variables in the config class

      +
        +
      • inputs

      • +
      • outputs

      • +
      • states

      • +
      • parameters

      • +
      +
    • +
    +
  2. +
  3. Creating a class that inherits from CasadiModel

    +
      +
    1. Assign the config with config: <<ConfigClass>>

    2. +
    3. Define model equations by overwriting the setup_system method

    4. +
    +
  4. +
+
+

Variable declaration

+

Let’s see, how we declare the variables required for our simple room model. +Since modeling in agentlib is based on the FMU-standard, we divide our +variables into inputs, outputs, parameters and locals (called states to +avoid clash with the python builtin locals). First, we need to create a custom +config for our CasadiModel.

+
class MyCasadiModelConfig(CasadiModelConfig):
+    inputs: List[CasadiInput] = [
+        # controls
+        CasadiInput(name="mDot", value=0.0225, unit="K", description="Air mass flow into zone"),
+
+        # disturbances
+        CasadiInput(name="load", value=150, unit="W", description="Heat "
+                                                                  "load into zone"),
+        CasadiInput(name="T_in", value=290.15, unit="K", description="Inflow air temperature"),
+
+        # settings
+        CasadiInput(name="T_upper", value=294.15, unit="K", description="Upper boundary (soft) for T."),
+    ]
+
+    states: List[CasadiState] = [
+        # differential
+        CasadiState(name="T", value=293.15, unit="K", description="Temperature of zone"),
+
+        # algebraic
+
+        # slack variables
+        CasadiState(name="T_slack", value=0, unit="K", description="Slack variable of temperature of zone")
+    ]
+
+    parameters: List[CasadiParameter] = [
+        CasadiParameter(name="cp", value=1000, unit="J/kg*K", description="thermal capacity of the air"),
+        CasadiParameter(name="C", value=100000, unit="J/K",
+                        description="thermal capacity of zone"),
+        CasadiParameter(name="s_T", value=1, unit="-", description="Weight for T in constraint function"),
+        CasadiParameter(name="r_mDot", value=1, unit="-",
+                        description="Weight for mDot in objective function")
+    ]
+    outputs: List[CasadiOutput] = [
+        CasadiOutput(name='T_out', unit="K", description="Temperature of zone")
+    ]
+
+
+

Our room model has four inputs. These include the inputs of the physical +system, being the air mass flow from the AHU, the temperature of this mass flow and +the load on the system. We also count the upper room temperature limit as an +input, since it should be settable by the occupants of the room. To declare an input, we put a CasadiInput object into a list inputs. A +variable always needs a name. You can also give it a value, which will be +used if no other value is provided at Runtime. The unit and description +parameters currently serve no purpose, but can be helpful to readers of the +model. Next we define the states. For one, that is the temperature of the room. +Since we use soft constraints to enforce an adequate room temperature, we also have to include +a slack variable.

+
+

Note

+

States in the context of an AgentLib model refers to all variables that +are local to a model. All differential variables have to be declared as +states, but not all states need to be associated with a +differential equation.

+
+

Next, we have the parameters. These include the specific thermal capacity of +air, the thermal capacity of the room and two weights for the cost function. +Finally, we specify an output of the model. It is not required for the MPC +in this example, but can be useful for situations, where one might want to +use the same model for optimization and simulation. Outputs always need to be +associated with an algebraic equation.

+
+
+

Equation and constraints

+

After specifying a config, we can write the model class itself, which containts the +dynamics. First, it is important to specify the config_type attribute of the +class and set it to the config class we defined. The model equations and constraints are specified in the setup_system method. +We can access the variables defined above by referencing self.<name>. +Differential equations are associated with a variable by setting the ode +attribute of that variable. In the same way, algebraic equations can be +defined by setting the alg attribute.

+
class MyCasadiModel(CasadiModel):
+
+    config: MyCasadiModelConfig
+
+    def setup_system(self):
+        # Define ode
+        self.T.ode = self.cp * self.mDot / self.C * \
+                       (self.T_in - self.T) + \
+                       self.load / self.C
+
+        # Define ae
+        self.T_out.alg = self.T
+
+        # Constraints: List[(lower bound, function, upper bound)]
+        self.constraints = [
+
+            # soft constraints
+            (0, self.T + self.T_slack, self.T_upper),
+
+        ]
+
+        # Objective function
+        objective = sum([
+            self.r_mDot * self.mDot,
+            self.s_T * self.T_slack ** 2,
+        ])
+
+        return objective
+
+
+

Constraints can be added to the model through the constraints attribute. +It should be defined as a list of tuples, with the lower bound coming first, +the constraint function coming second and the upper bound coming last. +Equality constraints can be added by setting upper and lower bound to the +same value. Note that algebraic equations will also be converted to equality +constraints internally. Here, we set one constraint to implement the soft +constraint on the room temperature.

+
+ + What's the difference between an algebraic equation and setting an +equality constraint? + +
+Algebraic equations are explicit assignments to a CasadiOutput. They are considered when simulating the model or when doing MPC with it. +Constraints specified as tuples can be of implicit nature, however they are +ignored for simulation. The only limitation on constraints is, that +variables that make up the upper or lower bound cannot be used as +optimization variables in the MPC. +
+
+

Note

+

Python intuition tells us self.<name> should not work, as we did not +set the attribute. +In the model base class of agentlib, the __get_attr__ method is written +in a way that allows access to all variables that are defined in the +Config class of the model.

+
+

Finally, we can specify and return the objective function in the same way as +the other equations. We use the sum() function from python to +improve readability.

+
+
+
+

Configuration of the multi-agent-system

+

Let’s look at the environment config first.

+
ENV_CONFIG = {"rt": False,
+              "t_sample": 60}
+
+
+

This time, we specify ‘rt’ +(=Realtime) as False, meaning we want the simulation to run as fast as possible. +The ‘t_sample’ option specifies the time step in which the interal clock of +the environment ticks. This is relevant e.g. for classical controllers like +PID. It will also affect the sampling with which results are saved.

+

Below is the config for the MPC agent. As before, we specify an “id” and a +list of modules, with the first one being a local_broadcast communicator. +Then, we add the MPC module. We specify “mpc” as the type, and then add the +other options. A central part of the MPC is its _optimizationbackend. The +optimization backend is specified by another dictionary, always consisting +of “type” and “model”. The model will usually be user-specified and usually +is provided with the same syntax of “file” and “class_name” as the custom +module in the PingPong example. The optimization backend also takes an +option “discretization_options”, however we will look at that later.

+
AGENT_MPC = {"id": "myMPCAgent",
+             "modules": [
+                 {"module_id": "Ag1Com",
+                  "type": "local_broadcast"},
+                 {"module_id": "myMPC",
+                  "type": "mpc",
+                  "optimization_backend":
+                      {"type": "casadi",
+                       "model": {
+                           "type": {"file": __file__,
+                                    "class_name": "MyCasadiModel"}},
+                       ...
+                       },
+                  "time_step": 900,
+                  "prediction_horizon": 5,
+                  "parameters": [
+                      {"name": "s_T", "value": 3},
+                      {"name": "r_mDot", "value": 1},
+                        ],
+                  "inputs": [
+                      {"name": "load", "value": 150},
+                      {"name": "T_upper", "value": ub},
+                      {"name": "T_in", "value": 290.15},
+                        ],
+                  "controls": [{"name": "mDot", "value": 0.02, "ub": 1, "lb": 0}],
+                  "states": [{"name": "T", "value": 298.16, "ub": 303.15, "lb": 288.15}],
+                  },
+                 ]}
+                 ]}
+
+
+

Aside from that, “time_step” and “prediction_horizon” need to be specified. +The other options the MPC module takes are parameters, inputs, controls and +states . The time step should be provided +in seconds. The states in the MPC config refer to differential variables, +not to be confused with states in the model, which refer to any internal +variables. Quantities declared in the module config are variables of the multi-agent-system and +can be shared with other modules of the same agent, and communicated with +other agents. All agent variables declared here must match - in name - their +counterpart in the provided model. Controls, states and inputs must be +provided fully matching the model. Outputs can be ignored if they are not +required. Finally, parameters can be omitted, if a default value is provided +in the model definition. Here, the weight parameters in the cost function +are provided, as it might be required to change them. However, physical +parameters such as the thermal capacity of air are taken from the model, as +they are not expected to change. A variable is given a name and a value. For states, the value will determine +the initial value of the differential variable, if it is not provided +externally, for example by a simulation agent. Since controls and +states are the variables of the optimization +problem, boundaries should be provided via the keys “ub” and “lb”. These +values are for constant hard boundaries. If time-variant boundaries are +required, one should declare an additional variable and constraint in the model.

+
+
+

Running the multi-agent-system

+

Now that we have our control agent setup, we need to simulate our system. +The easiest way to do this in agentlib, is to setup an agent with a +simulator module. Usually in agentlib, we would use an FMU to simulate a +system. In this example, we will use the CasadiModel we created for the +optimization. The resulting agent config is shown below.

+
AGENT_SIM = {"id": "SimAgent",
+             "modules": [
+                 {"module_id": "Ag1Com",
+                  "type": "local_broadcast"},
+                 {"module_id": "room",
+                  "type": "simulator",
+                  "model": {"type": {"file": __file__,
+                                     "class_name": "MyCasadiModel"},
+                            "states": [
+                                {"name": "T", "value": 298.16}
+                            ]},
+                  "t_sample": 60,
+                  "outputs": [
+                      {"name": "T_out", "alias": "T"},
+                  ],
+                  "inputs": [
+                      {"name": "mDot", "value": 0.02, "alias": "mDot"},
+                  ]},
+             ]}
+
+
+

The model type for the simulator is provided in the same manner as before. +However, here we can see, that we have the option to provide additional +variable options to the model. For example, here we change the starting +value of the temperature to a value above the upper (soft) boundary, so our +controller has to work.

+

Then, inputs and outputs of the simulator. Every +simulator needs to be provided with a sampling rate “t_sample” in seconds. +Additionally, declare the output “T_out”. This is the first time we use the +alias keyword. The alias is part of the duo of alias and source that uniquely +define a variable within the MAS. The source is the combination of the agent_id +and the module_id where the variable was defined. When expecting variables from +another agent, only the agent_id has to be specified, and when the variable is from +a module within the same agent, the module_id shoudld be specified. The +alias is a name independent of the variable name in models (think of long Modelica names) +and is consistent across agents for the same variable. By default, the name +of a variable is also its alias. In the case of T_out however, we have to +specify that this is the variable we want to send to the MPC for its initial +state. Since the state in the MPC agent is named “T” (and by default has +alias “T”), we have to set “T” as the alias for our model output. The model in turn takes the computed mass flow setpoint as input, hence we +also have to declare the input. Since the names mDot already match between +simulator and MPC, the explicit alias declaration is redundant in this case. +Additionally, we set a default value for “mDot”, which is used before the +first value is received from the MPC.

+
+ + Why are some values specified in the model and others in the module? + +
+Before every step, the simulator gets the current input values from the +agent and sets them to the model. After performing the step, the outputs +from the model are written to the agent. Since states per definition are +internal to the model, they are not set by the agent and their initial +values have to be changed in the model itself. The same goes for parameters. +
+

With all of the setup done, we can now see our MAS run. +Last time, we manually created the agents and the environment. This time, we +use the LocalMASAgency utility to setup the system and save results. By +setting the variable_logging option to True, time series of all agent +variables present in the system will be saved. After running the MAS, we can +retrieve and plot the results of our simulation.

+
def run_example(with_plots=True):
+    mas = LocalMASAgency(agent_configs=[AGENT_MPC, AGENT_SIM],
+                         env=ENV_CONFIG,
+                         variable_logging=True)
+    mas.run(until=10000)
+    results = mas.get_results()
+
+
+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/tutorials/Trajectories.html b/docs/0.6.4/docs/tutorials/Trajectories.html new file mode 100644 index 0000000..35d4cad --- /dev/null +++ b/docs/0.6.4/docs/tutorials/Trajectories.html @@ -0,0 +1,119 @@ + + + + + + + + + Working with time series — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Working with time series

+

Explanation of ‘examples/multi-agent-systems/casadi/mpc_trajectories.py’

+

tbd

+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/docs/tutorials/tutorial.html b/docs/0.6.4/docs/tutorials/tutorial.html new file mode 100644 index 0000000..9adb21e --- /dev/null +++ b/docs/0.6.4/docs/tutorials/tutorial.html @@ -0,0 +1,134 @@ + + + + + + + + + Tutorial — agentlib_mpc 0.6.4 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Tutorial

+

This section collects tutorials on how to get started with agentlib.

+

This tutorial is periodically updated, but for the most current and accurate information, please refer to the actual example files in the repository. The example files should be considered the authoritative source if there are any discrepancies.

+ +
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/pylint/pylint.html b/docs/0.6.4/pylint/pylint.html new file mode 100644 index 0000000..7b98bc4 --- /dev/null +++ b/docs/0.6.4/pylint/pylint.html @@ -0,0 +1,2084 @@ + + + + Pylint report + + + + + +

Pylint report from report.jinja2

+ + +

Score

+ 7.35 / 10 + + (previous score: 7.35 / 10) + + + +

Messages

+ +

Module ci.test_examples (ci/test_examples.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
50warningunused-importW0611
Unused import subprocess
90errorimport-errorE0401
Unable to import 'pytest'
658warningpointless-string-statementW0105TestExamples.test_mpc
String statement has no effect
734conventionmissing-function-docstringC0116TestExamples.test_admm_local
Missing function or method docstring
834conventionmissing-function-docstringC0116TestExamples.test_admm_coordinated
Missing function or method docstring
934conventionmissing-function-docstringC0116TestExamples.test_exchange_admm
Missing function or method docstring
1094conventionmissing-function-docstringC0116TestExamples.test_admm_mp_broadcast
Missing function or method docstring
+ +

Module /builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc (pylintrc)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'print-statement' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'parameter-unpacking' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'unpacking-in-except' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'old-raise-syntax' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'backtick' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'import-star-module-level' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'apply-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'basestring-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'cmp-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'coerce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'execfile-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'file-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'long-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'raw_input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'reduce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'standarderror-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'unicode-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'xrange-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'coerce-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'delslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'getslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'setslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'no-absolute-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'old-division' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'dict-iter-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'dict-view-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'next-method-called' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'metaclass-assignment' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'indexing-exception' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'raising-string' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'reload-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'oct-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'hex-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'nonzero-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'cmp-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'round-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'intern-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'unichr-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'map-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'zip-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'range-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'filter-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'using-cmp-argument' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'div-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'idiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'rdiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'exception-message-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'invalid-str-codec' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'sys-max-int' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'bad-python3-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-string-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-str-translate-call' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-itertools-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-types-field' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'next-method-defined' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'dict-items-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'dict-keys-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-operator-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-urllib-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'xreadlines-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'deprecated-sys-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'exception-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'comprehension-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.
10refactoruseless-option-valueR0022
Useless option value for '--disable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.
10warningunknown-option-valueW0012
Unknown option value for '--disable', expected a valid pylint message and got 'long-suffix'
10warningunknown-option-valueW0012
Unknown option value for '--disable', expected a valid pylint message and got 'old-ne-operator'
10warningunknown-option-valueW0012
Unknown option value for '--disable', expected a valid pylint message and got 'old-octal-literal'
10warningunknown-option-valueW0012
Unknown option value for '--disable', expected a valid pylint message and got 'non-ascii-bytes-literal'
10warningunknown-option-valueW0012
Unknown option value for '--disable', expected a valid pylint message and got 'eq-without-hash'
+ +

Module conftest (tests/conftest.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
20errorimport-errorE0401
Unable to import 'pytest'
70conventionmissing-function-docstringC0116model_type
Missing function or method docstring
130conventionmissing-function-docstringC0116example_casadi_model
Missing function or method docstring
1325warningredefined-outer-nameW0621example_casadi_model
Redefining name 'model_type' from outer scope (line 7)
+ +

Module test_admm (tests/test_admm.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
220conventioninvalid-nameC0103
Constant name "a" doesn't conform to UPPER_CASE naming style
630conventionmissing-class-docstringC0115TestRTADMM
Missing class docstring
744conventionmissing-function-docstringC0116TestRTADMM.test_admm_init
Missing function or method docstring
768warningunused-variableW0612TestRTADMM.test_admm_init
Unused variable 'admm_module'
804conventionmissing-function-docstringC0116TestRTADMM.test_comm
Missing function or method docstring
8513warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _start_executing_callbacks of a client class
8613warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _start_executing_callbacks of a client class
888warningattribute-defined-outside-initW0201TestRTADMM.test_comm
Attribute 'admm_module1' defined outside __init__
898warningattribute-defined-outside-initW0201TestRTADMM.test_comm
Attribute 'admm_module2' defined outside __init__
928warningattribute-defined-outside-initW0201TestRTADMM.test_comm
Attribute 'counter' defined outside __init__
938warningattribute-defined-outside-initW0201TestRTADMM.test_comm
Attribute 'counter2' defined outside __init__
1098warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _solve_local_optimization of a client class
11012warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _solve_local_optimization_debug of a client class
1128warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _solve_local_optimization of a client class
11312warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _solve_local_optimization_debug of a client class
11819warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _admm_loop of a client class
12319warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _admm_loop of a client class
12713warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _process_realtime of a client class
12813warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _process_realtime of a client class
14924warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _admm_variables of a client class
15024warningprotected-accessW0212TestRTADMM.test_comm
Access to a protected member _admm_variables of a client class
1634conventionmissing-function-docstringC0116TestRTADMM.new_receive
Missing function or method docstring
1674conventionmissing-function-docstringC0116TestRTADMM.new_receive_2
Missing function or method docstring
+ +

Module test_casadi_backend (tests/test_casadi_backend.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
40errorimport-errorE0401
Unable to import 'pytest'
260conventionmissing-function-docstringC0116var_ref
Missing function or method docstring
370conventionmissing-function-docstringC0116example_casadi_system
Missing function or method docstring
3748warningredefined-outer-nameW0621example_casadi_system
Redefining name 'var_ref' from outer scope (line 26)
440conventionmissing-function-docstringC0116collocation_discretization
Missing function or method docstring
4431warningredefined-outer-nameW0621collocation_discretization
Redefining name 'example_casadi_system' from outer scope (line 37)
550conventionmissing-function-docstringC0116example_backend
Missing function or method docstring
5532warningredefined-outer-nameW0621example_backend
Redefining name 'var_ref' from outer scope (line 26)
564conventioninvalid-nameC0103example_backend
Variable name "be" doesn't conform to snake_case naming style
610conventionmissing-function-docstringC0116test_optimization_variable
Missing function or method docstring
688warningunused-variableW0612test_optimization_variable
Unused variable 'optimization_variable'
754warningunused-variableW0612test_optimization_variable
Unused variable 'optimization_variable_1'
908warningunused-variableW0612test_optimization_variable
Unused variable 'optimization_variable_3'
970conventionmissing-function-docstringC0116test_system
Missing function or method docstring
9716warningredefined-outer-nameW0621test_system
Redefining name 'example_casadi_system' from outer scope (line 37)
1130conventionmissing-function-docstringC0116test_discretization
Missing function or method docstring
1144warningredefined-outer-nameW0621test_discretization
Redefining name 'collocation_discretization' from outer scope (line 44)
11451warningredefined-outer-nameW0621test_discretization
Redefining name 'example_casadi_system' from outer scope (line 37)
1350conventionmissing-function-docstringC0116test_add_opt
Missing function or method docstring
13517warningredefined-outer-nameW0621test_add_opt
Redefining name 'example_casadi_system' from outer scope (line 37)
1540conventionmissing-function-docstringC0116test_create_backend
Missing function or method docstring
15424warningredefined-outer-nameW0621test_create_backend
Redefining name 'example_backend' from outer scope (line 55)
1554conventioninvalid-nameC0103test_create_backend
Variable name "be" doesn't conform to snake_case naming style
15913warningprotected-accessW0212test_create_backend
Access to a protected member _mpc_inputs_to_nlp_inputs of a client class
+ +

Module test_casadi_ml_model (tests/test_casadi_ml_model.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
30errorimport-errorE0401
Unable to import 'pytest'
90conventionmissing-class-docstringC0115CasadiMLTestConfig
Missing class docstring
140conventionmissing-class-docstringC0115CasadiMLTestModel
Missing class docstring
230conventionmissing-function-docstringC0116test_casadi_ml_model
Missing function or method docstring
+ +

Module test_mpc (tests/test_mpc.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
60conventionwrong-import-orderC0411
standard import "import pathlib" should be placed before "import numpy as np"
130warningunused-importW0611
Unused OptimizationBackend imported from agentlib_mpc.optimization_backends.backend
180conventioninvalid-nameC0103
Constant name "a" doesn't conform to UPPER_CASE naming style
244conventionmissing-function-docstringC0116TestSampling.test_sample_datetime
Missing function or method docstring
754conventionmissing-function-docstringC0116TestSampling.test_get_scalar
Missing function or method docstring
814conventionmissing-function-docstringC0116TestSampling.test_series
Missing function or method docstring
828conventioninvalid-nameC0103TestSampling.test_series
Variable name "sr" doesn't conform to snake_case naming style
944conventionmissing-function-docstringC0116TestSampling.test_list
Missing function or method docstring
1054conventionmissing-function-docstringC0116TestSampling.test_previous_interpolation_method
Missing function or method docstring
1524conventioninvalid-nameC0103TestCasadiMPC.test_CasadiMPC
Method name "test_CasadiMPC" doesn't conform to snake_case naming style
15814warningprotected-accessW0212TestCasadiMPC.test_CasadiMPC
Access to a protected member _modules of a client class
1664conventionmissing-function-docstringC0116TestCasadiMPC.test_incomplete_config
Missing function or method docstring
+ +

Module test_serialized_ann (tests/test_serialized_ann.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
50conventionwrong-import-orderC0411
standard import "import unittest" should be placed before "import numpy as np"
80conventionwrong-import-orderC0411
standard import "from pathlib import Path" should be placed before "import numpy as np"
130conventionwrong-import-orderC0411
third party import "from fixtures.ann import ANNTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
140conventionwrong-import-orderC0411
third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
+ +

Module test_serialized_gpr (tests/test_serialized_gpr.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
20conventionwrong-import-orderC0411
standard import "import os" should be placed before "import numpy as np"
30conventionwrong-import-orderC0411
standard import "import unittest" should be placed before "import numpy as np"
50conventionwrong-import-orderC0411
standard import "from pathlib import Path" should be placed before "import numpy as np"
100warningunused-importW0611
Unused MLModels imported from agentlib_mpc.models.serialized_ml_model
110conventionwrong-import-orderC0411
third party import "from fixtures.gpr import GPRTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
120conventionwrong-import-orderC0411
third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
+ +

Module test_serialized_linreg (tests/test_serialized_linreg.py)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineCol.TypeSymbolIDObjMessage
10conventionmissing-module-docstringC0114
Missing module docstring
20conventionwrong-import-orderC0411
standard import "import os" should be placed before "import numpy as np"
30conventionwrong-import-orderC0411
standard import "import unittest" should be placed before "import numpy as np"
50conventionwrong-import-orderC0411
standard import "from pathlib import Path" should be placed before "import numpy as np"
110conventionwrong-import-orderC0411
third party import "from fixtures.linreg import LinRegTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
120conventionwrong-import-orderC0411
third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes"
+ + +

Metrics

+ + +

Count per types

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
NameCount
refactor67
warning40
error4
convention56
+ + +

Count per messages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameCount
useless-option-value67
unknown-option-value5
import-error4
pointless-string-statement1
missing-function-docstring26
unused-import3
missing-module-docstring6
redefined-outer-name9
invalid-name6
missing-class-docstring3
unused-variable4
protected-access14
attribute-defined-outside-init4
wrong-import-order15
+ + +

Count per modules

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameCount
/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc72
ci.test_examples7
conftest5
test_admm24
test_casadi_backend25
test_casadi_ml_model4
test_mpc13
test_serialized_ann4
test_serialized_gpr7
test_serialized_linreg6
+ + +

Count per path

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameCount
pylintrc72
ci/test_examples.py7
tests/conftest.py5
tests/test_admm.py24
tests/test_casadi_backend.py25
tests/test_casadi_ml_model.py4
tests/test_mpc.py13
tests/test_serialized_ann.py4
tests/test_serialized_gpr.py7
tests/test_serialized_linreg.py6
+ + + + \ No newline at end of file diff --git a/docs/0.6.4/pylint/pylint.json b/docs/0.6.4/pylint/pylint.json new file mode 100644 index 0000000..e95b137 --- /dev/null +++ b/docs/0.6.4/pylint/pylint.json @@ -0,0 +1,2423 @@ +{ + "messages": [ + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'print-statement' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'parameter-unpacking' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'unpacking-in-except' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'old-raise-syntax' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'backtick' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'import-star-module-level' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'apply-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'basestring-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'cmp-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'coerce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'execfile-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'file-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'long-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'raw_input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'reduce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'standarderror-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'unicode-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'xrange-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'coerce-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'delslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'getslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'setslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'no-absolute-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'old-division' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'dict-iter-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'dict-view-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'next-method-called' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'metaclass-assignment' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'indexing-exception' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'raising-string' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'reload-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'oct-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'hex-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'nonzero-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'cmp-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'round-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'intern-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'unichr-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'map-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'zip-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'range-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'filter-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'using-cmp-argument' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'div-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'idiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'rdiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'exception-message-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'invalid-str-codec' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'sys-max-int' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'bad-python3-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-string-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-str-translate-call' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-itertools-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-types-field' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'next-method-defined' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'dict-items-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'dict-keys-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-operator-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-urllib-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'xreadlines-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'deprecated-sys-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'exception-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'comprehension-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.", + "message-id": "R0022" + }, + { + "type": "refactor", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "useless-option-value", + "message": "Useless option value for '--disable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.", + "message-id": "R0022" + }, + { + "type": "warning", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "unknown-option-value", + "message": "Unknown option value for '--disable', expected a valid pylint message and got 'long-suffix'", + "message-id": "W0012" + }, + { + "type": "warning", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "unknown-option-value", + "message": "Unknown option value for '--disable', expected a valid pylint message and got 'old-ne-operator'", + "message-id": "W0012" + }, + { + "type": "warning", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "unknown-option-value", + "message": "Unknown option value for '--disable', expected a valid pylint message and got 'old-octal-literal'", + "message-id": "W0012" + }, + { + "type": "warning", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "unknown-option-value", + "message": "Unknown option value for '--disable', expected a valid pylint message and got 'non-ascii-bytes-literal'", + "message-id": "W0012" + }, + { + "type": "warning", + "module": "/builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc", + "obj": "", + "line": 1, + "column": 0, + "path": "pylintrc", + "symbol": "unknown-option-value", + "message": "Unknown option value for '--disable', expected a valid pylint message and got 'eq-without-hash'", + "message-id": "W0012" + }, + { + "type": "error", + "module": "ci.test_examples", + "obj": "", + "line": 9, + "column": 0, + "path": "ci/test_examples.py", + "symbol": "import-error", + "message": "Unable to import 'pytest'", + "message-id": "E0401" + }, + { + "type": "warning", + "module": "ci.test_examples", + "obj": "TestExamples.test_mpc", + "line": 65, + "column": 8, + "path": "ci/test_examples.py", + "symbol": "pointless-string-statement", + "message": "String statement has no effect", + "message-id": "W0105" + }, + { + "type": "convention", + "module": "ci.test_examples", + "obj": "TestExamples.test_admm_local", + "line": 73, + "column": 4, + "path": "ci/test_examples.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "ci.test_examples", + "obj": "TestExamples.test_admm_coordinated", + "line": 83, + "column": 4, + "path": "ci/test_examples.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "ci.test_examples", + "obj": "TestExamples.test_exchange_admm", + "line": 93, + "column": 4, + "path": "ci/test_examples.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "ci.test_examples", + "obj": "TestExamples.test_admm_mp_broadcast", + "line": 109, + "column": 4, + "path": "ci/test_examples.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "ci.test_examples", + "obj": "", + "line": 5, + "column": 0, + "path": "ci/test_examples.py", + "symbol": "unused-import", + "message": "Unused import subprocess", + "message-id": "W0611" + }, + { + "type": "convention", + "module": "conftest", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/conftest.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "error", + "module": "conftest", + "obj": "", + "line": 2, + "column": 0, + "path": "tests/conftest.py", + "symbol": "import-error", + "message": "Unable to import 'pytest'", + "message-id": "E0401" + }, + { + "type": "convention", + "module": "conftest", + "obj": "model_type", + "line": 7, + "column": 0, + "path": "tests/conftest.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "conftest", + "obj": "example_casadi_model", + "line": 13, + "column": 0, + "path": "tests/conftest.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "conftest", + "obj": "example_casadi_model", + "line": 13, + "column": 25, + "path": "tests/conftest.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'model_type' from outer scope (line 7)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/test_admm.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "", + "line": 22, + "column": 0, + "path": "tests/test_admm.py", + "symbol": "invalid-name", + "message": "Constant name \"a\" doesn't conform to UPPER_CASE naming style", + "message-id": "C0103" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "TestRTADMM", + "line": 63, + "column": 0, + "path": "tests/test_admm.py", + "symbol": "missing-class-docstring", + "message": "Missing class docstring", + "message-id": "C0115" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "TestRTADMM.test_admm_init", + "line": 74, + "column": 4, + "path": "tests/test_admm.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_admm_init", + "line": 76, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "unused-variable", + "message": "Unused variable 'admm_module'", + "message-id": "W0612" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 80, + "column": 4, + "path": "tests/test_admm.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 85, + "column": 13, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _start_executing_callbacks of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 86, + "column": 13, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _start_executing_callbacks of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 109, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _solve_local_optimization of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 110, + "column": 12, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _solve_local_optimization_debug of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 112, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _solve_local_optimization of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 113, + "column": 12, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _solve_local_optimization_debug of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 118, + "column": 19, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _admm_loop of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 123, + "column": 19, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _admm_loop of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 127, + "column": 13, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _process_realtime of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 128, + "column": 13, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _process_realtime of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 149, + "column": 24, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _admm_variables of a client class", + "message-id": "W0212" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 150, + "column": 24, + "path": "tests/test_admm.py", + "symbol": "protected-access", + "message": "Access to a protected member _admm_variables of a client class", + "message-id": "W0212" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "TestRTADMM.new_receive", + "line": 163, + "column": 4, + "path": "tests/test_admm.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_admm", + "obj": "TestRTADMM.new_receive_2", + "line": 167, + "column": 4, + "path": "tests/test_admm.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 88, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "attribute-defined-outside-init", + "message": "Attribute 'admm_module1' defined outside __init__", + "message-id": "W0201" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 89, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "attribute-defined-outside-init", + "message": "Attribute 'admm_module2' defined outside __init__", + "message-id": "W0201" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 92, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "attribute-defined-outside-init", + "message": "Attribute 'counter' defined outside __init__", + "message-id": "W0201" + }, + { + "type": "warning", + "module": "test_admm", + "obj": "TestRTADMM.test_comm", + "line": 93, + "column": 8, + "path": "tests/test_admm.py", + "symbol": "attribute-defined-outside-init", + "message": "Attribute 'counter2' defined outside __init__", + "message-id": "W0201" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "error", + "module": "test_casadi_backend", + "obj": "", + "line": 4, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "import-error", + "message": "Unable to import 'pytest'", + "message-id": "E0401" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "var_ref", + "line": 26, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "example_casadi_system", + "line": 37, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "example_casadi_system", + "line": 37, + "column": 48, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'var_ref' from outer scope (line 26)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "collocation_discretization", + "line": 44, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "collocation_discretization", + "line": 44, + "column": 31, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'example_casadi_system' from outer scope (line 37)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "example_backend", + "line": 55, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "example_backend", + "line": 55, + "column": 32, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'var_ref' from outer scope (line 26)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "example_backend", + "line": 56, + "column": 4, + "path": "tests/test_casadi_backend.py", + "symbol": "invalid-name", + "message": "Variable name \"be\" doesn't conform to snake_case naming style", + "message-id": "C0103" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_optimization_variable", + "line": 61, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_optimization_variable", + "line": 68, + "column": 8, + "path": "tests/test_casadi_backend.py", + "symbol": "unused-variable", + "message": "Unused variable 'optimization_variable'", + "message-id": "W0612" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_optimization_variable", + "line": 75, + "column": 4, + "path": "tests/test_casadi_backend.py", + "symbol": "unused-variable", + "message": "Unused variable 'optimization_variable_1'", + "message-id": "W0612" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_optimization_variable", + "line": 90, + "column": 8, + "path": "tests/test_casadi_backend.py", + "symbol": "unused-variable", + "message": "Unused variable 'optimization_variable_3'", + "message-id": "W0612" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_system", + "line": 97, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_system", + "line": 97, + "column": 16, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'example_casadi_system' from outer scope (line 37)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_discretization", + "line": 113, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_discretization", + "line": 114, + "column": 4, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'collocation_discretization' from outer scope (line 44)", + "message-id": "W0621" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_discretization", + "line": 114, + "column": 51, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'example_casadi_system' from outer scope (line 37)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_add_opt", + "line": 135, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_add_opt", + "line": 135, + "column": 17, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'example_casadi_system' from outer scope (line 37)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_create_backend", + "line": 154, + "column": 0, + "path": "tests/test_casadi_backend.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_create_backend", + "line": 154, + "column": 24, + "path": "tests/test_casadi_backend.py", + "symbol": "redefined-outer-name", + "message": "Redefining name 'example_backend' from outer scope (line 55)", + "message-id": "W0621" + }, + { + "type": "convention", + "module": "test_casadi_backend", + "obj": "test_create_backend", + "line": 155, + "column": 4, + "path": "tests/test_casadi_backend.py", + "symbol": "invalid-name", + "message": "Variable name \"be\" doesn't conform to snake_case naming style", + "message-id": "C0103" + }, + { + "type": "warning", + "module": "test_casadi_backend", + "obj": "test_create_backend", + "line": 159, + "column": 13, + "path": "tests/test_casadi_backend.py", + "symbol": "protected-access", + "message": "Access to a protected member _mpc_inputs_to_nlp_inputs of a client class", + "message-id": "W0212" + }, + { + "type": "error", + "module": "test_casadi_ml_model", + "obj": "", + "line": 3, + "column": 0, + "path": "tests/test_casadi_ml_model.py", + "symbol": "import-error", + "message": "Unable to import 'pytest'", + "message-id": "E0401" + }, + { + "type": "convention", + "module": "test_casadi_ml_model", + "obj": "CasadiMLTestConfig", + "line": 9, + "column": 0, + "path": "tests/test_casadi_ml_model.py", + "symbol": "missing-class-docstring", + "message": "Missing class docstring", + "message-id": "C0115" + }, + { + "type": "convention", + "module": "test_casadi_ml_model", + "obj": "CasadiMLTestModel", + "line": 14, + "column": 0, + "path": "tests/test_casadi_ml_model.py", + "symbol": "missing-class-docstring", + "message": "Missing class docstring", + "message-id": "C0115" + }, + { + "type": "convention", + "module": "test_casadi_ml_model", + "obj": "test_casadi_ml_model", + "line": 23, + "column": 0, + "path": "tests/test_casadi_ml_model.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/test_mpc.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "", + "line": 18, + "column": 0, + "path": "tests/test_mpc.py", + "symbol": "invalid-name", + "message": "Constant name \"a\" doesn't conform to UPPER_CASE naming style", + "message-id": "C0103" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_sample_datetime", + "line": 24, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_get_scalar", + "line": 75, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_series", + "line": 81, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_series", + "line": 82, + "column": 8, + "path": "tests/test_mpc.py", + "symbol": "invalid-name", + "message": "Variable name \"sr\" doesn't conform to snake_case naming style", + "message-id": "C0103" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_list", + "line": 94, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestSampling.test_previous_interpolation_method", + "line": 105, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestCasadiMPC.test_CasadiMPC", + "line": 152, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "invalid-name", + "message": "Method name \"test_CasadiMPC\" doesn't conform to snake_case naming style", + "message-id": "C0103" + }, + { + "type": "warning", + "module": "test_mpc", + "obj": "TestCasadiMPC.test_CasadiMPC", + "line": 158, + "column": 14, + "path": "tests/test_mpc.py", + "symbol": "protected-access", + "message": "Access to a protected member _modules of a client class", + "message-id": "W0212" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "TestCasadiMPC.test_incomplete_config", + "line": 166, + "column": 4, + "path": "tests/test_mpc.py", + "symbol": "missing-function-docstring", + "message": "Missing function or method docstring", + "message-id": "C0116" + }, + { + "type": "convention", + "module": "test_mpc", + "obj": "", + "line": 6, + "column": 0, + "path": "tests/test_mpc.py", + "symbol": "wrong-import-order", + "message": "standard import \"import pathlib\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "warning", + "module": "test_mpc", + "obj": "", + "line": 13, + "column": 0, + "path": "tests/test_mpc.py", + "symbol": "unused-import", + "message": "Unused OptimizationBackend imported from agentlib_mpc.optimization_backends.backend", + "message-id": "W0611" + }, + { + "type": "convention", + "module": "test_serialized_ann", + "obj": "", + "line": 5, + "column": 0, + "path": "tests/test_serialized_ann.py", + "symbol": "wrong-import-order", + "message": "standard import \"import unittest\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_ann", + "obj": "", + "line": 8, + "column": 0, + "path": "tests/test_serialized_ann.py", + "symbol": "wrong-import-order", + "message": "standard import \"from pathlib import Path\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_ann", + "obj": "", + "line": 13, + "column": 0, + "path": "tests/test_serialized_ann.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.ann import ANNTrainer\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_ann", + "obj": "", + "line": 14, + "column": 0, + "path": "tests/test_serialized_ann.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.data_generator import DataGenerator\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 2, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "wrong-import-order", + "message": "standard import \"import os\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 3, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "wrong-import-order", + "message": "standard import \"import unittest\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 5, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "wrong-import-order", + "message": "standard import \"from pathlib import Path\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 11, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.gpr import GPRTrainer\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_gpr", + "obj": "", + "line": 12, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.data_generator import DataGenerator\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + }, + { + "type": "warning", + "module": "test_serialized_gpr", + "obj": "", + "line": 10, + "column": 0, + "path": "tests/test_serialized_gpr.py", + "symbol": "unused-import", + "message": "Unused MLModels imported from agentlib_mpc.models.serialized_ml_model", + "message-id": "W0611" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 1, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "missing-module-docstring", + "message": "Missing module docstring", + "message-id": "C0114" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 2, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "wrong-import-order", + "message": "standard import \"import os\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 3, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "wrong-import-order", + "message": "standard import \"import unittest\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 5, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "wrong-import-order", + "message": "standard import \"from pathlib import Path\" should be placed before \"import numpy as np\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 11, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.linreg import LinRegTrainer\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + }, + { + "type": "convention", + "module": "test_serialized_linreg", + "obj": "", + "line": 12, + "column": 0, + "path": "tests/test_serialized_linreg.py", + "symbol": "wrong-import-order", + "message": "third party import \"from fixtures.data_generator import DataGenerator\" should be placed before \"from agentlib_mpc.data_structures import ml_model_datatypes\"", + "message-id": "C0411" + } + ], + "stats": { + "bad_names": { + "argument": 0, + "attr": 0, + "klass": 0, + "class_attribute": 0, + "class_const": 0, + "const": 2, + "inlinevar": 0, + "function": 0, + "method": 1, + "module": 0, + "variable": 3, + "typevar": 0, + "typealias": 0 + }, + "by_module": { + "agentlib_mpc.__init__": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 3, + "warning": 0 + }, + "ci.test_examples": { + "convention": 4, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 44, + "warning": 2 + }, + "conftest": { + "convention": 3, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 9, + "warning": 1 + }, + "test_admm": { + "convention": 7, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 86, + "warning": 17 + }, + "test_casadi_backend": { + "convention": 12, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 70, + "warning": 12 + }, + "test_casadi_ml_model": { + "convention": 3, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 13, + "warning": 0 + }, + "test_full_backend": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 0, + "warning": 0 + }, + "test_miqp_backend": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 0, + "warning": 0 + }, + "test_mpc": { + "convention": 11, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 71, + "warning": 2 + }, + "test_serialized_ann": { + "convention": 4, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 45, + "warning": 0 + }, + "test_serialized_gpr": { + "convention": 6, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 39, + "warning": 1 + }, + "test_serialized_linreg": { + "convention": 6, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 39, + "warning": 0 + } + }, + "by_msg": { + "import-error": 4, + "pointless-string-statement": 1, + "missing-function-docstring": 26, + "unused-import": 3, + "missing-module-docstring": 6, + "redefined-outer-name": 9, + "invalid-name": 6, + "missing-class-docstring": 3, + "unused-variable": 4, + "protected-access": 14, + "attribute-defined-outside-init": 4, + "wrong-import-order": 15 + }, + "code_type_count": { + "code": 0, + "comment": 0, + "docstring": 0, + "empty": 0, + "total": 0 + }, + "dependencies": { + "agentlib_mpc.modules": [ + "agentlib_mpc" + ], + "agentlib_mpc.models": [ + "agentlib_mpc" + ], + "pandas": [ + "ci.test_examples", + "test_mpc" + ], + "agentlib.utils": [ + "ci.test_examples", + "conftest" + ], + "agentlib.utils.local_broadcast_broker": [ + "ci.test_examples", + "test_admm" + ], + "numpy": [ + "test_mpc", + "test_serialized_linreg", + "test_admm", + "test_serialized_ann", + "test_serialized_gpr" + ], + "agentlib.core": [ + "test_admm" + ], + "agentlib_mpc.data_structures.admm_datatypes": [ + "test_admm" + ], + "agentlib_mpc.modules.dmpc.admm.admm": [ + "test_admm" + ], + "casadi": [ + "test_casadi_backend" + ], + "agentlib_mpc.data_structures.casadi_utils": [ + "test_casadi_backend" + ], + "agentlib_mpc.data_structures.mpc_datamodels": [ + "test_casadi_backend" + ], + "agentlib_mpc.models.casadi_model": [ + "test_casadi_backend", + "test_casadi_ml_model" + ], + "agentlib_mpc.optimization_backends.casadi_.basic": [ + "test_casadi_backend" + ], + "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup": [ + "test_casadi_backend" + ], + "agentlib_mpc.optimization_backends.casadi_.core.discretization": [ + "test_casadi_backend" + ], + "agentlib_mpc.models.casadi_ml_model": [ + "test_casadi_ml_model" + ], + "agentlib.core.environment": [ + "test_mpc" + ], + "agentlib.core.agent": [ + "test_mpc" + ], + "agentlib.core.errors": [ + "test_mpc" + ], + "agentlib_mpc.data_structures.interpolation": [ + "test_mpc" + ], + "agentlib_mpc.optimization_backends.backend": [ + "test_mpc" + ], + "agentlib_mpc.utils.sampling": [ + "test_mpc" + ], + "keras": [ + "test_serialized_ann" + ], + "agentlib_mpc.data_structures.ml_model_datatypes": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "agentlib_mpc.models.casadi_predictor": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "agentlib_mpc.models.serialized_ml_model": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "fixtures.ann": [ + "test_serialized_ann" + ], + "fixtures.data_generator": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "sklearn.gaussian_process": [ + "test_serialized_gpr" + ], + "fixtures.gpr": [ + "test_serialized_gpr" + ], + "sklearn.linear_model": [ + "test_serialized_linreg" + ], + "fixtures.linreg": [ + "test_serialized_linreg" + ] + }, + "duplicated_lines": { + "nb_duplicated_lines": 0, + "percent_duplicated_lines": 0.0 + }, + "node_count": { + "function": 13, + "klass": 9, + "method": 36, + "module": 12 + }, + "undocumented": { + "function": 12, + "klass": 4, + "method": 14, + "module": 6 + }, + "convention": 56, + "error": 4, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 419, + "warning": 35, + "global_note": 0, + "nb_duplicated_lines": 0, + "percent_duplicated_lines": 0.0 + }, + "previous": { + "bad_names": { + "argument": 0, + "attr": 0, + "klass": 0, + "class_attribute": 0, + "class_const": 0, + "const": 2, + "inlinevar": 0, + "function": 0, + "method": 1, + "module": 0, + "variable": 3, + "typevar": 0, + "typealias": 0 + }, + "by_module": { + "agentlib_mpc.__init__": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 3, + "warning": 0 + }, + "ci.test_examples": { + "convention": 4, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 44, + "warning": 2 + }, + "conftest": { + "convention": 3, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 9, + "warning": 1 + }, + "test_admm": { + "convention": 7, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 86, + "warning": 17 + }, + "test_casadi_backend": { + "convention": 12, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 70, + "warning": 12 + }, + "test_casadi_ml_model": { + "convention": 3, + "error": 1, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 13, + "warning": 0 + }, + "test_full_backend": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 0, + "warning": 0 + }, + "test_miqp_backend": { + "convention": 0, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 0, + "warning": 0 + }, + "test_mpc": { + "convention": 11, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 71, + "warning": 2 + }, + "test_serialized_ann": { + "convention": 4, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 45, + "warning": 0 + }, + "test_serialized_gpr": { + "convention": 6, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 39, + "warning": 1 + }, + "test_serialized_linreg": { + "convention": 6, + "error": 0, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 39, + "warning": 0 + } + }, + "by_msg": { + "import-error": 4, + "pointless-string-statement": 1, + "missing-function-docstring": 26, + "unused-import": 3, + "missing-module-docstring": 6, + "redefined-outer-name": 9, + "invalid-name": 6, + "missing-class-docstring": 3, + "unused-variable": 4, + "protected-access": 14, + "attribute-defined-outside-init": 4, + "wrong-import-order": 15 + }, + "code_type_count": { + "code": 0, + "comment": 0, + "docstring": 0, + "empty": 0, + "total": 0 + }, + "dependencies": { + "agentlib_mpc.modules": [ + "agentlib_mpc" + ], + "agentlib_mpc.models": [ + "agentlib_mpc" + ], + "pandas": [ + "ci.test_examples", + "test_mpc" + ], + "agentlib.utils": [ + "ci.test_examples", + "conftest" + ], + "agentlib.utils.local_broadcast_broker": [ + "ci.test_examples", + "test_admm" + ], + "numpy": [ + "test_mpc", + "test_serialized_linreg", + "test_admm", + "test_serialized_ann", + "test_serialized_gpr" + ], + "agentlib.core": [ + "test_admm" + ], + "agentlib_mpc.data_structures.admm_datatypes": [ + "test_admm" + ], + "agentlib_mpc.modules.dmpc.admm.admm": [ + "test_admm" + ], + "casadi": [ + "test_casadi_backend" + ], + "agentlib_mpc.data_structures.casadi_utils": [ + "test_casadi_backend" + ], + "agentlib_mpc.data_structures.mpc_datamodels": [ + "test_casadi_backend" + ], + "agentlib_mpc.models.casadi_model": [ + "test_casadi_ml_model", + "test_casadi_backend" + ], + "agentlib_mpc.optimization_backends.casadi_.basic": [ + "test_casadi_backend" + ], + "agentlib_mpc.optimization_backends.casadi_.core.VariableGroup": [ + "test_casadi_backend" + ], + "agentlib_mpc.optimization_backends.casadi_.core.discretization": [ + "test_casadi_backend" + ], + "agentlib_mpc.models.casadi_ml_model": [ + "test_casadi_ml_model" + ], + "agentlib.core.environment": [ + "test_mpc" + ], + "agentlib.core.agent": [ + "test_mpc" + ], + "agentlib.core.errors": [ + "test_mpc" + ], + "agentlib_mpc.data_structures.interpolation": [ + "test_mpc" + ], + "agentlib_mpc.optimization_backends.backend": [ + "test_mpc" + ], + "agentlib_mpc.utils.sampling": [ + "test_mpc" + ], + "keras": [ + "test_serialized_ann" + ], + "agentlib_mpc.data_structures.ml_model_datatypes": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "agentlib_mpc.models.casadi_predictor": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "agentlib_mpc.models.serialized_ml_model": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "fixtures.ann": [ + "test_serialized_ann" + ], + "fixtures.data_generator": [ + "test_serialized_gpr", + "test_serialized_ann", + "test_serialized_linreg" + ], + "sklearn.gaussian_process": [ + "test_serialized_gpr" + ], + "fixtures.gpr": [ + "test_serialized_gpr" + ], + "sklearn.linear_model": [ + "test_serialized_linreg" + ], + "fixtures.linreg": [ + "test_serialized_linreg" + ] + }, + "duplicated_lines": { + "nb_duplicated_lines": 0, + "percent_duplicated_lines": 0.0 + }, + "node_count": { + "function": 13, + "klass": 9, + "method": 36, + "module": 12 + }, + "undocumented": { + "function": 12, + "klass": 4, + "method": 14, + "module": 6 + }, + "convention": 56, + "error": 4, + "fatal": 0, + "info": 0, + "refactor": 0, + "statement": 419, + "warning": 35, + "global_note": 7.350835322195704, + "nb_duplicated_lines": 0, + "percent_duplicated_lines": 0.0 + } +} diff --git a/docs/0.6.4/pylint/pylint.svg b/docs/0.6.4/pylint/pylint.svg new file mode 100644 index 0000000..004aada --- /dev/null +++ b/docs/0.6.4/pylint/pylint.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + pylint + pylint + + + 7.35 + 7.35 + + diff --git a/docs/0.6.4/pylint/pylint.txt b/docs/0.6.4/pylint/pylint.txt new file mode 100644 index 0000000..ad9ba7f --- /dev/null +++ b/docs/0.6.4/pylint/pylint.txt @@ -0,0 +1,181 @@ +************* Module /builds/EBC/EBC_all/github_ci/AgentLib-MPC/pylintrc +pylintrc:1:0: R0022: Useless option value for '--disable', 'print-statement' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'parameter-unpacking' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'unpacking-in-except' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'old-raise-syntax' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'backtick' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'import-star-module-level' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'apply-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'basestring-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'cmp-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'coerce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'execfile-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'file-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'long-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'raw_input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'reduce-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'standarderror-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'unicode-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'xrange-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'coerce-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'delslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'getslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'setslice-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'no-absolute-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'old-division' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'dict-iter-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'dict-view-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'next-method-called' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'metaclass-assignment' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'indexing-exception' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'raising-string' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'reload-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'oct-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'hex-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'nonzero-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'cmp-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'input-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'round-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'intern-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'unichr-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'map-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'zip-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'range-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'filter-builtin-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'using-cmp-argument' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'div-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'idiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'rdiv-method' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'exception-message-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'invalid-str-codec' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'sys-max-int' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'bad-python3-import' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-string-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-str-translate-call' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-itertools-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-types-field' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'next-method-defined' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'dict-items-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'dict-keys-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-operator-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-urllib-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'xreadlines-attribute' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'deprecated-sys-function' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'exception-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'comprehension-escape' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +pylintrc:1:0: R0022: Useless option value for '--disable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value) +pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'long-suffix' (unknown-option-value) +pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'old-ne-operator' (unknown-option-value) +pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'old-octal-literal' (unknown-option-value) +pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'non-ascii-bytes-literal' (unknown-option-value) +pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'eq-without-hash' (unknown-option-value) +************* Module ci.test_examples +ci/test_examples.py:9:0: E0401: Unable to import 'pytest' (import-error) +ci/test_examples.py:65:8: W0105: String statement has no effect (pointless-string-statement) +ci/test_examples.py:73:4: C0116: Missing function or method docstring (missing-function-docstring) +ci/test_examples.py:83:4: C0116: Missing function or method docstring (missing-function-docstring) +ci/test_examples.py:93:4: C0116: Missing function or method docstring (missing-function-docstring) +ci/test_examples.py:109:4: C0116: Missing function or method docstring (missing-function-docstring) +ci/test_examples.py:5:0: W0611: Unused import subprocess (unused-import) +************* Module conftest +tests/conftest.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/conftest.py:2:0: E0401: Unable to import 'pytest' (import-error) +tests/conftest.py:7:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/conftest.py:13:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/conftest.py:13:25: W0621: Redefining name 'model_type' from outer scope (line 7) (redefined-outer-name) +************* Module test_admm +tests/test_admm.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/test_admm.py:22:0: C0103: Constant name "a" doesn't conform to UPPER_CASE naming style (invalid-name) +tests/test_admm.py:63:0: C0115: Missing class docstring (missing-class-docstring) +tests/test_admm.py:74:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_admm.py:76:8: W0612: Unused variable 'admm_module' (unused-variable) +tests/test_admm.py:80:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_admm.py:85:13: W0212: Access to a protected member _start_executing_callbacks of a client class (protected-access) +tests/test_admm.py:86:13: W0212: Access to a protected member _start_executing_callbacks of a client class (protected-access) +tests/test_admm.py:109:8: W0212: Access to a protected member _solve_local_optimization of a client class (protected-access) +tests/test_admm.py:110:12: W0212: Access to a protected member _solve_local_optimization_debug of a client class (protected-access) +tests/test_admm.py:112:8: W0212: Access to a protected member _solve_local_optimization of a client class (protected-access) +tests/test_admm.py:113:12: W0212: Access to a protected member _solve_local_optimization_debug of a client class (protected-access) +tests/test_admm.py:118:19: W0212: Access to a protected member _admm_loop of a client class (protected-access) +tests/test_admm.py:123:19: W0212: Access to a protected member _admm_loop of a client class (protected-access) +tests/test_admm.py:127:13: W0212: Access to a protected member _process_realtime of a client class (protected-access) +tests/test_admm.py:128:13: W0212: Access to a protected member _process_realtime of a client class (protected-access) +tests/test_admm.py:149:24: W0212: Access to a protected member _admm_variables of a client class (protected-access) +tests/test_admm.py:150:24: W0212: Access to a protected member _admm_variables of a client class (protected-access) +tests/test_admm.py:163:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_admm.py:167:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_admm.py:88:8: W0201: Attribute 'admm_module1' defined outside __init__ (attribute-defined-outside-init) +tests/test_admm.py:89:8: W0201: Attribute 'admm_module2' defined outside __init__ (attribute-defined-outside-init) +tests/test_admm.py:92:8: W0201: Attribute 'counter' defined outside __init__ (attribute-defined-outside-init) +tests/test_admm.py:93:8: W0201: Attribute 'counter2' defined outside __init__ (attribute-defined-outside-init) +************* Module test_casadi_backend +tests/test_casadi_backend.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/test_casadi_backend.py:4:0: E0401: Unable to import 'pytest' (import-error) +tests/test_casadi_backend.py:26:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:37:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:37:48: W0621: Redefining name 'var_ref' from outer scope (line 26) (redefined-outer-name) +tests/test_casadi_backend.py:44:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:44:31: W0621: Redefining name 'example_casadi_system' from outer scope (line 37) (redefined-outer-name) +tests/test_casadi_backend.py:55:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:55:32: W0621: Redefining name 'var_ref' from outer scope (line 26) (redefined-outer-name) +tests/test_casadi_backend.py:56:4: C0103: Variable name "be" doesn't conform to snake_case naming style (invalid-name) +tests/test_casadi_backend.py:61:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:68:8: W0612: Unused variable 'optimization_variable' (unused-variable) +tests/test_casadi_backend.py:75:4: W0612: Unused variable 'optimization_variable_1' (unused-variable) +tests/test_casadi_backend.py:90:8: W0612: Unused variable 'optimization_variable_3' (unused-variable) +tests/test_casadi_backend.py:97:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:97:16: W0621: Redefining name 'example_casadi_system' from outer scope (line 37) (redefined-outer-name) +tests/test_casadi_backend.py:113:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:114:4: W0621: Redefining name 'collocation_discretization' from outer scope (line 44) (redefined-outer-name) +tests/test_casadi_backend.py:114:51: W0621: Redefining name 'example_casadi_system' from outer scope (line 37) (redefined-outer-name) +tests/test_casadi_backend.py:135:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:135:17: W0621: Redefining name 'example_casadi_system' from outer scope (line 37) (redefined-outer-name) +tests/test_casadi_backend.py:154:0: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_casadi_backend.py:154:24: W0621: Redefining name 'example_backend' from outer scope (line 55) (redefined-outer-name) +tests/test_casadi_backend.py:155:4: C0103: Variable name "be" doesn't conform to snake_case naming style (invalid-name) +tests/test_casadi_backend.py:159:13: W0212: Access to a protected member _mpc_inputs_to_nlp_inputs of a client class (protected-access) +************* Module test_casadi_ml_model +tests/test_casadi_ml_model.py:3:0: E0401: Unable to import 'pytest' (import-error) +tests/test_casadi_ml_model.py:9:0: C0115: Missing class docstring (missing-class-docstring) +tests/test_casadi_ml_model.py:14:0: C0115: Missing class docstring (missing-class-docstring) +tests/test_casadi_ml_model.py:23:0: C0116: Missing function or method docstring (missing-function-docstring) +************* Module test_mpc +tests/test_mpc.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/test_mpc.py:18:0: C0103: Constant name "a" doesn't conform to UPPER_CASE naming style (invalid-name) +tests/test_mpc.py:24:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:75:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:81:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:82:8: C0103: Variable name "sr" doesn't conform to snake_case naming style (invalid-name) +tests/test_mpc.py:94:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:105:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:152:4: C0103: Method name "test_CasadiMPC" doesn't conform to snake_case naming style (invalid-name) +tests/test_mpc.py:158:14: W0212: Access to a protected member _modules of a client class (protected-access) +tests/test_mpc.py:166:4: C0116: Missing function or method docstring (missing-function-docstring) +tests/test_mpc.py:6:0: C0411: standard import "import pathlib" should be placed before "import numpy as np" (wrong-import-order) +tests/test_mpc.py:13:0: W0611: Unused OptimizationBackend imported from agentlib_mpc.optimization_backends.backend (unused-import) +************* Module test_serialized_ann +tests/test_serialized_ann.py:5:0: C0411: standard import "import unittest" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_ann.py:8:0: C0411: standard import "from pathlib import Path" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_ann.py:13:0: C0411: third party import "from fixtures.ann import ANNTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) +tests/test_serialized_ann.py:14:0: C0411: third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) +************* Module test_serialized_gpr +tests/test_serialized_gpr.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/test_serialized_gpr.py:2:0: C0411: standard import "import os" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_gpr.py:3:0: C0411: standard import "import unittest" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_gpr.py:5:0: C0411: standard import "from pathlib import Path" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_gpr.py:11:0: C0411: third party import "from fixtures.gpr import GPRTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) +tests/test_serialized_gpr.py:12:0: C0411: third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) +tests/test_serialized_gpr.py:10:0: W0611: Unused MLModels imported from agentlib_mpc.models.serialized_ml_model (unused-import) +************* Module test_serialized_linreg +tests/test_serialized_linreg.py:1:0: C0114: Missing module docstring (missing-module-docstring) +tests/test_serialized_linreg.py:2:0: C0411: standard import "import os" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_linreg.py:3:0: C0411: standard import "import unittest" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_linreg.py:5:0: C0411: standard import "from pathlib import Path" should be placed before "import numpy as np" (wrong-import-order) +tests/test_serialized_linreg.py:11:0: C0411: third party import "from fixtures.linreg import LinRegTrainer" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) +tests/test_serialized_linreg.py:12:0: C0411: third party import "from fixtures.data_generator import DataGenerator" should be placed before "from agentlib_mpc.data_structures import ml_model_datatypes" (wrong-import-order) + +----------------------------------- +Your code has been rated at 7.35/10 +