dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
literal.h
1
9#pragma once
10
11#include <compare>
12#include <ostream>
13#include <set>
14#include <utility>
15#include <vector>
16
17#include "dlinear/symbolic/symbolic_variable.h" // IWYU pragma: export
18
19namespace dlinear {
20
21using drake::symbolic::Variable;
22
24struct Literal {
26 bool truth;
27};
28using LiteralSet = std::set<Literal>;
29using Model = std::pair<std::vector<Literal>, std::vector<Literal>>;
30
31bool operator==(const dlinear::Literal &lhs, const dlinear::Literal &rhs);
32std::strong_ordering operator<=>(const dlinear::Literal &lhs, const dlinear::Literal &rhs);
33inline Literal operator!(const Literal &l) { return {l.var, !l.truth}; }
34
35bool operator==(const dlinear::LiteralSet &lhs, const dlinear::LiteralSet &rhs);
36std::strong_ordering operator<=>(const dlinear::LiteralSet &lhs, const dlinear::LiteralSet &rhs);
37
38std::ostream &operator<<(std::ostream &os, const std::vector<Variable> &variables);
39std::ostream &operator<<(std::ostream &os, const Literal &literal);
40std::ostream &operator<<(std::ostream &os, const LiteralSet &literals);
41std::ostream &operator<<(std::ostream &os, const Model &model);
42std::ostream &operator<<(std::ostream &os, const std::vector<Literal> &variables);
43
44} // namespace dlinear
45
46#ifdef DLINEAR_INCLUDE_FMT
47
48#include "dlinear/util/logging.h"
49
50OSTREAM_FORMATTER(dlinear::Variable)
51OSTREAM_FORMATTER(dlinear::Variable::Type)
52OSTREAM_FORMATTER(dlinear::Literal)
53OSTREAM_FORMATTER(dlinear::LiteralSet)
54OSTREAM_FORMATTER(dlinear::Model)
55
56#endif
Represents a symbolic variable.
Type
Supported types of symbolic variables.
Global namespace for the dlinear library.
LpColBound operator!(LpColBound bound)
Invert the bound with delta == 0.
std::set< Literal > LiteralSet
A set of literals.
Definition literal.h:28
std::pair< std::vector< Literal >, std::vector< Literal > > Model
A model is a pair of two vectors of literals.
Definition literal.h:29
A literal is a variable with an associated truth value, indicating whether it is true or false.
Definition literal.h:24
bool truth
Truth value.
Definition literal.h:26
Variable var
Variable.
Definition literal.h:25