dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
dlinear Namespace Reference

Global namespace for the dlinear library. More...

Namespaces

namespace  mps
 Namespace for the MPS parser of the dlinear library.
 
namespace  onnx
 Namespace for the ONNX parser of the dlinear library.
 
namespace  qsopt_ex
 
namespace  smt2
 Namespace for the SMT2 parser of the dlinear library.
 
namespace  vnnlib
 Namespace for the VNNLIB parser of the dlinear library.
 

Classes

class  ArgParser
 Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution. More...
 
class  BitIncrementIterator
 BitIncrementIterator class. More...
 
struct  Bound
 Tuple containing the value, bound type and theory literal associated with the bound. More...
 
class  BoundImplicator
 Use theory reasoning to add relations between literals using some simple theory inferences. More...
 
class  BoundIterator
 BoundIterator class. More...
 
class  BoundPreprocessor
 This class uses some basic algebraic operations to preprocess the constraints and identify violations before invoking the solver. More...
 
class  BoundVector
 Data structure to store the LP solver bounds in a sorted vector to determine the active lower and upper bound for the column. More...
 
class  Box
 Collection of variables with associated intervals. More...
 
class  CadicalSatSolver
 SAT solver based on CaDiCal. More...
 
class  CompleteSoplexTheorySolver
 Complete solver using SoPlex. More...
 
class  Config
 Simple dataclass used to store the configuration of the program. More...
 
class  Context
 Context class that holds the set of constraints and provide Assert/Push/Pop/CheckSat functionalities. More...
 
class  DeltaQsoptexTheorySolver
 Delta complete solver using QSopt_ex. More...
 
class  DeltaSoplexTheorySolver
 Delta complete solver using SoPlex. More...
 
class  Driver
 The Driver is the base class for all the parsers. More...
 
struct  EdgeEqual_
 
struct  EdgeHash_
 
class  ExpressionEvaluator
 Evaluate an expression with a given box. More...
 
class  FormulaVisitor
 This base class provides all the methods expected to visit the underlying formula and return a modified version. More...
 
class  GenericExpressionVisitor
 Generic expression visitor implementing the visitor pattern. More...
 
class  GenericFormulaVisitor
 Generic formula visitor implementing the visitor pattern. More...
 
class  Graph
 Graph class. More...
 
class  IfThenElseEliminator
 IfThenElseEliminator class. More...
 
class  Infinity
 Global class storing the infinity values for the different LP solvers. More...
 
class  Interval
 
class  IterationStats
 Dataclass collecting statistics about some operation or process. More...
 
class  LeakyReluConstraint
 
class  LinearFormulaFlattener
 Used by the PredicateAbstractor to ensure that all the theory literals are in the flattened standard form. More...
 
struct  Literal
 A literal is a variable with an associated truth value, indicating whether it is true or false. More...
 
class  NaiveCnfizer
 Transforms a symbolic formula f into a CNF formula by preserving its semantics. More...
 
class  Nnfizer
 Implementation of NNF (Negation Normal Form) conversion. More...
 
class  NNSoplexTheorySolver
 Specialised theory solver for neural networks using SoPlex. More...
 
struct  NumericDataContainer
 NumericDataContainer class. More...
 
class  OptionValue
 Represents an optional value in dLinear. More...
 
class  PicosatSatSolver
 PicoSAT is a SAT solver written in C. More...
 
class  PiecewiseLinearConstraint
 A piecewise linear constraint is a constraint that assumes different linear functions depending on the truth assignment of a literal. More...
 
class  PlaistedGreenbaumCnfizer
 Plaisted-Greenbaum transformation is a method to convert a formula into an equi-satisfiable vector of formulae in CNF. More...
 
class  PredicateAbstractor
 Predicate abstraction is a method to convert a first-order logic formula into a Boolean formula. More...
 
class  PrefixPrinter
 Print expressions and formulas in prefix-form. More...
 
class  QsoptexTheorySolver
 QSopt_ex is an exact LP solver written in C. More...
 
class  ReluConstraint
 A ReLU constraint is a kind of piecewise linear constraint. More...
 
class  RoundingModeGuard
 
class  SatSolver
 Base class for SAT solvers. More...
 
class  ScopedUnorderedMap
 
class  ScopedUnorderedSet
 
class  ScopedVector
 
class  SmtSolver
 This class provides an easy interface for using the underling solver. More...
 
