Free cookie consent management tool by TermsFeed Policy Generator

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

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

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

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