delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi::Variable Class Reference

Real symbolic variable. More...

#include <Variable.h>

Public Member Functions

 Variable ()
 Construct a new dummy variable object.
 Variable (std::string name)
 Construct a new real variable object, assigning it a name.
 Variable (Id id)
 Construct a new real variable object, but instead of creating a new one, it will use the given id, effectively "connecting" the object to an existing variable.

Static Public Attributes

static const Id dummy_id {std::numeric_limits<Id>::max()}
 ID of the dummy variable.

Static Private Member Functions

static Id GetNextId ()
 Get the next unique identifier for a variable.

Private Attributes

Id id_ {}
 Unique identifier.

Static Private Attributes

static std::vector< std::string > names_ {{"dummy"}}
 Names of all existing variables.

Detailed Description

Real symbolic variable.

Definition at line 20 of file Variable.h.

Constructor & Destructor Documentation

◆ Variable() [1/3]

delpi::Variable::Variable ( )
inline

Construct a new dummy variable object.

The default constructor is needed to support some data structures. The objects created by the default constructor share the same ID, std::numeric_limits<Id>::max(). As a result, they all are identified as a single variable by equality operator (==) and 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 34 of file Variable.h.

◆ Variable() [2/3]

delpi::Variable::Variable ( std::string name)
explicit

Construct a new real variable object, assigning it a name.

It will be given a unique incremental ID.

Parameters
namename of the variable

Definition at line 30 of file Variable.cpp.

◆ Variable() [3/3]

delpi::Variable::Variable ( Id id)
explicit

Construct a new real variable object, but instead of creating a new one, it will use the given id, effectively "connecting" the object to an existing variable.

Precondition
id must have benn assigned to a variable before by the GetNextId method.
Parameters
idunique identifier

Definition at line 26 of file Variable.cpp.

Member Function Documentation

◆ GetNextId()

Variable::Id delpi::Variable::GetNextId ( )
staticprivate

Get the next unique identifier for a variable.

Returns
incremental unique identifier

Definition at line 21 of file Variable.cpp.


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