#include <freConstrainedMetricInterface.h>


ConstrainedMetricInterface is used to extend a given metric with the functionality to regard given constraints for the objective value. To add this functionality to a metric, the metric has to be derived with ConstrainedMetricInterface as one of the base classes (e.g. see ConstrainedAccuracySetupOptimizationMetric) and ComputeConstraintPenalties should be used when computing the measurement.
The basic objectiv function can be modified by additional constraints, which can be handled as barrier functions.
Equality constraints will result 0 as long as the constraint is met. Otherwise they will result MaxConstraintPenalty.
Inequality constraints will be transformed to an inequality greater or equal zero (c(x)>= 0). The BarrierSize indicates the size of the region in front of the border of the legal value range. The barrier function is modelled by log(c(x)/BarrierSize). Example:
The given constraint is 500<= param_1. Its barriersize is 50, so the barrier region is between 500 and 550.
The constraint will be transformed in 0 <= param_1 - 500. The barrier function will 0 for any param_1 > 550 and min(-log((param_1 - 500)/50), MaxConstraintPenalty) for any other value of param_1.
A constrained metric can also have a failure threshold. An evaluation can always be accounted as a failure if the sum of computed constrained penalties is greater or equal to the threshold. If the evaluation is a failure the return of ComputeConstraintPenalties is false. Metrics implementing this interface can in this case skip the real evaluation. A threshold of 0 or less indicates that the metric should not care about the failure threshold.
Definition at line 66 of file freConstrainedMetricInterface.h.
typedef SetupOptimizationMetric::ParametersType FREE::ConstrainedMetricInterface::CnstrParametersType [protected] |
Standard class typedefs.
Definition at line 84 of file freConstrainedMetricInterface.h.
typedef SetupOptimizationMetric::DecomposedMeasureType FREE::ConstrainedMetricInterface::CnstrDecomposedMeasureType [protected] |
Definition at line 89 of file freConstrainedMetricInterface.h.
| FREE::ConstrainedMetricInterface::ConstrainedMetricInterface | ( | ) | [protected] |
Definition at line 167 of file freConstrainedMetricInterface.cxx.
References m_FailureThreshold, m_MaxConstraintPenalty, and ResetConstraints().

| virtual const char* FREE::ConstrainedMetricInterface::GetNameOfClass | ( | ) | const [inline, virtual] |
Reimplemented in FREE::ConstrainedAccuracySOMetric< VImageDimension >, FREE::ConstrainedImageClassificationSOMetric< VImageDimension >, and FREE::ConstrainedImageDifferenceSOMetric< VImageDimension >.
Definition at line 69 of file freConstrainedMetricInterface.h.
| void FREE::ConstrainedMetricInterface::ResetConstraints | ( | ) |
Resets the list of constraints.
Definition at line 33 of file freConstrainedMetricInterface.cxx.
References m_BarrierSizes, m_Constraints, and FREE::CollectionBase< TElement, TStorageType >::Reset().
Referenced by FREE::ConstrainedAccuracySOMetric< VImageDimension >::ConstrainedAccuracySOMetric(), FREE::ConstrainedImageClassificationSOMetric< VImageDimension >::ConstrainedImageClassificationSOMetric(), FREE::ConstrainedImageDifferenceSOMetric< VImageDimension >::ConstrainedImageDifferenceSOMetric(), and ConstrainedMetricInterface().

| void FREE::ConstrainedMetricInterface::AddConstraint | ( | const SetupParameterConstraint & | constraint, | |
| double | dBarrierSize | |||
| ) |
Adds a constraint to the metric.
Definition at line 42 of file freConstrainedMetricInterface.cxx.
References FREE::SmartCollectionBase< TElement >::AddElement(), m_BarrierSizes, and m_Constraints.
Referenced by FREE::ConstrainedImageDifferenceSOMetricControllerBase< FREE::ConstrainedImageDifferenceSOMetric< 2 > >::ActualizeMainComponent(), FREE::ConstrainedImageClassificationSOMetricControllerBase< FREE::ConstrainedImageClassificationSOMetric< 2 > >::ActualizeMainComponent(), and FREE::ConstrainedAccuracySOMetricControllerBase< FREE::ConstrainedAccuracySOMetric< 3 > >::ActualizeMainComponent().

