Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/12/17 14:11:43 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed bias 0 issue, PushExpressionFrequencyAnalyzer, Fixed probability for ERC settings, Fixed enable/disable instructions, Added expression descriptions

File:
1 edited

Legend:

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

    r15017 r15032  
    1515  /// </summary>
    1616  [StorableClass]
    17   [PushExpression(StackTypes.Exec, "EXEC.IF", StackTypes.Boolean, execIn: 2)]
     17  [PushExpression(
     18    StackTypes.Exec,
     19    "EXEC.IF",
     20    "If the top item of the BOOLEAN stack is TRUE then this removes the second item on the EXEC stack, leaving the first item to be executed. If it is false then it removes the first item, leaving the second to be executed.",
     21    StackTypes.Boolean,
     22    execIn: 2)]
    1823  public class ExecIfExpression : StatelessExpression {
    1924    public ExecIfExpression() { }
     
    3439
    3540  /// <summary>
    36   ///     Inserts beneath the top item of the EXEC stack a new item of the form
    37   ///     "( EXEC.Y <TopItem> )".
    38   /// </summary>
    39   [PushExpression(StackTypes.Exec, "EXEC.Y", execIn: 1)]
     41  /// Inserts beneath the top item of the EXEC stack a new item of the form "( EXEC.Y <TopItem> )".
     42  /// </summary>
     43  [PushExpression(
     44    StackTypes.Exec,
     45    "EXEC.Y",
     46    "Inserts beneath the top item of the EXEC stack a new item of the form \"( EXEC.Y <TopItem> )\"",
     47    execIn: 1)]
    4048  [StorableClass]
    4149  public class ExecYExpression : StatelessExpression {
     
    6674
    6775  /// <summary>
    68   ///     Removes the second item on the EXEC stack.
    69   /// </summary>
    70   [PushExpression(StackTypes.Exec, "EXEC.K", execIn: 2)]
     76  /// Removes the second item on the EXEC stack.
     77  /// </summary>
     78  [PushExpression(
     79    StackTypes.Exec,
     80    "EXEC.K",
     81    "Removes the second item on the EXEC stack.",
     82    execIn: 2)]
    7183  [StorableClass]
    7284  public class ExecKExpression : StatelessExpression {
     
    8698
    8799  /// <summary>
    88   ///     Pops 3 items from the EXEC stack, which we will call A, B, and C
    89   ///     (with A being the first one popped). Then pushes a list containing B and C back onto the EXEC stack, followed by
    90   ///     another instance of C, followed by another instance of A.
    91   /// </summary>
    92   [PushExpression(StackTypes.Exec, "EXEC.S", execIn: 3)]
     100  /// Pops 3 items from the EXEC stack, which we will call A, B, and C
     101  /// (with A being the first one popped). Then pushes a list containing B and C back onto the EXEC stack, followed by
     102  /// another instance of C, followed by another instance of A.
     103  /// </summary>
     104  [PushExpression(
     105    StackTypes.Exec,
     106    "EXEC.S",
     107    "Pops 3 items from the EXEC stack called A, B, and C. Then pushes a list containing B and C back onto the EXEC stack, followed by another instance of C, followed by another instance of A.",
     108    execIn: 3)]
    93109  [StorableClass]
    94110  public class ExecSExpression : StatelessExpression {
     
    121137
    122138  /// <summary>
    123   ///     Does nothing.
     139  /// Does nothing.
    124140  /// </summary>
    125141  ///
    126142  [StorableClass]
    127143  [Serializable]
    128   [PushExpression(StackTypes.Exec, "EXEC.NOOP")]
     144  [PushExpression(
     145    StackTypes.Exec,
     146    "EXEC.NOOP",
     147    "Does nothing.")]
    129148  public class ExecNoopExpression : StatelessExpression {
    130149    public ExecNoopExpression() { }
     
    141160  }
    142161
    143   [PushExpression(StackTypes.Exec, "EXEC.WHILE", StackTypes.Boolean, execIn: 1)]
     162  /// <summary>
     163  /// Executes top EXEC item recursively as long top BOOLEAN is TRUE.
     164  /// </summary>
     165  [PushExpression(
     166    StackTypes.Exec,
     167    "EXEC.WHILE",
     168    "Executes top EXEC item recursively as long top BOOLEAN is TRUE.",
     169    StackTypes.Boolean, execIn: 1)]
    144170  [StorableClass]
    145171  public class ExecWhileExpression : StatelessExpression {
     
    153179
    154180    public override void Eval(IInternalPushInterpreter interpreter) {
    155       if (interpreter.BooleanStack.IsEmpty) {
     181      if (interpreter.BooleanStack.IsEmpty ||
     182          !interpreter.BooleanStack.Pop()) {
    156183        interpreter.ExecStack.Pop();
    157184        return;
    158185      }
    159186
    160       var booleanTop = interpreter.BooleanStack.Pop();
    161 
    162       if (!booleanTop) {
    163         interpreter.ExecStack.Pop();
    164         return;
    165       }
    166 
    167187      interpreter.ExecStack.Push(this, interpreter.ExecStack.Top);
    168188    }
    169189  }
    170190
    171   [PushExpression(StackTypes.Exec, "EXEC.DO*WHILE", execIn: 1)]
     191  /// <summary>
     192  /// Executes top EXEC item recursively until max. amount of eval. expressions is reached or top EXEC item removes the the recursive call.
     193  /// </summary>
     194  [PushExpression(
     195    StackTypes.Exec,
     196    "EXEC.DO*WHILE",
     197    "Executes top EXEC item recursively until max. amount of eval. expressions is reached or top EXEC item removes the the recursive call.",
     198    execIn: 1)]
    172199  [StorableClass]
    173200  public class ExecDoWhileExpression : StatelessExpression {
     
    185212  }
    186213
    187   [PushExpression(StackTypes.Exec, "EXEC.WHEN", StackTypes.Boolean, execIn: 1)]
     214  /// <summary>
     215  /// Top EXEC item is only executed, if top BOOLEAN is TRUE.
     216  /// </summary>
     217  [PushExpression(
     218    StackTypes.Exec,
     219    "EXEC.WHEN",
     220    "Top EXEC item is only executed, if top BOOLEAN is TRUE.",
     221    StackTypes.Boolean,
     222    execIn: 1)]
    188223  [StorableClass]
    189224  public class ExecWhenExpression : StatelessExpression {
Note: See TracChangeset for help on using the changeset viewer.