ContractNetAssignmentPolicy

class ContractNetAssignmentPolicy(val deadline: Double, val selectBest: (List<Bid>) -> Bid? = ::lowestBidByName) : AssignmentPolicyIfc(source)

Award each task by Contract-Net auction: the dispatcher calls for proposals, the vehicles bid, the best bid wins.

The difference from every rule above is where the knowledge lives. NearestVehiclePolicy computes a number about each vehicle from the outside; this asks each vehicle what it makes of the job and lets it answer with whatever it knows about itself -- its speed, its charge, its faults, its own view of what it is willing to take on. Swap the fleet's BidPolicyIfc and the awards change without the dispatcher being touched, which is precisely what a passive resource cannot do, because it has nothing with which to hold an opinion.

Tasks are auctioned one at a time, in the order the selection rule chose, and a vehicle that wins one is withdrawn before the next call goes out. That is a greedy sequence of auctions rather than a combinatorial one: it can be beaten on a set of tasks that would be better matched jointly, and a policy wanting that should collect bids for all of them and solve. The greedy form is here because it is the one Contract-Net actually describes.

Parameters

deadline

how long each call for proposals stays open, in simulated time. Charged per auction, so a fleet with several tasks outstanding pays it several times over -- which is the honest cost of negotiating each job separately.

selectBest

which bid wins. Lower is better by convention, so the default takes the minimum.

Constructors

Link copied to clipboard
constructor(deadline: Double, selectBest: (List<Bid>) -> Bid? = ::lowestBidByName)

Properties

Link copied to clipboard
Link copied to clipboard
val selectBest: (List<Bid>) -> Bid?

Functions

Link copied to clipboard
open suspend override fun KSLProcessBuilder.assign(context: DispatchContext): List<AssignmentProposal>
Link copied to clipboard
open override fun toString(): String