dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
NNSoplexTheorySolver.h
1
9#pragma once
10
11#include <unordered_set>
12
13#include "dlinear/solver/PiecewiseLinearConstraint.h"
14#include "dlinear/solver/SoplexTheorySolver.h"
15#include "dlinear/symbolic/literal.h"
16#include "dlinear/symbolic/symbolic.h"
17
18namespace dlinear {
19
30 public:
32 const std::string &class_name = "NNSoplexTheorySolver");
33
34 void SetPiecewiseLinearConstraints(const std::vector<std::unique_ptr<PiecewiseLinearConstraint>> &relu_constraints);
35
36 void AddLiteral(const Variable &formula_var, const Formula &formula) override;
37 Explanations EnableLiteral(const Literal &lit) override;
38 SatResult CheckSatCore(mpq_class *actual_precision, std::set<LiteralSet> &explanations) override;
39 void Reset() override;
40
41 private:
42 enum class SpxCheckSatResult {
43 SAT,
44 SOI_VIOLATION,
46 };
47
48 struct PlConstraint {
49 const PiecewiseLinearConstraint *constraint;
50 bool active;
51 bool fixed;
52 };
53
54 SpxCheckSatResult SpxCheckSat(mpq_class *actual_precision);
55
56 void EnableSpxRow(int spx_row, bool truth) override;
57
58 void Consolidate(const Box &box) override;
59
60 void UpdateExplanationsWithCurrentPiecewiseLinearLiterals(std::set<LiteralSet> &explanations);
61
63 void SoiToObjFunction();
64
67
68 std::unordered_map<Variable, const PiecewiseLinearConstraint *> pl_theory_lit_;
69 std::vector<PlConstraint> enabled_pl_constraints_;
70 Explanations pl_explanations_;
71 Expression soi_;
72};
73
74} // namespace dlinear
Collection of variables with associated intervals.
Definition Box.h:31
Specialised theory solver for neural networks using SoPlex.
void Reset() override
Reset the linear problem.
void EnableSpxRow(int spx_row, bool truth) override
Enable the spx_row row for the LP solver.
void Consolidate(const Box &box) override
Consolidate the solver.
void SoiToObjFunction()
Convert the soi_ expression to an objective function inside soplex.
void AddLiteral(const Variable &formula_var, const Formula &formula) override
Add a Literal to the theory solver.
Explanations EnableLiteral(const Literal &lit) override
Activate the literal that had previously been added to the theory solver.
bool InvertGreatestViolation()
Invert the greatest violation found in the objective function.
SatResult CheckSatCore(mpq_class *actual_precision, std::set< LiteralSet > &explanations) override
Check the satisfiability of the theory.
A piecewise linear constraint is a constraint that assumes different linear functions depending on th...
Predicate abstraction is a method to convert a first-order logic formula into a Boolean formula.
SoPlex is an exact LP solver written in C++.
const PredicateAbstractor & predicate_abstractor() const
Get read-only access to the predicate abstractor of the TheorySolver.
std::set< LiteralSet > Explanations
Set of explanations of the conflict.
Represents a symbolic form of an expression.
Represents a symbolic form of a first-order logic formula.
Represents a symbolic variable.
Global namespace for the dlinear library.
SatResult
Result of running the theory solver over the literals decided by the SAT solver.
Definition SatResult.h:17
@ SAT
The problem is satisfiable.
@ INFEASIBLE
The problem is infeasible.
A literal is a variable with an associated truth value, indicating whether it is true or false.
Definition literal.h:24