Class SimpleResponder

Inheritance Relationships

Base Type

Class Documentation

class SimpleResponder : public rmf_traffic::schedule::Negotiator::Responder

A simple implementation of a Negotiator::Responder. It simply passes the result along to the Negotiation.

Public Types

using ApprovalMap = std::unordered_map<Negotiation::ConstTablePtr, std::function<UpdateVersion()>>
using BlockerSet = std::unordered_set<schedule::ParticipantId>

Public Functions

SimpleResponder(const Negotiation::TablePtr &table, std::vector<schedule::ParticipantId> *report_blockers = nullptr)

Constructor

Parameters:
  • table[in] The negotiation table that this SimpleResponder is tied to

  • report_blockers[in] If the blockers should be reported when a forfeit is given, provide a pointer to a vector of ParticipantIds.

SimpleResponder(const Negotiation::TablePtr &table, std::shared_ptr<ApprovalMap> approval_map, std::shared_ptr<BlockerSet> blockers)

Constructor

Parameters:
  • table[in] The negotiation table that this SimpleResponder is tied to

  • approval_map[in] If provided, the responder will store the approval callback in this map

  • blockers[in] If provided, the responder will store any solution blockers in this set

void submit(PlanId plan_id, std::vector<Route> itinerary, std::function<UpdateVersion()> approval_callback = nullptr) const final
virtual void reject(const Negotiation::Alternatives &alternatives) const final

The negotiator will call this function if it has decided to reject an attempt to negotiate. It must supply a set of alternatives for the parent negotiator to consider for its next proposal.

virtual void forfeit(const std::vector<ParticipantId> &blockers) const final

The negotiator will call this function if it cannot find any feasible proposal or alternative that can be accommodated by the parent.

Parameters:

blockers[in] Give the set of schedule participants that are blocking a solution from being found.

const std::vector<ParticipantId> &blockers() const

Get the blockers that were reported by the Negotiator, if a forfeit was given.

Public Static Functions

template<typename ...Args>
static inline std::shared_ptr<SimpleResponder> make(Args&&... args)