uatlib
Public Types | Public Member Functions | List of all members
uat::agent< R > Struct Template Referenceabstract

Class to define the default behavior of an agent. More...

#include <agent.hpp>

Public Types

using region_type = R
 

Public Member Functions

virtual auto bid_phase ([[maybe_unused]] uint_t time, [[maybe_unused]] bid_fn bid, [[maybe_unused]] permit_public_status_fn status, [[maybe_unused]] int seed) -> void
 
virtual auto ask_phase ([[maybe_unused]] uint_t time, [[maybe_unused]] ask_fn ask, [[maybe_unused]] permit_public_status_fn status, [[maybe_unused]] int seed) -> void
 
virtual auto on_bought ([[maybe_unused]] const R &region, [[maybe_unused]] uint_t time, [[maybe_unused]] value_t value) -> void
 
virtual auto on_sold ([[maybe_unused]] const R &region, [[maybe_unused]] uint_t time, [[maybe_unused]] value_t value) -> void
 
virtual auto stop (uint_t time, int seed) -> bool=0
 

Detailed Description

template<region_compatible R>
struct uat::agent< R >

Class to define the default behavior of an agent.

All agent implementations should inherit from this class for a given region type. The region type should be a region_compatible type. Functions that are not implemented by the agent will have no effect. We suggest using override to ensure that no function signature mismatch occurs.

Member Function Documentation

◆ ask_phase()

template<region_compatible R>
virtual auto uat::agent< R >::ask_phase ( [[maybe_unused] ] uint_t  time,
[[maybe_unused] ] ask_fn  ask,
[[maybe_unused] ] permit_public_status_fn  status,
[[maybe_unused] ] int  seed 
) -> void
inlinevirtual

Behavior of the agent during the ask phase.

Parameters
timeThe current time step.
askA function that allows the agent to ask for a permit.
statusA function that returns the public status of a permit.
seedA random seed.

The function ask and status receive a region and a uint_t as arguments representing the location and time of the permit. The third argument of ask is the value the agent is willing to ask for the permit. The function ask returns true if the asking was successful, and false otherwise. The function status returns the public status of the permit with type permit_public_status_t.

Note
The default behavior of this function is to do nothing. We suggest using override to ensure that no function signature mismatch occurs.

◆ bid_phase()

template<region_compatible R>
virtual auto uat::agent< R >::bid_phase ( [[maybe_unused] ] uint_t  time,
[[maybe_unused] ] bid_fn  bid,
[[maybe_unused] ] permit_public_status_fn  status,
[[maybe_unused] ] int  seed 
) -> void
inlinevirtual

Behavior of the agent during the bid phase.

Parameters
timeThe current time step.
bidA function that allows the agent to bid for a permit.
statusA function that returns the public status of a permit.
seedA random seed.

The function bid and status receive a region_compatible and a uint_t as arguments representing the location and time of the permit. The third argument of bid is the value the agent is willing to bid for the permit. The function bid returns true if the bidding was successful, and false otherwise. The function status returns the public status of the permit with type permit_public_status_t.

Note
The default behavior of this function is to do nothing. We suggest using override to ensure that no function signature mismatch occurs.

◆ on_bought()

template<region_compatible R>
virtual auto uat::agent< R >::on_bought ( [[maybe_unused] ] const R &  region,
[[maybe_unused] ] uint_t  time,
[[maybe_unused] ] value_t  value 
) -> void
inlinevirtual

Callback function called when the agent successfully buys a permit.

Parameters
regionThe region of the permit.
timeThe time of the permit.
valueThe value paid for the permit.
Note
The default behavior of this function is to do nothing. We suggest using override to ensure that no function signature mismatch occurs.

◆ on_sold()

template<region_compatible R>
virtual auto uat::agent< R >::on_sold ( [[maybe_unused] ] const R &  region,
[[maybe_unused] ] uint_t  time,
[[maybe_unused] ] value_t  value 
) -> void
inlinevirtual

Callback function called when the agent successfully sells a permit.

Parameters
regionThe region of the permit.
timeThe time of the permit.
valueThe value received for the permit.
Note
The default behavior of this function is to do nothing. We suggest using override to ensure that no function signature mismatch occurs.

◆ stop()

template<region_compatible R>
virtual auto uat::agent< R >::stop ( uint_t  time,
int  seed 
) -> bool
pure virtual

Controls when the agent should stop.

Once this function returns true, the agent will be removed from the simulation.

Parameters
timeThe current time step.
seedA random seed.
Note
This function must be implemented by the agent.

The documentation for this struct was generated from the following file: