LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
solver_options.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_SOLVERS_SOLVER_OPTIONS_H
6#define LINE_SOLVERS_SOLVER_OPTIONS_H
7
8/**
9 * @file
10 * @ingroup line_solvers
11 * @ingroup line_public
12 * The keyword arguments a solver takes, as one struct.
13 *
14 * Python builds a solver as `MVA(model, method='lin')` or
15 * `CTMC(model, cutoff=3, seed=23000)` -- one shared keyword surface across
16 * every solver, narrowed per solver by which keywords it reads. This is that
17 * surface: a field per keyword, and a fluent `set_*` per field so a C++ call
18 * reads like the Python one it was ported from.
19 *
20 * SolverOptions().set_cutoff(3).set_seed(23000)
21 *
22 * A field left at its default is NOT forwarded, so the engine's own default
23 * stands: that is what the negative/empty sentinels below mean. This mirrors
24 * MATLAB's `Solver.defaultOptions` merge rather than overwriting it.
25 */
26
27#include <cstddef>
28#include <string>
29#include <vector>
30
31namespace line {
32
33/** The knobs a solver reads; a negative or empty field keeps the engine default. */
35 std::string method = "default";
36 double tol = -1.0;
37 double iter_tol = -1.0;
38 int iter_max = -1;
39 std::size_t samples = 0;
40 unsigned long seed = 0;
41 /** CTMC `options.cutoff`, scalar or per class. */
42 double cutoff = -1.0;
43 std::vector<std::size_t> cutoff_vec;
44 /** CTMC refusal threshold on the state-space size. */
45 std::size_t state_max = 0;
46 /** Fluid `options.timespan(2)` and warm start. */
47 double timespan_end = -1.0;
48 std::vector<double> init_sol;
49 bool stiff = false;
50 /** The `options.config` fields of the MVA / NC / fluid families. */
51 std::string multiserver;
52 std::string highvar;
53 std::string np_priority;
54 /** MVA / NC `options.config.fork_join`: 'default'/'mmt'/'fjt' or 'ht'. */
55 std::string fork_join;
56 /** SSA `options.config.state_space_gen`. */
57 std::string state_space_gen;
58 /** SolverBA `options.level`. */
59 int level = 2;
60 /** JMT `options.keep`: leave the scratch directory in place after the solve. */
61 bool keep = false;
62 bool verbose = false;
63
64 SolverOptions& set_method(const std::string& v) { method = v; return *this; }
65 SolverOptions& set_tol(double v) { tol = v; return *this; }
66 SolverOptions& set_iter_tol(double v) { iter_tol = v; return *this; }
67 SolverOptions& set_iter_max(int v) { iter_max = v; return *this; }
68 SolverOptions& set_samples(std::size_t v) { samples = v; return *this; }
69 SolverOptions& set_seed(unsigned long v) { seed = v; return *this; }
70 SolverOptions& set_cutoff(double v) { cutoff = v; return *this; }
71 SolverOptions& set_cutoff_vec(const std::vector<std::size_t>& v) { cutoff_vec = v; return *this; }
72 SolverOptions& set_state_max(std::size_t v) { state_max = v; return *this; }
73 SolverOptions& set_timespan_end(double v) { timespan_end = v; return *this; }
74 SolverOptions& set_init_sol(const std::vector<double>& v) { init_sol = v; return *this; }
75 SolverOptions& set_stiff(bool v) { stiff = v; return *this; }
76 SolverOptions& set_multiserver(const std::string& v) { multiserver = v; return *this; }
77 SolverOptions& set_highvar(const std::string& v) { highvar = v; return *this; }
78 SolverOptions& set_np_priority(const std::string& v) { np_priority = v; return *this; }
79 SolverOptions& set_fork_join(const std::string& v) { fork_join = v; return *this; }
80 SolverOptions& set_state_space_gen(const std::string& v) { state_space_gen = v; return *this; }
81 SolverOptions& set_level(int v) { level = v; return *this; }
82 SolverOptions& set_keep(bool v) { keep = v; return *this; }
83 SolverOptions& set_verbose(bool v) { verbose = v; return *this; }
84};
85
86} // namespace line
87
88#endif // LINE_SOLVERS_SOLVER_OPTIONS_H
The knobs a solver reads; a negative or empty field keeps the engine default.
bool keep
JMT options.keep: leave the scratch directory in place after the solve.
std::vector< std::size_t > cutoff_vec
std::string multiserver
The options.config fields of the MVA / NC / fluid families.
SolverOptions & set_cutoff(double v)
SolverOptions & set_iter_max(int v)
SolverOptions & set_init_sol(const std::vector< double > &v)
std::size_t state_max
CTMC refusal threshold on the state-space size.
SolverOptions & set_timespan_end(double v)
std::vector< double > init_sol
SolverOptions & set_keep(bool v)
double cutoff
CTMC options.cutoff, scalar or per class.
SolverOptions & set_samples(std::size_t v)
SolverOptions & set_multiserver(const std::string &v)
SolverOptions & set_stiff(bool v)
SolverOptions & set_verbose(bool v)
SolverOptions & set_fork_join(const std::string &v)
SolverOptions & set_state_space_gen(const std::string &v)
int level
SolverBA options.level.
SolverOptions & set_highvar(const std::string &v)
std::string np_priority
SolverOptions & set_iter_tol(double v)
SolverOptions & set_tol(double v)
SolverOptions & set_cutoff_vec(const std::vector< std::size_t > &v)
std::string fork_join
MVA / NC options.config.fork_join: 'default'/'mmt'/'fjt' or 'ht'.
double timespan_end
Fluid options.timespan(2) and warm start.
SolverOptions & set_method(const std::string &v)
SolverOptions & set_state_max(std::size_t v)
std::string state_space_gen
SSA options.config.state_space_gen.
SolverOptions & set_level(int v)
SolverOptions & set_seed(unsigned long v)
SolverOptions & set_np_priority(const std::string &v)