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
- agentlib_mpc.modules.dmpc.admm package
- Submodules
- agentlib_mpc.modules.dmpc.admm.admm module
ADMM
ADMM.admm_step()
ADMM.all_coupling_statuses()
ADMM.assert_mpc_variables_are_in_model()
ADMM.collect_couplings_for_optimization()
ADMM.collect_variables_for_optimization()
ADMM.cons_and_exchange
ADMM.deregister_all_participants()
ADMM.get_participants_values()
ADMM.get_results()
ADMM.participant_callback()
ADMM.penalty_factor_var
ADMM.process()
ADMM.receive_participant()
ADMM.registered_participants
ADMM.reset_participants_ready()
ADMM.send_coupling_values()
ADMM.send_coupling_variable()
ADMM.update_lambda()
ADMM.var_ref
ADMMConfig
ADMMConfig.controls
ADMMConfig.couplings
ADMMConfig.exchange
ADMMConfig.inputs
ADMMConfig.iteration_timeout
ADMMConfig.log_level
ADMMConfig.max_iterations
ADMMConfig.module_id
ADMMConfig.optimization_backend
ADMMConfig.outputs
ADMMConfig.parameters
ADMMConfig.penalty_factor
ADMMConfig.prediction_horizon
ADMMConfig.r_del_u
ADMMConfig.registration_period
ADMMConfig.sampling_time
ADMMConfig.set_outputs
ADMMConfig.shared_variable_fields
ADMMConfig.states
ADMMConfig.time_step
ADMMConfig.type
ADMMConfig.validate_incoming_values
ADMMConfig.check_prefixes_of_variables
ADMMConfig.model_post_init()
ADMMParticipation
LocalADMM
LocalADMMConfig
LocalADMMConfig.controls
LocalADMMConfig.couplings
LocalADMMConfig.exchange
LocalADMMConfig.inputs
LocalADMMConfig.iteration_timeout
LocalADMMConfig.log_level
LocalADMMConfig.max_iterations
LocalADMMConfig.module_id
LocalADMMConfig.optimization_backend
LocalADMMConfig.outputs
LocalADMMConfig.parameters
LocalADMMConfig.penalty_factor
LocalADMMConfig.prediction_horizon
LocalADMMConfig.r_del_u
LocalADMMConfig.registration_delay
LocalADMMConfig.registration_period
LocalADMMConfig.sampling_time
LocalADMMConfig.set_outputs
LocalADMMConfig.shared_variable_fields
LocalADMMConfig.states
LocalADMMConfig.sync_delay
LocalADMMConfig.time_step
LocalADMMConfig.type
LocalADMMConfig.validate_incoming_values
LocalADMMConfig.model_post_init()
ModuleStatus
ParticipantStatus
- agentlib_mpc.modules.dmpc.admm.admm_coordinated module
CoordinatedADMM
CoordinatedADMMConfig
CoordinatedADMMConfig.controls
CoordinatedADMMConfig.coordinator
CoordinatedADMMConfig.couplings
CoordinatedADMMConfig.exchange
CoordinatedADMMConfig.inputs
CoordinatedADMMConfig.iteration_timeout
CoordinatedADMMConfig.log_level
CoordinatedADMMConfig.max_iterations
CoordinatedADMMConfig.messages_in
CoordinatedADMMConfig.messages_out
CoordinatedADMMConfig.module_id
CoordinatedADMMConfig.optimization_backend
CoordinatedADMMConfig.outputs
CoordinatedADMMConfig.parameters
CoordinatedADMMConfig.penalty_factor
CoordinatedADMMConfig.prediction_horizon
CoordinatedADMMConfig.r_del_u
CoordinatedADMMConfig.registration_interval
CoordinatedADMMConfig.registration_period
CoordinatedADMMConfig.request_frequency
CoordinatedADMMConfig.sampling_time
CoordinatedADMMConfig.set_outputs
CoordinatedADMMConfig.shared_variable_fields
CoordinatedADMMConfig.states
CoordinatedADMMConfig.time_step
CoordinatedADMMConfig.type
CoordinatedADMMConfig.validate_incoming_values
CoordinatedADMMConfig.couplings_should_have_values
CoordinatedADMMConfig.model_post_init()
coupInput
- agentlib_mpc.modules.dmpc.admm.admm_coordinator module
ADMMCoordinator
ADMMCoordinatorConfig
ADMMCoordinatorConfig.abs_tol
ADMMCoordinatorConfig.admm_iter_max
ADMMCoordinatorConfig.dual_tol
ADMMCoordinatorConfig.log_level
ADMMCoordinatorConfig.maxIter
ADMMCoordinatorConfig.messages_in
ADMMCoordinatorConfig.messages_out
ADMMCoordinatorConfig.module_id
ADMMCoordinatorConfig.penalty_change_factor
ADMMCoordinatorConfig.penalty_change_threshold
ADMMCoordinatorConfig.penalty_factor
ADMMCoordinatorConfig.prediction_horizon
ADMMCoordinatorConfig.primal_tol
ADMMCoordinatorConfig.registration_period
ADMMCoordinatorConfig.rel_tol
ADMMCoordinatorConfig.sampling_time
ADMMCoordinatorConfig.save_iter_interval
ADMMCoordinatorConfig.save_solve_stats
ADMMCoordinatorConfig.shared_variable_fields
ADMMCoordinatorConfig.solve_stats_file
ADMMCoordinatorConfig.time_out_non_responders
ADMMCoordinatorConfig.time_step
ADMMCoordinatorConfig.type
ADMMCoordinatorConfig.use_relative_tolerances
ADMMCoordinatorConfig.validate_incoming_values
ADMMCoordinatorConfig.wait_time_on_start_iters
ADMMCoordinatorConfig.default_sampling_time
ADMMCoordinatorConfig.model_post_init()
ADMMCoordinatorConfig.solve_stats_file_is_csv
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:
- 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:
check_valid_fields
»shared_variable_fields
check_valid_level
»log_level
- 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.
- 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
- 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.
- 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:
check_valid_fields
»shared_variable_fields
check_valid_level
»log_level
- 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
- 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.