Class Negotiator

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

class Negotiator

A pure abstract interface class that facilitates negotiating a resolution to a schedule conflict. An example implementation of this class can be found as rmf_traffic::agv::Negotiator.

Subclassed by rmf_traffic::agv::SimpleNegotiator, rmf_traffic::schedule::StubbornNegotiator

Public Types

using TableViewerPtr = Negotiation::Table::ViewerPtr
using ResponderPtr = std::shared_ptr<const Responder>

Public Functions

virtual void respond(const TableViewerPtr &table_viewer, const ResponderPtr &responder) = 0

Have the Negotiator respond to an attempt to negotiate.

Parameters:
  • table[in] The Negotiation::Table that is being used for the negotiation.

  • responder[in] The Responder instance that the negotiator should use when a response is ready.

  • interrupt_flag[in] A pointer to a flag that can be used to interrupt the negotiator if it has been running for too long. If the planner should run indefinitely, then pass a nullptr.

virtual ~Negotiator() = default
class Responder

A pure abstract interface class that allows the Negotiator to respond to other Negotiators.

Subclassed by rmf_traffic::schedule::SimpleResponder

Public Types

using ParticipantId = rmf_traffic::schedule::ParticipantId
using ItineraryVersion = rmf_traffic::schedule::ItineraryVersion
using UpdateVersion = rmf_utils::optional<ItineraryVersion>
using ApprovalCallback = std::function<UpdateVersion()>
using Alternatives = Negotiation::Alternatives

Public Functions

virtual void submit(PlanId plan_id, std::vector<Route> itinerary, ApprovalCallback approval_callback = nullptr) const = 0

The negotiator will call this function when it has an itinerary to submit in response to a negotiation.

Parameters:
  • plan_id[in] A unique ID that refers to the plan that is being submitted.

  • itinerary[in] The itinerary that is being proposed

  • approval_callback[in] This callback will get triggered if this submission gets approved. The return value of the callback should be the itinerary version of the participant update that will follow the resolution of this negotiation (or a nullopt if no update will be performed). Pass in a nullptr if an approval callback is not necessary.

virtual void reject(const Alternatives &alternatives) const = 0

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 = 0

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.

virtual ~Responder() = default