10 #include "creativity/data/Variable.hpp" 45 Equation(
const std::shared_ptr<const Variable> &y);
76 std::shared_ptr<const Variable>
depVar()
const;
89 std::vector<std::string>
names()
const;
95 std::list<std::shared_ptr<const Variable>>::const_iterator
begin()
const;
99 std::list<std::shared_ptr<const Variable>>::const_iterator
end()
const;
114 void addVar(
const std::shared_ptr<const Variable> &var);
std::list< std::shared_ptr< const Variable > >::const_iterator end() const
Const access to the past-the-end iterator of independent variables.
Primary namespace for all Creativity library code.
Definition: config.hpp:4
std::shared_ptr< const Variable > dep_var_
The dependent variable.
Definition: Equation.hpp:108
Class to store a equation.
Definition: Equation.hpp:33
std::shared_ptr< const Variable > depVar() const
Accesses the dependent variable.
void addVar(const std::shared_ptr< const Variable > &var)
Internal method to add a variable to the model.
friend std::ostream & operator<<(std::ostream &os, const Equation &eq)
Overloaded so that an Equation can be sent to an output stream, resulting in output such as y ~ const...
Equation()=delete
Not default constructible.
std::list< std::shared_ptr< const Variable > > indep_vars_
The independent variables; the first is always a ConstantVariable.
Definition: Equation.hpp:111
Proxy operator%(const std::shared_ptr< const Variable > &var)
Adds a variable (lvalue version).
std::list< std::shared_ptr< const Variable > >::const_iterator begin() const
Const access to the beginning iterator of independent variables.
Proxy object returned by << that allows more variables to be appended with +.
Definition: Equation.hpp:118
unsigned int numVars() const
Returns the number of independent variables.
bool hasConstant() const
Returns true if the model includes a constant, false if it does not.
Equation operator+(const std::shared_ptr< const Variable > &var) const &
The addition operator duplicates the called-upon Equation an adds a new term to the duplicate...
static std::shared_ptr< ConstantVariable > create(Args... args)
Forwards arguments to the protected constructor and returns a shared_ptr to the created object...
Definition: Variable.hpp:93
std::vector< std::string > names() const
Returns the names of the variables in the same order they will be returned by begin()/end().