![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
A finite-state agent with active, weighted passive and immediate transitions (handle semantics). More...
#include <line/lang/lal/builder.h>
Public Member Functions | |
| Agent (const std::string &name, const std::vector< std::string > &states, const std::string &initial) | |
| const std::string & | name () const |
| const std::vector< std::string > & | states () const |
| const std::string & | initial () const |
| const std::vector< Transition > & | transitions () const |
| const std::optional< std::vector< double > > & | initial_distribution () const |
| const std::optional< QueueInfo > & | queue_info () const |
| bool | unbounded_queue () const |
| bool | has_vars () const |
| bool | same (const Agent &o) const |
| Agent & | active (const std::string &source, const std::string &action, double rate, const std::string &target, const std::optional< std::string > &label=std::nullopt, int priority=0) |
| Add a timed action at rate. | |
| Agent & | active (const std::string &source, const std::string &action, ValueFn rate, const std::string &target, const std::optional< std::string > &label=std::nullopt, int priority=0) |
| A timed action whose rate is a function of the joint state. | |
| Agent & | passive (const std::string &source, const std::string &action, const std::string &target, double weight=1.0) |
| Add a passive reaction, chosen in proportion to weight among the enabled ones. | |
| Agent & | passive (const std::string &source, const std::string &action, const std::string &target, ValueFn weight) |
| Agent & | immediate (const std::string &source, const std::string &action, const std::string &target, double weight=1.0, int priority=0, const std::optional< std::string > &label=std::nullopt) |
| Add a zero-time action. | |
| Agent & | immediate (const std::string &source, const std::string &action, const std::string &target, ValueFn weight, int priority=0, const std::optional< std::string > &label=std::nullopt) |
| ActionRef | action (const std::string &name) const |
| Reference an existing action (a transition or a command) for synchronisation. | |
| Agent & | set_initial_distribution (const std::vector< double > &p) |
| Start the agent from a law over its states, a vector in state order. | |
| Agent & | set_initial_distribution (const std::map< std::string, double > &p) |
| Start the agent from a law over its states, by state name (missing states have probability 0). | |
| Agent & | setInitialDistribution (const std::vector< double > &p) |
| Agent & | setInitialDistribution (const std::map< std::string, double > &p) |
| Agent & | command (const std::string &action, const CommandOptions &o) |
| Add a guarded command to a typed-variable agent (command). | |
| Agent & | command (const std::string &action, const CommandValue &value, std::function< bool(const Vars &)> guard, std::function< Vars(const Vars &)> update, Role role=Role::Active, int priority=0, const std::string &label=std::string()) |
| command(action, rate, guard, update[, role, priority, label]); for a non-active role value is the weight. | |
| AgentRecord | record () const |
| The immutable record (_record); a typed-variable agent is expanded from its initial valuation. | |
Static Public Member Functions | |
| static Agent | with_vars (const std::string &name, const std::vector< std::pair< std::string, std::vector< long > > > &vars, const Vars &initial) |
| A typed-variable agent (Agent(name, vars={...}, initial={...})): vars maps each variable, in order, to its finite domain of distinct values; initial gives every variable a value in its domain. | |
| static std::vector< Agent > | array (const Agent &prototype, long n) |
| n copies of prototype named <name>_0 ... <name>_{n-1}, labels suffixed [i] (Agent.array). | |
| static Agent | from_record (const AgentRecord &value) |
| Rebuild a builder agent from a parsed record (as Composition.from_string does). | |
Friends | |
| class | Composition |
A finite-state agent with active, weighted passive and immediate transitions (handle semantics).
Declare its states by name (Agent(name, states, initial)) and add transitions with active/passive/immediate, or declare typed variables (Agent::with_vars) and add guarded commands; the local state is then the tuple of variable values, enumerated from the initial valuation.
|
inline |
Definition at line 288 of file builder.h.
References initial(), name(), states(), and line::lal::value_error().
Referenced by active(), active(), array(), command(), command(), from_record(), immediate(), immediate(), passive(), passive(), same(), set_initial_distribution(), set_initial_distribution(), setInitialDistribution(), setInitialDistribution(), and with_vars().
|
inline |
Reference an existing action (a transition or a command) for synchronisation.
Definition at line 614 of file builder.h.
References line::lal::Transition::action, name(), and line::lal::value_error().
Referenced by active(), active(), command(), command(), immediate(), immediate(), passive(), passive(), and line::lal::solve_reduced().
|
inline |
Add a timed action at rate.
priority orders the timed actions of this agent: an action is disabled while one of the same agent with a higher priority is enabled. label (nonempty) aliases the event label.
Definition at line 346 of file builder.h.
References action(), line::lal::Active, and Agent().
Referenced by line::lal::markov_chain_agent(), and line::lal::markov_process_agent().
|
inline |
A timed action whose rate is a function of the joint state.
Definition at line 351 of file builder.h.
References action(), line::lal::Active, and Agent().
n copies of prototype named <name>_0 ... <name>_{n-1}, labels suffixed [i] (Agent.array).
Definition at line 450 of file builder.h.
References Agent(), line::lal::Transition::label, name(), and line::lal::value_error().
|
inline |
Add a guarded command to a typed-variable agent (command).
guard(v) and update(v) take the agent's variables; update returns the variables it changes. A command is disabled where its guard is false or its update leaves a domain.
Definition at line 413 of file builder.h.
References action(), line::lal::Active, Agent(), line::lal::CommandValue::CommandValue(), line::lal::CommandOptions::guard, line::lal::CommandOptions::label, line::lal::CommandOptions::priority, line::lal::CommandOptions::rate, line::lal::CommandOptions::role, line::lal::CommandOptions::update, line::lal::value_error(), and line::lal::CommandOptions::weight.
Referenced by command().
|
inline |
command(action, rate, guard, update[, role, priority, label]); for a non-active role value is the weight.
Definition at line 433 of file builder.h.
References action(), line::lal::Active, Agent(), command(), line::lal::CommandOptions::guard, line::lal::CommandOptions::label, line::lal::CommandOptions::priority, line::lal::CommandOptions::rate, line::lal::CommandOptions::role, line::lal::CommandOptions::update, and line::lal::CommandOptions::weight.
|
inlinestatic |
Rebuild a builder agent from a parsed record (as Composition.from_string does).
Definition at line 487 of file builder.h.
References Agent(), line::lal::AgentRecord::initial, line::lal::AgentRecord::initial_distribution, line::lal::AgentRecord::name, line::lal::AgentRecord::states, and line::lal::AgentRecord::transitions.
Referenced by line::lal::Composition::from_string().
|
inline |
Add a zero-time action.
Immediate actions have maximal progress: in a state where any is enabled, only those of the highest priority fire, chosen in proportion to weight, and timed actions wait. The vanishing states this creates are eliminated by the solvers.
Definition at line 369 of file builder.h.
References action(), Agent(), and line::lal::Immediate.
|
inline |
Definition at line 373 of file builder.h.
References action(), Agent(), and line::lal::Immediate.
|
inline |
Definition at line 333 of file builder.h.
Referenced by Agent(), and with_vars().
|
inline |
|
inline |
Definition at line 331 of file builder.h.
Referenced by action(), line::lal::Composition::add(), line::lal::Composition::add(), line::lal::Composition::add(), line::lal::Composition::add(), Agent(), array(), line::lal::Composition::synchronize(), and with_vars().
|
inline |
Add a passive reaction, chosen in proportion to weight among the enabled ones.
Definition at line 356 of file builder.h.
References action(), Agent(), and line::lal::Passive.
|
inline |
Definition at line 360 of file builder.h.
References action(), Agent(), and line::lal::Passive.
|
inline |
|
inline |
The immutable record (_record); a typed-variable agent is expanded from its initial valuation.
Definition at line 468 of file builder.h.
References line::lal::AgentRecord::discrete, line::lal::AgentRecord::initial, line::lal::AgentRecord::initial_distribution, line::lal::AgentRecord::name, line::lal::AgentRecord::queue_info, line::lal::AgentRecord::states, line::lal::AgentRecord::transitions, line::lal::AgentRecord::unbounded_initial, line::lal::AgentRecord::unbounded_queue, and line::lal::value_error().
|
inline |
|
inline |
Start the agent from a law over its states, by state name (missing states have probability 0).
Definition at line 392 of file builder.h.
References Agent(), set_initial_distribution(), and line::lal::value_error().
|
inline |
Start the agent from a law over its states, a vector in state order.
Definition at line 382 of file builder.h.
References Agent(), and line::lal::value_error().
Referenced by set_initial_distribution(), setInitialDistribution(), and setInitialDistribution().
|
inline |
Definition at line 405 of file builder.h.
References Agent(), and set_initial_distribution().
|
inline |
Definition at line 404 of file builder.h.
References Agent(), and set_initial_distribution().
|
inline |
|
inline |
|
inline |
Definition at line 337 of file builder.h.
Referenced by line::lal::solve_reduced().
|
inlinestatic |
A typed-variable agent (Agent(name, vars={...}, initial={...})): vars maps each variable, in order, to its finite domain of distinct values; initial gives every variable a value in its domain.
Definition at line 304 of file builder.h.
References Agent(), initial(), name(), and line::lal::value_error().
|
friend |