Class CentralizedNegotiation
Defined in File CentralizedNegotiation.hpp
Nested Relationships
Nested Types
Class Documentation
-
class CentralizedNegotiation
Public Types
-
using Proposal = std::unordered_map<schedule::ParticipantId, Plan>
When a proposal is found, it will provide a plan for each agent.
Public Functions
Constructor
- Parameters:
viewer – [in] A viewer for the traffic schedule. You may provide a std::shared_ptr<const schedule::Database> for this. The negotiation will avoid creating any new conflicts with schedule participants that are not part of the negotiation.
Set the schedule viewer.
-
CentralizedNegotiation &optimal(bool on = true)
Require the negotiation to consider all combinations so that it finds the (near-)optimal solution. Off by default.
-
CentralizedNegotiation &log(bool on = true)
Toggle on/off whether to log the progress of the negotiation and save it in the Result. Off by default.
-
CentralizedNegotiation &print(bool on = true)
Toggle on/off whether to print the progress of the negotiation while it is running. Off by default.
-
class Agent
Public Functions
Constructor
- Parameters:
id – [in] This agent’s ID within the schedule database. If multiple agents are given the same ID in a negotiation, then a runtime exception will be thrown.
starts – [in] The starting condition for this agent.
goal – [in] The goal for this agent.
planner – [in] The single-agent planner used for this agent. Each agent can have its own planner or they can share planners. If this is set to nullptr when the negotiation begins, then a runtime exception will be thrown.
options – [in] Options to use for the negotiator of this agent. If nullopt is provided, then the default options of the SimpleNegotiator will be used.
Constructor
The planner will use whichever starting condition provides the optimal plan.
- Parameters:
id – [in] This agent’s ID within the schedule database. If multiple agents are given the same ID in a negotiation, then a runtime exception will be thrown.
starts – [in] One or more starting conditions for this agent. If no starting conditions are provided before the negotiation begins, then a runtime exception will be thrown.
goal – [in] The goal for this agent.
planner – [in] The single-agent planner used for this agent. Each agent can have its own planner or they can share planners. If this is set to nullptr when the negotiation begins, then a runtime exception will be thrown.
options – [in] Options to use for the negotiator of this agent. If nullopt is provided, then the default options of the SimpleNegotiator will be used.
-
schedule::ParticipantId id() const
Get the ID for this agent.
-
Agent &id(schedule::ParticipantId value)
Set the ID for this agent.
Set the planner for this agent.
-
const std::optional<SimpleNegotiator::Options> &options() const
Get the options for this agent.
-
Agent &options(std::optional<SimpleNegotiator::Options> value)
Set the options for this agent.
-
class Result
Public Functions
-
const std::optional<Proposal> &proposal() const
If a solution was found, it will be provided by this proposal.
-
const std::unordered_set<schedule::ParticipantId> &blockers() const
This is a list of schedule Participants that were not part of the negotiation who blocked the planning effort. Blockers do not necessarily prevent a solution from being found, but they do prevent the optimal solution from being available.
-
const std::vector<std::string> &log() const
A log of messages related to the negotiation. This will be empty unless the log() function of the CentralizedNegotiation is toggled on before solving.
-
const std::optional<Proposal> &proposal() const
-
using Proposal = std::unordered_map<schedule::ParticipantId, Plan>