Changeset 14909 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions
- Timestamp:
- 05/03/17 01:31:10 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExpressionTable.cs
r14875 r14909 141 141 public static IReadOnlyList<string> GetExpressionsByStackTypes(StackTypes allowedTypes) { 142 142 return stackDependencyToNamesTable 143 .Where(entry => (entry.Key & ~allowedTypes) == StackTypes.None)143 .Where(entry => (entry.Key & ~allowedTypes) == 0x0) 144 144 .SelectMany(entry => entry.Value) 145 145 .ToArray(); -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorNthExpressions.cs
r14834 r14909 16 16 IPushStack<List<T>> vectorStack, 17 17 IPushStack<T> literalStack) { 18 if (vectorStack.IsEmpty || interpreter.IntegerStack.IsEmpty) return false;18 if (vectorStack.IsEmpty || vectorStack.Top.Count == 0 || interpreter.IntegerStack.IsEmpty) return false; 19 19 20 20 var vector = vectorStack.Pop(); -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorSetExpressions.cs
r14875 r14909 17 17 bool isLiteralTypeInteger = false) { 18 18 if (vectorStack.IsEmpty || 19 vectorStack.Top.Count == 0 || 19 20 literalStack.IsEmpty || 20 21 (isLiteralTypeInteger && interpreter.IntegerStack.Count < 2) || … … 38 39 39 40 if (index < 0) 40 index = vector.Count - index;41 index *= -1; 41 42 42 43 vector[index] = literal; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorSubExpressions.cs
r14875 r14909 16 16 if (vectorStack.IsEmpty || interpreter.IntegerStack.Count < 2) return false; 17 17 18 var first = (int)Math.Min(vectorStack. Count, Math.Max(0, interpreter.IntegerStack[1]));19 var second = (int)Math.Min(vectorStack. Count, Math.Max(first, interpreter.IntegerStack.Top));18 var first = (int)Math.Min(vectorStack.Top.Count, Math.Max(0, interpreter.IntegerStack[1])); 19 var second = (int)Math.Min(vectorStack.Top.Count, Math.Max(first, interpreter.IntegerStack.Top)); 20 20 interpreter.IntegerStack.Remove(2); 21 21 22 if (vectorStack.Top.Count == 0) 23 return true; 24 22 25 var result = vectorStack.Top.GetRange(first, second - first); 23 vectorStack. Push(result);26 vectorStack.SetTop(result); 24 27 return true; 25 28 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorTakeExpressions.cs
r14834 r14909 16 16 17 17 var count = (int)interpreter.IntegerStack.Pop(); 18 19 if (vectorStack.Top.Count == 0) 20 return true; 21 22 count %= vectorStack.Top.Count; 23 24 if (count < 0) 25 count *= -1; 26 18 27 var result = vectorStack.Top.GetRange(0, count); 28 vectorStack.SetTop(result); 19 29 20 vectorStack.Push(result);21 30 return true; 22 31 }
Note: See TracChangeset
for help on using the changeset viewer.