dlinear
0.0.1
Delta-complete SMT solver for linear programming
|
The Driver is the base class for all the parsers. More...
#include <Driver.h>
Public Member Functions | |
Driver (Context &context, const std::string &class_name="Driver") | |
construct a new parser driver context | |
bool | ParseStream (std::istream &in, const std::string &sname="stream input") |
Invoke the scanner and parser for a stream. | |
bool | ParseString (const std::string &input, const std::string &sname="string stream") |
Invoke the scanner and parser on an input string. | |
virtual bool | ParseFile (const std::string &filename) |
Invoke the scanner and parser on a file. | |
void | Push (int n) |
Push the current context to the stack. | |
void | Pop (int n) |
Restore a previously pushed context from the stack. | |
void | CheckSat () |
Call context_.CheckSat() and print proper output messages to the standard output. | |
void | GetModel () |
Return a model computed by the solver in response to an invocation of the check-sat. | |
void | GetAssertions () const |
Callback for the command get-assertions . | |
void | GetOption (const std::string &key) const |
Callback for the command get-option . | |
void | GetInfo (const std::string &key) const |
Callback for the command get-info . | |
void | SetInfo (const std::string &key, const std::string &value) |
Callback for the command set-info . | |
void | SetOption (const std::string &key, const std::string &value) |
Callback for the command set-option . | |
void | SetLogic (const Logic logic) |
Callback for the command set-logic . | |
void | Maximize (const Expression &f) |
Maximize the objective function f . | |
void | Minimize (const Expression &f) |
Minimize the objective function f . | |
void | Exit () |
Callback for the command exit . | |
bool | trace_scanning () const |
Check whether the scanner debugger is enabled. | |
bool | trace_parsing () const |
Check whether the trace debugger is enabled. | |
const Context & | context () const |
Get read-only access to the enabled of the Driver. | |
const std::string & | stream_name () const |
Get read-only access to the stream name of the input being parsed. | |
std::string & | m_stream_name () |
Get read-write access to the stream name of the input being parsed. | |
const Stats & | stats () const |
Statistics for the driver. | |
Static Public Member Functions | |
static void | Error (const std::string &m) |
General error handling. | |
Protected Member Functions | |
virtual bool | ParseStreamCore (std::istream &in)=0 |
Parse the stream. | |
Protected Attributes | |
std::string | stream_name_ |
The name of the stream being parsed. | |
Context & | context_ |
The context filled during parsing of the expressions. | |
bool | debug_scanning_ {false} |
Enable debug output in the flex scanner. | |
bool | debug_parsing_ {false} |
Enable debug output in the bison parser. | |
Stats | stats_ |
Statistics for the driver. | |
Timer * | timer_ |
Pointer to the timer for the driver. Used to Pause the timer when checking sat. | |
The Driver is the base class for all the parsers.
It contains the common logic to allow the parsed data to be saved in the context. It coordinates the communication between the parser (bison) and the scanner (flex).
|
inlinenodiscard |
|
inline |
void dlinear::Driver::GetAssertions | ( | ) | const |
Callback for the command get-assertions
.
Print all the assertions currently in the context. If the mode is set to silent, it does not print anything.
Definition at line 76 of file Driver.cpp.
void dlinear::Driver::GetInfo | ( | const std::string & | key | ) | const |
Callback for the command get-info
.
Print information about the solver or the current context.
key | key of the information to print |
Definition at line 93 of file Driver.cpp.
void dlinear::Driver::GetOption | ( | const std::string & | key | ) | const |
Callback for the command get-option
.
Print the value of and option or an empty string if the option is not set.
key | key of the option |
Definition at line 88 of file Driver.cpp.
|
inline |
void dlinear::Driver::Maximize | ( | const Expression & | f | ) |
Maximize the objective function f
.
The objective function is added to the context as a constraint.
f | expression to maximize} |
Definition at line 98 of file Driver.cpp.
void dlinear::Driver::Minimize | ( | const Expression & | f | ) |
Minimize the objective function f
.
The objective function is added to the context as a constraint.
f | expression to minimize |
Definition at line 106 of file Driver.cpp.
|
virtual |
Invoke the scanner and parser on a file.
Use parse_stream with a std::ifstream if detection of file reading errors is required.
filename | input file name |
Reimplemented in dlinear::onnx::OnnxDriver.
Definition at line 54 of file Driver.cpp.
bool dlinear::Driver::ParseStream | ( | std::istream & | in, |
const std::string & | sname = "stream input" ) |
Invoke the scanner and parser for a stream.
in | input stream |
sname | stream name for error messages |
Definition at line 30 of file Driver.cpp.
|
protectedpure virtual |
Parse the stream.
in | input stream |
Implemented in dlinear::mps::MpsDriver, dlinear::onnx::OnnxDriver, dlinear::smt2::Smt2Driver, and dlinear::vnnlib::VnnlibDriver.
bool dlinear::Driver::ParseString | ( | const std::string & | input, |
const std::string & | sname = "string stream" ) |
Invoke the scanner and parser on an input string.
input | input string |
sname | stream name for error messages |
Definition at line 49 of file Driver.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |