|
dlinear
0.0.1
Delta-complete SMT solver for linear programming
|
Public Member Functions | |
LeakyReluConstraint (const Variable &relu_var, const Expression &e, float alpha, const PredicateAbstractor &pa) | |
Construct a new LeakyReluConstraint object. | |
LeakyReluConstraint (const Formula &active_formula, const Formula &inactive_formula, Variable relu_var, Expression active_soi, Expression inactive_soi, const PredicateAbstractor &pa) | |
Construct a new Relu Constraint object. | |
LeakyReluConstraint (Variable active_var, Variable inactive_var, Variable relu_var, Expression active_soi, Expression inactive_soi) | |
Construct a new Relu Constraint object. | |
void | UpdateUpperBound (const mpq_class *upper_bound) override |
Update the upper bounds of the constraint. | |
void | UpdateLowerBound (const mpq_class *lower_bound) override |
Update the lower bounds of the constraint. | |
std::set< LiteralSet > | TightenBounds (BoundPreprocessor &preprocessor) override |
Use the preprocessor to tighten the bounds of the constraint and hopefully fix its state to either active or inactive. | |
LiteralSet | Assumptions () const override |
The assumptions used to guide the SAT solver towards the most promising sub-problems. | |
LiteralSet | LearnedClauses () const override |
Produce some learned clauses the SAT solver will use to prune the sub-problems this piecewise constraint will not be satisfied in. | |
std::ostream & | Print (std::ostream &os) const override |
Print the constraint on the standard output. | |
![]() | |
PiecewiseLinearConstraint (const mpq_class *lb=nullptr, const mpq_class *ub=nullptr, Variable active_var={}, Variable inactive_var={}, Variable theory_var={}, Expression active_soi={0}, Expression inactive_soi={0}, PiecewiseConstraintState state=PiecewiseConstraintState::NOT_FIXED) | |
Construct a new Piecewise Linear Constraint object. | |
void | UpdateBounds (const mpq_class &lb, const mpq_class &ub) |
Update the bounds of the constraint. | |
void | UpdateBounds (const mpq_class *lb, const mpq_class *ub) |
Update the bounds of the constraint. | |
mpq_class | Cost (const Environment &env) const |
Calculate the cost of the violation of the constraint. | |
mpq_class | Cost (const Environment &env, bool active) const |
Calculate the cost of the violation of the constraint forcing a specific state. | |
bool | has_lower_bound () const |
Check whether the constraint is lower bounded. | |
bool | has_upper_bound () const |
Check whether the constraint is upper bounded. | |
bool | fixed () const |
Check whether the constraint is fixed. | |
const mpq_class & | lower_bound () const |
Get read-only access to the lower bound of the constraint. | |
const mpq_class & | upper_bound () const |
Get read-only access to the upper bound of the constraint. | |
const Variable & | active_var () const |
Get read-only access to the boolean variable associated with the y = f_\text{active}(x) theory literal of the constraint. | |
const Variable & | inactive_var () const |
Get read-only access to the boolean variable associated with the y = f_\text{inactive}(x) theory literal of the constraint. | |
const Variable & | theory_var () const |
Get read-only access to the theory variable y of the constraint. | |
const Expression & | active_soi () const |
Get read-only access to the expression y - f_\text{active}(x) of the constraint. | |
const Expression & | inactive_soi () const |
Get read-only access to the expression y - f_\text{inactive}(x) of the constraint. | |
const Expression & | soi () const |
PiecewiseConstraintState | state () const |
Get read-only access to the state of the constraint. | |
Static Public Attributes | |
static const mpq_class | zero {0} |
Zero constant all the pointers to the default lower bound will point to. | |
![]() | |
static const Expression | zero_soi {0} |
Expression 0 used as a soi if the constraint is not fixed yet. | |
Additional Inherited Members | |
![]() | |
const mpq_class * | lower_bound_ |
Lower bound of the constraint. | |
const mpq_class * | upper_bound_ |
Upper bound of the constraint. | |
const Variable | active_var_ |
Boolean variable associated with the y = f_\text{active}(x) theory literal. | |
const Variable | inactive_var_ |
Boolean variable associated with the y = f_\text{inactive}(x) theory literal. | |
const Variable | theory_var_ |
Theory variable y . | |
const Expression | active_soi_ |
Expression y - f_\text{active}(x) . | |
const Expression | inactive_soi_ |
Expression y - f_\text{inactive}(x) . | |
PiecewiseConstraintState | state_ |
State of the constraint. | |
Definition at line 15 of file LeakyReluConstraint.h.
dlinear::LeakyReluConstraint::LeakyReluConstraint | ( | const Variable & | relu_var, |
const Expression & | e, | ||
float | alpha, | ||
const PredicateAbstractor & | pa ) |
Construct a new LeakyReluConstraint object.
Given the standard ReLU definition, where relu_var
is y and e
is x , we store the following:
inactive_formula
is the formula y = alpha * x active_formula
is the formula y = x active_soi
is the sum of infeasibility y - x used if the constraint is active.inactive_soi
is the sum of infeasibility y - alpha * x used if the constraint is inactive. relu_var | theory variable y |
e | expression x |
alpha | leaky factor |
pa | predicate abstractor used to convert the formula to a boolean variable |
Definition at line 18 of file LeakyReluConstraint.cpp.
dlinear::LeakyReluConstraint::LeakyReluConstraint | ( | const Formula & | active_formula, |
const Formula & | inactive_formula, | ||
Variable | relu_var, | ||
Expression | active_soi, | ||
Expression | inactive_soi, | ||
const PredicateAbstractor & | pa ) |
Construct a new Relu Constraint object.
Given the standard ReLU definition, the three theory variables are:
inactive_formula
is the formula y = 0 active_formula
is the formula y = x relu_var
is the theory variable y active_formula | formula y = x |
inactive_formula | formula y = 0 |
relu_var | theory variable y |
active_soi | sum of infeasibility y - x used if the constraint is active. It must be 0 for the constraint to be satisfied |
pa | predicate abstractor used to convert the formula to a boolean variable |
dlinear::LeakyReluConstraint::LeakyReluConstraint | ( | Variable | active_var, |
Variable | inactive_var, | ||
Variable | relu_var, | ||
Expression | active_soi, | ||
Expression | inactive_soi ) |
Construct a new Relu Constraint object.
Given the standard ReLU definition, the three theory variables are:
inactive_var
is the boolean variable associated with the formula y = 0 active_var
is the boolean variable associated with the formula y = x relu_var
is the theory variable y active_var | boolean variable associated with the formula y = x |
inactive_var | boolean variable associated with the formula y = 0 |
relu_var | theory variable y |
active_soi | sum of infeasibility y - x used if the constraint is active. It must be 0 for the constraint to be satisfied |
Definition at line 23 of file LeakyReluConstraint.cpp.
|
nodiscardoverridevirtual |
The assumptions used to guide the SAT solver towards the most promising sub-problems.
Implements dlinear::PiecewiseLinearConstraint.
Definition at line 72 of file LeakyReluConstraint.cpp.
|
nodiscardoverridevirtual |
Produce some learned clauses the SAT solver will use to prune the sub-problems this piecewise constraint will not be satisfied in.
Implements dlinear::PiecewiseLinearConstraint.
Definition at line 78 of file LeakyReluConstraint.cpp.
|
overridevirtual |
Print the constraint on the standard output.
os | standard output |
Implements dlinear::PiecewiseLinearConstraint.
Definition at line 86 of file LeakyReluConstraint.cpp.
|
overridevirtual |
Use the preprocessor
to tighten the bounds of the constraint and hopefully fix its state to either active or inactive.
preprocessor | preprocessor to use to tighten the bounds |
Implements dlinear::PiecewiseLinearConstraint.
Definition at line 52 of file LeakyReluConstraint.cpp.
|
overridevirtual |
Update the lower bounds of the constraint.
lb | lower bound of the constraint |
Reimplemented from dlinear::PiecewiseLinearConstraint.
Definition at line 33 of file LeakyReluConstraint.cpp.
|
overridevirtual |
Update the upper bounds of the constraint.
ub | upper bound of the constraint |
Reimplemented from dlinear::PiecewiseLinearConstraint.
Definition at line 40 of file LeakyReluConstraint.cpp.