struct  SmtSolverOutput
 Data struct containing the output of the solver, such as the result of the computation as well as some statistics. More...
 
class  SoplexTheorySolver
 SoPlex is an exact LP solver written in C++. More...
 
class  SortedVector
 Vector that maintains its elements sorted. More...
 
class  Stats
 Dataclass collecting statistics about some operation or process. More...
 
class  TheorySolver
 Base class for theory solvers. More...
 
class  Timer
 Timer class using the a steady clock. More...
 
class  TimerBase
 Simple timer class to evaluate the performance of the software. More...
 
class  TimerGuard
 The TimeGuard wraps a timer object and pauses it when the guard object is destructed. More...
 
class  TseitinCnfizer
 Tsietin transformation is a method to convert a formula into an equi-satisfiable vector of formulae in CNF. More...
 
struct  user_clock
 
class  UserTimer
 Timer class using the user_clock. More...
 

Concepts

concept  IsAnyOf
 Check if the type T is any of the types U.
 
concept  IsNotAnyOf
 Check if the type T is not any of the types U.
 
concept  Arithmetic
 Check if the type T supports the arithmetic operations +, -, *, /.
 
concept  Numeric
 Check if the type T supports the arithmetic operations +, -, *, / and the comparison operators <, >, <=, >=.
 

Typedefs

using LiteralSet = std::set<Literal>
 A set of literals.
 
using Model = std::pair<std::vector<Literal>, std::vector<Literal>>
 A model is a pair of two vectors of literals.
 

Enumerations

enum class  Logic {
  QF_NRA , QF_NRA_ODE , QF_LRA , QF_RDL ,
  QF_LIA , LRA
}
 The SMT-LIB logic the SMT2 file is using. More...
 
enum class  LpColBound {
  L = 0 , SL = 1 , B = 2 , SU = 3 ,
  U = 4 , D = 5 , F = 6
}
 Describe the bound of a linear program variable. More...
 
enum class  LpResult {
  LP_NO_RESULT , LP_UNSOLVED , LP_INFEASIBLE , LP_UNBOUNDED ,
  LP_OPTIMAL , LP_DELTA_OPTIMAL
}
 Result of running the LP solver over the input problem. More...
 
enum class  LpRowSense {
  LT = 0 , EQ = 1 , LE = 2 , GE ,
  GT , NQ , IN
}
 Sense of a linear programming row describing a constraint. More...
 
enum class  PiecewiseConstraintState { NOT_FIXED , INACTIVE , ACTIVE }
 State a piecewise constraint can be in. More...
 
enum class  SatResult {
  SAT_NO_RESULT , SAT_UNSOLVED , SAT_UNSATISFIABLE , SAT_SATISFIABLE ,
  SAT_DELTA_SATISFIABLE
}
 Result of running the theory solver over the literals decided by the SAT solver. More...
 
enum class  SmtResult {
  UNSOLVED , SKIP_SAT , SAT , DELTA_SAT ,
  OPTIMAL , DELTA_OPTIMAL , UNBOUNDED , INFEASIBLE ,
  UNSAT , UNKNOWN , ERROR
}
 SmtSolver Result based on the result of the solver. More...
 
enum class  RelationalOperator {
  EQ , NEQ , GT , GEQ ,
  LT , LEQ
}
 Relational operators are used in formulas. More...
 
enum class  VisitResult { CONTINUE , SKIP , STOP }
 Result returned by the visit function. More...
 

Functions

Logic parseLogic (const std::string &s)
 Parse the logic from a string.
 
char toChar (LpColBound bound)
 Convert the bound to a character.
 
LpColBound operator! (LpColBound bound)
 Invert the bound with delta == 0.
 
LpColBound operator- (LpColBound bound)
 Invert the bound with delta > 0.
 
LpColBound operator~ (LpColBound bound)
 Relax the bound.
 
LpColBound parseLpBound (char bound)
 Parse the bound from a character.
 
LpColBound relax (LpColBound bound)
 Relax the bound.
 
LpColBound invert (LpColBound bound, bool delta)
 Invert the bound.
 
LpResult parseLpResult (int res)
 Parse the result from the returned integer.
 
LpRowSense parseLpSense (const Formula &f)
 Parse the sense from a formula.
 
LpRowSense parseLpSense (char sense)
 Parse the sense from a character.
 
