Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 16:42:09 (8 years ago)
Author:
mkommend
Message:

#2521: Refactored IntegerVectorEncoding, KnapsackProblem, and P3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs

    r13361 r13364  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.BinaryVectorEncoding;
     27using HeuristicLab.Encodings.IntegerVectorEncoding;
    2728using HeuristicLab.Encodings.RealVectorEncoding;
    2829using HeuristicLab.Optimization;
     
    7980  }
    8081
    81   //[Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
    82   //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    83   //[StorableClass]
    84   //public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
    85 
    86   //  [StorableConstructor]
    87   //  private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
    88   //  private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    89   //  public SingleObjectiveIntegerVectorProgrammableProblem()
    90   //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
    91 
    92   //  public override IDeepCloneable Clone(Cloner cloner) {
    93   //    return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
    94   //  }
    95   //}
     82  [Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
     83  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     84  [StorableClass]
     85  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
     86
     87    [StorableConstructor]
     88    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     89    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     90
     91    public SingleObjectiveIntegerVectorProgrammableProblem()
     92      : base() {
     93      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
     94      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
     95      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
     96      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
     97      ProblemScript.Code = codeTemplate;
     98    }
     99
     100    public override IDeepCloneable Clone(Cloner cloner) {
     101      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
     102    }
     103  }
    96104
    97105  [Item("Real Vector Programmable Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
     
    216224  }
    217225
    218   //[Item("Integer Vector Programmable Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
    219   //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    220   //[StorableClass]
    221   //public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
    222 
    223   //  [StorableConstructor]
    224   //  private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
    225   //  private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    226   //  public MultiObjectiveIntegerVectorProgrammableProblem()
    227   //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
    228 
    229   //  public override IDeepCloneable Clone(Cloner cloner) {
    230   //    return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
    231   //  }
    232   //}
     226  [Item("Integer Vector Programmable Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
     227  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     228  [StorableClass]
     229  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
     230
     231    [StorableConstructor]
     232    private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     233    private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     234
     235    public MultiObjectiveIntegerVectorProgrammableProblem()
     236      : base() {
     237      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
     238      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
     239      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
     240      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
     241      ProblemScript.Code = codeTemplate;
     242    }
     243
     244    public override IDeepCloneable Clone(Cloner cloner) {
     245      return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
     246    }
     247  }
    233248
    234249  [Item("Real Vector Programmable Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
Note: See TracChangeset for help on using the changeset viewer.