Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15493 for branches


Ignore:
Timestamp:
12/05/17 13:35:20 (6 years ago)
Author:
abeham
Message:

#2747: Implemeted hard-coded genetic algorithm for faster evaluation

Location:
branches/CFSAP
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/CFSAP/HeuristicLab.Problems.Instances.CFSAP/3.3/BozejkoCFSAPInstanceProvider.cs

    r15472 r15493  
    6262      };
    6363    }
     64
    6465    public override CFSAPData ImportData(string path) {
    6566      var instance = LoadInstance(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
  • branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/CFSAP.cs

    r15472 r15493  
    108108      var order = individual.Permutation("sequence");
    109109      var assignment = individual.BinaryVector("assignment");
    110       int T = EvaluateAssignement(order, assignment.Select(x => x ? 1 : 0).ToArray(),
    111         ProcessingTimesParameter.Value, SetupTimesParameter.Value);
    112       return T;
     110      return Evaluate(order, assignment);
     111    }
     112
     113    public int Evaluate(Permutation order, BinaryVector assignment) {
     114      return EvaluateAssignement(order, assignment, ProcessingTimes, SetupTimes);
    113115    }
    114116
     
    130132          int operation = order[i];
    131133          if (assignment[operation] == machine) {
     134            if (first == -1)
     135              first = operation;
     136            else
     137              T += setupTimes[machine][last, operation];
     138            last = operation;
     139          }
     140        }
     141        if (last != -1 && first != -1)
     142          T += setupTimes[machine][last, first];
     143      }
     144
     145      return T;
     146    }
     147
     148    //Function to evaluate individual with the specified assignment
     149    public static int EvaluateAssignement(Permutation order, BinaryVector assignment, IntMatrix processingTimes, ItemList<IntMatrix> setupTimes) {
     150      if (processingTimes.Rows != 2) throw new ArgumentException("Method can only be used when there are two machines.", "assignment");
     151      var N = order.Length;
     152      int T = 0;
     153
     154      for (int i = 0; i < N; i++) {
     155        int operation = order[i];
     156        int machine = assignment[operation] ? 1 : 0;
     157        T += processingTimes[machine, operation];
     158      }
     159
     160      for (int machine = 0; machine < 2; machine++) {
     161        int first = -1;
     162        int last = -1;
     163        for (int i = 0; i < N; i++) {
     164          int operation = order[i];
     165          if ((assignment[operation] ? 1 : 0) == machine) {
    132166            if (first == -1)
    133167              first = operation;
  • branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/HeuristicLab.Problems.Scheduling.CFSAP-3.3.csproj

    r15472 r15493  
    103103      <Private>False</Private>
    104104    </Reference>
     105    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     106      <SpecificVersion>False</SpecificVersion>
     107      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     108      <Private>False</Private>
     109    </Reference>
    105110    <Reference Include="SimSharp-3.0.9, Version=3.0.9.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    106111      <SpecificVersion>False</SpecificVersion>
     
    121126    <Compile Include="CFSAP.cs" />
    122127    <Compile Include="CFSAPSequenceOnly.cs" />
     128    <Compile Include="GeneticAlgorithm.cs" />
    123129    <Compile Include="ICFSAP.cs" />
    124130    <Compile Include="MultiNestCFSAP.cs" />
    125131    <Compile Include="MultiNestCFSAPSolvingStrategy.cs" />
     132    <Compile Include="OptimalAssignment.cs" />
    126133    <Compile Include="Plugin.cs" />
    127134    <None Include="Properties\AssemblyInfo.cs.frame" />
  • branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/Plugin.cs.frame

    r15472 r15493  
    3838  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3939  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     40  [PluginDependency("HeuristicLab.Random", "3.3")]
    4041  public class HeuristicLabProblemsSchedulingCFSAPPlugin : PluginBase  {
    4142  }
Note: See TracChangeset for help on using the changeset viewer.