char toChar (LpRowSense sense)
 Convert the sense to a character.
 
LpRowSense operator! (LpRowSense sense)
 Invert the sense with delta == 0.
 
LpRowSense operator- (LpRowSense sense)
 Invert the sense with delta > 0.
 
LpRowSense operator~ (LpRowSense sense)
 Relax the sense, assuming delta > 0.e.
 
std::string ToPrefix (const Expression &e)
 Produce the prefix-string representation of the expression e.
 
std::string ToPrefix (const Formula &f)
 Produce the prefix-string representation of the formula f.
 
FormulaKind operator- (FormulaKind kind)
 Change the kind of the formula by multiplying all the expressions by a negative number.
 
Formula imply (const Formula &f1, const Formula &f2)
 Return a formula f1f2.
 
Formula imply (const Variable &v, const Formula &f)
 Return a formula vf.
 
Formula imply (const Formula &f, const Variable &v)
 Return a formula fv.
 
Formula imply (const Variable &v1, const Variable &v2)
 Return a formula v1v2.
 
Formula iff (const Formula &f1, const Formula &f2)
 Return a formula f1f2.
 
Formula iff (const Variable &v, const Formula &f)
 Return a formula vf.
 
Formula iff (const Formula &f, const Variable &v)
 Return a formula fv.
 
Formula iff (const Variable &v1, const Variable &v2)
 Return a formula v1v2.
 
std::set< Formulamap (const std::set< Formula > &formulas, const std::function< Formula(const Formula &)> &func)
 Given formulas = {f₁, ..., fₙ} and a func : Formula → Formula, map(formulas, func) returns a set {func(f₁), ... func(fₙ)}.
 
bool is_atomic (const Formula &f)
 Check if f is atomic.
 
bool is_clause (const Formula &f)
 Check if f is a clause.
 
std::set< Formulaget_clauses (const Formula &f)
 Returns the set of clauses in f.
 
bool is_cnf (const Formula &f)
 Check if f is in CNF form.
 
bool HaveIntersection (const Variables &variables1, const Variables &variables2)
 Check if the intersection of variables1 and variables2 is non-empty.
 
Formula DeltaStrengthen (const Formula &f, const double delta)
 Strengthen the input formula $p f by delta.
 
Formula DeltaWeaken (const Formula &f, const double delta)
 Weaken the input formula $p f by delta.
 
bool IsDifferentiable (const Formula &f)
 Check if the formula f is symbolic-differentiable.
 
bool IsDifferentiable (const Expression &e)
 Check if the expression f is symbolic-differentiable.
 
Formula make_conjunction (const std::vector< Formula > &formulas)
 Make conjunction of formulas.
 
Formula make_disjunction (const std::vector< Formula > &formulas)
 Make disjunction of formulas.
 
std::vector< VariableCreateVector (const std::string &prefix, int size, Variable::Type type=Variable::Type::CONTINUOUS)
 Creates a vector of variables of type whose size is size.
 
RelationalOperator operator! (RelationalOperator op)
 Negates op.
 
std::string GetExtension (const std::string &name)
 Get the extension of the file.
 
std::vector< std::string > SplitStringByWhitespace (const char *in)
 Split a C-string by whitespace.
 
std::vector< std::string > GetFiles (const std::string &path, const std::string &extension="")
 Get the files in a directory.
 
bool IsInteger (double v)
 Returns true if v is represented by int.
 
bool IsInteger (const mpq_class &v)
 Check if v is represented by int.
 
int ConvertInt64ToInt (std::int64_t v)
 Convert v of int64_t to int.
 
double ConvertInt64ToDouble (std::int64_t v)
 Convert v of int64_t to double.
 
mpq_class ConvertInt64ToRational (std::int64_t v)
 Convert v of int64_t to rational.
 

Detailed Description

Global namespace for the dlinear library.

BoundIterator class.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License File containing the main header for the dlinear library.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Onnx wrapper.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Driver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Bound class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License BoundImplicator class.

This class is used to propagate some simple theory inferences in the SAT solver. E.g.

\[ x \le 10 \implies x < 4 \newline x < 2 \implies \neg (x = 8) \]

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License

It is used to iterate over the bounds of a theory solver without copying each dlinear::BoundVector::Bound. Usually the results of bound violation.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License BoundPreprocessor class.

