uatlib
Classes | Typedefs | Functions | Variables
simulation.hpp File Reference

Defines the simulation function and related types. More...

#include <uat/agent.hpp>
#include <deque>
#include <optional>
#include <random>
#include <vector>
#include <cool/compose.hpp>
Include dependency graph for simulation.hpp:

Go to the source code of this file.

Classes

struct  uat::trade_info_t< R >
 Type to represent the information in a trade transaction. More...
 
struct  uat::permit_private_status::on_sale
 Represents the private status of a permit that is available for trading. More...
 
struct  uat::permit_private_status::in_use
 Represents the private status of a permit that is not available for trading. More...
 
struct  uat::permit_private_status::out_of_limits
 Represents the private status of a permit that is out of limits (past and future). More...
 
struct  uat::permit_private_status_t
 Represents the private status of a permit. More...
 
struct  uat::agent_private_status::inactive
 Represents the private status of an agent that is inactive in the simulation. More...
 
struct  uat::agent_private_status::active
 Represents the private status of an agent that is active in the simulation. More...
 
class  uat::agents_private_status_t
 Private status of the collection of agents in the simulation. More...
 
struct  uat::stop_criterion::no_agents_t
 Stop criterion that stops the simulation when there are no agents. More...
 
struct  uat::stop_criterion::time_threshold_t
 Stop criterion that stops the simulation when a time threshold is reached. More...
 
struct  uat::simulation_opts_t< R >
 Options to configure the simulation. More...
 

Typedefs

using uat::factory_t = std::function< std::vector< any_agent >(uint_t, int)>
 A function type that generates agents for each iteration.
 
using uat::agent_private_status_t = std::variant< agent_private_status::inactive, agent_private_status::active >
 Variant that represents the private status of an agent.
 
using uat::permit_private_status_fn = type_safe::function_ref< permit_private_status_t(region_view, uint_t)>
 Function reference that allows the simulation to access the private status of an agent.
 
template<region_compatible R>
using uat::trade_callback_t = std::function< void(trade_info_t< R >)>
 Callback type that receives information about a trade transaction.
 
using uat::simulation_callback_t = std::function< void(uint_t, const agents_private_status_t &, permit_private_status_fn)>
 Callback type that receives information about the status of the simulation.
 
using uat::stop_criterion_t = std::variant< stop_criterion::no_agents_t, stop_criterion::time_threshold_t >
 Variant that represents the possible stop criteria for the simulation.
 

Functions

template<region_compatible R>
auto uat::simulate (const simulation_opts_t< R > &opts={}) -> void
 

Variables

constexpr auto uat::no_owner = std::numeric_limits<uint_t>::max()
 Unique value to represent the absence of an owner.
 

Detailed Description

Defines the simulation function and related types.

Function Documentation

◆ simulate()

template<region_compatible R>
auto uat::simulate ( const simulation_opts_t< R > &  opts = {}) -> void

A simulation of a first-price sealed-bid auction.

Parameters
factoryA function that generates agents for each iteration.
seedA random seed.
optsOptions to configure the simulation.