1#include "GPSymbRegEvalOp.h"
9 if (!calculateBoundsIfRootNode(result, tree)) {
19 IAPrimitiveP prim1 = boost::dynamic_pointer_cast<IAPrimitive>(tree[tree.
iNode_]->primitive_);
21 IABounds bounds1 = prim1->calculateBounds(tree);
23 if (!bounds1.isWithinBounds) {
30 IAPrimitiveP prim2 = boost::dynamic_pointer_cast<IAPrimitive>(tree[tree.
iNode_]->primitive_);
32 IABounds bounds2 = prim2->calculateBounds(tree);
34 if (!bounds2.isWithinBounds) {
39 double ll = bounds1.lowerBound * bounds2.lowerBound;
40 double lu = bounds1.lowerBound * bounds2.upperBound;
41 double ul = bounds1.upperBound * bounds2.lowerBound;
42 double uu = bounds1.upperBound * bounds2.upperBound;
45 if (ll <= lu && ll <= ul && ll <= uu) {
47 retVal.isLowerBoundInclusive = bounds1.isLowerBoundInclusive && bounds2.isLowerBoundInclusive;
48 retVal.lowerBound = ll;
49 }
else if (lu <= ll && lu <= ul && lu <= uu) {
51 retVal.isLowerBoundInclusive = bounds1.isLowerBoundInclusive && bounds2.isUpperBoundInclusive;
52 retVal.lowerBound = lu;
53 }
else if (ul <= ll && ul <= lu && ul <= uu) {
55 retVal.isLowerBoundInclusive = bounds1.isUpperBoundInclusive && bounds2.isLowerBoundInclusive;
56 retVal.lowerBound = ul;
59 retVal.isLowerBoundInclusive = bounds1.isUpperBoundInclusive && bounds2.isUpperBoundInclusive;
60 retVal.lowerBound = uu;
63 if (ll >= lu && ll >= ul && ll >= uu) {
65 retVal.isUpperBoundInclusive = bounds1.isLowerBoundInclusive && bounds2.isLowerBoundInclusive;
66 retVal.upperBound = ll;
67 }
else if (lu >= ll && lu >= ul && lu >= uu) {
69 retVal.isUpperBoundInclusive = bounds1.isLowerBoundInclusive && bounds2.isUpperBoundInclusive;
70 retVal.upperBound = lu;
71 }
else if (ul >= ll && ul >= lu && ul >= uu) {
73 retVal.isUpperBoundInclusive = bounds1.isUpperBoundInclusive && bounds2.isLowerBoundInclusive;
74 retVal.upperBound = ul;
77 retVal.isUpperBoundInclusive = bounds1.isUpperBoundInclusive && bounds2.isUpperBoundInclusive;
78 retVal.upperBound = uu;
81 retVal.isWithinBounds =
true;
virtual void execute(void *result, Tree::Tree &tree)
Execute the primitive.
void execute(void *result, Tree &tree)
Execute the primitive.
Tree class - implements genotype as a tree.
uint iNode_
current node index (when parsing the tree)