This class uses some basic algebraic operations to preprocess the constraints and identify violations before invoking the solver. Namely, the bounds are propagated through the constraints.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License BoundVector class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License CadicalSatSolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Complete version of SoplexTheorySolver.

The LP solver used is Soplex. This solver is complete. It means that it will always solve the linear problem exactly.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Context class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Context::Impl class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License DeltaQsoptexTheorySolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License DeltaSoplexTheorySolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License LeakyReluConstraint class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Logic enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License LpColBound enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License LpResult enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License LpRowSense enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Theory solver using SoPlex.

Neural network theory solver using SoPlex.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PicosatSatSolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PiecewiseConstraintState enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PiecewiseLinearConstraint class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License QsoptexTheorySolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License ReluConstraint class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SatResult enum.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SatSolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SmtSolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SmtSolverOutput struct.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SoplexTheorySolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License TheorySolver class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Environment class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Expression evaluator class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Base class for visitors of symbolic formulas.

The class provides all the methods expected to visit the underlying formula and return a modified version. By default, the visitor returns the original formula, but it can be overridden by the derived classes.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License GenericExpressionVisitor class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License IfThenElseEliminator class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License LinearFormulaFlattener class

Used by the dlinear::PredicateAbstractor to ensure that all the theory literals are in the flattened standard form.

See also
LinearFormulaFlattener::Flatten
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Collection of data structures and functions for working with literals.

Literals are a pair formed by a boolean variable and a truth value indicating whether the variable is negated or not.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License NaiveCnfizer class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Nnfizer class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PlaistedGreenbaumCnfizer class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PredicateAbstractor class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License PrefixPrinter class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License This is the header file that we consolidate Drake's symbolic classes and expose them inside of dlinear namespace.

Other files in dlinear should include this file and should NOT include files in drake/common directory. Similarly, BUILD files should only have a dependency "//dlinear/symbolic:symbolic", not "@drake_symbolic//:symbolic".

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License TseininCnfizer class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License ArgParser class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License BitIncrementIterator class.

It implements an abstraction used to iterate over all the possible bit vectors of a given size.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Box class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Collection of concepts used in the dlinear library.

Concepts have been introduced in the c++20 standard and are used in the dlinear library in order to make the code more readable and to provide better error messages in templated code.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Config class. Used to store the configuration of the program.

Simple dataclass used to store the configuration of the program. It is generated from dlinear::ArgParser.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Utilities for filesystem operations.

Simple utilities that make operations on the filesystem easier.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Graph class.

Generic graph implementation that can be used to represent a graph with vertices of type T.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Infinity class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Interval class.

An interval assigned to a variable describes the range of values it can assume.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Logging macros. Allows logging with different verbosity levels using spdlog.

The verbosity level is set with the -V flag. The verbosity level is an integer between 0 and 5 and it increases with each -V flag. It can be reduced with the -q flag. It starts at 2 (warning).

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Math utilities.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License NumericDataContainer class.

Simple class that holds a numeric value and a data value. It is used to take advantage of the strong ordering and equality operators of the numeric value, as well as the arithmetic operators, while still being able to store additional data.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License OptionValue class.

It is used to wrap a value that can be set from multiple sources. The value is overwritten only if it is not set from a higher priority source. The priority is defined as follows, where the higher the number, the higher the priority:

  1. Default value
  2. Value set by a command-line argument
  3. Value provided from a file
  4. Value set by a code
    See also
    Type
    Author
    Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
    Licence:
    BSD 3-Clause License RoundingModeGuard class.
    Author
    Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
    Licence:
    BSD 3-Clause License Backtrackable scoped unordered_map.
    This is a unordered_map that supports backtracking. It is used to store intermediate results.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Backtrackable unordered set.

This is a unordered_set that supports backtracking. It is used to store intermediate results.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Backtrackable scoped vector.

This is a vector that supports backtracking. It is used to store intermediate results.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License SortedVector class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Stats class.
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Licence:
BSD 3-Clause License Timer class.

Enumeration Type Documentation

◆ Logic

enum class dlinear::Logic
strong

The SMT-LIB logic the SMT2 file is using.

Enumerator
QF_NRA 

Quantifier free non-linear real arithmetic.

QF_NRA_ODE 

Quantifier free non-linear real arithmetic with ODEs.

QF_LRA 

Quantifier free linear real arithmetic. It is the only one dlinear supports.

