Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/17 00:27:31 (8 years ago)
Author:
pkimmesw
Message:

#2665 LexicaseSelector, Performance improvements, UI Fixes, Debugger only shows used stacks, fixed Debugger stepping, Added vector expressions, ERCOptions,

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DefineExpressions.cs

    r14777 r14834  
    1414  public abstract class DefineExpression<T> : StatelessExpression {
    1515    protected bool Eval(
    16       IStack<T> stack,
    17       IStack<string> nameStack,
     16      IPushStack<T> stack,
     17      IPushStack<string> nameStack,
    1818      IDictionary<string, Expression> customExpressions,
    1919      Func<T, Expression> creator) {
     
    3333  [PushExpression(StackTypes.Code, "CODE.DEFINE", StackTypes.Name)]
    3434  public class CodeDefineExpression : DefineExpression<Expression> {
    35     public override bool Eval(IPushInterpreter interpreter) {
     35    public override bool Eval(IInternalPushInterpreter interpreter) {
    3636      if (interpreter.Configuration.TopLevelPushCode && (interpreter.CodeStack.Count < 2)) return false;
    3737
     
    5050  [PushExpression(StackTypes.Exec, "EXEC.DEFINE", StackTypes.Name)]
    5151  public class ExecDefineExpression : DefineExpression<Expression> {
    52     public override bool Eval(IPushInterpreter interpreter) {
     52    public override bool Eval(IInternalPushInterpreter interpreter) {
    5353      if (interpreter.ExecStack.Count < 2) return false;
    5454
     
    6969  public class FloatDefineExpression : DefineExpression<double> {
    7070
    71     public override bool Eval(IPushInterpreter interpreter) {
     71    public override bool Eval(IInternalPushInterpreter interpreter) {
    7272      return this.Eval(
    7373        interpreter.FloatStack,
     
    8080  [PushExpression(StackTypes.Integer, "INTEGER.DEFINE", StackTypes.Name)]
    8181  public class IntegerDefineExpression : DefineExpression<long> {
    82     public override bool Eval(IPushInterpreter interpreter) {
     82    public override bool Eval(IInternalPushInterpreter interpreter) {
    8383      return this.Eval(
    8484        interpreter.IntegerStack,
     
    9191  [PushExpression(StackTypes.Boolean, "BOOLEAN.DEFINE", StackTypes.Name)]
    9292  public class BooleanDefineExpression : DefineExpression<bool> {
    93     public override bool Eval(IPushInterpreter interpreter) {
     93    public override bool Eval(IInternalPushInterpreter interpreter) {
    9494      return this.Eval(
    9595        interpreter.BooleanStack,
     
    102102  [PushExpression(StackTypes.Char, "CHAR.DEFINE", StackTypes.Name)]
    103103  public class CharDefineExpression : DefineExpression<char> {
    104     public override bool Eval(IPushInterpreter interpreter) {
     104    public override bool Eval(IInternalPushInterpreter interpreter) {
    105105      return Eval(
    106106        interpreter.CharStack,
     
    113113  [PushExpression(StackTypes.String, "STRING.DEFINE", StackTypes.Name)]
    114114  public class StringDefineExpression : DefineExpression<string> {
    115     public override bool Eval(IPushInterpreter interpreter) {
     115    public override bool Eval(IInternalPushInterpreter interpreter) {
    116116      return Eval(
    117117        interpreter.StringStack,
     
    121121    }
    122122  }
     123
     124  [PushExpression(StackTypes.IntegerVector, "INTEGER[].DEFINE", StackTypes.Name)]
     125  public class IntegerVectorDefineExpression : DefineExpression<List<long>> {
     126    public override bool Eval(IInternalPushInterpreter interpreter) {
     127      return Eval(
     128        interpreter.IntegerVectorStack,
     129        interpreter.NameStack,
     130        interpreter.CustomExpressions,
     131        v => new IntegerVectorPushExpression(v));
     132    }
     133  }
    123134}
Note: See TracChangeset for help on using the changeset viewer.