public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (Lawnmower)problem; var d = (LawnmowerData)input; switch (p.Orientation) { case Lawnmower.O_UP: p.PosY--; if (p.PosY < 0) { p.PosY = p.MaxY - 1; } break; case Lawnmower.O_LEFT: p.PosX--; if (p.PosX < 0) { p.PosX = p.MaxX - 1; } break; case Lawnmower.O_DOWN: p.PosY++; if (p.PosY >= p.MaxY) { p.PosY = 0; } break; case Lawnmower.O_RIGHT: p.PosX++; if (p.PosX >= p.MaxX) { p.PosX = 0; } break; default: // whoa! state.Output.Fatal("Whoa, somehow I got a bad orientation! (" + p.Orientation + ")"); break; } p.Moves++; if (p.Map[p.PosX][p.PosY] == Lawnmower.UNMOWED) { p.Sum++; p.Map[p.PosX][p.PosY] = p.Moves; } // return [0,0] d.x = 0; d.y = 0; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var edge = ((EdgeData)(input)).edge; var prob = (Edge)problem; if (prob.From.Length == prob.NumEdges) // we're full, need to expand { var from_ = new int[prob.NumEdges * 2]; var to_ = new int[prob.NumEdges * 2]; var reading_ = new int[prob.NumEdges * 2]; Array.Copy(prob.From, 0, from_, 0, prob.From.Length); Array.Copy(prob.To, 0, to_, 0, prob.To.Length); Array.Copy(prob.Reading, 0, reading_, 0, prob.Reading.Length); prob.From = from_; prob.To = to_; prob.Reading = reading_; } if (prob.Start.Length == prob.NumNodes) // we're full, need to expand { var start_ = new bool[prob.NumNodes * 2]; var accept_ = new bool[prob.NumNodes * 2]; Array.Copy(prob.Start, 0, start_, 0, prob.Start.Length); Array.Copy(prob.Accept, 0, accept_, 0, prob.Accept.Length); prob.Start = start_; prob.Accept = accept_; } var newedge = prob.NumEdges; prob.NumEdges++; var newnode = prob.NumNodes; prob.NumNodes++; // set up new node prob.Accept[newnode] = false; prob.Start[newnode] = false; // set up new edge prob.From[newedge] = prob.To[edge]; prob.To[newedge] = newnode; prob.Reading[newedge] = prob.Reading[edge]; // pass the original edge down the left child Children[0].Eval(state, thread, input, stack, individual, problem); // reset input for right child ((EdgeData)(input)).edge = newedge; // pass the new edge down the right child Children[1].Eval(state, thread, input, stack, individual, problem); }
public override void Eval( IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (Ant)problem; switch (p.Orientation) { case Ant.O_UP: p.Orientation = Ant.O_RIGHT; break; case Ant.O_LEFT: p.Orientation = Ant.O_UP; break; case Ant.O_DOWN: p.Orientation = Ant.O_LEFT; break; case Ant.O_RIGHT: p.Orientation = Ant.O_DOWN; break; default: // whoa! state.Output.Fatal("Whoa, somehow I got a bad orientation! (" + p.Orientation + ")"); break; } p.Moves++; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var image = ((FeatureExtractionProblem)problem).currentImage[thread]; var transformer = ((FeatureExtractionProblem)problem).imageTransformer; transformer.TransformImage(image, (Image.ImageTransformer.TransformationType)morphType); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (FeatureExtractionProblem)problem; Children[0].Eval(state, thread, input, stack, individual, problem); p.imageTransformer.TransformImage(p.currentImage[thread], Image.ImageTransformer.TransformationType.OPEN); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (FeatureExtractionProblem2)problem; Children[0].Eval(state, thread, input, stack, individual, problem); p.currentImage[thread] = p.imageTransformer.RotateViaCenter(p.currentImage[thread], 20); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (FeatureExtractionProblem)problem; Children[0].Eval(state, thread, input, stack, individual, problem); p.currentImage[thread] = p.currentImage[thread].Not(); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { Children[0].Eval(state, thread, input, stack, individual, problem); var md = (MajorityData)input; long y0 = md.Data0; long y1 = md.Data1; Children[1].Eval(state, thread, input, stack, individual, problem); long z0 = md.Data0; long z1 = md.Data1; Children[2].Eval(state, thread, input, stack, individual, problem); // IF Y THEN Z ELSE MD is // (Y -> Z) ^ (~Y -> MD) // (!Y v Z) ^ (Y v MD) md.Data0 = (~y0 | z0) & (y0 | md.Data0); md.Data1 = (~y1 | z1) & (y1 | md.Data1); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var md = (MultiplexerData)input; Children[0].Eval(state, thread, input, stack, individual, problem); if (md.Status == MultiplexerData.STATUS_3) { md.Dat3 = (byte)(md.Dat3 ^ -1); // BRS: this was originally "md.dat_3 ^= -1;" } else if (md.Status == MultiplexerData.STATUS_6) { md.Dat6 ^= -1L; } else // md.status == MultiplexerData.STATUS_11 { for (var x = 0; x < MultiplexerData.MULTI_11_NUM_BITSTRINGS; x++) { md.Dat11[x] ^= -1L; } } }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var cProblem = (MultiClassifierProblem)problem; ((ClassificationData)input).doubleVal = cProblem.CurrentParam[paramIndex]; ((ClassificationData)input).index = (int)paramIndex; }
/// <summary> /// Just like eval, but it retraces the map and prints out info. /// </summary> public void EvalPrint(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem, int[][] map2) { var p = (Ant)problem; switch (p.Orientation) { case Ant.O_UP: p.PosY--; if (p.PosY < 0) { p.PosY = p.MaxY - 1; } break; case Ant.O_LEFT: p.PosX--; if (p.PosX < 0) { p.PosX = p.MaxX - 1; } break; case Ant.O_DOWN: p.PosY++; if (p.PosY >= p.MaxY) { p.PosY = 0; } break; case Ant.O_RIGHT: p.PosX++; if (p.PosX >= p.MaxX) { p.PosX = 0; } break; default: // whoa! state.Output.Fatal("Whoa, somehow I got a bad orientation! (" + p.Orientation + ")"); break; } p.Moves++; if (p.Map[p.PosX][p.PosY] == Ant.FOOD && p.Moves < p.MaxMoves) { p.Sum++; p.Map[p.PosX][p.PosY] = Ant.ATE; } if (p.Moves < p.MaxMoves) { if (++p.PMod > 122 /* ascii z */) { p.PMod = 97; /* ascii a */ } map2[p.PosX][p.PosY] = p.PMod; } }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { ((MultiplexerData)input).x = (((Multiplexer)problem).addressPart >> 0) & 1; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // No need to evaluate or look at children. }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // no need to do anything here }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { Children[0].Eval(state, thread, input, stack, individual, problem); ((MultiplexerData)input).x ^= 1; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { ((ParityData)input).x = ((((Parity)problem).bits >> 31) & 1); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { index = ((ClassificationData)input).index; var minVal = ((MultiClassifierProblem)problem).Dataset.MinValues[index]; var maxVal = ((MultiClassifierProblem)problem).Dataset.MaxValues[index]; printedValue = Math.Round(minVal + (maxVal - minVal) * value); //if (val == maxVal) // val = -1; ((ClassificationData)input).doubleVal = printedValue; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // Evaluate both children. Return the second one (done automagically). Children[0].Eval(state, thread, input, stack, individual, problem); Children[1].Eval(state, thread, input, stack, individual, problem); }
public void EvalPrint( IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem, int[][] map2) { Eval(state, thread, input, stack, individual, problem); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var rd = ((DoubleData)(input)); rd.x = ((MultiValuedRegression)problem).currentX; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var rd = (RegressionData)input; rd.x = ((Regression)problem).CurrentValue; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var rd = ((RegressionData)(input)); Children[0].Eval(state, thread, input, stack, individual, problem); rd.x = rd.x * rd.x; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var rd = ((TwoBoxData)input); var tb = ((TwoBox)problem); rd.x = tb.inputsh0[tb.currentIndex]; }
public override void eval(ec.EvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, Problem problem) { UnityProblem p = (UnityProblem)problem; GameObject ball = p.model.ball.gameObject; GameObject car = p.model.car.gameObject; ((RegressionData)input).x = Vector3.Distance(ball.transform.position, car.transform.position); }
public override void Eval( IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // Evaluate both children. Easy as cake. Children[0].Eval(state, thread, input, stack, individual, problem); Children[1].Eval(state, thread, input, stack, individual, problem); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var rd = ((LawnmowerData)(input)); rd.x = x; rd.y = y; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var md = (MajorityData)input; md.Data0 = X0; md.Data1 = X1; }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var p = (FeatureExtractionProblem2)problem; var c0 = p.currentImage[thread].Copy(); Children[0].Eval(state, thread, input, stack, individual, problem); var c1 = p.currentImage[thread].Copy(); c0.CopyTo(p.currentImage[thread]); Children[1].Eval(state, thread, input, stack, individual, problem); p.currentImage[thread] = p.currentImage[thread].Mul(c1); }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var md = (MultiplexerData)input; long[] dat_11 = null; // quiets compiler complaints long dat_6 = 0L; byte dat_3 = 0; // No shortcuts for now Children[0].Eval(state, thread, input, stack, individual, problem); if (md.Status == MultiplexerData.STATUS_3) { dat_3 = md.Dat3; } else if (md.Status == MultiplexerData.STATUS_6) { dat_6 = md.Dat6; } else // md.status == MultiplexerData.STATUS_11 { dat_11 = md.PopDat11(); Array.Copy(md.Dat11, 0, dat_11, 0, MultiplexerData.MULTI_11_NUM_BITSTRINGS); } Children[1].Eval(state, thread, input, stack, individual, problem); // modify if (md.Status == MultiplexerData.STATUS_3) { md.Dat3 |= dat_3; } else if (md.Status == MultiplexerData.STATUS_6) { md.Dat6 |= dat_6; } else // md.status == MultiplexerData.STATUS_11 { for (int x = 0; x < MultiplexerData.MULTI_11_NUM_BITSTRINGS; x++) { md.Dat11[x] |= dat_11[x]; } md.PushDat11(dat_11); } }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { var edge = ((EdgeData)(input)).edge; var prob = (Edge)problem; prob.Reading[edge] = Edge.EPSILON; }