QF_RDL 

Quantifier free real difference logic.

QF_LIA 

Quantifier free linear integer arithmetic.

LRA 

Linear real arithmetic.

Definition at line 17 of file Logic.h.

◆ LpColBound

enum class dlinear::LpColBound
strong

Describe the bound of a linear program variable.

If the bound is strict, it means that the variable cannot assume the bound value. When using delta complete solvers, strict bounds can be relaxed to non-strict bounds.

Warning
The order of the enum is important and should not be changed. It is used to compare the bounds.
Enumerator

Lower bound.

SL 

Strict lower bound.

Both upper and lower bound are equal (fixed)

SU 

Strict upper bound.

Upper bound.

Variable must be different from the bound.

Free variable.

Definition at line 21 of file LpColBound.h.

◆ LpResult

enum class dlinear::LpResult
strong

Result of running the LP solver over the input problem.

Enumerator
LP_NO_RESULT 

No result has been obtained yet.

LP_UNSOLVED 

The problem has not been solved. An error may have occurred.

LP_INFEASIBLE 

The problem is infeasible.

LP_UNBOUNDED 

The problem is unbounded.

LP_OPTIMAL 

The problem has been solved optimally.

LP_DELTA_OPTIMAL 

The problem has been solved optimally, but with a delta.

Definition at line 14 of file LpResult.h.

◆ LpRowSense

enum class dlinear::LpRowSense
strong

Sense of a linear programming row describing a constraint.

If the sense is strict, it means that the variable cannot assume the right-hand-side value. When using delta complete solvers, strict senses can be relaxed to non-strict senses.

Warning
The order of the enum is important and should not be changed. It is used to compare the senses.
Enumerator
LT 

Less than.

EQ 

Equal to.

LE 

Less than or equal to.

GE 

Greater than or equal to.

GT 

Greater than.

NQ 

Not equal to.

IN 

Inactive.

Definition at line 23 of file LpRowSense.h.

◆ PiecewiseConstraintState

State a piecewise constraint can be in.

Enumerator
NOT_FIXED 

The constraint is not fixed yet.

INACTIVE 

The constraint is inactive.

ACTIVE 

The constraint is active.

Definition at line 14 of file PiecewiseConstraintState.h.

◆ RelationalOperator

enum class dlinear::RelationalOperator
strong

Relational operators are used in formulas.

Enumerator
EQ 

=

NEQ 

!=

GT 

GEQ 

>=

LT 

<

LEQ 

<=

Definition at line 191 of file symbolic.h.

◆ SatResult

enum class dlinear::SatResult
strong

Result of running the theory solver over the literals decided by the SAT solver.

It describes the result the solver was able to produce on the input problem for the current iteration.

Enumerator
SAT_NO_RESULT 

No result has been obtained yet.

SAT_UNSOLVED 

The problem has not been solved. An error may have occurred.

SAT_UNSATISFIABLE 

The problem is unsatisfiable.

SAT_SATISFIABLE 

The problem is satisfiable.

SAT_DELTA_SATISFIABLE 

The problem is satisfiable, but with a delta >= 0.

Definition at line 17 of file SatResult.h.

◆ SmtResult

enum class dlinear::SmtResult
strong

SmtSolver Result based on the result of the solver.

Enumerator
UNSOLVED 

The solver has not yet been run.

SKIP_SAT 

The user asked to skip the satisfiability check.

SAT 

The problem is satisfiable.

DELTA_SAT 

The problem is delta-satisfiable.

OPTIMAL 

The optimization problem is optimal.

DELTA_OPTIMAL 

The optimization problem is delta-optimal.

UNBOUNDED 

The problem is unbounded.

INFEASIBLE 

The problem is infeasible.

UNSAT 

The problem is unsatisfiable.

UNKNOWN 

Could not determine satisfiability.

ERROR 

An error occurred.

Definition at line 24 of file SmtSolverOutput.h.

◆ VisitResult

enum class dlinear::VisitResult
strong

Result returned by the visit function.

Depending on the result, the search algorithm will continue, skip adding the adjacent vertices to the stack/queue, or stop the search altogether.

See also
Graph<T, W>::DFS
Graph<T, W>::BFS
Enumerator
CONTINUE 

Continue the search as usual and add the adjacent vertices to the stack/queue.

SKIP 

Skip adding the adjacent vertices to the stack/queue, but continue the search.

