dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
dlinear::drake::symbolic::Variables Class Reference

Represents a set of variables. More...

#include <symbolic_variables.h>

Public Member Functions

 Variables ()=default
 Default constructor.
 
 ~Variables ()=default
 Default destructor.
 
 Variables (std::initializer_list< Variable > init)
 List constructor.
 
size_t get_hash () const
 Returns hash value.
 
size_type size () const
 Returns the number of elements.
 
bool empty () const
 Checks if this set is empty or not.
 
std::string to_string () const
 Returns string representation of Variables.
 
iterator begin ()
 Returns an iterator to the beginning.
 
iterator end ()
 Returns an iterator to the end.
 
const_iterator begin () const
 Returns an iterator to the beginning.
 
const_iterator end () const
 Returns an iterator to the end.
 
const_iterator cbegin () const
 Returns a const iterator to the beginning.
 
const_iterator cend () const
 Returns a const iterator to the end.
 
reverse_iterator rbegin ()
 Returns a reverse iterator to the beginning.
 
reverse_iterator rend ()
 Returns a reverse iterator to the end.
 
const_reverse_iterator rbegin () const
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator rend () const
 Returns a reverse iterator to the end.
 
const_reverse_iterator crbegin () const
 Returns a const reverse-iterator to the beginning.
 
const_reverse_iterator crend () const
 Returns a const reverse-iterator to the end.
 
void insert (const Variable &var)
 Inserts a variable var into a set.
 
template<class InputIt >
void insert (InputIt first, InputIt last)
 Inserts variables in [first, last) into a set.
 
void insert (const Variables &vars)
 Inserts variables in vars into a set.
 
size_type erase (const Variable &key)
 Erases key from a set.
 
size_type erase (const Variables &vars)
 Erases variables in vars from a set.
 
iterator find (const Variable &key)
 Finds element with specific key.
 
bool include (const Variable &key) const
 Return true if key is included in the Variables.
 
bool IsSubsetOf (const Variables &vars) const
 Return true if vars is a subset of the Variables.
 
bool IsSupersetOf (const Variables &vars) const
 Return true if vars is a superset of the Variables.
 
bool IsStrictSubsetOf (const Variables &vars) const
 Return true if vars is a strict subset of the Variables.
 
bool IsStrictSupersetOf (const Variables &vars) const
 Return true if vars is a strict superset of the Variables.
 

Friends

Variables intersect (const Variables &vars1, const Variables &vars2)
 Returns the intersection of vars1 and vars2.
 

Detailed Description

Represents a set of variables.

This class is based on std::set<Variable>. The intent is to add things that we need including set-union (Variables::insert, operator+, operator+=), set-minus (Variables::erase, operator-, operator-=), and subset/superset checking functions (Variables::IsSubsetOf, Variables::IsSupersetOf, Variables::IsStrictSubsetOf, Variables::IsStrictSupersetOf).

Definition at line 24 of file symbolic_variables.h.

Member Function Documentation

◆ erase() [1/2]

size_type dlinear::drake::symbolic::Variables::erase ( const Variable & key)
inline

Erases key from a set.

Return number of erased elements (0 or 1).

Definition at line 95 of file symbolic_variables.h.

◆ erase() [2/2]

size_type dlinear::drake::symbolic::Variables::erase ( const Variables & vars)

Erases variables in vars from a set.

Return number of erased elements ([0, vars.size()]).

Friends And Related Symbol Documentation

◆ intersect

Variables intersect ( const Variables & vars1,
const Variables & vars2 )
friend

Returns the intersection of vars1 and vars2.

This function has a time complexity of O(N₁ + N₂) where N₁ and N₂ are the size of vars1 and vars2 respectively.


The documentation for this class was generated from the following file: