- Timestamp:
- 08/29/17 18:05:17 (8 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/ExpressionsClassDiagramm.cd
r15334 r15344 2 2 <ClassDiagram MajorVersion="1" MinorVersion="1"> 3 3 <Class Name="HeuristicLab.Problems.ProgramSynthesis.Push.Expressions.Expression"> 4 <Position X=" 3" Y="0.5" Width="2" />4 <Position X="2.75" Y="0.5" Width="2" /> 5 5 <Members> 6 6 <Method Name="Expression" Hidden="true" /> 7 <Method Name="IPooledObject.Init" Hidden="true" />8 7 <Method Name="IPooledObject.Reset" Hidden="true" /> 9 8 </Members> 10 9 <TypeIdentifier> 11 <HashCode>EAAAAAgAJAAAAAA MAAAAAAAAAAAAACAAAQAAAAAAABA=</HashCode>10 <HashCode>EAAAAAgAJAAAAAAEAAAAAAAAAAAAACAAAQAAAAAAABA=</HashCode> 12 11 <FileName>Push\Expressions\Expression.cs</FileName> 13 12 </TypeIdentifier> … … 15 14 </Class> 16 15 <Class Name="HeuristicLab.Problems.ProgramSynthesis.Push.Expressions.PushProgram"> 17 <Position X="0.5" Y=" 4.5" Width="2" />16 <Position X="0.5" Y="3.5" Width="2" /> 18 17 <Compartments> 19 18 <Compartment Name="Fields" Collapsed="true" /> … … 21 20 </Compartments> 22 21 <TypeIdentifier> 23 <HashCode>AMtgMCECJAAABAA cgAYAAAQCQkABAeBgAQEIIgCAABo=</HashCode>22 <HashCode>AMtgMCECJAAABAAUgAYAAAQCQkABAeBgAQEIIgCAABo=</HashCode> 24 23 <FileName>Push\Expressions\PushProgram.cs</FileName> 25 24 </TypeIdentifier> … … 27 26 </Class> 28 27 <Class Name="HeuristicLab.Problems.ProgramSynthesis.Push.Expressions.StatefulExpression<T>"> 29 <Position X="2.75" Y=" 4.5" Width="2" />28 <Position X="2.75" Y="3.5" Width="2" /> 30 29 <Compartments> 31 30 <Compartment Name="Fields" Collapsed="true" /> … … 33 32 </Compartments> 34 33 <TypeIdentifier> 35 <HashCode>AAggAAAAAACABAA IgAAAAAAAAAAAAKAAAAAABAAAAAA=</HashCode>34 <HashCode>AAggAAAAAACABAAAgAAAAAAAAAAAAKAAAAAABAAAAAA=</HashCode> 36 35 <FileName>Push\Expressions\StatefulExpression.cs</FileName> 37 36 </TypeIdentifier> … … 39 38 </Class> 40 39 <Class Name="HeuristicLab.Problems.ProgramSynthesis.Push.Expressions.StatelessExpression"> 41 <Position X="5" Y=" 4.5" Width="2" />40 <Position X="5" Y="3.5" Width="2" /> 42 41 <Members> 43 42 <Field Name="hashCode" Hidden="true" /> … … 51 50 </TypeIdentifier> 52 51 </Class> 53 <Font Name=" Segoe UI" Size="9" />52 <Font Name="Courier" Size="9" /> 54 53 </ClassDiagram> -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/HeuristicLab.Problems.ProgramSynthesis.csproj
r15334 r15344 310 310 </ItemGroup> 311 311 <ItemGroup> 312 <None Include="ExpressionsClassDiagramm.cd" /> 312 <None Include="ExpressionsClassDiagramm.cd"> 313 <SubType>Designer</SubType> 314 </None> 313 315 <None Include="packages.config" /> 314 316 </ItemGroup> -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration/PushConfiguration.cs
r15341 r15344 44 44 public PushConfiguration(PushConfiguration origin, Cloner cloner) : base(origin, cloner) { 45 45 Parameters = cloner.Clone(origin.Parameters); 46 FloatStringFormat = origin.FloatStringFormat; 46 47 } 47 48 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Evaluator/PushBenchmarkSuiteEvaluator.cs
r15341 r15344 560 560 } 561 561 562 return diff; 562 return double.IsNaN(diff) || double.IsInfinity(diff) 563 ? worstResult 564 : diff; 563 565 } 564 566 … … 581 583 } 582 584 583 return diff; 585 return double.IsNaN(diff) || double.IsInfinity(diff) 586 ? worstResult 587 : diff; 584 588 } 585 589 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/EmptyExpression.cs
r15334 r15344 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions { 2 using System.Collections.Generic;3 2 4 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 12 11 /// </summary> 13 12 [StorableClass] 14 public abstract class EmptyExpression <T>: StatelessExpression {13 public abstract class EmptyExpression : StatelessExpression { 15 14 protected EmptyExpression() { } 16 15 [StorableConstructor] … … 21 20 } 22 21 23 public void Eval(IPushStack <T>stack, IPushStack<bool> booleanStack) {22 public void Eval(IPushStack stack, IPushStack<bool> booleanStack) { 24 23 booleanStack.Push(stack.IsEmpty); 25 24 } … … 32 31 "Pushes TRUE onto the BOOLEAN stack if the EXEC stack is empty, otherwise FALSE.", 33 32 StackTypes.Boolean)] 34 public class ExecEmptyExpression : EmptyExpression <Expression>{33 public class ExecEmptyExpression : EmptyExpression { 35 34 public ExecEmptyExpression() { } 36 35 [StorableConstructor] … … 48 47 "Pushes TRUE onto the BOOLEAN stack if the CODE stack is empty, otherwise FALSE.", 49 48 StackTypes.Boolean)] 50 public class CodeEmptyExpression : EmptyExpression <Expression>{49 public class CodeEmptyExpression : EmptyExpression { 51 50 public CodeEmptyExpression() { } 52 51 [StorableConstructor] … … 63 62 "Pushes TRUE onto the BOOLEAN stack if the INTEGER stack is empty, otherwise FALSE.", 64 63 StackTypes.Boolean)] 65 public class IntegerEmptyExpression : EmptyExpression <long>{64 public class IntegerEmptyExpression : EmptyExpression { 66 65 public IntegerEmptyExpression() { } 67 66 [StorableConstructor] … … 77 76 "FLOAT.EMPTY", "Pushes TRUE onto the BOOLEAN stack if the FLOAT stack is empty, otherwise FALSE.", 78 77 StackTypes.Boolean)] 79 public class FloatEmptyExpression : EmptyExpression <double>{78 public class FloatEmptyExpression : EmptyExpression { 80 79 public FloatEmptyExpression() { } 81 80 [StorableConstructor] … … 91 90 "BOOLEAN.EMPTY", 92 91 "Pushes TRUE onto the BOOLEAN stack if the BOOLEAN stack is empty, otherwise FALSE.")] 93 public class BooleanEmptyExpression : EmptyExpression <bool>{92 public class BooleanEmptyExpression : EmptyExpression { 94 93 public BooleanEmptyExpression() { } 95 94 [StorableConstructor] … … 106 105 "Pushes TRUE onto the BOOLEAN stack if the CHAR stack is empty, otherwise FALSE.", 107 106 StackTypes.Boolean)] 108 public class CharEmptyExpression : EmptyExpression <char>{107 public class CharEmptyExpression : EmptyExpression { 109 108 public CharEmptyExpression() { } 110 109 [StorableConstructor] … … 121 120 "Pushes TRUE onto the BOOLEAN stack if the STRING stack is empty, otherwise FALSE.", 122 121 StackTypes.Boolean)] 123 public class StringEmptyExpression : EmptyExpression <string>{122 public class StringEmptyExpression : EmptyExpression { 124 123 public StringEmptyExpression() { } 125 124 [StorableConstructor] … … 136 135 "Pushes TRUE onto the BOOLEAN stack if the INTEGER[] stack is empty, otherwise FALSE.", 137 136 StackTypes.Boolean)] 138 public class IntegerVectorEmptyExpression : EmptyExpression <IReadOnlyList<long>>{137 public class IntegerVectorEmptyExpression : EmptyExpression { 139 138 public IntegerVectorEmptyExpression() { } 140 139 [StorableConstructor] … … 151 150 "Pushes TRUE onto the BOOLEAN stack if the FLOAT[] stack is empty, otherwise FALSE.", 152 151 StackTypes.Boolean)] 153 public class FloatVectorEmptyExpression : EmptyExpression <IReadOnlyList<double>>{152 public class FloatVectorEmptyExpression : EmptyExpression { 154 153 public FloatVectorEmptyExpression() { } 155 154 [StorableConstructor] … … 166 165 "Pushes TRUE onto the BOOLEAN stack if the BOOLEAN[] stack is empty, otherwise FALSE.", 167 166 StackTypes.Boolean)] 168 public class BooleanVectorEmptyExpression : EmptyExpression <IReadOnlyList<bool>>{167 public class BooleanVectorEmptyExpression : EmptyExpression { 169 168 public BooleanVectorEmptyExpression() { } 170 169 [StorableConstructor] … … 181 180 "Pushes TRUE onto the BOOLEAN stack if the STRING[] stack is empty, otherwise FALSE.", 182 181 StackTypes.Boolean)] 183 public class StringVectorEmptyExpression : EmptyExpression <IReadOnlyList<string>>{182 public class StringVectorEmptyExpression : EmptyExpression { 184 183 public StringVectorEmptyExpression() { } 185 184 [StorableConstructor] … … 189 188 } 190 189 } 190 191 [StorableClass] 192 [PushExpression( 193 StackTypes.Print, 194 "PRINT.EMPTY", 195 "Pushes TRUE onto the BOOLEAN stack if the PRINT stack is empty, otherwise FALSE.", 196 StackTypes.Boolean)] 197 public class PrintEmptyExpression : EmptyExpression { 198 public PrintEmptyExpression() { } 199 [StorableConstructor] 200 protected PrintEmptyExpression(bool deserializing) : base(deserializing) { } 201 public override void Eval(IInternalPushInterpreter interpreter) { 202 Eval(interpreter.PrintStack, interpreter.BooleanStack); 203 } 204 } 191 205 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/Expression.cs
r15334 r15344 16 16 [StorableConstructor] 17 17 protected Expression(bool deserializing) { } 18 protected Expression(Expression origin, Cloner cloner) { } 18 19 19 20 public bool IsProgram { get { return GetType() == typeof(PushProgram); } } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/IntegerExpressions.cs
r15032 r15344 28 28 var first = interpreter.IntegerStack.Pop(); 29 29 var second = interpreter.IntegerStack.Top; 30 var result = second + first;30 var result = unchecked(second + first); 31 31 32 32 interpreter.IntegerStack.Top = result; … … 54 54 var first = interpreter.IntegerStack.Pop(); 55 55 var second = interpreter.IntegerStack.Top; 56 var result = second - first;56 var result = unchecked(second - first); 57 57 58 58 interpreter.IntegerStack.Top = result; … … 80 80 var first = interpreter.IntegerStack.Pop(); 81 81 var second = interpreter.IntegerStack.Top; 82 var result = second * first;82 var result = unchecked(second * first); 83 83 84 84 interpreter.IntegerStack.Top = result; … … 101 101 102 102 public override bool IsNoop(IInternalPushInterpreter interpreter) { 103 return interpreter.IntegerStack.Count < 2 || interpreter.IntegerStack.Top == 0; 103 return interpreter.IntegerStack.Count < 2 || 104 interpreter.IntegerStack.Top == 0 || 105 (interpreter.IntegerStack.Top == -1 && interpreter.IntegerStack[1] == long.MinValue); 104 106 } 105 107 … … 127 129 128 130 public override bool IsNoop(IInternalPushInterpreter interpreter) { 129 return interpreter.IntegerStack.Count < 2 || interpreter.IntegerStack.Top == 0; 131 return interpreter.IntegerStack.Count < 2 || 132 interpreter.IntegerStack.Top == 0 || 133 (interpreter.IntegerStack.Top == -1 && interpreter.IntegerStack[1] == long.MinValue); 130 134 } 131 135 … … 348 352 349 353 public override void Eval(IInternalPushInterpreter interpreter) { 350 var value = (long)(interpreter.FloatStack.Pop());354 var value = unchecked((long)interpreter.FloatStack.Pop()); 351 355 interpreter.IntegerStack.Push(value); 352 356 } … … 424 428 425 429 public override void Eval(IInternalPushInterpreter interpreter) { 426 interpreter.IntegerStack.Top += 1; 430 var result = unchecked(interpreter.IntegerStack.Top + 1); 431 interpreter.IntegerStack.Top = result; 427 432 } 428 433 } … … 446 451 447 452 public override void Eval(IInternalPushInterpreter interpreter) { 448 interpreter.IntegerStack.Top -= 1; 453 var result = unchecked(interpreter.IntegerStack.Top - 1); 454 interpreter.IntegerStack.Top = result; 449 455 } 450 456 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/PushProgram.cs
r15334 r15344 51 51 depth = origin.depth; 52 52 treeIndex = origin.treeIndex; 53 expressions = new List<Expression>(origin.expressions); 53 54 var expressionsCopy = new List<Expression>(origin.expressions.Count); 55 for (var i = 0; i < origin.expressions.Count; i++) { 56 expressionsCopy.Add(cloner.Clone(origin.expressions[i])); 57 } 58 59 expressions = expressionsCopy; 54 60 } 55 61 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatelessExpression.cs
r15032 r15344 2 2 using System; 3 3 4 using HeuristicLab.Common; 4 5 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 6 … … 16 17 [StorableConstructor] 17 18 protected StatelessExpression(bool deserializing) : base(deserializing) { } 19 20 protected StatelessExpression(StatelessExpression origin, Cloner cloner) : base(origin, cloner) { } 18 21 19 22 public override int GetHashCode() { -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/BenchmarkSuite/IntegerVectorPushBenchmarkSuiteProblem.cs
r15334 r15344 48 48 PushEvaluator.LoadData(data); 49 49 50 Name = " Push Problem:" + data.Name;50 Name = "[Push][IntVector] " + data.Name; 51 51 Description = data.Description; 52 52 BestKnownQuality = data.BestResult; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/BenchmarkSuite/PlushPushBenchmarkSuiteProblem.cs
r15334 r15344 45 45 PushEvaluator.LoadData(data); 46 46 47 Name = " Push Problem:" + data.Name;47 Name = "[Push][Plush] " + data.Name; 48 48 Description = data.Description; 49 49 BestKnownQuality = data.BestResult;
Note: See TracChangeset
for help on using the changeset viewer.