STOP 

Stop the search altogether.

Definition at line 31 of file Graph.hpp.

Function Documentation

◆ ConvertInt64ToDouble()

double dlinear::ConvertInt64ToDouble ( std::int64_t v)

Convert v of int64_t to double.

Exceptions
std::runtime_errorif this conversion result in a loss of precision.
Parameters
vvalue to convert
Returns
converted value

Definition at line 39 of file math.cpp.

◆ ConvertInt64ToInt()

int dlinear::ConvertInt64ToInt ( std::int64_t v)

Convert v of int64_t to int.

Exceptions
std::runtime_errorif this conversion result in a loss of precision.
Parameters
vvalue to convert
Returns
converted value

Definition at line 34 of file math.cpp.

◆ ConvertInt64ToRational()

mpq_class dlinear::ConvertInt64ToRational ( std::int64_t v)

Convert v of int64_t to rational.

Parameters
vvalue to convert
Returns
converted value

Definition at line 45 of file math.cpp.

◆ CreateVector()

std::vector< Variable > dlinear::CreateVector ( const std::string & prefix,
int size,
Variable::Type type = Variable::Type::CONTINUOUS )

Creates a vector of variables of type whose size is size.

The variables are numbered with prefix. For example

CreateVector("x", 5) // returns [x0, x1, x2, x3, x4]
std::vector< Variable > CreateVector(const std::string &prefix, const int size, const Variable::Type type)
Creates a vector of variables of type whose size is size.
Definition symbolic.cpp:501
Parameters
prefixprefix of variable names. Must not be empty.
sizesize of vector. Must be >= 1.
typetype of variables
Returns
vector of variables

Definition at line 501 of file symbolic.cpp.

◆ DeltaStrengthen()

Formula dlinear::DeltaStrengthen ( const Formula & f,
double delta )

Strengthen the input formula $p f by delta.

Strengthen the input formula f by delta.

Parameters
fformula to strengthen
deltaamount to strengthen by
Returns
strengthened formula

Definition at line 470 of file symbolic.cpp.

◆ DeltaWeaken()

Formula dlinear::DeltaWeaken ( const Formula & f,
double delta )

Weaken the input formula $p f by delta.

Weaken the input formula f by delta.

Parameters
fformula to weaken
deltaamount to weaken by
Returns
weakened formula

Definition at line 476 of file symbolic.cpp.

◆ get_clauses()

std::set< Formula > dlinear::get_clauses ( const Formula & f)

Returns the set of clauses in f.

F is assumed to be in CNF. That is, f is either a single clause or a conjunction of clauses.

Parameters
fformula to get clauses from
Returns
set of clauses in f

Definition at line 98 of file symbolic.cpp.

◆ GetExtension()

std::string dlinear::GetExtension ( const std::string & name)

Get the extension of the file.

Extracts the extension from name, meaning the part of the file name after the last dot.

Note
It returns an empty string if there is no extension in name.
Parameters
nameThe name of the file.
Returns
The extension of the file.

Definition at line 16 of file filesystem.cpp.

◆ GetFiles()

std::vector< std::string > dlinear::GetFiles ( const std::string & path,
const std::string & extension = "" )

Get the files in a directory.

Parameters
pathThe path to the directory.
Returns
A vector of strings, each string being the path to each file in the directory.

Definition at line 35 of file filesystem.cpp.

◆ HaveIntersection()

bool dlinear::HaveIntersection ( const Variables & variables1,
const Variables & variables2 )

Check if the intersection of variables1 and variables2 is non-empty.

Parameters
variables1set of variables
variables2set of variables
Returns
true if variables1 and variables2 is an non-empty intersection.

Definition at line 126 of file symbolic.cpp.

◆ invert()

LpColBound dlinear::invert ( LpColBound bound,
bool delta )
inline

Invert the bound.

Depending on whether the value of delta is > 0 or not, there are two possible conversion:

  • If delta > 0: !U == SL, !SU == L, !B == D, !D == B, !IN == IN, !L == SU, !SL == U
  • If delta == 0: -U == L, -L == U, -B == F, -F == B Any other bound generates an assertion error
    Note
    this function combines both ! and - operators
    Parameters
    boundbound to invert
    deltawhether delta is greater than 0
    Returns
    inverted bound

Definition at line 92 of file LpColBound.h.

◆ is_atomic()