| void FREE::ConstrainedMetricInterface::SetMaxConstraintPenalty | ( | double | dPenalty | ) | [inline] |
Definition at line 78 of file freConstrainedMetricInterface.h.
Referenced by FREE::ConstrainedImageDifferenceSOMetricControllerBase< FREE::ConstrainedImageDifferenceSOMetric< 2 > >::ActualizeMainComponent(), FREE::ConstrainedImageClassificationSOMetricControllerBase< FREE::ConstrainedImageClassificationSOMetric< 2 > >::ActualizeMainComponent(), and FREE::ConstrainedAccuracySOMetricControllerBase< FREE::ConstrainedAccuracySOMetric< 3 > >::ActualizeMainComponent().
| double FREE::ConstrainedMetricInterface::GetMaxConstraintPenalty | ( | ) | [inline] |
Definition at line 79 of file freConstrainedMetricInterface.h.
| virtual unsigned int FREE::ConstrainedMetricInterface::GetNumberOfConstrainedValues | ( | void | ) | const [inline, virtual] |
Definition at line 81 of file freConstrainedMetricInterface.h.
| void FREE::ConstrainedMetricInterface::SetFailureThreshold | ( | double | dThreshold | ) | [inline] |
Definition at line 83 of file freConstrainedMetricInterface.h.
Referenced by FREE::ConstrainedImageDifferenceSOMetricControllerBase< FREE::ConstrainedImageDifferenceSOMetric< 2 > >::ActualizeMainComponent(), FREE::ConstrainedImageClassificationSOMetricControllerBase< FREE::ConstrainedImageClassificationSOMetric< 2 > >::ActualizeMainComponent(), and FREE::ConstrainedAccuracySOMetricControllerBase< FREE::ConstrainedAccuracySOMetric< 3 > >::ActualizeMainComponent().
| double FREE::ConstrainedMetricInterface::GetFailureThreshold | ( | ) | [inline] |
Definition at line 84 of file freConstrainedMetricInterface.h.
| bool FREE::ConstrainedMetricInterface::ComputeConstraintPenalties | ( | const CnstrParametersType & | parameters, | |
| CnstrDecomposedMeasureType & | penalties | |||
| ) | const [protected] |
This function computes the penalties by calling ComputeConstraintPenalty for each parameter. The computed penalties will be inserted in the passed parameter penalties.
| [in] | parameters | Parameter values that should be used for computation. |
| [out] | penalties | The computed penalties in the same order like the parameters. |
Definition at line 51 of file freConstrainedMetricInterface.cxx.
References ComputeConstraintPenalty(), m_Constraints, m_FailureThreshold, and FREE::CollectionBase< TElement, TStorageType >::Size().
Referenced by FREE::ConstrainedImageDifferenceSOMetric< VImageDimension >::ComputeDecomposedValue(), FREE::ConstrainedImageClassificationSOMetric< VImageDimension >::ComputeDecomposedValue(), and FREE::ConstrainedAccuracySOMetric< VImageDimension >::ComputeDecomposedValue().

| double FREE::ConstrainedMetricInterface::ComputeConstraintPenalty | ( | const unsigned int | iConstraintID, | |
| const CnstrParametersType & | parameters | |||
| ) | const [protected] |
Definition at line 72 of file freConstrainedMetricInterface.cxx.
References catchAllNPassMacro, GetClassLocationMacro, FREE::SetupParameterConstraint::GetConstraintTerm(), FREE::SetupParameterConstraint::GetDestinationID(), FREE::SmartCollectionBase< TElement >::GetElement(), FREE::SetupParameterConstraint::GetRelationType(), FREE::LogException(), m_Constraints, m_MaxConstraintPenalty, FREE::SetupParameterConstraint::RTEqual, FREE::SetupParameterConstraint::RTGreaterOrEqual, throwExceptionMacro, and FREE::Convert::ToStr().
Referenced by ComputeConstraintPenalties().

Definition at line 104 of file freConstrainedMetricInterface.h.
Referenced by AddConstraint(), ComputeConstraintPenalties(), ComputeConstraintPenalty(), and ResetConstraints().
std::vector<double> FREE::ConstrainedMetricInterface::m_BarrierSizes [protected] |
Definition at line 105 of file freConstrainedMetricInterface.h.
Referenced by AddConstraint(), and ResetConstraints().
double FREE::ConstrainedMetricInterface::m_MaxConstraintPenalty [protected] |
Definition at line 107 of file freConstrainedMetricInterface.h.
Referenced by ComputeConstraintPenalty(), FREE::ConstrainedAccuracySOMetric< VImageDimension >::ConstrainedAccuracySOMetric(), FREE::ConstrainedImageClassificationSOMetric< VImageDimension >::ConstrainedImageClassificationSOMetric(), FREE::ConstrainedImageDifferenceSOMetric< VImageDimension >::ConstrainedImageDifferenceSOMetric(), and ConstrainedMetricInterface().
double FREE::ConstrainedMetricInterface::m_FailureThreshold [protected] |
Definition at line 108 of file freConstrainedMetricInterface.h.
Referenced by ComputeConstraintPenalties(), and ConstrainedMetricInterface().
1.5.3 written by Dimitri van Heesch,
© 1997-2000