29 std::string
const&
name )
33 std::string
const&
name )
37 std::string
const&
name )
41 char const*
const name )
45 char const*
const name )
49 char const*
const name )
54 return data->upperBound;
59 return data->lowerBound;
65 throw IPOE(
"ipo::Constraint::setUpperBound(): upper bound must exceed lower." );
71 if(
data->upperBound <= lowerBound )
72 throw IPOE(
"ipo::Constraint::setLowerBound(): upper bound must exceed lower." );
95 auto f = [](
double x)->std::string {
96 std::ostringstream ost;
97 double a { std::fabs( x ) };
98 if( x < 0 ) ost <<
"−";
107 for(
auto const& e : const_cast<ipo::Constraint&>( *this ).getVariables() ){
108 if( first ) first =
false;
else ostream <<
", ";
109 ostream << e.getName();
112 std::cout << prefix <<
" Constraint function value = " <<
value() << std::endl;
Shared pointer to ipo::Function object.
ModelBase & model
A Model to attach this to.
virtual void summary(std::ostream &ostream=std::cout, std::string const &prefix="") const override
Create a summary of this function.
std::shared_ptr< Data > data
The objective data.
#define IPOE(message)
Macro to allow file and line names in exceptions.
Class for a constraint function.
Abstract base class for model.
Class for an objective function.
double getLowerBound() const
Get lower bound of Constraint.
virtual void setUpperBound(double const upperBound)
Set upper bound of Constraint.
double value() const noexcept
Value of the objective function at the current value of the variables.
std::string getName() const
Get name of variable.
This class computes a function at a vector.
Constraint(detail::ModelBase &model, detail::SharedFunctionPtr function, std::string const &name)
Use this constructor to construct from a ipo_function::SharedFunctionPtr object.
double getUpperBound() const
Get upper bound of Constraint.
bool operator==(Array const &lhs, Array const &rhs)
Compare two Array objects.
SharedFunctionPtr function
The objective or constraint function.
virtual void setLowerBound(double const lowerBound)
Set lower bound of Constraint.
Constraint & operator=(Constraint const &constraint)
Assignment operator.
This namespace holds all the interior-point optimisation classes.