bool dlinear::is_atomic ( const Formula & f)

Check if f is atomic.

Parameters
fformula to check
Returns
whether f is atomic

Definition at line 53 of file symbolic.cpp.

◆ is_clause()

bool dlinear::is_clause ( const Formula & f)

Check if f is a clause.

A clause is a disjunction of literals.

Parameters
fformula to check
Returns
whether f is a clause

Definition at line 78 of file symbolic.cpp.

◆ is_cnf()

bool dlinear::is_cnf ( const Formula & f)

Check if f is in CNF form.

Parameters
fformula to check
Returns
whether f is in CNF form

Definition at line 110 of file symbolic.cpp.

◆ IsDifferentiable() [1/2]

bool dlinear::IsDifferentiable ( const Expression & e)

Check if the expression f is symbolic-differentiable.

Parameters
eexpression to check
Returns
true if e is symbolic-differentiable

Definition at line 483 of file symbolic.cpp.

◆ IsDifferentiable() [2/2]

bool dlinear::IsDifferentiable ( const Formula & f)

Check if the formula f is symbolic-differentiable.

Parameters
fformula to check
Returns
true if f is symbolic-differentiable

Definition at line 481 of file symbolic.cpp.

◆ IsInteger() [1/2]

bool dlinear::IsInteger ( const mpq_class & v)

Check if v is represented by int.

Parameters
vvalue to check
Returns
whether v is represented by int

Definition at line 25 of file math.cpp.

◆ IsInteger() [2/2]

bool dlinear::IsInteger ( double v)

Returns true if v is represented by int.

Check if v is represented by int.

Parameters
vvalue to check
Returns
whether v is represented by int

Definition at line 16 of file math.cpp.

◆ make_conjunction()

Formula dlinear::make_conjunction ( const std::vector< Formula > & formulas)

Make conjunction of formulas.

Note
This is different from the one in Drake's symbolic library. It takes std::vector<Formula> while Drake's version takes std::set<Formula>.
Parameters
formulasinput formulas
Returns
conjunction of formulas

Definition at line 485 of file symbolic.cpp.

◆ make_disjunction()

Formula dlinear::make_disjunction ( const std::vector< Formula > & formulas)

Make disjunction of formulas.

Note
This is different from the one in Drake's symbolic library. It takes std::vector<Formula> while Drake's version takes std::set<Formula>.
Parameters
formulasinput formulas
Returns
disjunction of formulas

Definition at line 493 of file symbolic.cpp.

◆ map()

std::set< Formula > dlinear::map ( const std::set< Formula > & formulas,
const std::function< Formula(const Formula &)> & func )

Given formulas = {f₁, ..., fₙ} and a func : Formula → Formula, map(formulas, func) returns a set {func(f₁), ... func(fₙ)}.

Parameters
formulasset of formulas
funcfunction to apply to each formula
Returns
set of formulas obtained by applying func to each formula in

Definition at line 47 of file symbolic.cpp.

◆ operator!() [1/3]

LpColBound dlinear::operator! ( LpColBound bound)

Invert the bound with delta == 0.

More specifically, !U == SL, !SU == L, !B == D, !D == B, !IN == IN, !L == SU, !SL == U.

Warning
This is not the same as operator-()
Parameters
boundbound to invert
Returns
inverted bound

Definition at line 54 of file LpColBound.cpp.

◆ operator!() [2/3]

LpRowSense dlinear::operator! ( LpRowSense sense)

Invert the sense with delta == 0.

More specifically, !LE == GT, !GE == LT, !EQ == NQ, !NQ == EQ, !IN == IN, !GT == LE, !LT == GE.

Warning
This is not the same as operator-()
Parameters
sensesense to invert
Returns
inverted sense
See also
operator-(LpRowSense)

Definition at line 68 of file LpRowSense.cpp.

◆ operator!() [3/3]

RelationalOperator dlinear::operator! ( RelationalOperator op)

Negates op.

Parameters
opoperator to negate
Returns
negated operator

Definition at line 512 of file symbolic.cpp.

◆ operator-() [1/3]

FormulaKind dlinear::operator- ( FormulaKind kind)

Change the kind of the formula by multiplying all the expressions by a negative number.

In practice this inverts the inequality from \( < \) to \( > \) and \( \leq \) to \( \geq \) and vice versa.

