24#ifndef quantlib_optimization_constraint_h
25#define quantlib_optimization_constraint_h
47 bool empty()
const {
return !impl_; }
51 Constraint(Impl* impl = NULL);
52 virtual ~Constraint() {
delete impl_; }
73 for (
size_t i = 0; i < params.size(); ++i) {
74 if (params[i] <= 0.0)
return false;
89 Impl(RealType low, RealType high) : low_(low), high_(high) {}
91 for (
size_t i = 0; i < params.size(); i++) {
92 if ((params[i] < low_) || (params[i] > high_))
return false;
103 Constraint(
new BoundaryConstraint::Impl(low, high)) {}
113 return c1_.test(params) && c2_.test(params);
122 Constraint(
new CompositeConstraint::Impl(c1, c2)) {}
Dynamically-sized vector class.
Constraint imposing all arguments to be in [low,high]
Constraint enforcing both given sub-constraints
Base class for constraint implementations.
virtual bool test(const DynamicVector< RealType > ¶ms) const =0
Tests if params satisfy the constraint.
Constraint imposing positivity to all arguments
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.