Multiplies two ObjectiveFunction values together. More...
#include <CompositeOFMultiply.hpp>
Public Member Functions | |
CompositeOFMultiply (ObjectiveFunction *, ObjectiveFunction *) | |
virtual | ~CompositeOFMultiply () |
virtual bool | concrete_evaluate (PatchData &patch, double &fval, MsqError &err) |
virtual msq_std::list < QualityMetric * > | get_quality_metric_list () |
CompositeOFMultiply (ObjectiveFunction *, ObjectiveFunction *) | |
virtual | ~CompositeOFMultiply () |
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 * | objFunc1 |
ObjectiveFunction * | objFunc2 |
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 } |
Multiplies two ObjectiveFunction values together.
Definition at line 51 of file includeLinks/CompositeOFMultiply.hpp.
CompositeOFMultiply | ( | ObjectiveFunction * | Obj1, |
ObjectiveFunction * | Obj2 | ||
) |
Sets the QualityMetric pointer to the metric associated with Obj1 and Obj2 if Obj1 and Obj2 are associated with the same metric. Otherwise, it sets the QualityMetric pointer to NULL. The new ObjectiveFunction's negateFlag is set to negative one only if both Obj1 and Obj2's negateFlag are negative one (because obj1 and obj2's evaluate function multiply their return values by negative one if their respective function needs to be maximized. If both of these functions needed to be maximized, then the negative ones will have cancelled out). Otherwise, the negateFlag is set to one. Defaults to the analytical gradient.
Obj1 | (ObjectiveFunction*) |
Obj2 | (ObjectiveFunction*) |
Definition at line 56 of file ObjectiveFunction/CompositeOFMultiply.cpp.
References ObjectiveFunction::ANALYTICAL_GRADIENT, ObjectiveFunction::get_negate_flag(), ObjectiveFunction::get_quality_metric(), CompositeOFMultiply::objFunc1, CompositeOFMultiply::objFunc2, ObjectiveFunction::set_gradient_type(), ObjectiveFunction::set_negate_flag(), and ObjectiveFunction::set_quality_metric().
|
virtual |
Definition at line 73 of file ObjectiveFunction/CompositeOFMultiply.cpp.
|
virtual |
|
protectedvirtual |
Implement the scalar multiply analytic gradient.
Analytically computes the composite objective function's gradient, using the multiplication rule. 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 128 of file ObjectiveFunction/CompositeOFMultiply.cpp.
References ObjectiveFunction::compute_gradient(), i, MSQ_ERRZERO, MSQ_FUNCTION_TIMER, PatchData::num_vertices(), CompositeOFMultiply::objFunc1, and CompositeOFMultiply::objFunc2.
|
protectedvirtual |
Implement the scalar multiply analytic gradient.
Reimplemented from ObjectiveFunction.
Evaluate the objective function on a given patch.
Implements ObjectiveFunction.
Computes fval= objFunc1->evaluate(patch,err)*objFunc2->evaluate(patch,err). Note that since objFunc1 and objFunc2's evaluate() functions are called (as opposed to their concrete_evaluates) the returned values have already been multiplied by the respective negateFlag (that is, if objFunc1 (or objFunc2) needed to be maximized then the value has been multiplied by negative one so that it may be minimized instead.) Function returns `false' if either objFunc1->evaluate() or objFunc2->evaluate() returns `false'; otherwise function returns `true'.
Implements ObjectiveFunction.
Definition at line 99 of file ObjectiveFunction/CompositeOFMultiply.cpp.
References ObjectiveFunction::evaluate(), MSQ_CHKERR, CompositeOFMultiply::objFunc1, and CompositeOFMultiply::objFunc2.
|
virtual |
Returns the QualityMetric list associated with objFunc1 merged with the QualityMetric list associated with objFunc2. The entries in this merged list may not be unique.
Reimplemented from ObjectiveFunction.
Definition at line 81 of file ObjectiveFunction/CompositeOFMultiply.cpp.
References ObjectiveFunction::get_quality_metric_list(), CompositeOFMultiply::objFunc1, and CompositeOFMultiply::objFunc2.
|
virtual |
returns a list of all associated metrics;
Reimplemented from ObjectiveFunction.
|
private |
Definition at line 65 of file includeLinks/CompositeOFMultiply.hpp.
Referenced by CompositeOFMultiply::CompositeOFMultiply(), CompositeOFMultiply::compute_analytical_gradient(), CompositeOFMultiply::concrete_evaluate(), and CompositeOFMultiply::get_quality_metric_list().
|
private |
Definition at line 66 of file includeLinks/CompositeOFMultiply.hpp.
Referenced by CompositeOFMultiply::CompositeOFMultiply(), CompositeOFMultiply::compute_analytical_gradient(), CompositeOFMultiply::concrete_evaluate(), and CompositeOFMultiply::get_quality_metric_list().