Parameters
kindkind of the formula
Returns
the negated kind

Definition at line 19 of file symbolic.cpp.

◆ operator-() [2/3]

LpColBound dlinear::operator- ( LpColBound bound)

Invert the bound with delta > 0.

More specifically, -U == L, -L == U, -B == F, -F == B. Any other bound generates an assertion error

Warning
This is not the same as operator!()
Parameters
boundbound to invert
Returns
inverted bound

Definition at line 73 of file LpColBound.cpp.

◆ operator-() [3/3]

LpRowSense dlinear::operator- ( LpRowSense sense)

Invert the sense with delta > 0.

More specifically, -LE == GT, -GE == LE, -EQ == NQ, -NQ == EQ. Any other sense generates an assertion error

Warning
This is not the same as operator!()
Parameters
sensesense to invert
Returns
inverted sense
See also
operator!(LpRowSense)

Definition at line 89 of file LpRowSense.cpp.

◆ operator~() [1/2]

LpColBound dlinear::operator~ ( LpColBound bound)

Relax the bound.

More specifically, ~SL == L, ~SU == U, ~D == F. Any other bound remain unchanged.

Parameters
boundbound to relax
Returns
relaxed bound

Definition at line 88 of file LpColBound.cpp.

◆ operator~() [2/2]

LpRowSense dlinear::operator~ ( LpRowSense sense)

Relax the sense, assuming delta > 0.e.

More specifically, LT -> LE, GT -> GE. The other senses remain unchanged.

Parameters
sensesense to relax
Returns
relaxed sense

Definition at line 104 of file LpRowSense.cpp.

◆ parseLogic()

Logic dlinear::parseLogic ( const std::string & s)

Parse the logic from a string.

Parameters
sstring to parse
Returns
corresponding logic

Definition at line 12 of file Logic.cpp.

◆ parseLpBound()

LpColBound dlinear::parseLpBound ( char bound)

Parse the bound from a character.

Parameters
boundcharacter to parse
Returns
corresponding bound

◆ parseLpResult()

LpResult dlinear::parseLpResult ( int res)

Parse the result from the returned integer.

Parameters
resreturn code
Returns
corresponding result

◆ parseLpSense() [1/2]

LpRowSense dlinear::parseLpSense ( char sense)

Parse the sense from a character.

Parameters
sensecharacter to parse
Returns
corresponding sense

Definition at line 23 of file LpRowSense.cpp.

◆ parseLpSense() [2/2]

LpRowSense dlinear::parseLpSense ( const Formula & f)

Parse the sense from a formula.

Precondition
f is a relational formula
Parameters
fformula to parse
Returns
corresponding sense

Definition at line 12 of file LpRowSense.cpp.

◆ relax()

LpColBound dlinear::relax ( LpColBound bound)
inline

Relax the bound.

More specifically, ~SL == L, ~SU == U, ~D == F. Any other bound remain unchanged.

Parameters
boundbound to relax
Returns
relaxed bound

Definition at line 79 of file LpColBound.h.

◆ SplitStringByWhitespace()

std::vector< std::string > dlinear::SplitStringByWhitespace ( const char * in)

Split a C-string by whitespace.

Each word is returned as a separate string in a vector.

Note
This function is not Unicode-aware.
The words are trimmed.
Parameters
ininput string to split
Returns
vector os strings

Definition at line 22 of file filesystem.cpp.

◆ toChar() [1/2]

char dlinear::toChar ( LpColBound bound)

Convert the bound to a character.

Parameters
boundbound to convert
Returns
corresponding character

Definition at line 33 of file LpColBound.cpp.

◆ toChar() [2/2]

char dlinear::toChar ( LpRowSense sense)

Convert the sense to a character.

Parameters
sensesense to convert
Returns
corresponding character

Definition at line 47 of file LpRowSense.cpp.

◆ ToPrefix() [1/2]

std::string dlinear::ToPrefix ( const Expression & e)

Produce the prefix-string representation of the expression e.

Parameters
eexpression to convert
Returns
prefix-string representation of the expression

Definition at line 242 of file PrefixPrinter.cpp.

◆ ToPrefix() [2/2]

std::string dlinear::ToPrefix ( const Formula & f)

Produce the prefix-string representation of the formula f.

Parameters
fformula to convert
Returns
prefix-string representation of the formula

Definition at line 251 of file PrefixPrinter.cpp.