Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17680 for branches


Ignore:
Timestamp:
07/18/20 00:25:54 (4 years ago)
Author:
abeham
Message:

#2521: working on problems / fixing P3

Location:
branches/2521_ProblemRefactoring
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs

    r17513 r17680  
    119119
    120120    #region ResultsProperties
    121     private double ResultsBestQuality {
    122       get { return ((DoubleValue)Results["Best Quality"].Value).Value; }
    123       set { ((DoubleValue)Results["Best Quality"].Value).Value = value; }
    124     }
    125 
    126     private BinaryVector ResultsBestSolution {
    127       get { return (BinaryVector)Results["Best Solution"].Value; }
    128       set { Results["Best Solution"].Value = value; }
    129     }
    130 
    131     private int ResultsBestFoundOnEvaluation {
    132       get { return ((IntValue)Results["Evaluation Best Solution Was Found"].Value).Value; }
    133       set { ((IntValue)Results["Evaluation Best Solution Was Found"].Value).Value = value; }
    134     }
    135 
    136     private int ResultsEvaluations {
    137       get { return ((IntValue)Results["Evaluations"].Value).Value; }
    138       set { ((IntValue)Results["Evaluations"].Value).Value = value; }
    139     }
    140     private int ResultsIterations {
    141       get { return ((IntValue)Results["Iterations"].Value).Value; }
    142       set { ((IntValue)Results["Iterations"].Value).Value = value; }
    143     }
    144 
    145     private DataTable ResultsQualities {
    146       get { return ((DataTable)Results["Qualities"].Value); }
    147     }
    148     private DataRow ResultsQualitiesBest {
    149       get { return ResultsQualities.Rows["Best Quality"]; }
    150     }
    151 
    152     private DataRow ResultsQualitiesIteration {
    153       get { return ResultsQualities.Rows["Iteration Quality"]; }
    154     }
    155 
    156 
    157     private DataRow ResultsLevels {
    158       get { return ((DataTable)Results["Pyramid Levels"].Value).Rows["Levels"]; }
    159     }
    160 
    161     private DataRow ResultsSolutions {
    162       get { return ((DataTable)Results["Stored Solutions"].Value).Rows["Solutions"]; }
    163     }
     121    [Storable] private DoubleValue resultsBestQuality;
     122    public double ResultsBestQuality {
     123      get => resultsBestQuality.Value;
     124      set => resultsBestQuality.Value = value;
     125    }
     126    [Storable] private IntValue resultsBestFoundOnEvaluation;
     127    public int ResultsBestFoundOnEvaluation {
     128      get => resultsBestFoundOnEvaluation.Value;
     129      set => resultsBestFoundOnEvaluation.Value = value;
     130    }
     131    [Storable] private IntValue resultsEvaluations;
     132    public int ResultsEvaluations {
     133      get => resultsEvaluations.Value;
     134      set => resultsEvaluations.Value = value;
     135    }
     136    [Storable] private IntValue resultsIterations;
     137    public int ResultsIterations {
     138      get => resultsIterations.Value;
     139      set => resultsIterations.Value = value;
     140    }
     141    [Storable] public DataRow ResultsQualitiesBest { get; private set; }
     142    [Storable] public DataRow ResultsQualitiesIteration { get; private set; }
     143    [Storable] public DataRow ResultsLevels { get; private set; }
     144    [Storable] public DataRow ResultsSolutions { get; private set; }
    164145    #endregion
    165146
     
    175156      tracker = cloner.Clone(original.tracker);
    176157      seen = new HashSet<BinaryVector>(original.seen.Select(cloner.Clone), new EnumerableBoolEqualityComparer());
     158      resultsBestQuality = cloner.Clone(original.resultsBestQuality);
     159      resultsBestFoundOnEvaluation = cloner.Clone(original.resultsBestFoundOnEvaluation);
     160      resultsEvaluations = cloner.Clone(original.resultsEvaluations);
     161      resultsIterations = cloner.Clone(original.resultsIterations);
     162      ResultsQualitiesBest = cloner.Clone(original.ResultsQualitiesBest);
     163      ResultsQualitiesIteration = cloner.Clone(original.ResultsQualitiesIteration);
     164      ResultsLevels = cloner.Clone(original.ResultsLevels);
     165      ResultsSolutions = cloner.Clone(original.ResultsSolutions);
    177166    }
    178167
     
    239228
    240229      // Set up the results display
    241       Results.Add(new Result("Iterations", new IntValue(0)));
    242       Results.Add(new Result("Evaluations", new IntValue(0)));
    243       Results.Add(new Result("Best Solution", new BinaryVector(tracker.BestSolution)));
    244       Results.Add(new Result("Best Quality", new DoubleValue(tracker.BestQuality)));
    245       Results.Add(new Result("Evaluation Best Solution Was Found", new IntValue(tracker.BestFoundOnEvaluation)));
     230      if (!Results.TryGetValue("Iterations", out var result))
     231        Results.Add(new Result("Iterations", resultsIterations = new IntValue(0)));
     232      else result.Value = resultsIterations = new IntValue(0);
     233      if (!Results.TryGetValue("Evaluations", out var result2))
     234        Results.Add(new Result("Evaluations", resultsEvaluations = new IntValue(0)));
     235      else result2.Value = resultsEvaluations = new IntValue(0);
     236      if (!Results.TryGetValue("Best Quality", out var result4))
     237        Results.Add(new Result("Best Quality", resultsBestQuality = new DoubleValue(tracker.BestQuality)));
     238      else result4.Value = resultsBestQuality = new DoubleValue(tracker.BestQuality);
     239      if (!Results.TryGetValue("Evaluation Best Solution Was Found", out var result5))
     240        Results.Add(new Result("Evaluation Best Solution Was Found", resultsBestFoundOnEvaluation = new IntValue(tracker.BestFoundOnEvaluation)));
     241      else result5.Value = resultsBestFoundOnEvaluation = new IntValue(tracker.BestFoundOnEvaluation);
    246242      var table = new DataTable("Qualities");
    247       table.Rows.Add(new DataRow("Best Quality"));
    248       var iterationRows = new DataRow("Iteration Quality");
    249       iterationRows.VisualProperties.LineStyle = DataRowVisualProperties.DataRowLineStyle.Dot;
    250       table.Rows.Add(iterationRows);
    251       Results.Add(new Result("Qualities", table));
     243      table.Rows.Add(ResultsQualitiesBest = new DataRow("Best Quality"));
     244      table.Rows.Add(ResultsQualitiesIteration = new DataRow("Iteration Quality"));
     245      ResultsQualitiesIteration.VisualProperties.LineStyle = DataRowVisualProperties.DataRowLineStyle.Dot;
     246      if (!Results.TryGetValue("Qualities", out var result6))
     247        Results.Add(new Result("Qualities", table));
     248      else result6.Value = table;
    252249
    253250      table = new DataTable("Pyramid Levels");
    254       table.Rows.Add(new DataRow("Levels"));
    255       Results.Add(new Result("Pyramid Levels", table));
     251      table.Rows.Add(ResultsLevels = new DataRow("Levels"));
     252      if (!Results.TryGetValue("Pyramid Levels", out var result7))
     253        Results.Add(new Result("Pyramid Levels", table));
     254      else result7.Value = table;
    256255
    257256      table = new DataTable("Stored Solutions");
    258       table.Rows.Add(new DataRow("Solutions"));
    259       Results.Add(new Result("Stored Solutions", table));
     257      table.Rows.Add(ResultsSolutions = new DataRow("Solutions"));
     258      if (!Results.TryGetValue("Stored Solutions", out var result8))
     259        Results.Add(new Result("Stored Solutions", table));
     260      else result8.Value = table;
    260261
    261262      base.Initialize(cancellationToken);
     
    273274        } finally {
    274275          ResultsEvaluations = tracker.Evaluations;
    275           ResultsBestSolution = new BinaryVector(tracker.BestSolution);
    276276          ResultsBestQuality = tracker.BestQuality;
    277277          ResultsBestFoundOnEvaluation = tracker.BestFoundOnEvaluation;
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleEncoding.cs

    r17461 r17680  
    3030  [StorableType("09b9d24c-2576-495a-b06c-338d095cba0d")]
    3131  public interface IScheduleEncoding : IEncoding<IScheduleSolution> {
    32     IValueParameter<ItemList<Job>> JobDataParameter { get; set; }
    33     IFixedValueParameter<IntValue> JobsParameter { get; set; }
    34     IFixedValueParameter<IntValue> ResourcesParameter { get; set; }
     32    IValueParameter<ItemList<Job>> JobDataParameter { get; }
     33    IFixedValueParameter<IntValue> JobsParameter { get; }
     34    IFixedValueParameter<IntValue> ResourcesParameter { get; }
    3535
    3636    ItemList<Job> JobData { get; }
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding.cs

    r17614 r17680  
    3434  public abstract class ScheduleEncoding<TSchedule> : Encoding<TSchedule>, IScheduleEncoding
    3535  where TSchedule : class, IScheduleSolution {
    36     #region Encoding Parameters
    37     [Storable]
    38     private IValueParameter<ItemList<Job>> jobDataParameter;
    39     public IValueParameter<ItemList<Job>> JobDataParameter {
    40       get { return jobDataParameter; }
    41       set {
    42         if (value == null) throw new ArgumentNullException("JobData parameter must not be null.");
    43         if (value.Value == null) throw new ArgumentNullException("JobData parameter value must not be null.");
    44         if (jobDataParameter == value) return;
    45 
    46         if (jobDataParameter != null) Parameters.Remove(jobDataParameter);
    47         jobDataParameter = value;
    48         Parameters.Add(jobDataParameter);
    49         OnJobDataParameterChanged();
    50       }
    51     }
    52 
    53     [Storable]
    54     private IFixedValueParameter<IntValue> jobsParameter;
    55     public IFixedValueParameter<IntValue> JobsParameter {
    56       get { return jobsParameter; }
    57       set {
    58         if (value == null) throw new ArgumentNullException("Jobs parameter must not be null.");
    59         if (value.Value == null) throw new ArgumentNullException("Jobs parameter value must not be null.");
    60         if (jobsParameter == value) return;
    61 
    62         if (jobsParameter != null) Parameters.Remove(jobsParameter);
    63         jobsParameter = value;
    64         Parameters.Add(jobsParameter);
    65         OnJobsParameterChanged();
    66       }
    67     }
    68     [Storable]
    69     private IFixedValueParameter<IntValue> resourcesParameter;
    70     public IFixedValueParameter<IntValue> ResourcesParameter {
    71       get { return resourcesParameter; }
    72       set {
    73         if (value == null) throw new ArgumentNullException("Resources parameter must not be null.");
    74         if (value.Value == null) throw new ArgumentNullException("Resources parameter value must not be null.");
    75         if (resourcesParameter == value) return;
    76 
    77         if (resourcesParameter != null) Parameters.Remove(resourcesParameter);
    78         resourcesParameter = value;
    79         Parameters.Add(resourcesParameter);
    80         OnBoundsParameterChanged();
    81       }
    82     }
    83 
    84     [Storable]
    85     private IValueParameter<IScheduleDecoder<TSchedule>> decoderParameter;
    86     public IValueParameter<IScheduleDecoder<TSchedule>> DecoderParameter {
    87       get { return decoderParameter; }
    88       set {
    89         if (value == null) throw new ArgumentNullException("Decoder parameter must not be null.");
    90         if (value.Value == null) throw new ArgumentNullException("Decoder parameter value must not be null.");
    91         if (decoderParameter == value) return;
    92 
    93         if (decoderParameter != null) Parameters.Remove(decoderParameter);
    94         decoderParameter = value;
    95         Parameters.Add(decoderParameter);
    96         OnDecoderParameterChanged();
    97       }
    98     }
    99     #endregion
     36    [Storable] public IValueParameter<ItemList<Job>> JobDataParameter { get; private set; }
     37    [Storable] public IFixedValueParameter<IntValue> JobsParameter { get; private set; }
     38    [Storable] public IFixedValueParameter<IntValue> ResourcesParameter { get; private set; }
     39    [Storable] public IValueParameter<IScheduleDecoder<TSchedule>> DecoderParameter { get; private set; }
    10040
    10141    public ItemList<Job> JobData {
     
    12060    protected ScheduleEncoding(ScheduleEncoding<TSchedule> original, Cloner cloner)
    12161      : base(original, cloner) {
    122       jobDataParameter = cloner.Clone(original.JobDataParameter);
    123       jobsParameter = cloner.Clone(original.JobsParameter);
    124       resourcesParameter = cloner.Clone(original.ResourcesParameter);
    125       decoderParameter = cloner.Clone(original.DecoderParameter);
     62      JobDataParameter = cloner.Clone(original.JobDataParameter);
     63      JobsParameter = cloner.Clone(original.JobsParameter);
     64      ResourcesParameter = cloner.Clone(original.ResourcesParameter);
     65      DecoderParameter = cloner.Clone(original.DecoderParameter);
     66
     67      RegisterParameterEvents();
    12668    }
    12769
     
    13274      int resources = jobData.SelectMany(j => j.Tasks).Select(t => t.ResourceNr).Distinct().Count();
    13375
    134       jobDataParameter = new ValueParameter<ItemList<Job>>(Name + ".JobData", new ItemList<Job>(jobData));
    135       jobsParameter = new FixedValueParameter<IntValue>(Name + ".Jobs", new IntValue(jobs));
    136       resourcesParameter = new FixedValueParameter<IntValue>(Name + ".Resources", new IntValue(resources));
    137       decoderParameter = new ValueParameter<IScheduleDecoder<TSchedule>>(Name + ".Decoder");
     76      Parameters.Add(JobDataParameter = new ValueParameter<ItemList<Job>>(Name + ".JobData", new ItemList<Job>(jobData)));
     77      Parameters.Add(JobsParameter = new FixedValueParameter<IntValue>(Name + ".Jobs", new IntValue(jobs)));
     78      Parameters.Add(ResourcesParameter = new FixedValueParameter<IntValue>(Name + ".Resources", new IntValue(resources)));
     79      Parameters.Add(DecoderParameter = new ValueParameter<IScheduleDecoder<TSchedule>>(Name + ".Decoder"));
    13880
    139       Parameters.Add(jobDataParameter);
    140       Parameters.Add(jobsParameter);
    141       Parameters.Add(resourcesParameter);
    142       Parameters.Add(decoderParameter);
     81      RegisterParameterEvents();
     82    }
     83
     84    private void RegisterParameterEvents() {
     85      ItemListParameterChangeHandler<Job>.Create(JobDataParameter, () => {
     86        ConfigureOperators(Operators);
     87        OnJobDataChanged();
     88      });
     89      IntValueParameterChangeHandler.Create(JobsParameter, () => {
     90        ConfigureOperators(Operators);
     91        OnJobsChanged();
     92      });
     93      IntValueParameterChangeHandler.Create(ResourcesParameter, () => {
     94        ConfigureOperators(Operators);
     95        OnResourcesChanged();
     96      });
     97      ParameterChangeHandler<IScheduleDecoder<TSchedule>>.Create(DecoderParameter, () => {
     98        ConfigureOperators(Operators);
     99        OnDecoderChanged();
     100      });
    143101    }
    144102
    145103    public Schedule Decode(IScheduleSolution schedule, ItemList<Job> jobData) {
    146104      return Decoder.DecodeSchedule(schedule, jobData);
    147     }
    148 
    149     private void OnJobDataParameterChanged() {
    150       ConfigureOperators(Operators);
    151     }
    152     private void OnJobsParameterChanged() {
    153       ConfigureOperators(Operators);
    154     }
    155     private void OnBoundsParameterChanged() {
    156       ConfigureOperators(Operators);
    157     }
    158 
    159     private void OnDecoderParameterChanged() {
    160       ConfigureOperators(Operators);
    161105    }
    162106
     
    187131        manipulator.ScheduleParameter.ActualName = Name;
    188132    }
     133
     134    public event EventHandler JobDataChanged;
     135    protected virtual void OnJobDataChanged() => JobDataChanged?.Invoke(this, EventArgs.Empty);
     136
     137    public event EventHandler JobsChanged;
     138    protected virtual void OnJobsChanged() => JobsChanged?.Invoke(this, EventArgs.Empty);
     139   
     140    public event EventHandler ResourcesChanged;
     141    protected virtual void OnResourcesChanged() => ResourcesChanged?.Invoke(this, EventArgs.Empty);
     142
     143    public event EventHandler DecoderChanged;
     144    protected virtual void OnDecoderChanged() => DecoderChanged?.Invoke(this, EventArgs.Empty);
    189145  }
    190146}
  • branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/ParameterChangeHandler.cs

    r17614 r17680  
    2121
    2222using System;
     23using System.ComponentModel;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    214215     => new StringValueParameterChangeHandler(parameter, handler);
    215216  }
     217
     218  public class ItemListParameterChangeHandler<T> : ParameterChangeHandler<ItemList<T>> where T : class,IItem {
     219    private ItemList<T> last;
     220
     221    private ItemListParameterChangeHandler(IValueParameter<ItemList<T>> parameter, Action handler)
     222      : base(parameter, handler) {
     223      last = parameter.Value;
     224      if (last != null && !(last is ReadOnlyItemList<T>)) {
     225        last.PropertyChanged += ParameterValueOnListChanged;
     226      }
     227    }
     228
     229    protected override void ParameterOnValueChanged(object sender, EventArgs e) {
     230      if (last != null && !(last is ReadOnlyItemList<T>))
     231        last.PropertyChanged -= ParameterValueOnListChanged;
     232      last = ((IValueParameter<ItemList<T>>)sender).Value;
     233      if (last != null && !(last is ReadOnlyItemList<T>))
     234        last.PropertyChanged += ParameterValueOnListChanged;
     235      base.ParameterOnValueChanged(sender, e);
     236    }
     237
     238    private void ParameterValueOnListChanged(object sender, PropertyChangedEventArgs e) {
     239      if (e.PropertyName == "Item[]") handler();
     240    }
     241    public static ItemListParameterChangeHandler<T> Create(IValueParameter<ItemList<T>> parameter, Action handler)
     242     => new ItemListParameterChangeHandler<T>(parameter, handler);
     243  }
    216244}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblem.cs

    r17594 r17680  
    6767      get { return (IResultParameter<LAPAssignment>)Parameters["Best LAP Solution"]; }
    6868    }
    69     //public IResultDefinition<LAPAssignment> BestLAPSolution => BestLAPSolutionParameter;
    7069    #endregion
    7170
     
    101100    public LinearAssignmentProblem()
    102101      : base(new PermutationEncoding("Assignment")) {
     102      Encoding.LengthParameter.ReadOnly = DimensionRefParameter.ReadOnly = true;
     103
    103104      Parameters.Add(new ValueParameter<DoubleMatrix>("Costs", CostsDescription, new DoubleMatrix(3, 3)));
    104105      Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs

    r17620 r17680  
    7070    public OrienteeringProblem()
    7171      : base(new IntegerVectorEncoding("Route")) {
     72      Maximization = true;
     73      Encoding.LengthParameter.ReadOnly = DimensionRefParameter.ReadOnly = true;
     74      Encoding.BoundsParameter.ReadOnly = BoundsRefParameter.ReadOnly = true;
     75
    7276      Parameters.Add(OrienteeringProblemDataParameter = new ValueParameter<IOrienteeringProblemData>("OP Data", "The main parameters for the orienteering problem.", new OrienteeringProblemData()));
    7377      Parameters.Add(BestKnownSolutionParameter = new OptionalValueParameter<OrienteeringSolution>("BestKnownSolution", "The best known solution of this Orienteering instance."));
    7478      Parameters.Add(BestOrienteeringSolutionParameter = new ResultParameter<OrienteeringSolution>("Best Orienteering Solution", "The best so far solution found."));
    75       Maximization = true;
     79     
    7680      Dimension = OrienteeringProblemData.Cities;
    7781      Bounds = new Data.IntMatrix(new[,] { { 0, Dimension } }, @readonly: true);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/ProbabilisticTSP.cs

    r17544 r17680  
    6666    protected ProbabilisticTSP() : base(new PermutationEncoding("Tour")) {
    6767      Maximization = false;
     68      Encoding.LengthParameter.ReadOnly = DimensionRefParameter.ReadOnly = true;
     69      Encoding.PermutationTypeParameter.ReadOnly = PermutationTypeRefParameter.ReadOnly = true;
     70      PermutationTypeRefParameter.Hidden = true;
     71
    6872      Parameters.Add(PTSPDataParameter = new ValueParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters for the pTSP."));
    6973      Parameters.Add(BestKnownSolutionParameter = new OptionalValueParameter<IProbabilisticTSPSolution>("BestKnownSolution", "The best known solution of this pTSP instance."));
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r17544 r17680  
    106106      : base(new PermutationEncoding("Assignment") { Length = 5 }) {
    107107      Maximization = false;
     108      Encoding.LengthParameter.ReadOnly = DimensionRefParameter.ReadOnly = true;
     109      Encoding.PermutationTypeParameter.ReadOnly = PermutationTypeRefParameter.ReadOnly = true;
     110      PermutationTypeRefParameter.Hidden = true;
     111
    108112      Parameters.Add(BestKnownSolutionsParameter = new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    109113      Parameters.Add(BestKnownSolutionParameter = new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/HeuristicLab.Problems.Scheduling.Views-3.3.csproj

    r17461 r17680  
    183183      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
    184184      <Name>HeuristicLab.Optimization-3.3</Name>
     185      <Private>False</Private>
     186    </ProjectReference>
     187    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     188      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
     189      <Name>HeuristicLab.Parameters-3.3</Name>
    185190      <Private>False</Private>
    186191    </ProjectReference>
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs

    r17517 r17680  
    7979   
    8080    #region Parameter Properties
    81     [Storable] public IValueParameter<ItemList<Job>> JobDataParameter { get; private set; }
     81    [Storable] public ReferenceParameter<ItemList<Job>> JobDataParameter { get; private set; }
    8282    [Storable] public OptionalValueParameter<Schedule> BestKnownSolutionParameter { get; private set; }
    83     [Storable] public IFixedValueParameter<IntValue> JobsParameter { get; private set; }
    84     [Storable] public IFixedValueParameter<IntValue> ResourcesParameter { get; private set; }
     83    [Storable] public ReferenceParameter<IntValue> JobsParameter { get; private set; }
     84    [Storable] public ReferenceParameter<IntValue> ResourcesParameter { get; private set; }
    8585    [Storable] public IFixedValueParameter<EnumValue<JSSPObjective>> ObjectiveParameter { get; private set; }
    8686    #endregion
     
    137137    public JobShopSchedulingProblem()
    138138      : base(new JobSequenceMatrixEncoding()) {
    139       Parameters.Add(JobDataParameter = new ValueParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance.", new ItemList<Job>()));
     139      Parameters.Add(JobDataParameter = new ReferenceParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance.", Encoding.JobDataParameter));
    140140      Parameters.Add(BestKnownSolutionParameter = new OptionalValueParameter<Schedule>("BestKnownSolution", "The best known solution of this JSSP instance."));
    141       Parameters.Add(JobsParameter = new FixedValueParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", new IntValue()));
    142       Parameters.Add(ResourcesParameter = new FixedValueParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", new IntValue()));
     141      Parameters.Add(JobsParameter = new ReferenceParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", Encoding.JobsParameter));
     142      Parameters.Add(ResourcesParameter = new ReferenceParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", Encoding.ResourcesParameter));
    143143      Parameters.Add(ObjectiveParameter = new FixedValueParameter<EnumValue<JSSPObjective>>("Objective", "The objective to use in the evaluation of a schedule.", new EnumValue<JSSPObjective>(JSSPObjective.Makespan)));
    144144      EncodingParameter.Hidden = false;
    145 
    146       Encoding.ResourcesParameter = ResourcesParameter;
    147       Encoding.JobsParameter = JobsParameter;
    148       Encoding.JobDataParameter = JobDataParameter;
    149145
    150146      RegisterEventHandlers();
     
    191187    protected override void OnEncodingChanged() {
    192188      base.OnEncodingChanged();
    193       Encoding.ResourcesParameter = ResourcesParameter;
    194       Encoding.JobsParameter = JobsParameter;
    195       Encoding.JobDataParameter = JobDataParameter;
     189      Parameters.Remove(JobDataParameter);
     190      Parameters.Add(JobDataParameter = new ReferenceParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance.", Encoding.JobDataParameter));
     191      Parameters.Remove(JobsParameter);
     192      Parameters.Add(JobsParameter = new ReferenceParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", Encoding.JobsParameter));
     193      Parameters.Remove(ResourcesParameter);
     194      Parameters.Add(ResourcesParameter = new ReferenceParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", Encoding.ResourcesParameter));
    196195    }
    197196
Note: See TracChangeset for help on using the changeset viewer.