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

Represents a symbolic variable. More...

#include <symbolic_variable.h>

Public Types

enum class  Type { CONTINUOUS , INTEGER , BINARY , BOOLEAN }
 Supported types of symbolic variables. More...
 

Public Member Functions

 Variable ()
 Default constructor.
 
 ~Variable ()=default
 Default destructor.
 
 Variable (std::string name, Type type=Type::CONTINUOUS)
 Constructs a variable with a string.
 
bool is_dummy () const
 Checks if this is a dummy variable (ID = 0) which is created by the 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.
 

Private Attributes

Id id_ {}
 Unique identifier.
 
Type type_ {Type::CONTINUOUS}
 Type of variable.
 

Static Private Attributes

static std::vector< std::string > names_
 Names of variables.
 

Detailed Description

Represents a symbolic variable.

Definition at line 15 of file symbolic_variable.h.

Member Enumeration Documentation

◆ Type

Supported types of symbolic variables.

Enumerator
CONTINUOUS 

A CONTINUOUS variable takes a mpq_class value.

INTEGER 

An INTEGER variable takes an int value.

BINARY 

A BINARY variable takes an integer value from {0, 1}.

BOOLEAN 

A BOOLEAN variable takes a bool value.

Definition at line 20 of file symbolic_variable.h.

Constructor & Destructor Documentation

◆ Variable() [1/2]

dlinear::drake::symbolic::Variable::Variable ( )
inline

Default constructor.

Constructs a dummy variable of CONTINUOUS type. This is needed to have Eigen::Matrix<Variable>. The objects created by the default constructor share the same ID, zero. As a result, they all are identified as a single variable by equality operator (==). They all have the same hash value as well.

It is allowed to construct a dummy variable but it should not be used to construct a symbolic expression.

Definition at line 41 of file symbolic_variable.h.

◆ Variable() [2/2]

dlinear::drake::symbolic::Variable::Variable ( std::string name,
Type type = Type::CONTINUOUS )
explicit

Constructs a variable with a string.

If not specified, it has CONTINUOUS type by default.


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