Changeset 16811


Ignore:
Timestamp:
04/18/19 11:01:14 (4 months ago)
Author:
abeham
Message:

#2521: Removed usage of default constructor

Location:
branches/2521_ProblemRefactoring
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs

    r16806 r16811  
    6868      ParameterizeOperators();
    6969    }
    70 
     70 
    7171    protected SingleObjectiveProblem() : base() {
    7272      Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true });
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblem.cs

    r16751 r16811  
    7171    }
    7272
    73     public MultiObjectiveProgrammableProblem()
    74       : base() {
     73    public MultiObjectiveProgrammableProblem(TEncoding encoding)
     74      : base(encoding) {
    7575      Parameters.Add(new FixedValueParameter<MultiObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>>("ProblemScript", "Defines the problem.",
    7676        new MultiObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>() { Name = Name }));
    77       ProblemScript.Encoding = (TEncoding)Encoding.Clone();
     77      ProblemScript.Encoding = (TEncoding)encoding.Clone();
    7878
    7979      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs

    r16725 r16811  
    4545
    4646    public SingleObjectiveBinaryVectorProgrammableProblem()
    47       : base() {
     47      : base(new BinaryVectorEncoding()) {
    4848      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    4949      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
     
    6969
    7070    public SingleObjectiveIntegerVectorProgrammableProblem()
    71       : base() {
     71      : base(new IntegerVectorEncoding()) {
    7272      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    7373      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
     
    9292
    9393    public SingleObjectiveRealVectorProgrammableProblem()
    94       : base() {
     94      : base(new RealVectorEncoding()) {
    9595      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    9696      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
     
    115115
    116116    public SingleObjectivePermutationProgrammableProblem()
    117       : base() {
     117      : base(new PermutationEncoding()) {
    118118      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    119119      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
     
    137137    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    138138    public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
    139       : base() {
     139      : base(new SymbolicExpressionTreeEncoding()) {
    140140      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    141141      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding");
     
    159159    private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    160160    public SingleObjectiveLinearLinkageProgrammableProblem()
    161       : base() {
     161      : base(new LinearLinkageEncoding()) {
    162162      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
    163163      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.LinearLinkageEncoding");
     
    182182
    183183    public SingleObjectiveCombinedEncodingProgrammableProblem()
    184       : base() {
     184      : base(new CombinedEncoding()) {
    185185      ProblemScript.Code = ScriptTemplates.SingleObjectiveCombinedEncodingProblem_Template;
    186186    }
     
    204204
    205205    public MultiObjectiveBinaryVectorProgrammableProblem()
    206       : base() {
     206      : base(new BinaryVectorEncoding()) {
    207207      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    208208      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
     
    228228
    229229    public MultiObjectiveIntegerVectorProgrammableProblem()
    230       : base() {
     230      : base(new IntegerVectorEncoding()) {
    231231      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    232232      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
     
    251251
    252252    public MultiObjectiveRealVectorProgrammableProblem()
    253       : base() {
     253      : base(new RealVectorEncoding()) {
    254254      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    255255      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
     
    273273    private MultiObjectivePermutationProgrammableProblem(MultiObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    274274    public MultiObjectivePermutationProgrammableProblem()
    275       : base() {
     275      : base(new PermutationEncoding()) {
    276276      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    277277      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
     
    295295    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(MultiObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    296296    public MultiObjectiveSymbolicExpressionTreeProgrammableProblem()
    297       : base() {
     297      : base(new SymbolicExpressionTreeEncoding()) {
    298298      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    299299      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding");
     
    317317    private MultiObjectiveLinearLinkageProgrammableProblem(MultiObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    318318    public MultiObjectiveLinearLinkageProgrammableProblem()
    319       : base() {
     319      : base(new LinearLinkageEncoding()) {
    320320      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
    321321      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.LinearLinkageEncoding");
     
    340340
    341341    public MultiObjectiveCombinedEncodingProgrammableProblem()
    342       : base() {
     342      : base(new CombinedEncoding()) {
    343343      ProblemScript.Code = ScriptTemplates.MultiObjectiveCombinedEncodingProblem_Template;
    344344    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs

    r16751 r16811  
    7373    [StorableConstructor]
    7474    protected SingleObjectiveProgrammableProblem(StorableConstructorFlag _) : base(_) { }
    75     public SingleObjectiveProgrammableProblem()
    76       : base() {
     75    public SingleObjectiveProgrammableProblem(TEncoding encoding)
     76      : base(encoding) {
    7777      Parameters.Add(new FixedValueParameter<SingleObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>>("ProblemScript", "Defines the problem.", new SingleObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>() { Name = Name }));
    78       ProblemScript.Encoding = (TEncoding)Encoding.Clone();
     78      ProblemScript.Encoding = (TEncoding)encoding.Clone();
    7979
    8080      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
Note: See TracChangeset for help on using the changeset viewer.