9#include "dlinear/symbolic/hash.h"
11namespace dlinear::drake {
52 bool is_dummy()
const {
return get_id() == 0; }
54 Type get_type()
const;
55 size_t get_hash()
const {
return std::hash<Id>{}(
id_); }
56 std::string get_name()
const;
57 std::string to_string()
const;
65 friend std::ostream &operator<<(std::ostream &os,
const Variable &var);
68 static std::vector<std::string>
names_;
70 static Id get_next_id();
84struct less<
dlinear::drake::symbolic::Variable> {
92struct equal_to<
dlinear::drake::symbolic::Variable> {
99struct hash<
dlinear::drake::symbolic::Variable> {
Represents a symbolic variable.
Type
Supported types of symbolic variables.
@ INTEGER
An INTEGER variable takes an int value.
@ BINARY
A BINARY variable takes an integer value from {0, 1}.
@ CONTINUOUS
A CONTINUOUS variable takes a mpq_class value.
@ BOOLEAN
A BOOLEAN variable takes a bool value.
Type type_
Type of variable.
static std::vector< std::string > names_
Names of variables.
~Variable()=default
Default destructor.
bool is_dummy() const
Checks if this is a dummy variable (ID = 0) which is created by the default constructor.
Variable(std::string name, Type type=Type::CONTINUOUS)
Constructs a variable with a string.
Variable()
Default constructor.
bool equal_to(const Variable &v) const
Checks the equality of two variables based on their ID values.
bool less(const Variable &v) const
Compares two variables based on their ID values.
Global namespace for the dlinear library.