dlinear
0.0.1
Delta-complete SMT solver for linear programming
|
Delta complete solver using SoPlex. More...
#include <DeltaSoplexTheorySolver.h>
Public Member Functions | |
Explanations | EnableLiteral (const Literal &lit) override |
Activate the literal that had previously been added to the theory solver. | |
void | AddLiteral (const Variable &formula_var, const Formula &formula) override |
Add a Literal to the theory solver. | |
Public Member Functions inherited from dlinear::SoplexTheorySolver | |
void | AddVariable (const Variable &var) override |
Add a variable (column) to the theory solver. | |
void | AddLiterals () override |
Add a vector of literals to the theory solver. | |
void | Consolidate (const Box &box) override |
Consolidate the solver. | |
void | Reset () override |
Reset the linear problem. | |
Public Member Functions inherited from dlinear::TheorySolver | |
TheorySolver (const PredicateAbstractor &predicate_abstractor, const std::string &class_name="TheorySolver") | |
Construct a new Theory Solver object. | |
virtual Explanations | PreprocessFixedLiterals (const LiteralSet &fixed_literals) |
Add the fixed literals to the theory solver. | |
Explanations | EnableLiterals (std::span< const Literal > theory_literals) |
Activate the literals that have previously been added to the theory solver. | |
const Box & | model () const |
Get read-only access to the model that satisfies all the constraints of the TheorySolver. | |
const Config & | config () const |
Get read-only access to the configuration of the TheorySolver. | |
const PredicateAbstractor & | predicate_abstractor () const |
Get read-only access to the predicate abstractor of the TheorySolver. | |
const std::map< Variable::Id, int > & | var_to_theory_col () const |
Get read-only access to the map of variables to the theory columns of the TheorySolver. | |
const std::vector< Variable > & | theory_col_to_var () const |
Get read-only access to the map of theory columns to the variables of the TheorySolver. | |
const std::map< Variable::Id, int > & | lit_to_theory_row () const |
Get read-only access to the map of literals to the theory rows of the TheorySolver. | |
const std::vector< Literal > & | theory_row_to_lit () const |
Get read-only access to the map of theory rows to the literals of the TheorySolver. | |
const BoundVectorMap & | theory_bounds () const |
Get read-only access to the bounds of each theory variable of the TheorySolver. | |
const BoundVectorMap & | fixed_theory_bounds () const |
Get read-only access to the fixed bounds of each theory variable of the TheorySolver. | |
const BoundPreprocessor & | preprocessor () const |
Get read-only access to the bound preprocessor of the TheorySolver. | |
BoundPreprocessor & | m_preprocessor () |
Get read-write access to the bound preprocessor of the TheorySolver. | |
const BoundPreprocessor & | fixed_preprocessor () const |
Get read-only access to the fixed bound preprocessor of the TheorySolver. | |
BoundPreprocessor & | m_fixed_preprocessor () |
Get read-write access to the fixed bound preprocessor of the TheorySolver. | |
std::size_t | theory_row_count () const |
Get read-only access to the number of rows of the TheorySolver. | |
std::size_t | theory_col_count () const |
Get read-only access to the number of columns of the TheorySolver. | |
std::set< Literal > | enabled_literals () const |
Get read-only access to the vector of enabled literals of the TheorySolver. | |
SatResult | CheckSat (const Box &box, mpq_class *actual_precision, std::set< LiteralSet > &explanations) |
Check the satisfiability of the theory. | |
virtual SatResult | CheckSatCore (mpq_class *actual_precision, std::set< LiteralSet > &explanations)=0 |
Check the satisfiability of the theory. | |
const IterationStats & | stats () const |
Get the statistics of the theory solver. | |
Private Member Functions | |
void | EnableSpxRow (int spx_row, bool truth) override |
Enable the spx_row row for the LP solver. | |
Additional Inherited Members | |
Public Types inherited from dlinear::TheorySolver | |
using | Bound = std::tuple<const Variable &, LpColBound, const mpq_class &> |
Bound on the variable. | |
using | Violation = BoundIterator |
Bound iterator over some violated bounds. | |
using | Explanations = std::set<LiteralSet> |
Set of explanations of the conflict. | |
Protected Types inherited from dlinear::TheorySolver | |
enum class | BoundViolationType { NO_BOUND_VIOLATION , LOWER_BOUND_VIOLATION , UPPER_BOUND_VIOLATION } |
Enum used to describe how the bounds on a variable participate in the infeasibility result of an LP problem. More... | |
Protected Member Functions inherited from dlinear::SoplexTheorySolver | |
void | UpdateModelBounds () override |
Update each variable in the model with the bounds passed to the theory solver. | |
void | UpdateModelSolution () override |
Update the model with the solution obtained from the LP solver. | |
void | UpdateExplanation (LiteralSet &explanation) override |
Use the result from the theory solver to update the explanation with the conflict that has been detected. | |
virtual void | EnableSpxVarBound () |
Set the bounds of the variables in the LP solver. | |
void | EnableSpxRow (int spx_row) |
Enable the spx_row row for the LP solver. | |
void | DisableSpxRows () |
Disable all disabled spx rows from the LP solver. | |
soplex::DSVectorRational | ParseRowCoeff (const Formula &formula) |
Parse a formula and return the vector of coefficients to apply to the decisional variables. | |
void | SetSPXVarCoeff (soplex::DSVectorRational &coeffs, const Variable &var, const mpq_class &value) const |
Set the coefficients to apply to var on a specific row. | |
void | GetSpxInfeasibilityRay (soplex::VectorRational &farkas_ray) |
Get the infeasibility ray of the LP problem. | |
void | GetSpxInfeasibilityRay (soplex::VectorRational &farkas_ray, std::vector< BoundViolationType > &bounds_ray) |
Get the infeasibility rays of the LP problem. | |
std::vector< std::pair< int, soplex::Rational > > | GetActiveRows () |
Get all active rows in the current solution. | |
std::vector< std::pair< int, soplex::Rational > > | GetActiveRows (const std::vector< int > &spx_rows) |
Get active rows in the current solution among the rows in spx_rows . | |
std::optional< soplex::Rational > | IsRowActive (int spx_row) |
Check if the spx_row is active. | |
bool | IsRowActive (int spx_row, const soplex::Rational &value) |
Check if the spx_row is active with value value . | |
Protected Member Functions inherited from dlinear::TheorySolver | |
void | UpdateExplanations (Explanations &explanations) |
Use the result from the theory solver to update the explanations with the conflict that has been detected. | |
Protected Attributes inherited from dlinear::SoplexTheorySolver | |
soplex::SoPlex | spx_ |
SoPlex exact LP solver. | |
soplex::LPColSetRational | spx_cols_ |
Columns of the LP problem. | |
soplex::LPRowSetRational | spx_rows_ |
Rows of the LP problem. | |
std::vector< mpq_class > | spx_rhs_ |
Right-hand side of the rows. | |
std::vector< LpRowSense > | spx_sense_ |
Sense of the rows. | |
Protected Attributes inherited from dlinear::TheorySolver | |
const Config & | config_ |
Configuration of the theory solver. | |
bool | is_consolidated_ |
Whether the solver has been consolidated. | |
const PredicateAbstractor & | predicate_abstractor_ |
Predicate abstractor used to create the theory solver. | |
std::map< Variable::Id, int > | var_to_theory_col_ |
Variable ⇔ theory column. | |
std::vector< Variable > | theory_col_to_var_ |
Theory column ⇔ Variable. | |
std::map< Variable::Id, int > | lit_to_theory_row_ |
Literal ⇔ theory row. | |
std::vector< Literal > | theory_row_to_lit_ |
Theory row ⇔ Literal The row is the constraint used by the theory solver. | |
std::vector< bool > | theory_rows_state_ |
Whether each theory row is enabled or not. | |
BoundPreprocessor | fixed_preprocessor_ |
Preprocessor for the bounds. Only computed on fixed literal theories. | |
BoundPreprocessor | preprocessor_ |
Preprocessor for the bounds. | |
Box | model_ |
Model produced by the theory solver. | |
IterationStats | stats_ |
Statistics of the theory solver. | |
Static Protected Attributes inherited from dlinear::SoplexTheorySolver | |
static mpq_class | infinity_ {soplex::infinity} |
Positive infinity. | |
static mpq_class | ninfinity_ {-soplex::infinity} |
Negative infinity. | |
Delta complete solver using SoPlex.
The LP problem is solver exactly, within a given precision, delta. Since the value of delta is considered strictly positive, strict inequalities will be relaxed and not-equal-to constraints ignored.
Definition at line 31 of file DeltaSoplexTheorySolver.h.
|
overridevirtual |
Add a Literal to the theory solver.
A Literal is formed by a variable that corresponds to a theory formula inside the PredicateAbstractor and the formula itself
formula_var | boolean variable that corresponds to the theory formula |
formula | symbolic formula that represents the theory formula |
Implements dlinear::TheorySolver.
Definition at line 29 of file DeltaSoplexTheorySolver.cpp.
|
overridevirtual |
Activate the literal that had previously been added to the theory solver.
If the literal is a row inside the TheorySolver, then the the corresponding constraint is activated by giving it the proper values.
If the literal is a simple bound on the variable (column), some additional checks are made. Theory solvers struggle to handle problems with inverted bounds. It is convenient to have a method that checks them beforehand. If at least a bound is inverted, the problem is UNSAT, since it is impossible to satisfy the constraint. An explanation is produced and returned to the SAT solver.
lit | literal to activate |
Implements dlinear::TheorySolver.
Definition at line 56 of file DeltaSoplexTheorySolver.cpp.
|
overrideprivatevirtual |
Enable the spx_row
row for the LP solver.
spx_row | index of the row to enable |
truth | truth value of the row |
Implements dlinear::SoplexTheorySolver.
Definition at line 120 of file DeltaSoplexTheorySolver.cpp.