Commit c7babc60 authored by David Bommes's avatar David Bommes
Browse files

removed redundant and confusing functions

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@208 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent f026294f
......@@ -50,7 +50,7 @@ public:
enum ConstraintType {NC_EQUAL, NC_LESS_EQUAL, NC_GREATER_EQUAL};
/// Default constructor
NConstraintInterface(const ConstraintType _type = NC_EQUAL, double _eps = 1e-6) : type_(_type), eps_(_eps) {}
NConstraintInterface(const ConstraintType _type = NC_EQUAL, double _eps = 1e-6) : type_(_type) {}
/// Destructor
virtual ~NConstraintInterface() {}
......@@ -62,18 +62,7 @@ public:
virtual ConstraintType& constraint_type ( ) { return type_; }
virtual bool is_satisfied ( const double* _x )
{
switch( type_)
{
case NC_EQUAL : return (fabs(eval_constraint(_x)) <= eps_); break;
case NC_LESS_EQUAL : return ( eval_constraint(_x) <= eps_); break;
case NC_GREATER_EQUAL: return ( eval_constraint(_x) >= -eps_); break;
}
return false;
}
virtual bool is_satisfied ( const double* _x, double _eps )
virtual bool is_satisfied ( const double* _x, double _eps = 1e-6)
{
switch( type_)
{
......@@ -89,25 +78,7 @@ public:
virtual bool constant_gradient() const { return false;}
virtual bool constant_hessian () const { return false;}
virtual double gradient_update_factor( const double* _x )
{
double val = eval_constraint(_x);
bool upper_bound_ok = ( val <= eps_);
bool lower_bound_ok = ( val >= -eps_);
if(upper_bound_ok)
{
if(lower_bound_ok || type_ == NC_LESS_EQUAL) return 0.0;
else return 1.0;
}
else
{
if(lower_bound_ok && type_ == NC_GREATER_EQUAL) return 0.0;
else return -1.0;
}
}
virtual double gradient_update_factor( const double* _x, double _eps )
virtual double gradient_update_factor( const double* _x, double _eps = 1e-6)
{
double val = eval_constraint(_x);
bool upper_bound_ok = ( val <= _eps);
......@@ -129,8 +100,6 @@ public:
private:
// constraint type
ConstraintType type_;
double eps_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment