Adds a scalar to a given ObjectiveFunction. More...
#include <CompositeOFScalarAdd.hpp>
Public Member Functions | |
CompositeOFScalarAdd (double, ObjectiveFunction *) | |
virtual | ~CompositeOFScalarAdd () |
virtual bool | concrete_evaluate (PatchData &patch, double &fval, MsqError &err) |
virtual msq_std::list < QualityMetric * > | get_quality_metric_list () |
Returns the QualityMetric list assossiated with objFunc. More... | |
CompositeOFScalarAdd (double, ObjectiveFunction *) | |
virtual | ~CompositeOFScalarAdd () |
virtual bool | concrete_evaluate (PatchData &patch, double &fval, MsqError &err) |
virtual msq_std::list < QualityMetric * > | get_quality_metric_list () |
Public Member Functions inherited from ObjectiveFunction | |
ObjectiveFunction () | |
virtual | ~ObjectiveFunction () |
bool | evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_gradient_type (GRADIENT_TYPE grad) |
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT. More... | |
bool | compute_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size=0) |
Calls either compute_numerical_gradient or compute_analytical_gradient depending on the value of gradType. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
bool | compute_hessian (PatchData &patch, MsqHessian &hessian, Vector3D *const &grad, double &OF_val, MsqError &err) |
Calls compute_analytical_hessian. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
QualityMetric * | get_quality_metric () |
void | set_quality_metric (QualityMetric *qm) |
Set the value of qMetric. More... | |
void | set_negate_flag (int neg) |
Set the value of ObjectiveFunction's negateFlag. Unless composite, concrete ObjectiveFunctions should set this flag to to the value of the associated QualityMetric's negateFLag. More... | |
int | get_negate_flag () |
Returns negateFlag. More... | |
ObjectiveFunction () | |
virtual | ~ObjectiveFunction () |
bool | evaluate (PatchData &patch, double &fval, MsqError &err) |
void | set_gradient_type (GRADIENT_TYPE grad) |
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT. More... | |
bool | compute_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size=0) |
Calls either compute_numerical_gradient or compute_analytical_gradient depending on the value of gradType. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
bool | compute_hessian (PatchData &patch, MsqHessian &hessian, Vector3D *const &grad, double &OF_val, MsqError &err) |
Calls compute_analytical_hessian. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
QualityMetric * | get_quality_metric () |
void | set_quality_metric (QualityMetric *qm) |
Set the value of qMetric. More... | |
void | set_negate_flag (int neg) |
Set the value of ObjectiveFunction's negateFlag. Unless composite, concrete ObjectiveFunctions should set this flag to to the value of the associated QualityMetric's negateFLag. More... | |
int | get_negate_flag () |
Returns negateFlag. More... | |
Protected Member Functions | |
bool | compute_analytical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
bool | compute_analytical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
Protected Member Functions inherited from ObjectiveFunction | |
bool | compute_numerical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
Non-virtual function which numerically computes the gradient of the Objective Function. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
virtual bool | compute_analytical_hessian (PatchData &, MsqHessian &, Vector3D *const &, double &, MsqError &) |
double | get_eps (PatchData &pd, double &local_val, int k, MsqVertex *vertex, MsqError &err) |
Returns eps used in the numerical gradient calculation. More... | |
void | set_use_local_gradient (bool new_bool) |
Sets useLocalGradient This variable determines whether compute_numercial_gradient can use the most efficient gradient calculation. More... | |
bool | compute_numerical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
Non-virtual function which numerically computes the gradient of the Objective Function. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'. More... | |
virtual bool | compute_analytical_hessian (PatchData &, MsqHessian &, Vector3D *const &, double &, MsqError &) |
double | get_eps (PatchData &pd, double &local_val, int k, MsqVertex *vertex, MsqError &err) |
Returns eps used in the numerical gradient calculation. More... | |
void | set_use_local_gradient (bool new_bool) |
Sets useLocalGradient This variable determines whether compute_numercial_gradient can use the most efficient gradient calculation. More... | |
Private Attributes | |
double | mAlpha |
ObjectiveFunction * | objFunc |
Additional Inherited Members | |
Public Types inherited from ObjectiveFunction | |
enum | GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT } |
enum | GRADIENT_TYPE { NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT, NUMERICAL_GRADIENT, ANALYTICAL_GRADIENT } |
Adds a scalar to a given ObjectiveFunction.
Definition at line 53 of file includeLinks/CompositeOFScalarAdd.hpp.
CompositeOFScalarAdd | ( | double | alp, |
ObjectiveFunction * | Obj1 | ||
) |
Sets the QualityMetric pointer to the metric associated with Obj1. The new ObjectiveFunction's negateFlag is also the same as that of Obj1. This objective function defaults to the analytical gradient which essentially just calls Obj1's gradient function.
alp | (double) |
Obj1 | (ObjectiveFunction*) |
Definition at line 50 of file ObjectiveFunction/CompositeOFScalarAdd.cpp.
References ObjectiveFunction::ANALYTICAL_GRADIENT, ObjectiveFunction::get_quality_metric(), CompositeOFScalarAdd::mAlpha, CompositeOFScalarAdd::objFunc, ObjectiveFunction::set_gradient_type(), ObjectiveFunction::set_negate_flag(), and ObjectiveFunction::set_quality_metric().
|
virtual |
Definition at line 60 of file ObjectiveFunction/CompositeOFScalarAdd.cpp.
CompositeOFScalarAdd | ( | double | , |
ObjectiveFunction * | |||
) |
|
virtual |
|
protectedvirtual |
Analytically computes the composite objective function's gradient by scaling the gradient returned objFunc->compute_gradient().
patch | The PatchData object for which the objective function gradient is computed. |
grad | An array of Vector3D, at least the size of the number of vertices in the patch. |
array_size | is the size of the grad Vector3D[] array and must correspond to the number of vertices in the patch. |
Reimplemented from ObjectiveFunction.
Definition at line 99 of file ObjectiveFunction/CompositeOFScalarAdd.cpp.
References ObjectiveFunction::compute_gradient(), CompositeOFScalarAdd::mAlpha, MSQ_ERRZERO, MSQ_FUNCTION_TIMER, and CompositeOFScalarAdd::objFunc.
|
protectedvirtual |
Fills an array of Vector3D, grad, with the gradient of the objective function computed using the gradient of the quality metric. If the function has not been over-riden in the concrete Objective Function, the base class implementation prints a warning and then defaults to numerical gradient. Function returns 'false' if the patch is not within a required feasible regeion. Otherwise, it returns 'true'.
patch | The PatchData object for which the objective function gradient is computed. |
grad | An array of Vector3D, at least the size of the number of vertices in the patch. |
OF_val | is set to the value of the objective function. |
array_size | is the size of the grad Vector3D[] array and must correspond to the number of vertices in the patch. |
Reimplemented from ObjectiveFunction.
Evaluate the objective function on a given patch.
Implements ObjectiveFunction.
Computes fval= mAlpha+objFunc->evaluate(patch,err). Note that since Obj's evaluate() function is called (as opposed to its concrete_evaluate) the returned value has been multiplied by objFunc's negateFlag (that is, if objFunc needed to be maximized then the value has been multiplied by negative one so that it may be minimized instead.) Functions returns `false' if and only if objFunc->evaluate() returns `false'.
Implements ObjectiveFunction.
Definition at line 72 of file ObjectiveFunction/CompositeOFScalarAdd.cpp.
References ObjectiveFunction::evaluate(), CompositeOFScalarAdd::mAlpha, MSQ_CHKERR, and CompositeOFScalarAdd::objFunc.
|
virtual |
Returns the QualityMetric list assossiated with objFunc.
Reimplemented from ObjectiveFunction.
Definition at line 86 of file ObjectiveFunction/CompositeOFScalarAdd.cpp.
References ObjectiveFunction::get_quality_metric_list(), and CompositeOFScalarAdd::objFunc.
|
virtual |
returns a list of all associated metrics;
Reimplemented from ObjectiveFunction.
|
private |
Definition at line 67 of file includeLinks/CompositeOFScalarAdd.hpp.
Referenced by CompositeOFScalarAdd::CompositeOFScalarAdd(), CompositeOFScalarAdd::compute_analytical_gradient(), and CompositeOFScalarAdd::concrete_evaluate().
|
private |