Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/Attributes/PushExpressionAttriubte.cs @ 16752

Last change on this file since 16752 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 1.7 KB
RevLine 
[14727]1using System;
2
[15771]3namespace HeuristicLab.Problems.ProgramSynthesis {
[14727]4
5  [AttributeUsage(AttributeTargets.Class)]
6  public class PushExpressionAttribute : Attribute {
[14834]7    public readonly StackTypes StackType;
[14777]8    public readonly StackTypes AdditionalStackDependencies;
[15032]9    public readonly string Name;
10    public readonly string Description;
[15273]11    public readonly int? InExpressionNr;
[15032]12
13    /// <summary>
14    /// Determines if this expression manipulates the exec stack.
15    /// </summary>
[14952]16    public readonly bool ManipulatesExec;
[15032]17
18    /// <summary>
19    /// Determines the amount of items fetched form the EXEC stack required for this expression. Used for mapping individuals.
20    /// </summary>
[15334]21    public readonly uint RequiredBlockCount;
[14727]22
[15017]23    /// <summary>
[15032]24    /// Determines if the expression is visible to the user for configuration purposes.
[15017]25    /// </summary>
26    public readonly bool IsHidden;
27
28    public PushExpressionAttribute(
29      StackTypes stackType,
[15032]30      string name,
31      string description,
[15017]32      StackTypes additionalStackDependencies = default(StackTypes),
[15334]33      uint requiredBlockCount = 0,
[15273]34      bool isHidden = false,
35      int inExpressionNr = -1) {
[15032]36
[14908]37      StackType = stackType;
38      AdditionalStackDependencies = additionalStackDependencies;
[15032]39      Name = name;
40      Description = description;
[15334]41      RequiredBlockCount = requiredBlockCount;
[15017]42      IsHidden = isHidden;
[15273]43      InExpressionNr = inExpressionNr > 0 ? inExpressionNr : default(int?);
[14952]44      ManipulatesExec = stackType == StackTypes.Exec || AdditionalStackDependencies.HasFlag(StackTypes.Exec);
[14727]45    }
[15273]46
47    public bool IsInExpression { get { return this.InExpressionNr.HasValue; } }
[14727]48  }
49}
Note: See TracBrowser for help on using the repository browser.