Scales a given an ObjectiveFunction. More...
#include <CompositeOFScalarMultiply.hpp>
Public Member Functions | |
CompositeOFScalarMultiply (double, ObjectiveFunction *) | |
virtual | ~CompositeOFScalarMultiply () |
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... | |
CompositeOFScalarMultiply (double, ObjectiveFunction *) | |
virtual | ~CompositeOFScalarMultiply () |
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) |
Implement the scalar multiply analytic gradient. More... | |
bool | compute_analytical_gradient (PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size) |
Implement the scalar multiply analytic gradient. More... | |
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 | |
ObjectiveFunction * | objFunc |
double | mAlpha |
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 } |
Scales a given an ObjectiveFunction.
Definition at line 53 of file includeLinks/CompositeOFScalarMultiply.hpp.
CompositeOFScalarMultiply | ( | double | alp, |
ObjectiveFunction * | Obj | ||
) |
Sets the QualityMetric pointer to the metric associated with Obj. However, if alp is less than zero, the new ObjectiveFunction's negateFlag is the opposite of Obj's. This objective function defaults to the analytical gradient.
alp | (double) |
Obj | (ObjectiveFunction*) |
Definition at line 53 of file ObjectiveFunction/CompositeOFScalarMultiply.cpp.
References ObjectiveFunction::ANALYTICAL_GRADIENT, ObjectiveFunction::get_quality_metric(), CompositeOFScalarMultiply::mAlpha, MSQ_DBGOUT, CompositeOFScalarMultiply::objFunc, ObjectiveFunction::set_gradient_type(), ObjectiveFunction::set_negate_flag(), and ObjectiveFunction::set_quality_metric().
|
virtual |
Definition at line 68 of file ObjectiveFunction/CompositeOFScalarMultiply.cpp.
CompositeOFScalarMultiply | ( | double | , |
ObjectiveFunction * | |||
) |
|
virtual |
|
protectedvirtual |
Implement the scalar multiply analytic gradient.
Analytically computes the composite objective function's gradient by scaling the gradient returned objFunc->compute_gradient(). If mAlpha is less than zero, the gradient is scaled by negatvie mAlpha because the ObjectiveFunction is multiplied by negative one so that it may be minimized.
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 110 of file ObjectiveFunction/CompositeOFScalarMultiply.cpp.
References ObjectiveFunction::compute_gradient(), ObjectiveFunction::get_negate_flag(), i, CompositeOFScalarMultiply::mAlpha, MSQ_ERRZERO, MSQ_FUNCTION_TIMER, PatchData::num_vertices(), and CompositeOFScalarMultiply::objFunc.
|
protectedvirtual |
Implement the scalar multiply analytic gradient.
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.) Function returns `false' if and only if objFunc->evaluate() returns `false'.
Implements ObjectiveFunction.
Definition at line 79 of file ObjectiveFunction/CompositeOFScalarMultiply.cpp.
References ObjectiveFunction::evaluate(), CompositeOFScalarMultiply::mAlpha, MSQ_CHKERR, and CompositeOFScalarMultiply::objFunc.
|
virtual |
Returns the QualityMetric list assossiated with objFunc.
Reimplemented from ObjectiveFunction.
Definition at line 93 of file ObjectiveFunction/CompositeOFScalarMultiply.cpp.
References ObjectiveFunction::get_quality_metric_list(), and CompositeOFScalarMultiply::objFunc.
|
virtual |
returns a list of all associated metrics;
Reimplemented from ObjectiveFunction.
|
private |
Definition at line 69 of file includeLinks/CompositeOFScalarMultiply.hpp.
Referenced by CompositeOFScalarMultiply::CompositeOFScalarMultiply(), CompositeOFScalarMultiply::compute_analytical_gradient(), and CompositeOFScalarMultiply::concrete_evaluate().
|
private |
Definition at line 68 of file includeLinks/CompositeOFScalarMultiply.hpp.
Referenced by CompositeOFScalarMultiply::CompositeOFScalarMultiply(), CompositeOFScalarMultiply::compute_analytical_gradient(), CompositeOFScalarMultiply::concrete_evaluate(), and CompositeOFScalarMultiply::get_quality_metric_list().