5#include <initializer_list>
10#include "dlinear/symbolic/symbolic_variable.h"
12namespace dlinear::drake {
31 typedef typename std::set<Variable>::size_type size_type;
32 typedef typename std::set<Variable>::iterator iterator;
33 typedef typename std::set<Variable>::const_iterator const_iterator;
34 typedef typename std::set<Variable>::reverse_iterator reverse_iterator;
35 typedef typename std::set<Variable>::const_reverse_iterator
36 const_reverse_iterator;
51 size_type
size()
const {
return vars_.size(); }
54 bool empty()
const {
return vars_.empty(); }
60 iterator
begin() {
return vars_.begin(); }
62 iterator
end() {
return vars_.end(); }
64 const_iterator
begin()
const {
return vars_.cbegin(); }
66 const_iterator
end()
const {
return vars_.cend(); }
68 const_iterator
cbegin()
const {
return vars_.cbegin(); }
70 const_iterator
cend()
const {
return vars_.cend(); }
72 reverse_iterator
rbegin() {
return vars_.rbegin(); }
74 reverse_iterator
rend() {
return vars_.rend(); }
76 const_reverse_iterator
rbegin()
const {
return vars_.crbegin(); }
78 const_reverse_iterator
rend()
const {
return vars_.crend(); }
80 const_reverse_iterator
crbegin()
const {
return vars_.crbegin(); }
82 const_reverse_iterator
crend()
const {
return vars_.crend(); }
87 template<
class InputIt>
88 void insert(InputIt first, InputIt last) {
89 vars_.insert(first, last);
103 const_iterator
find(
const Variable &key)
const {
return vars_.find(key); }
121 friend std::ostream &operator<<(std::ostream &,
const Variables &vars);
127 explicit Variables(std::set<Variable> vars);
129 std::set<Variable> vars_;
Represents a symbolic variable.
Represents a set of variables.
void insert(const Variables &vars)
Inserts variables in vars into a set.
void insert(const Variable &var)
Inserts a variable var into a set.
const_reverse_iterator crbegin() const
Returns a const reverse-iterator to the beginning.
size_type size() const
Returns the number of elements.
size_type erase(const Variables &vars)
Erases variables in vars from a set.
const_iterator begin() const
Returns an iterator to the beginning.
const_reverse_iterator rend() const
Returns a reverse iterator to the end.
bool IsStrictSupersetOf(const Variables &vars) const
Return true if vars is a strict superset of the Variables.
bool IsSubsetOf(const Variables &vars) const
Return true if vars is a subset of the Variables.
void insert(InputIt first, InputIt last)
Inserts variables in [first, last) into a set.
Variables()=default
Default constructor.
const_iterator end() const
Returns an iterator to the end.
const_reverse_iterator rbegin() const
Returns a reverse iterator to the beginning.
bool IsStrictSubsetOf(const Variables &vars) const
Return true if vars is a strict subset of the Variables.
const_iterator cend() const
Returns a const iterator to the end.
reverse_iterator rend()
Returns a reverse iterator to the end.
iterator begin()
Returns an iterator to the beginning.
Variables(std::initializer_list< Variable > init)
List constructor.
size_type erase(const Variable &key)
Erases key from a set.
bool empty() const
Checks if this set is empty or not.
std::string to_string() const
Returns string representation of Variables.
iterator end()
Returns an iterator to the end.
iterator find(const Variable &key)
Finds element with specific key.
const_reverse_iterator crend() const
Returns a const reverse-iterator to the end.
reverse_iterator rbegin()
Returns a reverse iterator to the beginning.
~Variables()=default
Default destructor.
const_iterator cbegin() const
Returns a const iterator to the beginning.
friend Variables intersect(const Variables &vars1, const Variables &vars2)
Returns the intersection of vars1 and vars2.
size_t get_hash() const
Returns hash value.
bool include(const Variable &key) const
Return true if key is included in the Variables.
bool IsSupersetOf(const Variables &vars) const
Return true if vars is a superset of the Variables.
LpColBound operator-(LpColBound bound)
Invert the bound with delta > 0.
Computes the hash value of v using std::hash.