public abstract class SegmentPropagatorCostFunction extends DefinitionalObject
ParameterOptimizer
.
This is the definition of the
evaluator
.Modifier | Constructor and Description |
---|---|
protected |
SegmentPropagatorCostFunction()
Initializes a new instance.
|
protected |
SegmentPropagatorCostFunction(CostFunctionGoal goal,
double tolerance)
Initializes a new instance.
|
protected |
SegmentPropagatorCostFunction(CostFunctionGoal goal,
double tolerance,
CostFunctionScaling scaling)
Initializes a new instance.
|
protected |
SegmentPropagatorCostFunction(CostFunctionGoal goal,
double tolerance,
CostFunctionScaling scaling,
double weight)
Initializes a new instance.
|
protected |
SegmentPropagatorCostFunction(SegmentPropagatorCostFunction existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected abstract boolean |
checkForSameDefinition(SegmentPropagatorCostFunction other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
void |
enumerateDependencies(DependencyEnumerator enumerator)
Enumerates the dependencies of this object by calling
DependencyEnumerator#enumerate(T) for each object that this object directly depends upon. |
protected void |
freezeAggregatedObjects()
Called by
DefinitionalObject.freeze() to also freeze any objects that are considered to be a part of this object. |
abstract SegmentPropagatorCostFunctionEvaluator |
getEvaluator(EvaluatorGroup group)
Creates and returns the
SegmentPropagatorCostFunctionEvaluator . |
CostFunctionGoal |
getGoal()
Gets a value indicating whether the cost function is supposed to be minimized or maximized.
|
String |
getName()
Gets an optional name to identify this constraint.
|
CostFunctionSettings |
getSettings()
Gets the settings for the
ParameterOptimizer
associated with this cost function. |
void |
setGoal(CostFunctionGoal value)
Sets a value indicating whether the cost function is supposed to be minimized or maximized.
|
void |
setName(String value)
Sets an optional name to identify this constraint.
|
void |
setSettings(CostFunctionSettings value)
Sets the settings for the
ParameterOptimizer
associated with this cost function. |
protected void |
validateProperties()
Validates that required properties are configured correctly in order to get an
evaluator for this instance.
|
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, clone, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, freeze, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
protected SegmentPropagatorCostFunction()
Initializes a new instance. The weight defaults to 1.0.
Before SegmentPropagatorCostFunction.getEvaluator(agi.foundation.EvaluatorGroup)
can be called,
Goal
(get
/ set
) must be configured, and
Settings
(get
/ set
) must be configured with a valid Tolerance
(get
/ set
).
Scaling
(get
/ set
) defaults to NoScalingOnCostFunction
.
protected SegmentPropagatorCostFunction(@Nonnull CostFunctionGoal goal, double tolerance)
Scaling
(get
/ set
) defaults to NoScalingOnCostFunction
.goal
- Whether the cost function is supposed to be minimized or maximized.tolerance
- The cost function is considered to be converged if its value changes by less than
this value from one iteration to the next.protected SegmentPropagatorCostFunction(@Nonnull CostFunctionGoal goal, double tolerance, @Nonnull CostFunctionScaling scaling)
goal
- Whether the cost function is supposed to be minimized or maximized.tolerance
- The cost function is considered to be converged if its value changes by less than
this value from one iteration to the next.scaling
- The type of scaling to be used on this cost function.protected SegmentPropagatorCostFunction(@Nonnull CostFunctionGoal goal, double tolerance, @Nonnull CostFunctionScaling scaling, double weight)
goal
- Whether the cost function is supposed to be minimized or maximized.tolerance
- The cost function is considered to be converged if its value changes by less than
this value from one iteration to the next.scaling
- The type of scaling to be used on this cost function.weight
- A value multiplied by the cost function to prioritize or de-prioritize it
with respect to the constraint errors of any active constraints.protected SegmentPropagatorCostFunction(@Nonnull SegmentPropagatorCostFunction existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected abstract boolean checkForSameDefinition(SegmentPropagatorCostFunction other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
SegmentPropagatorCostFunction.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
public void enumerateDependencies(DependencyEnumerator enumerator)
DependencyEnumerator#enumerate(T)
for each object that this object directly depends upon.
Derived classes which contain additional dependencies MUST override this method, call the base
implementation, and enumerate dependencies introduced by the derived class.enumerateDependencies
in interface IEnumerateDependencies
enumerateDependencies
in class DefinitionalObject
enumerator
- The enumerator that is informed of the dependencies of this object.protected void freezeAggregatedObjects()
DefinitionalObject.freeze()
to also freeze any objects that are considered to be a part of this object.
Derived classes which contain additional aggregated objects MUST override this method, call the base
implementation, and freeze aggregated objects introduced by the derived class. The objects that need to be
frozen in this method are frequently created in this object's constructor and are not settable via
properties.freezeAggregatedObjects
in class DefinitionalObject
@Nonnull public final CostFunctionGoal getGoal()
public final void setGoal(@Nonnull CostFunctionGoal value)
public final CostFunctionSettings getSettings()
ParameterOptimizer
associated with this cost function.public final void setSettings(CostFunctionSettings value)
ParameterOptimizer
associated with this cost function.public final String getName()
public final void setName(String value)
@Nonnull public abstract SegmentPropagatorCostFunctionEvaluator getEvaluator(@Nonnull EvaluatorGroup group)
SegmentPropagatorCostFunctionEvaluator
.
Derived classes should call SegmentPropagatorCostFunction.validateProperties()
to check properties
owned by this base class, as well as validate their own properties.
group
- The EvaluatorGroup
to use to create any necessary
evaluators
for this constraint.cost function evaluator
.protected void validateProperties()
SegmentPropagatorCostFunction.getEvaluator(agi.foundation.EvaluatorGroup)
, as well as validate their own properties.