Changeset 14733 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions
- Timestamp:
- 03/08/17 11:57:42 (8 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/BooleanExpressions.cs
r14727 r14733 9 9 [PushExpression(StackType.Boolean, "BOOLEAN.AND")] 10 10 public class BooleanAndExpression : PushResultExpression<bool> { 11 public override void Eval(IPush GpInterpreter interpreter) {11 public override void Eval(IPushInterpreter interpreter) { 12 12 this.Eval(interpreter.BooleanStack, 2, values => values[0] && values[1]); 13 13 } … … 19 19 [PushExpression(StackType.Boolean, "BOOLEAN.OR")] 20 20 public class BooleanOrExpression : PushResultExpression<bool> { 21 public override void Eval(IPush GpInterpreter interpreter) {21 public override void Eval(IPushInterpreter interpreter) { 22 22 this.Eval(interpreter.BooleanStack, 2, values => values[0] || values[1]); 23 23 } … … 29 29 [PushExpression(StackType.Boolean, "BOOLEAN.NOT")] 30 30 public class BooleanNotExpression : PushResultExpression<bool> { 31 public override void Eval(IPush GpInterpreter interpreter) {31 public override void Eval(IPushInterpreter interpreter) { 32 32 this.Eval(interpreter.BooleanStack, 1, values => !values[0]); 33 33 } … … 39 39 [PushExpression(StackType.Boolean, "BOOLEAN.FROMFLOAT")] 40 40 public class BooleanFromFloatExpression : StatelessExpression { 41 public override void Eval(IPush GpInterpreter interpreter) {41 public override void Eval(IPushInterpreter interpreter) { 42 42 if (interpreter.FloatStack.Count == 0) return; 43 43 … … 53 53 [PushExpression(StackType.Boolean, "BOOLEAN.FROMINTEGER")] 54 54 public class BooleanFromIntegerExpression : StatelessExpression { 55 public override void Eval(IPush GpInterpreter interpreter) {55 public override void Eval(IPushInterpreter interpreter) { 56 56 if (interpreter.IntegerStack.Count == 0) return; 57 57 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/CodeExpressions.cs
r14727 r14733 22 22 [PushExpression(StackType.Code, "CODE.DO")] 23 23 public class CodeDoExpression : StatelessExpression { 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 // not enough arguments on stack 26 26 if (interpreter.CodeStack.Count == 0) return; … … 36 36 [PushExpression(StackType.Code, "CODE.DO*")] 37 37 public class CodeDoXExpression : StatelessExpression { 38 public override void Eval(IPush GpInterpreter interpreter) {38 public override void Eval(IPushInterpreter interpreter) { 39 39 // not enough arguments on stack 40 40 if (interpreter.CodeStack.Count == 0) return; … … 50 50 [PushExpression(StackType.Code, "CODE.NOOP")] 51 51 public class CodeNoopExpression : StatelessExpression { 52 public override void Eval(IPush GpInterpreter interpreter) {52 public override void Eval(IPushInterpreter interpreter) { 53 53 // nothing to do 54 54 } … … 61 61 [PushExpression(StackType.Code, "CODE.QUOTE")] 62 62 public class CodeQuoteExpression : StatelessExpression { 63 public override void Eval(IPush GpInterpreter interpreter) {63 public override void Eval(IPushInterpreter interpreter) { 64 64 // not enough arguments on stack 65 65 if (interpreter.ExecStack.Count == 0) return; … … 77 77 [PushExpression(StackType.Code, "CODE.IF")] 78 78 public class CodeIfExpression : StatelessExpression { 79 public override void Eval(IPush GpInterpreter interpreter) {79 public override void Eval(IPushInterpreter interpreter) { 80 80 // not enough arguments on stack 81 81 if ((interpreter.BooleanStack.Count == 0) || (interpreter.CodeStack.Count < 2)) return; … … 94 94 [PushExpression(StackType.Code, "CODE.APPEND")] 95 95 public class CodeAppendExpression : StatelessExpression { 96 public override void Eval(IPush GpInterpreter interpreter) {96 public override void Eval(IPushInterpreter interpreter) { 97 97 if (interpreter.CodeStack.Count < 2) return; 98 98 … … 163 163 [PushExpression(StackType.Code, "CODE.ATOM")] 164 164 public class CodeAtomExpression : StatelessExpression { 165 public override void Eval(IPush GpInterpreter interpreter) {165 public override void Eval(IPushInterpreter interpreter) { 166 166 if (interpreter.CodeStack.Count == 0) return; 167 167 … … 181 181 [PushExpression(StackType.Code, "CODE.CAR")] 182 182 public class CodeCarExpression : StatelessExpression { 183 public override void Eval(IPush GpInterpreter interpreter) {183 public override void Eval(IPushInterpreter interpreter) { 184 184 if ((interpreter.CodeStack.Count == 0) || (interpreter.CodeStack.Top.GetType() != 185 185 typeof(ExecExpandExpression))) return; … … 202 202 [PushExpression(StackType.Code, "CODE.CDR")] 203 203 public class CodeCdrExpression : StatelessExpression { 204 public override void Eval(IPush GpInterpreter interpreter) {204 public override void Eval(IPushInterpreter interpreter) { 205 205 if (interpreter.CodeStack.Count == 0) return; 206 206 … … 233 233 [PushExpression(StackType.Code, "CODE.CONS")] 234 234 public class CodeConsExpression : StatelessExpression { 235 public override void Eval(IPush GpInterpreter interpreter) {235 public override void Eval(IPushInterpreter interpreter) { 236 236 if (interpreter.CodeStack.Count < 2) 237 237 return; … … 269 269 [PushExpression(StackType.Code, "CODE.CONTAINER")] 270 270 public class CodeContainerExpression : StatelessExpression { 271 public override void Eval(IPush GpInterpreter interpreter) {271 public override void Eval(IPushInterpreter interpreter) { 272 272 if ((interpreter.CodeStack.Count < 2) || 273 273 (interpreter.CodeStack[interpreter.CodeStack.Count - 2].GetType() != … … 307 307 [PushExpression(StackType.Code, "CODE.CONTAINS")] 308 308 public class CodeContainsExpression : StatelessExpression { 309 public override void Eval(IPush GpInterpreter interpreter) {309 public override void Eval(IPushInterpreter interpreter) { 310 310 if (interpreter.CodeStack.Count < 2 || 311 311 !interpreter.CodeStack[interpreter.CodeStack.Count - 2].CanExpand) … … 327 327 [PushExpression(StackType.Code, "CODE.DEFINITION")] 328 328 public class CodeDefinitionExpression : StatelessExpression { 329 public override void Eval(IPush GpInterpreter interpreter) {329 public override void Eval(IPushInterpreter interpreter) { 330 330 if ((interpreter.NameStack.Count == 0) || 331 331 !interpreter.CustomExpressions.ContainsKey(interpreter.NameStack.Top)) return; … … 363 363 [PushExpression(StackType.Code, "CODE.DISCREPANCY")] 364 364 public class CodeDiscrepancyExpression : StatelessExpression { 365 public override void Eval(IPush GpInterpreter interpreter) {365 public override void Eval(IPushInterpreter interpreter) { 366 366 if (interpreter.CodeStack.Count < 2) return; 367 367 … … 418 418 [PushExpression(StackType.Code, "CODE.EXTRACT")] 419 419 public class CodeExtractExpression : StatelessExpression { 420 public override void Eval(IPush GpInterpreter interpreter) {420 public override void Eval(IPushInterpreter interpreter) { 421 421 if (interpreter.IntegerStack.Count == 0 || 422 422 interpreter.CodeStack.Count == 0 || … … 437 437 [PushExpression(StackType.Code, "CODE.FROMBOOLEAN")] 438 438 public class CodeFromBooleanExpression : StatelessExpression { 439 public override void Eval(IPush GpInterpreter interpreter) {439 public override void Eval(IPushInterpreter interpreter) { 440 440 if (interpreter.BooleanStack.Count == 0) return; 441 441 … … 452 452 [PushExpression(StackType.Code, "CODE.FROMFLOAT")] 453 453 public class CodeFromFloatExpression : StatelessExpression { 454 public override void Eval(IPush GpInterpreter interpreter) {454 public override void Eval(IPushInterpreter interpreter) { 455 455 if (interpreter.FloatStack.Count == 0) return; 456 456 … … 467 467 [PushExpression(StackType.Code, "CODE.FROMINTEGER")] 468 468 public class CodeFromIntegerExpression : StatelessExpression { 469 public override void Eval(IPush GpInterpreter interpreter) {469 public override void Eval(IPushInterpreter interpreter) { 470 470 if (interpreter.IntegerStack.Count == 0) return; 471 471 … … 482 482 [PushExpression(StackType.Code, "CODE.FROMNAME")] 483 483 public class CodeFromNameExpression : StatelessExpression { 484 public override void Eval(IPush GpInterpreter interpreter) {484 public override void Eval(IPushInterpreter interpreter) { 485 485 if (interpreter.NameStack.Count == 0) return; 486 486 … … 498 498 [PushExpression(StackType.Code, "CODE.CODEINSERT")] 499 499 public class CodeInsertExpression : StatelessExpression { 500 public override void Eval(IPush GpInterpreter interpreter) {500 public override void Eval(IPushInterpreter interpreter) { 501 501 if (interpreter.IntegerStack.Count == 0 || 502 502 interpreter.CodeStack.Count < 2 || … … 533 533 [PushExpression(StackType.Code, "CODE.LENGTH")] 534 534 public class CodeLengthExpression : StatelessExpression { 535 public override void Eval(IPush GpInterpreter interpreter) {535 public override void Eval(IPushInterpreter interpreter) { 536 536 if (interpreter.CodeStack.Count == 0) return; 537 537 … … 551 551 [PushExpression(StackType.Code, "CODE.LIST")] 552 552 public class CodeListExpression : StatelessExpression { 553 public override void Eval(IPush GpInterpreter interpreter) {553 public override void Eval(IPushInterpreter interpreter) { 554 554 if (interpreter.CodeStack.Count < 2) return; 555 555 … … 568 568 [PushExpression(StackType.Code, "CODE.MEMBER")] 569 569 public class CodeMemberExpression : StatelessExpression { 570 public override void Eval(IPush GpInterpreter interpreter) {570 public override void Eval(IPushInterpreter interpreter) { 571 571 if (interpreter.CodeStack.Count < 2) return; 572 572 … … 588 588 [PushExpression(StackType.Code, "CODE.NTH")] 589 589 public class CodeNthExpression : StatelessExpression { 590 public override void Eval(IPush GpInterpreter interpreter) {590 public override void Eval(IPushInterpreter interpreter) { 591 591 if ((interpreter.CodeStack.Count == 0) || (interpreter.IntegerStack.Count == 0)) return; 592 592 … … 625 625 [PushExpression(StackType.Code, "CODE.NTHCDR")] 626 626 public class CodeNthCdrExpression : StatelessExpression { 627 public override void Eval(IPush GpInterpreter interpreter) {627 public override void Eval(IPushInterpreter interpreter) { 628 628 if ((interpreter.CodeStack.Count == 0) || (interpreter.IntegerStack.Count == 0)) return; 629 629 … … 656 656 [PushExpression(StackType.Code, "CODE.NULL")] 657 657 public class CodeNullExpression : StatelessExpression { 658 public override void Eval(IPush GpInterpreter interpreter) {658 public override void Eval(IPushInterpreter interpreter) { 659 659 if (interpreter.CodeStack.Count == 0) return; 660 660 … … 671 671 [PushExpression(StackType.Code, "CODE.POSITION")] 672 672 public class CodePositionExpression : StatelessExpression { 673 public override void Eval(IPush GpInterpreter interpreter) {673 public override void Eval(IPushInterpreter interpreter) { 674 674 if (interpreter.CodeStack.Count < 2) return; 675 675 … … 697 697 [PushExpression(StackType.Code, "CODE.SIZE")] 698 698 public class CodeSizeExpression : StatelessExpression { 699 public override void Eval(IPush GpInterpreter interpreter) {699 public override void Eval(IPushInterpreter interpreter) { 700 700 if (interpreter.CodeStack.Count == 0) return; 701 701 … … 717 717 [PushExpression(StackType.Code, "CODE.SUBST")] 718 718 public class CodeSubstitutionExpression : StatelessExpression { 719 public override void Eval(IPush GpInterpreter interpreter) {719 public override void Eval(IPushInterpreter interpreter) { 720 720 if ((interpreter.CodeStack.Count < 3) || (interpreter.CodeStack.Top.GetType() != 721 721 typeof(ExecExpandExpression))) return; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DefineExpressions.cs
r14727 r14733 31 31 [PushExpression(StackType.Code, "CODE.DEFINE")] 32 32 public class CodeDefineExpression : DefineExpression<Expression> { 33 public override void Eval(IPush GpInterpreter interpreter) {33 public override void Eval(IPushInterpreter interpreter) { 34 34 if (interpreter.Configuration.TopLevelPushCode && (interpreter.CodeStack.Count < 2)) return; 35 35 … … 46 46 [PushExpression(StackType.Exec, "EXEC.DEFINE")] 47 47 public class ExecDefineExpression : DefineExpression<Expression> { 48 public override void Eval(IPush GpInterpreter interpreter) {48 public override void Eval(IPushInterpreter interpreter) { 49 49 if (interpreter.ExecStack.Count < 2) return; 50 50 … … 62 62 public class FloatDefineExpression : DefineExpression<double> { 63 63 64 public override void Eval(IPush GpInterpreter interpreter) {64 public override void Eval(IPushInterpreter interpreter) { 65 65 this.Eval( 66 66 interpreter.FloatStack, … … 73 73 [PushExpression(StackType.Integer, "INTEGER.DEFINE")] 74 74 public class IntegerDefineExpression : DefineExpression<long> { 75 public override void Eval(IPush GpInterpreter interpreter) {75 public override void Eval(IPushInterpreter interpreter) { 76 76 this.Eval( 77 77 interpreter.IntegerStack, … … 84 84 [PushExpression(StackType.Boolean, "BOOLEAN.DEFINE")] 85 85 public class BooleanDefineExpression : DefineExpression<bool> { 86 public override void Eval(IPush GpInterpreter interpreter) {86 public override void Eval(IPushInterpreter interpreter) { 87 87 this.Eval( 88 88 interpreter.BooleanStack, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoCountExpressions.cs
r14727 r14733 8 8 protected DoCountExpression() { } 9 9 protected DoCountExpression(LoopState state) : base(state) { } 10 protected override bool HasInsufficientArguments(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {10 protected override bool HasInsufficientArguments(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 11 11 return interpreter.IntegerStack.Count < 1 || 12 12 sourceStack.Count == 0 || … … 14 14 } 15 15 16 protected override LoopState InitState(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {16 protected override LoopState InitState(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 17 17 var state = new LoopState( 18 18 body: sourceStack.Pop(), … … 47 47 public CodeDoCountExpression(LoopState state) : base(state) { } 48 48 49 public override void Eval(IPush GpInterpreter interpreter) {49 public override void Eval(IPushInterpreter interpreter) { 50 50 this.Eval(interpreter, interpreter.CodeStack); 51 51 } … … 75 75 public ExecDoCountExpression(LoopState state) : base(state) { } 76 76 77 public override void Eval(IPush GpInterpreter interpreter) {77 public override void Eval(IPushInterpreter interpreter) { 78 78 this.Eval(interpreter, interpreter.ExecStack); 79 79 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoRangeExpressions.cs
r14727 r14733 7 7 protected DoRangeExpression() { } 8 8 protected DoRangeExpression(LoopState state) : base(state) { } 9 protected override bool HasInsufficientArguments(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {9 protected override bool HasInsufficientArguments(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 10 10 return interpreter.IntegerStack.Count < 2 || 11 11 sourceStack.Count == 0 || … … 13 13 } 14 14 15 protected override LoopState InitState(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {15 protected override LoopState InitState(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 16 16 var destinationIndex = interpreter.IntegerStack.Pop(); 17 17 var incrementor = destinationIndex < interpreter.IntegerStack.Top ? -1 : 1; … … 52 52 53 53 public CodeDoRangeExpression(LoopState state) : base(state) { } 54 public override void Eval(IPush GpInterpreter interpreter) {54 public override void Eval(IPushInterpreter interpreter) { 55 55 this.Eval(interpreter, interpreter.CodeStack); 56 56 } … … 90 90 91 91 public ExecDoRangeExpression(LoopState state) : base(state) { } 92 public override void Eval(IPush GpInterpreter interpreter) {92 public override void Eval(IPushInterpreter interpreter) { 93 93 this.Eval(interpreter, interpreter.ExecStack); 94 94 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoTimesExpressions.cs
r14727 r14733 7 7 protected DoTimesExpression() { } 8 8 protected DoTimesExpression(LoopState state) : base(state) { } 9 protected override bool HasInsufficientArguments(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {9 protected override bool HasInsufficientArguments(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 10 10 return (interpreter.IntegerStack.Count < 1) || (sourceStack.Count == 0) || (interpreter.IntegerStack.Top <= 0); 11 11 } 12 12 13 protected override LoopState InitState(IPush GpInterpreter interpreter, IStack<Expression> sourceStack) {13 protected override LoopState InitState(IPushInterpreter interpreter, IStack<Expression> sourceStack) { 14 14 //this.State.Body = sourceStack.Pop(); 15 15 //this.State.DestinationIndex = interpreter.IntegerStack.Pop(); … … 24 24 } 25 25 26 protected override void PushIteration(IPush GpInterpreter interpreter) {26 protected override void PushIteration(IPushInterpreter interpreter) { 27 27 var newState = new LoopState(State.Body, State.CurrentIndex + this.State.Incrementor, State.DestinationIndex, State.Incrementor); 28 28 var nextLoopExpression = Clone(newState); … … 31 31 } 32 32 33 protected override void PushLastIteration(IPush GpInterpreter interpreter) {33 protected override void PushLastIteration(IPushInterpreter interpreter) { 34 34 interpreter.ExecStack.Push(this.State.Body); 35 35 } … … 47 47 public CodeDoTimesExpression(LoopState state) : base(state) { } 48 48 49 public override void Eval(IPush GpInterpreter interpreter) {49 public override void Eval(IPushInterpreter interpreter) { 50 50 this.Eval(interpreter, interpreter.CodeStack); 51 51 } … … 70 70 public ExecDoTimesExpression(LoopState state) : base(state) { } 71 71 72 public override void Eval(IPush GpInterpreter interpreter) {72 public override void Eval(IPushInterpreter interpreter) { 73 73 this.Eval(interpreter, interpreter.ExecStack); 74 74 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DuplicateExpressions.cs
r14727 r14733 27 27 [PushExpression(StackType.Integer, "INTEGER.DUP")] 28 28 public class IntegerDuplicateExpression : DuplicateExpression<long> { 29 public override void Eval(IPush GpInterpreter interpreter) {29 public override void Eval(IPushInterpreter interpreter) { 30 30 this.Eval(interpreter.IntegerStack); 31 31 } … … 34 34 [PushExpression(StackType.Float, "FLOAT.DUP")] 35 35 public class FloatDuplicateExpression : DuplicateExpression<double> { 36 public override void Eval(IPush GpInterpreter interpreter) {36 public override void Eval(IPushInterpreter interpreter) { 37 37 this.Eval(interpreter.FloatStack); 38 38 } … … 41 41 [PushExpression(StackType.Boolean, "BOOLEAN.DUP")] 42 42 public class BooleanDuplicateExpression : DuplicateExpression<bool> { 43 public override void Eval(IPush GpInterpreter interpreter) {43 public override void Eval(IPushInterpreter interpreter) { 44 44 this.Eval(interpreter.BooleanStack); 45 45 } … … 48 48 [PushExpression(StackType.Name, "NAME.DUP")] 49 49 public class NameDuplicateExpression : DuplicateExpression<string> { 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 this.Eval(interpreter.NameStack); 52 52 } … … 55 55 [PushExpression(StackType.Exec, "EXEC.DUP")] 56 56 public class ExecDuplicateExpression : DuplicateExpression<Expression> { 57 public override void Eval(IPush GpInterpreter interpreter) {57 public override void Eval(IPushInterpreter interpreter) { 58 58 this.Eval(interpreter.ExecStack); 59 59 } … … 62 62 [PushExpression(StackType.Code, "CODE.DUP")] 63 63 public class CodeDuplicateExpression : DuplicateExpression<Expression> { 64 public override void Eval(IPush GpInterpreter interpreter) {64 public override void Eval(IPushInterpreter interpreter) { 65 65 this.Eval(interpreter.CodeStack); 66 66 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/EqualsExpressions.cs
r14727 r14733 20 20 [PushExpression(StackType.Integer, "INTEGER.=")] 21 21 public class IntegerEqualsExpression : EqualsExpression<long> { 22 public override void Eval(IPush GpInterpreter interpreter) {22 public override void Eval(IPushInterpreter interpreter) { 23 23 this.Eval(interpreter.IntegerStack, interpreter.BooleanStack); 24 24 } … … 27 27 [PushExpression(StackType.Float, "FLOAT.=")] 28 28 public class FloatEqualsExpression : EqualsExpression<double> { 29 public override void Eval(IPush GpInterpreter interpreter) {29 public override void Eval(IPushInterpreter interpreter) { 30 30 this.Eval(interpreter.FloatStack, interpreter.BooleanStack); 31 31 } … … 34 34 [PushExpression(StackType.Boolean, "BOOLEAN.=")] 35 35 public class BooleanEqualsExpression : EqualsExpression<bool> { 36 public override void Eval(IPush GpInterpreter interpreter) {36 public override void Eval(IPushInterpreter interpreter) { 37 37 this.Eval(interpreter.BooleanStack, interpreter.BooleanStack); 38 38 } … … 41 41 [PushExpression(StackType.Name, "NAME.=")] 42 42 public class NameEqualsExpression : EqualsExpression<string> { 43 public override void Eval(IPush GpInterpreter interpreter) {43 public override void Eval(IPushInterpreter interpreter) { 44 44 this.Eval(interpreter.NameStack, interpreter.BooleanStack); 45 45 } … … 48 48 [PushExpression(StackType.Exec, "EXEC.=")] 49 49 public class ExecEqualsExpression : EqualsExpression<Expression> { 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 this.Eval(interpreter.ExecStack, interpreter.BooleanStack); 52 52 } … … 55 55 [PushExpression(StackType.Code, "CODE.=")] 56 56 public class CodeEqualsExpression : EqualsExpression<Expression> { 57 public override void Eval(IPush GpInterpreter interpreter) {57 public override void Eval(IPushInterpreter interpreter) { 58 58 this.Eval(interpreter.CodeStack, interpreter.BooleanStack); 59 59 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExecExpressions.cs
r14729 r14733 9 9 using Interpreter; 10 10 11 public class ExecExpandExpression : Stateful lExpression<PushProgram> {11 public class ExecExpandExpression : StatefulExpression<PushProgram> { 12 12 public static readonly ExecExpandExpression Empty = new ExecExpandExpression(); 13 13 … … 32 32 } 33 33 34 public override void Eval(IPush GpInterpreter interpreter) {34 public override void Eval(IPushInterpreter interpreter) { 35 35 interpreter.ExecStack.Push(this.State.Expressions); 36 36 } … … 81 81 [PushExpression(StackType.Exec, "EXEC.IF")] 82 82 public class ExecIfExpression : StatelessExpression { 83 public override void Eval(IPush GpInterpreter interpreter) {83 public override void Eval(IPushInterpreter interpreter) { 84 84 // not enough arguments on stack 85 85 if ((interpreter.BooleanStack.Count == 0) || (interpreter.ExecStack.Count < 2)) return; … … 98 98 [PushExpression(StackType.Exec, "EXEC.Y")] 99 99 public class ExecYExpression : StatelessExpression { 100 public override void Eval(IPush GpInterpreter interpreter) {100 public override void Eval(IPushInterpreter interpreter) { 101 101 // not enough arguments on stack 102 102 if (interpreter.ExecStack.Count == 0 || … … 119 119 [PushExpression(StackType.Exec, "EXEC.K")] 120 120 public class ExecKExpression : StatelessExpression { 121 public override void Eval(IPush GpInterpreter interpreter) {121 public override void Eval(IPushInterpreter interpreter) { 122 122 if (interpreter.ExecStack.Count < 2) return; 123 123 … … 134 134 [PushExpression(StackType.Exec, "EXEC.S")] 135 135 public class ExecSExpression : StatelessExpression { 136 public override void Eval(IPush GpInterpreter interpreter) {136 public override void Eval(IPushInterpreter interpreter) { 137 137 if (interpreter.ExecStack.Count < 3) return; 138 138 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/Expression.cs
r14727 r14733 24 24 } 25 25 26 public abstract void Eval(IPush GpInterpreter interpreter);26 public abstract void Eval(IPushInterpreter interpreter); 27 27 28 28 public override string ToString() { -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExpressionTable.cs
r14727 r14733 65 65 private static Dictionary<string, Func<Expression>> GetStatefullExpressionFactory() { 66 66 var dictionary = new Dictionary<string, Func<Expression>>(); 67 var statefullExpressionType = typeof(Stateful lExpression<>);67 var statefullExpressionType = typeof(StatefulExpression<>); 68 68 var expressionTypes = GetExpressionTypes(statefullExpressionType); 69 69 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/FloatExpressions.cs
r14727 r14733 11 11 [PushExpression(StackType.Float, "FLOAT.+")] 12 12 public class FloatAddExpression : PushResultExpression<double> { 13 public override void Eval(IPush GpInterpreter interpreter) {13 public override void Eval(IPushInterpreter interpreter) { 14 14 Eval(interpreter.FloatStack, 2, values => values[0] + values[1]); 15 15 } … … 21 21 [PushExpression(StackType.Float, "FLOAT.-")] 22 22 public class FloatSubtractExpression : PushResultExpression<double> { 23 public override void Eval(IPush GpInterpreter interpreter) {23 public override void Eval(IPushInterpreter interpreter) { 24 24 this.Eval(interpreter.FloatStack, 2, values => values[0] - values[1]); 25 25 } … … 31 31 [PushExpression(StackType.Float, "FLOAT.*")] 32 32 public class FloatMultiplyExpression : PushResultExpression<double> { 33 public override void Eval(IPush GpInterpreter interpreter) {33 public override void Eval(IPushInterpreter interpreter) { 34 34 this.Eval(interpreter.FloatStack, 2, values => values[0] * values[1]); 35 35 } … … 42 42 [PushExpression(StackType.Float, "FLOAT./")] 43 43 public class FloatDivideExpression : PushResultExpression<double> { 44 public override void Eval(IPush GpInterpreter interpreter) {44 public override void Eval(IPushInterpreter interpreter) { 45 45 this.Eval(interpreter.FloatStack, 2, values => values[0] / values[1], 0); 46 46 } … … 56 56 [PushExpression(StackType.Float, "FLOAT.%")] 57 57 public class FloatModuloExpression : PushResultExpression<double> { 58 public override void Eval(IPush GpInterpreter interpreter) {58 public override void Eval(IPushInterpreter interpreter) { 59 59 this.Eval(interpreter.FloatStack, 2, values => values[0] % values[1], 0); 60 60 } … … 66 66 [PushExpression(StackType.Float, "FLOAT.MIN")] 67 67 public class FloatMinExpression : PushResultExpression<double> { 68 public override void Eval(IPush GpInterpreter interpreter) {68 public override void Eval(IPushInterpreter interpreter) { 69 69 this.Eval(interpreter.FloatStack, 2, values => Math.Min(values[0], values[1])); 70 70 } … … 76 76 [PushExpression(StackType.Float, "FLOAT.MAX")] 77 77 public class FloatMaxExpression : PushResultExpression<double> { 78 public override void Eval(IPush GpInterpreter interpreter) {78 public override void Eval(IPushInterpreter interpreter) { 79 79 this.Eval(interpreter.FloatStack, 2, values => Math.Max(values[0], values[1])); 80 80 } … … 86 86 [PushExpression(StackType.Float, "FLOAT.<")] 87 87 public class FloatSmallerThanExpression : PushResultExpression<double> { 88 public override void Eval(IPush GpInterpreter interpreter) {88 public override void Eval(IPushInterpreter interpreter) { 89 89 this.Eval(interpreter.FloatStack, interpreter.BooleanStack, 2, values => values[0] < values[1]); 90 90 } … … 96 96 [PushExpression(StackType.Float, "FLOAT.>")] 97 97 public class FloatGreaterThanExpression : PushResultExpression<double> { 98 public override void Eval(IPush GpInterpreter interpreter) {98 public override void Eval(IPushInterpreter interpreter) { 99 99 this.Eval(interpreter.FloatStack, interpreter.BooleanStack, 2, values => values[0] > values[1]); 100 100 } … … 106 106 [PushExpression(StackType.Float, "FLOAT.SIN")] 107 107 public class FloatSineExpression : PushResultExpression<double> { 108 public override void Eval(IPush GpInterpreter interpreter) {108 public override void Eval(IPushInterpreter interpreter) { 109 109 this.Eval(interpreter.FloatStack, 1, values => Math.Sin(values[0])); 110 110 } … … 116 116 [PushExpression(StackType.Float, "FLOAT.COS")] 117 117 public class FloatCosineExpression : PushResultExpression<double> { 118 public override void Eval(IPush GpInterpreter interpreter) {118 public override void Eval(IPushInterpreter interpreter) { 119 119 this.Eval(interpreter.FloatStack, 1, values => Math.Cos(values[0])); 120 120 } … … 126 126 [PushExpression(StackType.Float, "FLOAT.FROMBOOLEAN")] 127 127 public class FloatFromBooleanExpression : StatelessExpression { 128 public override void Eval(IPush GpInterpreter interpreter) {128 public override void Eval(IPushInterpreter interpreter) { 129 129 if (interpreter.BooleanStack.Count == 0) return; 130 130 … … 141 141 [PushExpression(StackType.Float, "FLOAT.FROMINTEGER")] 142 142 public class FloatFromIntegerExpression : StatelessExpression { 143 public override void Eval(IPush GpInterpreter interpreter) {143 public override void Eval(IPushInterpreter interpreter) { 144 144 if (interpreter.IntegerStack.Count == 0) return; 145 145 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/FlushExpressions.cs
r14727 r14733 17 17 [PushExpression(StackType.Integer, "INTEGER.FLUSH")] 18 18 public class IntegerFlushExpression : FlushExpression<long> { 19 public override void Eval(IPush GpInterpreter interpreter) {19 public override void Eval(IPushInterpreter interpreter) { 20 20 Eval(interpreter.IntegerStack); 21 21 } … … 24 24 [PushExpression(StackType.Float, "FLOAT.FLUSH")] 25 25 public class FloatFlushExpression : FlushExpression<double> { 26 public override void Eval(IPush GpInterpreter interpreter) {26 public override void Eval(IPushInterpreter interpreter) { 27 27 Eval(interpreter.FloatStack); 28 28 } … … 31 31 [PushExpression(StackType.Boolean, "BOOLEAN.FLUSH")] 32 32 public class BooleanFlushExpression : FlushExpression<bool> { 33 public override void Eval(IPush GpInterpreter interpreter) {33 public override void Eval(IPushInterpreter interpreter) { 34 34 Eval(interpreter.BooleanStack); 35 35 } … … 38 38 [PushExpression(StackType.Name, "NAME.FLUSH")] 39 39 public class NameFlushExpression : FlushExpression<string> { 40 public override void Eval(IPush GpInterpreter interpreter) {40 public override void Eval(IPushInterpreter interpreter) { 41 41 Eval(interpreter.NameStack); 42 42 } … … 45 45 [PushExpression(StackType.Exec, "EXEC.FLUSH")] 46 46 public class ExecFlushExpression : FlushExpression<Expression> { 47 public override void Eval(IPush GpInterpreter interpreter) {47 public override void Eval(IPushInterpreter interpreter) { 48 48 Eval(interpreter.ExecStack); 49 49 } … … 52 52 [PushExpression(StackType.Code, "CODE.FLUSH")] 53 53 public class CodeFlushExpression : FlushExpression<Expression> { 54 public override void Eval(IPush GpInterpreter interpreter) {54 public override void Eval(IPushInterpreter interpreter) { 55 55 Eval(interpreter.CodeStack); 56 56 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/IntegerExpressions.cs
r14727 r14733 12 12 [PushExpression(StackType.Integer, "INTEGER.+")] 13 13 public class IntegerAddExpression : PushResultExpression<long> { 14 public override void Eval(IPush GpInterpreter interpreter) {14 public override void Eval(IPushInterpreter interpreter) { 15 15 this.Eval(interpreter.IntegerStack, 2, values => values[0] + values[1]); 16 16 } … … 22 22 [PushExpression(StackType.Integer, "INTEGER.-")] 23 23 public class IntegerSubtractExpression : PushResultExpression<long> { 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 this.Eval(interpreter.IntegerStack, 2, values => values[0] - values[1]); 26 26 } … … 32 32 [PushExpression(StackType.Integer, "INTEGER.*")] 33 33 public class IntegerMultiplyExpression : PushResultExpression<long> { 34 public override void Eval(IPush GpInterpreter interpreter) {34 public override void Eval(IPushInterpreter interpreter) { 35 35 this.Eval(interpreter.IntegerStack, 2, values => values[0] * values[1]); 36 36 } … … 43 43 [PushExpression(StackType.Integer, "INTEGER./")] 44 44 public class IntegerDivideExpression : PushResultExpression<long> { 45 public override void Eval(IPush GpInterpreter interpreter) {45 public override void Eval(IPushInterpreter interpreter) { 46 46 this.Eval(interpreter.IntegerStack, 2, values => values[0] / values[1], 0); 47 47 } … … 58 58 [PushExpression(StackType.Integer, "INTEGER.%")] 59 59 public class IntegerModuloExpression : PushResultExpression<long> { 60 public override void Eval(IPush GpInterpreter interpreter) {60 public override void Eval(IPushInterpreter interpreter) { 61 61 this.Eval(interpreter.IntegerStack, 2, values => values[0] % values[1], 0); 62 62 } … … 68 68 [PushExpression(StackType.Integer, "INTEGER.MIN")] 69 69 public class IntegerMinExpression : PushResultExpression<long> { 70 public override void Eval(IPush GpInterpreter interpreter) {70 public override void Eval(IPushInterpreter interpreter) { 71 71 this.Eval(interpreter.IntegerStack, 2, values => Math.Min(values[0], values[1])); 72 72 } … … 78 78 [PushExpression(StackType.Integer, "INTEGER.MAX")] 79 79 public class IntegerMaxExpression : PushResultExpression<long> { 80 public override void Eval(IPush GpInterpreter interpreter) {80 public override void Eval(IPushInterpreter interpreter) { 81 81 this.Eval(interpreter.IntegerStack, 2, values => Math.Max(values[0], values[1])); 82 82 } … … 88 88 [PushExpression(StackType.Integer, "INTEGER.<")] 89 89 public class IntegerSmallerThanExpression : PushResultExpression<long> { 90 public override void Eval(IPush GpInterpreter interpreter) {90 public override void Eval(IPushInterpreter interpreter) { 91 91 this.Eval(interpreter.IntegerStack, interpreter.BooleanStack, 2, values => values[0] < values[1]); 92 92 } … … 98 98 [PushExpression(StackType.Integer, "INTEGER.>")] 99 99 public class IntegerGreaterThanExpression : PushResultExpression<long> { 100 public override void Eval(IPush GpInterpreter interpreter) {100 public override void Eval(IPushInterpreter interpreter) { 101 101 this.Eval(interpreter.IntegerStack, interpreter.BooleanStack, 2, values => values[0] > values[1]); 102 102 } … … 108 108 [PushExpression(StackType.Integer, "INTEGER.FROMBOOLEAN")] 109 109 public class IntegerFromBooleanExpression : StatelessExpression { 110 public override void Eval(IPush GpInterpreter interpreter) {110 public override void Eval(IPushInterpreter interpreter) { 111 111 if (interpreter.BooleanStack.Count == 0) return; 112 112 … … 123 123 [PushExpression(StackType.Integer, "INTEGER.FROMFLOAT")] 124 124 public class IntegerFromFloatExpression : StatelessExpression { 125 public override void Eval(IPush GpInterpreter interpreter) {125 public override void Eval(IPushInterpreter interpreter) { 126 126 if (interpreter.FloatStack.Count == 0) return; 127 127 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/LoopExpression.cs
r14727 r14733 32 32 } 33 33 34 public abstract class LoopExpression : Stateful lExpression<LoopState> {34 public abstract class LoopExpression : StatefulExpression<LoopState> { 35 35 protected LoopExpression() : base(new LoopState()) { } 36 36 protected LoopExpression(LoopState state) : base(state) { } 37 37 38 protected void Eval(IPush GpInterpreter interpreter, IStack<Expression> sourceStack, bool pushCurrentIndex = false) {38 protected void Eval(IPushInterpreter interpreter, IStack<Expression> sourceStack, bool pushCurrentIndex = false) { 39 39 // if not initialized 40 40 if (this.State.Body == null) { … … 59 59 protected abstract LoopExpression Clone(LoopState state); 60 60 61 protected virtual void PushIteration(IPush GpInterpreter interpreter) {61 protected virtual void PushIteration(IPushInterpreter interpreter) { 62 62 interpreter.IntegerStack.Push(this.State.CurrentIndex); 63 63 … … 68 68 } 69 69 70 protected virtual void PushLastIteration(IPush GpInterpreter interpreter) {70 protected virtual void PushLastIteration(IPushInterpreter interpreter) { 71 71 interpreter.IntegerStack.Push(this.State.CurrentIndex); 72 72 interpreter.ExecStack.Push(this.State.Body); … … 95 95 //} 96 96 97 protected abstract bool HasInsufficientArguments(IPush GpInterpreter interpreter, IStack<Expression> sourceStack);97 protected abstract bool HasInsufficientArguments(IPushInterpreter interpreter, IStack<Expression> sourceStack); 98 98 99 protected abstract LoopState InitState(IPush GpInterpreter interpreter, IStack<Expression> sourceStack);99 protected abstract LoopState InitState(IPushInterpreter interpreter, IStack<Expression> sourceStack); 100 100 } 101 101 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/NameExpressions.cs
r14727 r14733 5 5 using Interpreter; 6 6 7 public class NameDefineXExecExpression : Stateful lExpression<string> {7 public class NameDefineXExecExpression : StatefulExpression<string> { 8 8 public NameDefineXExecExpression(string state) : base(state) { } 9 9 10 public override void Eval(IPush GpInterpreter interpreter) {10 public override void Eval(IPushInterpreter interpreter) { 11 11 Expression expression; 12 12 if (!interpreter.IsNameQuoteFlagSet && … … 31 31 [PushExpression(StackType.Name, "NAME.QUOTE")] 32 32 public class NameQuoteExpression : StatelessExpression { 33 public override void Eval(IPush GpInterpreter interpreter) {33 public override void Eval(IPushInterpreter interpreter) { 34 34 interpreter.IsNameQuoteFlagSet = true; 35 35 } … … 41 41 [PushExpression(StackType.Name, "NAME.RANDBOUNDNAME")] 42 42 public class NameRandBoundNameExpression : StatelessExpression { 43 public override void Eval(IPush GpInterpreter interpreter) {43 public override void Eval(IPushInterpreter interpreter) { 44 44 if (interpreter.CustomExpressions.Count == 0) 45 45 return; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/PopExpressions.cs
r14727 r14733 15 15 [PushExpression(StackType.Integer, "INTEGER.POP")] 16 16 public class IntegerPopExpression : PopExpression<long> { 17 public override void Eval(IPush GpInterpreter interpreter) {17 public override void Eval(IPushInterpreter interpreter) { 18 18 this.Eval(interpreter.IntegerStack); 19 19 } … … 22 22 [PushExpression(StackType.Float, "FLOAT.POP")] 23 23 public class FloatPopExpression : PopExpression<double> { 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 this.Eval(interpreter.FloatStack); 26 26 } … … 29 29 [PushExpression(StackType.Boolean, "BOOLEAN.POP")] 30 30 public class BooleanPopExpression : PopExpression<bool> { 31 public override void Eval(IPush GpInterpreter interpreter) {31 public override void Eval(IPushInterpreter interpreter) { 32 32 this.Eval(interpreter.BooleanStack); 33 33 } … … 36 36 [PushExpression(StackType.Name, "NAME.POP")] 37 37 public class NamePopExpression : PopExpression<string> { 38 public override void Eval(IPush GpInterpreter interpreter) {38 public override void Eval(IPushInterpreter interpreter) { 39 39 this.Eval(interpreter.NameStack); 40 40 } … … 43 43 [PushExpression(StackType.Exec, "EXEC.POP")] 44 44 public class ExecPopExpression : PopExpression<Expression> { 45 public override void Eval(IPush GpInterpreter interpreter) {45 public override void Eval(IPushInterpreter interpreter) { 46 46 this.Eval(interpreter.ExecStack); 47 47 } … … 50 50 [PushExpression(StackType.Code, "CODE.POP")] 51 51 public class CodePopExpression : PopExpression<Expression> { 52 public override void Eval(IPush GpInterpreter interpreter) {52 public override void Eval(IPushInterpreter interpreter) { 53 53 this.Eval(interpreter.CodeStack); 54 54 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/PushExpressions.cs
r14727 r14733 3 3 using HeuristicLab.Problems.ProgramSynthesis.Push.Stack; 4 4 5 public abstract class PushExpression<T> : Stateful lExpression<T> {5 public abstract class PushExpression<T> : StatefulExpression<T> { 6 6 7 7 protected PushExpression(T state) : base(state) { } … … 18 18 } 19 19 20 public override void Eval(IPush GpInterpreter interpreter) {20 public override void Eval(IPushInterpreter interpreter) { 21 21 this.Eval(interpreter.IntegerStack); 22 22 } … … 28 28 } 29 29 30 public override void Eval(IPush GpInterpreter interpreter) {30 public override void Eval(IPushInterpreter interpreter) { 31 31 this.Eval(interpreter.FloatStack); 32 32 } … … 38 38 } 39 39 40 public override void Eval(IPush GpInterpreter interpreter) {40 public override void Eval(IPushInterpreter interpreter) { 41 41 this.Eval(interpreter.BooleanStack); 42 42 } … … 48 48 } 49 49 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 this.Eval(interpreter.NameStack); 52 52 } … … 58 58 } 59 59 60 public override void Eval(IPush GpInterpreter interpreter) {60 public override void Eval(IPushInterpreter interpreter) { 61 61 this.Eval(interpreter.ExecStack); 62 62 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/RandExpressions.cs
r14727 r14733 10 10 [PushExpression(StackType.Name, "NAME.RAND")] 11 11 public class NameRandExpression : StatelessExpression { 12 public override void Eval(IPush GpInterpreter interpreter) {12 public override void Eval(IPushInterpreter interpreter) { 13 13 var name = NameGenerator.RandomName(interpreter.Random); 14 14 … … 22 22 [PushExpression(StackType.Integer, "INTEGER.RAND")] 23 23 public class IntegerRandExpression : StatelessExpression { 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 var value = interpreter.Random.Next( 26 26 interpreter.Configuration.MinRandomInteger, … … 36 36 [PushExpression(StackType.Float, "FLOAT.RAND")] 37 37 public class FloatRandExpression : StatelessExpression { 38 public override void Eval(IPush GpInterpreter interpreter) {38 public override void Eval(IPushInterpreter interpreter) { 39 39 var value = interpreter.Random.NextDouble() * (interpreter.Configuration.MaxRandomFloat - interpreter.Configuration.MinRandomFloat) + interpreter.Configuration.MinRandomFloat; 40 40 … … 48 48 [PushExpression(StackType.Boolean, "BOOLEAN.RAND")] 49 49 public class BooleanRandExpression : StatelessExpression { 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 var value = interpreter.Random.NextDouble() > 0.5; 52 52 … … 60 60 [PushExpression(StackType.Code, "CODE.RAND")] 61 61 public class CodeRandExpression : StatelessExpression { 62 public override void Eval(IPush GpInterpreter interpreter) {62 public override void Eval(IPushInterpreter interpreter) { 63 63 if (interpreter.IntegerStack.Count == 0 || 64 64 interpreter.IntegerStack.Top < 1) return; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/RotateExpressions.cs
r14727 r14733 16 16 [PushExpression(StackType.Integer, "INTEGER.ROT")] 17 17 public class IntegerRotateExpression : RotateExpression<long> { 18 public override void Eval(IPush GpInterpreter interpreter) {18 public override void Eval(IPushInterpreter interpreter) { 19 19 Eval(interpreter.IntegerStack); 20 20 } … … 23 23 [PushExpression(StackType.Float, "FLOAT.ROT")] 24 24 public class FloatRotateExpression : RotateExpression<double> { 25 public override void Eval(IPush GpInterpreter interpreter) {25 public override void Eval(IPushInterpreter interpreter) { 26 26 Eval(interpreter.FloatStack); 27 27 } … … 30 30 [PushExpression(StackType.Boolean, "BOOLEAN.ROT")] 31 31 public class BooleanRotateExpression : RotateExpression<bool> { 32 public override void Eval(IPush GpInterpreter interpreter) {32 public override void Eval(IPushInterpreter interpreter) { 33 33 Eval(interpreter.BooleanStack); 34 34 } … … 37 37 [PushExpression(StackType.Name, "NAME.ROT")] 38 38 public class NameRotateExpression : RotateExpression<string> { 39 public override void Eval(IPush GpInterpreter interpreter) {39 public override void Eval(IPushInterpreter interpreter) { 40 40 Eval(interpreter.NameStack); 41 41 } … … 44 44 [PushExpression(StackType.Exec, "EXEC.ROT")] 45 45 public class ExecRotateExpression : RotateExpression<Expression> { 46 public override void Eval(IPush GpInterpreter interpreter) {46 public override void Eval(IPushInterpreter interpreter) { 47 47 Eval(interpreter.ExecStack); 48 48 } … … 51 51 [PushExpression(StackType.Code, "CODE.ROT")] 52 52 public class CodeRotateExpression : RotateExpression<Expression> { 53 public override void Eval(IPush GpInterpreter interpreter) {53 public override void Eval(IPushInterpreter interpreter) { 54 54 Eval(interpreter.CodeStack); 55 55 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ShoveExpressions.cs
r14727 r14733 22 22 [PushExpression(StackType.Integer, "INTEGER.SHOVE")] 23 23 public class IntegerShoveExpression : ShoveExpression<long> { 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 Eval(interpreter.IntegerStack, interpreter.IntegerStack, 2); 26 26 } … … 29 29 [PushExpression(StackType.Float, "FLOAT.SHOVE")] 30 30 public class FloatShoveExpression : ShoveExpression<double> { 31 public override void Eval(IPush GpInterpreter interpreter) {31 public override void Eval(IPushInterpreter interpreter) { 32 32 Eval(interpreter.FloatStack, interpreter.IntegerStack); 33 33 } … … 36 36 [PushExpression(StackType.Boolean, "BOOLEAN.SHOVE")] 37 37 public class BooleanShoveExpression : ShoveExpression<bool> { 38 public override void Eval(IPush GpInterpreter interpreter) {38 public override void Eval(IPushInterpreter interpreter) { 39 39 Eval(interpreter.BooleanStack, interpreter.IntegerStack); 40 40 } … … 43 43 [PushExpression(StackType.Name, "NAME.SHOVE")] 44 44 public class NameShoveExpression : ShoveExpression<string> { 45 public override void Eval(IPush GpInterpreter interpreter) {45 public override void Eval(IPushInterpreter interpreter) { 46 46 Eval(interpreter.NameStack, interpreter.IntegerStack); 47 47 } … … 50 50 [PushExpression(StackType.Exec, "EXEC.SHOVE")] 51 51 public class ExecShoveExpression : ShoveExpression<Expression> { 52 public override void Eval(IPush GpInterpreter interpreter) {52 public override void Eval(IPushInterpreter interpreter) { 53 53 Eval(interpreter.ExecStack, interpreter.IntegerStack); 54 54 } … … 57 57 [PushExpression(StackType.Code, "CODE.SHOVE")] 58 58 public class CodeShoveExpression : ShoveExpression<Expression> { 59 public override void Eval(IPush GpInterpreter interpreter) {59 public override void Eval(IPushInterpreter interpreter) { 60 60 Eval(interpreter.CodeStack, interpreter.IntegerStack); 61 61 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StackdepthExpressions.cs
r14727 r14733 22 22 public class IntegerStackdepthExpression : StackdepthExpression<long> { 23 23 24 public override void Eval(IPush GpInterpreter interpreter) {24 public override void Eval(IPushInterpreter interpreter) { 25 25 Eval(interpreter.IntegerStack, interpreter.IntegerStack, true); 26 26 } … … 29 29 [PushExpression(StackType.Float, "FLOAT.STACKDEPTH")] 30 30 public class FloatStackdepthExpression : StackdepthExpression<double> { 31 public override void Eval(IPush GpInterpreter interpreter) {31 public override void Eval(IPushInterpreter interpreter) { 32 32 Eval(interpreter.FloatStack, interpreter.IntegerStack); 33 33 } … … 36 36 [PushExpression(StackType.Boolean, "BOOLEAN.STACKDEPTH")] 37 37 public class BooleanStackdepthExpression : StackdepthExpression<bool> { 38 public override void Eval(IPush GpInterpreter interpreter) {38 public override void Eval(IPushInterpreter interpreter) { 39 39 Eval(interpreter.BooleanStack, interpreter.IntegerStack); 40 40 } … … 43 43 [PushExpression(StackType.Name, "NAME.STACKDEPTH")] 44 44 public class NameStackdepthExpression : StackdepthExpression<string> { 45 public override void Eval(IPush GpInterpreter interpreter) {45 public override void Eval(IPushInterpreter interpreter) { 46 46 Eval(interpreter.NameStack, interpreter.IntegerStack); 47 47 } … … 50 50 [PushExpression(StackType.Exec, "EXEC.STACKDEPTH")] 51 51 public class ExecStackdepthExpression : StackdepthExpression<Expression> { 52 public override void Eval(IPush GpInterpreter interpreter) {52 public override void Eval(IPushInterpreter interpreter) { 53 53 Eval(interpreter.ExecStack, interpreter.IntegerStack); 54 54 } … … 57 57 [PushExpression(StackType.Code, "CODE.STACKDEPTH")] 58 58 public class CodeStackdepthExpression : StackdepthExpression<Expression> { 59 public override void Eval(IPush GpInterpreter interpreter) {59 public override void Eval(IPushInterpreter interpreter) { 60 60 Eval(interpreter.CodeStack, interpreter.IntegerStack); 61 61 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatelessExpression.cs
r14727 r14733 3 3 private readonly int hashCode; 4 4 protected StatelessExpression() { 5 this.hashCode = this.GetType(). FullName.GetHashCode();5 this.hashCode = this.GetType().GetHashCode(); 6 6 } 7 7 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/SwapExpressions.cs
r14727 r14733 20 20 [PushExpression(StackType.Integer, "INTEGER.SWAP")] 21 21 public class IntegerSwapExpression : SwapExpression<long> { 22 public override void Eval(IPush GpInterpreter interpreter) {22 public override void Eval(IPushInterpreter interpreter) { 23 23 Eval(interpreter.IntegerStack); 24 24 } … … 27 27 [PushExpression(StackType.Float, "FLOAT.SWAP")] 28 28 public class FloatSwapExpression : SwapExpression<double> { 29 public override void Eval(IPush GpInterpreter interpreter) {29 public override void Eval(IPushInterpreter interpreter) { 30 30 Eval(interpreter.FloatStack); 31 31 } … … 34 34 [PushExpression(StackType.Boolean, "BOOLEAN.SWAP")] 35 35 public class BooleanSwapExpression : SwapExpression<bool> { 36 public override void Eval(IPush GpInterpreter interpreter) {36 public override void Eval(IPushInterpreter interpreter) { 37 37 Eval(interpreter.BooleanStack); 38 38 } … … 41 41 [PushExpression(StackType.Name, "NAME.SWAP")] 42 42 public class NameSwapExpression : SwapExpression<string> { 43 public override void Eval(IPush GpInterpreter interpreter) {43 public override void Eval(IPushInterpreter interpreter) { 44 44 Eval(interpreter.NameStack); 45 45 } … … 48 48 [PushExpression(StackType.Exec, "EXEC.SWAP")] 49 49 public class ExecSwapExpression : SwapExpression<Expression> { 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 Eval(interpreter.ExecStack); 52 52 } … … 55 55 [PushExpression(StackType.Code, "CODE.SWAP")] 56 56 public class CodeSwapExpression : SwapExpression<Expression> { 57 public override void Eval(IPush GpInterpreter interpreter) {57 public override void Eval(IPushInterpreter interpreter) { 58 58 Eval(interpreter.CodeStack); 59 59 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/YankDuplicateExpressions.cs
r14727 r14733 48 48 [PushExpression(StackType.Integer, "INTEGER.YANKDUP")] 49 49 public class IntegerYankDuplicateExpression : YankDuplicateExpression<long> { 50 public override void Eval(IPush GpInterpreter interpreter) {50 public override void Eval(IPushInterpreter interpreter) { 51 51 this.Eval(interpreter.IntegerStack); 52 52 } … … 55 55 [PushExpression(StackType.Float, "FLOAT.YANKDUP")] 56 56 public class FloatYankDuplicateExpression : YankDuplicateExpression<double> { 57 public override void Eval(IPush GpInterpreter interpreter) {57 public override void Eval(IPushInterpreter interpreter) { 58 58 this.Eval(interpreter.FloatStack, interpreter.IntegerStack); 59 59 } … … 62 62 [PushExpression(StackType.Boolean, "BOOLEAN.YANKDUP")] 63 63 public class BooleanYankDuplicateExpression : YankDuplicateExpression<bool> { 64 public override void Eval(IPush GpInterpreter interpreter) {64 public override void Eval(IPushInterpreter interpreter) { 65 65 this.Eval(interpreter.BooleanStack, interpreter.IntegerStack); 66 66 } … … 69 69 [PushExpression(StackType.Name, "NAME.YANKDUP")] 70 70 public class NameYankDuplicateExpression : YankDuplicateExpression<string> { 71 public override void Eval(IPush GpInterpreter interpreter) {71 public override void Eval(IPushInterpreter interpreter) { 72 72 this.Eval(interpreter.NameStack, interpreter.IntegerStack); 73 73 } … … 76 76 [PushExpression(StackType.Exec, "EXEC.YANKDUP")] 77 77 public class ExecYankDuplicateExpression : YankDuplicateExpression<Expression> { 78 public override void Eval(IPush GpInterpreter interpreter) {78 public override void Eval(IPushInterpreter interpreter) { 79 79 this.Eval(interpreter.ExecStack, interpreter.IntegerStack); 80 80 } … … 83 83 [PushExpression(StackType.Code, "CODE.YANKDUP")] 84 84 public class CodeYankDuplicateExpression : YankDuplicateExpression<Expression> { 85 public override void Eval(IPush GpInterpreter interpreter) {85 public override void Eval(IPushInterpreter interpreter) { 86 86 this.Eval(interpreter.CodeStack, interpreter.IntegerStack); 87 87 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/YankExpressions.cs
r14727 r14733 24 24 [PushExpression(StackType.Integer, "INTEGER.YANK")] 25 25 public class IntegerYankExpression : YankExpression<long> { 26 public override void Eval(IPush GpInterpreter interpreter) {26 public override void Eval(IPushInterpreter interpreter) { 27 27 this.Eval(interpreter.IntegerStack, interpreter.IntegerStack, 2); 28 28 } … … 31 31 [PushExpression(StackType.Float, "FLOAT.YANK")] 32 32 public class FloatYankExpression : YankExpression<double> { 33 public override void Eval(IPush GpInterpreter interpreter) {33 public override void Eval(IPushInterpreter interpreter) { 34 34 this.Eval(interpreter.FloatStack, interpreter.IntegerStack); 35 35 } … … 38 38 [PushExpression(StackType.Boolean, "BOOLEAN.YANK")] 39 39 public class BooleanYankExpression : YankExpression<bool> { 40 public override void Eval(IPush GpInterpreter interpreter) {40 public override void Eval(IPushInterpreter interpreter) { 41 41 this.Eval(interpreter.BooleanStack, interpreter.IntegerStack); 42 42 } … … 45 45 [PushExpression(StackType.Name, "NAME.YANK")] 46 46 public class NameYankExpression : YankExpression<string> { 47 public override void Eval(IPush GpInterpreter interpreter) {47 public override void Eval(IPushInterpreter interpreter) { 48 48 this.Eval(interpreter.NameStack, interpreter.IntegerStack); 49 49 } … … 52 52 [PushExpression(StackType.Exec, "EXEC.YANK")] 53 53 public class ExecYankExpression : YankExpression<Expression> { 54 public override void Eval(IPush GpInterpreter interpreter) {54 public override void Eval(IPushInterpreter interpreter) { 55 55 this.Eval(interpreter.ExecStack, interpreter.IntegerStack); 56 56 } … … 59 59 [PushExpression(StackType.Code, "CODE.YANK")] 60 60 public class CodeYankExpression : YankExpression<Expression> { 61 public override void Eval(IPush GpInterpreter interpreter) {61 public override void Eval(IPushInterpreter interpreter) { 62 62 this.Eval(interpreter.CodeStack, interpreter.IntegerStack); 63 63 }
Note: See TracChangeset
for help on using the changeset viewer.