Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/07/17 13:49:09 (6 years ago)
Author:
abeham
Message:

#2747: worked on the CFSAP

  • Introduced new benchmark instances mentioned in the literature and updated the parser
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/CFSAPSequenceOnly.cs

    r14757 r15456  
    3434
    3535namespace HeuristicLab.Problems.Scheduling.CFSAP {
    36   [Item("Cyclic Flow Shop with two machine nests (CFSAP) sequence only", "Non-permutational cyclic flow shop scheduling problem with two machine nests from W. Bozejko.")]
     36  [Item("Cyclic flow shop with two machines and a single nest (CFSAP) sequencing problem", "Non-permutational cyclic flow shop scheduling problem with a single nest of two machine from W. Bozejko.")]
    3737  [Creatable(CreatableAttribute.Categories.CombinatorialProblems)]
    3838  [StorableClass]
     
    9090    public override double Evaluate(Individual individual, IRandom random) {
    9191      var order = individual.Permutation(Encoding.Name);
     92      int T = EvaluateSequence(order);
     93      return T;
     94    }
     95
     96    public int EvaluateSequence(Permutation order) {
    9297      var N = order.Length;
    9398      var processingTimes = ProcessingTimesParameter.Value;
     
    229234    }
    230235
     236    /// <summary>
     237    /// Imports the first nest (index 0) given in the CFSAPData.
     238    /// This is the same as calling Load(data, 0).
     239    /// </summary>
     240    /// <param name="data">The data of all nests.</param>
    231241    public void Load(CFSAPData data) {
    232       if (data.MachineNests != 2) throw new ArgumentException("Currently only two machine nests are supported.");
    233       ProcessingTimesParameter.Value = new IntMatrix(data.ProcessingTimes);
    234       var setups = new ItemList<IntMatrix>(data.MachineNests);
    235       for (var m = 0; m < data.SetupTimes.GetLength(0); m++) {
     242      Load(data, 0);
     243    }
     244
     245    /// <summary>
     246    /// Imports a specific nest given in the CFSAPData.
     247    /// </summary>
     248    /// <param name="data">The data of all nests.</param>
     249    /// <param name="nest">The zero-based index of the nest that should be imported.</param>
     250    public void Load(CFSAPData data, int nest) {
     251      if (data.Machines[nest] != 2) throw new ArgumentException("Currently only two machines per nest are supported.");
     252      if (nest < 0 || nest >= data.Nests) throw new ArgumentException("Nest must be a zero-based index.");
     253      var pr = new int[data.Machines[nest], data.Jobs];
     254      for (var i = 0; i < data.Machines[nest]; i++)
     255        for (var j = 0; j < data.Jobs; j++)
     256          pr[i, j] = data.ProcessingTimes[nest][i][j];
     257      ProcessingTimesParameter.Value = new IntMatrix(pr);
     258      var setups = new ItemList<IntMatrix>(data.Machines[nest]);
     259      for (var m = 0; m < data.SetupTimes[nest].GetLength(0); m++) {
    236260        var setupTimes = new int[data.Jobs, data.Jobs];
    237261        for (var i = 0; i < data.Jobs; i++)
    238         for (var j = 0; j < data.Jobs; j++)
    239           setupTimes[i, j] = data.SetupTimes[m, i, j];
     262          for (var j = 0; j < data.Jobs; j++)
     263            setupTimes[i, j] = data.SetupTimes[nest][m][i][j];
    240264        setups.Add(new IntMatrix(setupTimes));
    241265      }
    242266      SetupTimesParameter.Value = setups;
    243267      Encoding.Length = data.Jobs;
    244       Name = data.Name;
     268      Name = data.Name + "-nest" + nest;
    245269      Description = data.Description;
    246270    }
Note: See TracChangeset for help on using the changeset viewer.