delpi
0.0.1
DElta-complete LP solver
Toggle main menu visibility
Loading...
Searching...
No Matches
Config.h
1
10
#pragma once
11
12
#include <iosfwd>
13
#include <string>
14
#include <string_view>
15
16
#include "delpi/util/OptionValue.hpp"
17
18
namespace
delpi
{
19
20
#define DELPI_PARAMETER(param_name, type, default_value, help) \
21
public: \
22
\
23
OptionValue<type> &m_##param_name() { return param_name##_; } \
24
\
25
[[nodiscard]] const type ¶m_name() const { return param_name##_.get(); } \
26
static constexpr type default_##param_name{default_value}; \
27
static constexpr const char *const help_##param_name{help}; \
28
\
29
private: \
30
OptionValue<type> param_name##_{default_value};
31
36
class
Config {
37
public
:
39
enum class
LpSolver
{
40
SOPLEX
,
41
QSOPTEX
,
42
DELPI
,
43
};
44
45
enum class
Format
{
46
AUTO
,
47
MPS
,
48
LP
,
49
};
50
51
enum class
LpMode
{
52
AUTO
= 0,
53
PURE_PRECISION_BOOSTING
= 1,
54
PURE_ITERATIVE_REFINEMENT
= 2,
55
HYBRID
= 3,
56
};
57
59
Config
() =
default
;
64
explicit
Config
(std::string filename);
69
explicit
Config
(
bool
read_from_stdin);
74
explicit
Config
(
Format
format);
75
76
public
:
77
static
constexpr
std::string_view help_filename{
"Input file name"
};
78
80
[[nodiscard]]
const
std::string &filename()
const
{
return
filename_.get(); }
82
[[nodiscard]] std::string filename_extension()
const
;
84
OptionValue<std::string> &m_filename() {
return
filename_; }
89
[[nodiscard]]
LpMode
actual_lp_mode()
const
;
94
[[nodiscard]]
Format
actual_format()
const
;
95
96
private
:
97
OptionValue<std::string> filename_{
""
};
98
99
DELPI_PARAMETER(continuous_output,
bool
,
false
,
100
"Continuous output.\n"
101
"\t\tIf a delta-optimal solution with actual_delta > delta is found, output it and continue"
)
102
DELPI_PARAMETER(csv,
bool
, false,
"Produce CSV output. Must also specify --with-timings to get the time stats"
)
103
DELPI_PARAMETER(debug_parsing,
bool
, false,
"Debug parsing"
)
104
DELPI_PARAMETER(delta,
double
, 0,
"Delta used by the LP solver solver"
)
105
DELPI_PARAMETER(format,
Format
, delpi::Config::
Format
::
AUTO
,
106
"Input file format\n"
107
"\t\tOne of: auto (1), mps (2)"
)
108
DELPI_PARAMETER(lp_mode,
LpMode
, delpi::Config::
LpMode
::
AUTO
,
109
"LP mode used by the LP solver.\n"
110
"\t\tNot all solvers may support all modes\n"
111
"\t\tOne of: auto (1), pure-precision-boosting (2), pure-iterative-refinement (3), hybrid (4)"
)
112
DELPI_PARAMETER(lp_solver,
LpSolver
, delpi::Config::
LpSolver
::
SOPLEX
,
113
"Underlying LP solver used by the theory solver.\n"
114
"\t\tOne of: soplex (1), qsoptex (2)"
)
115
DELPI_PARAMETER(number_of_jobs,
unsigned
int
, 1u,
"Number of jobs"
)
116
DELPI_PARAMETER(skip_optimise,
bool
, false,
117
"Whether to skip the objective function, turning the optimisation in a feasibility problem. "
118
"Only affects the MPS format"
)
119
DELPI_PARAMETER(dry_run,
bool
, false,
"Whether to stop the program before running any optimization algorithm"
)
120
DELPI_PARAMETER(produce_models,
bool
, false,
121
"Produce models, showing a valid assignment.\n"
122
"\t\tOnly applicable if the problem is feasible"
)
123
DELPI_PARAMETER(random_seed,
unsigned
int
, 0u,
124
"Set the random seed. 0 means that the seed will be generated on the fly"
)
125
DELPI_PARAMETER(read_from_stdin,
bool
, false,
"Read the input from the standard input"
)
126
DELPI_PARAMETER(silent,
bool
, false,
"Silent mode. Nothing will be printed on the standard output"
)
127
DELPI_PARAMETER(
128
timeout,
unsigned
int
, 0,
129
"Timeout in milliseconds for the main routine, without accounting for input parsing. 0 means no timeout"
)
130
DELPI_PARAMETER(verbose_delpi,
int
, 2,
"Verbosity level for delpi. In the range [0, 5]"
)
131
DELPI_PARAMETER(verbose_simplex,
int
, 0,
"Verbosity level for simplex. In the range [0, 5]"
)
132
DELPI_PARAMETER(verify,
bool
, false,
133
"If the input produces a feasible output, verify the assignment against the input"
)
134
DELPI_PARAMETER(with_timings,
bool
, false,
"Report timings alongside results"
)
135
};
136
137
std::ostream &operator<<(std::ostream &os, const Config &config);
138
std::ostream &operator<<(std::ostream &os, const Config::
LpSolver
&lp_solver);
139
std::ostream &operator<<(std::ostream &os, const Config::
Format
&format);
140
std::ostream &operator<<(std::ostream &os, const Config::
LpMode
&mode);
141
142
}
// namespace delpi
143
144
#ifdef DELPI_INCLUDE_FMT
145
146
#include "delpi/util/logging.h"
147
148
OSTREAM_FORMATTER(delpi::Config);
149
OSTREAM_FORMATTER(
delpi::Config::LpSolver
);
150
OSTREAM_FORMATTER(
delpi::Config::Format
);
151
OSTREAM_FORMATTER(
delpi::Config::LpMode
);
152
153
#endif
delpi::Config
Simple dataclass used to store the configuration of the program.
Definition
Config.h:36
delpi::Config::LpSolver
LpSolver
Underlying LP solver used by the theory solver.
Definition
Config.h:39
delpi::Config::LpSolver::DELPI
@ DELPI
Delpi Solver.
Definition
Config.h:42
delpi::Config::LpSolver::QSOPTEX
@ QSOPTEX
Qsoptex Solver.
Definition
Config.h:41
delpi::Config::LpSolver::SOPLEX
@ SOPLEX
Soplex Solver. Default option.
Definition
Config.h:40
delpi::Config::LpMode
LpMode
LP mode used by the LP solver.
Definition
Config.h:51
delpi::Config::LpMode::HYBRID
@ HYBRID
Use both modes, if available.
Definition
Config.h:55
delpi::Config::LpMode::PURE_PRECISION_BOOSTING
@ PURE_PRECISION_BOOSTING
Use the precision boosting mode, if available.
Definition
Config.h:53
delpi::Config::LpMode::PURE_ITERATIVE_REFINEMENT
@ PURE_ITERATIVE_REFINEMENT
Use the iterative refinement mode, if available.
Definition
Config.h:54
delpi::Config::Format
Format
Format of the input file.
Definition
Config.h:45
delpi::Config::Format::LP
@ LP
LP format.
Definition
Config.h:48
delpi::Config::Format::AUTO
@ AUTO
Automatically detect the input format based on the file extension. Default option.
Definition
Config.h:46
delpi::Config::Format::MPS
@ MPS
MPS format.
Definition
Config.h:47
delpi
Global namespace for the delpi library.
delpi
util
Config.h
Generated by
1.17.0