20#ifndef NUMERICSCRITERIAFUNCTIONS_H_
21#define NUMERICSCRITERIAFUNCTIONS_H_
23#include <fmatvec/fmatvec.h>
24#include <mbsim/functions/function.h>
47 void setFunction(
Function<fmatvec::Vec(fmatvec::Vec)> *function_) {
71 virtual bool isBetter(
const fmatvec::Vec & vector,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT)) = 0;
98 int operator ()(
const fmatvec::Vec & vector)
override;
99 bool isBetter(
const fmatvec::Vec & vector,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
100 void clear()
override;
103 const std::vector<double> & getResults() {
107 void setTolerance(
double tol) {
113 virtual double computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT)) = 0;
144 int operator ()(
const fmatvec::Vec & vector)
override;
145 bool isBetter(
const fmatvec::Vec & vector,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
146 void clear()
override;
149 virtual void setTolerances(
const std::map<fmatvec::RangeV, double> & tolerances_) {
150 tolerances = tolerances_;
154 virtual std::vector<double> computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT)) = 0;
159 std::map<fmatvec::RangeV, double> tolerances;
185 double computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
207 std::vector<double> computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
225 virtual fmatvec::Vec getLastPoint() {
231 double computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
257 virtual fmatvec::Vec getLastPoint() {
262 std::vector<double> computeResults(
const fmatvec::Vec & x,
const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT))
override;
Mother class for different criterias that are fulfilled or not.
Definition: criteria_functions.h:33
virtual bool isBetter(const fmatvec::Vec &vector, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT))=0
compares the result of given vector with the last result and returns if it got better (for damping)
CriteriaFunction()
Constructor.
Definition: criteria_functions.cc:31
int operator()(const fmatvec::Vec &vector) override=0
computes the criteria
~CriteriaFunction() override
Destructor.
virtual void clear()=0
deletes the list of criteria results
Function< fmatvec::Vec(fmatvec::Vec)> * function
function that computes the values
Definition: criteria_functions.h:77
Definition: function.h:53
This criteria function class applies the infinity norm globally for complete vectors thus it has one ...
Definition: criteria_functions.h:84
~GlobalCriteriaFunction() override
Destructor.
void clear() override
deletes the list of criteria results
Definition: criteria_functions.cc:63
int operator()(const fmatvec::Vec &vector) override
computes the criteria
Definition: criteria_functions.cc:39
double tolerance
tolerance value for the criteria results
Definition: criteria_functions.h:119
GlobalCriteriaFunction(const double &tolerance_=1e-10)
Constructor.
Definition: criteria_functions.cc:35
bool isBetter(const fmatvec::Vec &vector, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT)) override
compares the result of given vector with the last result and returns if it got better (for damping)
Definition: criteria_functions.cc:52
std::vector< double > criteriaResults
saves the results of the criteria
Definition: criteria_functions.h:124
This criteria function class applies the infinity norm globally on the complete vector and compares i...
Definition: criteria_functions.h:170
GlobalResidualCriteriaFunction(const double &tolerance_=1e-10)
Constructor.
Definition: criteria_functions.cc:106
~GlobalResidualCriteriaFunction() override
Destructor.
This criteria function class applies the infinity norm globally on the difference between the complet...
Definition: criteria_functions.h:213
~GlobalShiftCriteriaFunction() override
Destructor.
fmatvec::Vec lastPoint
save the point of the last step for comparison
Definition: criteria_functions.h:237
GlobalShiftCriteriaFunction(const double &tolerance_=1e-10)
Constructor.
Definition: criteria_functions.cc:133
This criteria function class applies the infinity norm locally for arbitrary combinations of sub-vect...
Definition: criteria_functions.h:130
LocalCriteriaFunction(std::map< fmatvec::RangeV, double > tolerances_)
Constructor.
Definition: criteria_functions.cc:67
bool isBetter(const fmatvec::Vec &vector, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT)) override
compares the result of given vector with the last result and returns if it got better (for damping)
Definition: criteria_functions.cc:88
int operator()(const fmatvec::Vec &vector) override
computes the criteria
Definition: criteria_functions.cc:71
~LocalCriteriaFunction() override
Destructor.
std::vector< std::vector< double > > criteriaResults
saves the results of the criteria for each index set and each operator step
Definition: criteria_functions.h:164
void clear() override
deletes the list of criteria results
Definition: criteria_functions.cc:102
This criteria function class applies the infinity norm on single indices sets (each with another tole...
Definition: criteria_functions.h:192
LocalResidualCriteriaFunction(const std::map< fmatvec::RangeV, double > &tolerances_)
Constructor.
Definition: criteria_functions.cc:117
~LocalResidualCriteriaFunction() override
Destructor.
This criteria function class applies the infinity norm on single indices sets (each with another tole...
Definition: criteria_functions.h:244
fmatvec::Vec lastPoint
save the point of the last step for comparison
Definition: criteria_functions.h:267
LocalShiftCriteriaFunction(const std::map< fmatvec::RangeV, double > &tolerances_)
Constructor.
Definition: criteria_functions.cc:152
~LocalShiftCriteriaFunction() override
Destructor.
namespace MBSim
Definition: bilateral_constraint.cc:30