コード例 #1
0
ファイル: issue33.cs プロジェクト: njb0401/JobShop
 public FactoryScheduling(FactoryDescription data)
 {
     factoryData = data;
 }
コード例 #2
0
ファイル: issue33.cs プロジェクト: RickOne16/or-tools
 public FactoryScheduling(FactoryDescription data) {
   factoryData = data;
 }
コード例 #3
0
ファイル: issue33.cs プロジェクト: njb0401/JobShop
        public FactoryDescription FetchData()
        {
            // deterministic seed for result reproducibility
            Random randomDuration = new Random(2);

            // FactoryDescription(nbTools, nblocations, nbTasks per cycle)
            FactoryDescription factoryDescription = new FactoryDescription(5, 4, 3);

            // Travelling time and distance are temporarily identical and they
            // are no different for different tools
            int[,] travellingTime = new int[factoryDescription.NbWorkLocations,
                                            factoryDescription.NbWorkLocations];
            for (int i = 0; i < travellingTime.GetLength(0); i++)
            {
                for (int j = 0; j < travellingTime.GetLength(1); j++)
                {
                    if (i == j)
                    {
                        travellingTime[i, j] = 0;
                    }
                    else
                    {
                        travellingTime[i, j] = (5 * Math.Abs(i - j)) * 10;
                    }
                }
            }

            factoryDescription.Tools[0].AddTaskType(0);
            factoryDescription.Tools[1].AddTaskType(0);
            factoryDescription.Tools[2].AddTaskType(1);
            factoryDescription.Tools[3].AddTaskType(1);
            factoryDescription.Tools[4].AddTaskType(2);
            factoryDescription.Tools[1].AddTaskType(1);

            foreach (Tool tool in factoryDescription.Tools)
            {
                tool.TravellingTime = travellingTime;
            }

            int c = 0;
            int nbCyclePerWorkLocation = 2;

            int[] boll = new int[100];
            for (int i = 0; i < factoryDescription.NbWorkLocations; i++)
            {
                factoryDescription.Locations[i].NbTasks =
                    nbCyclePerWorkLocation * factoryDescription.NbTaskPerCycle;
                for (int j = 0; j < nbCyclePerWorkLocation; j++)
                {
                    for (int k = 0; k < factoryDescription.NbTaskPerCycle; k++)
                    {
                        Task t = new Task(c, k, i, k + j * factoryDescription.NbTaskPerCycle);

                        // Filling in tool-dependent durations
                        Tool[] compatibleTools = factoryDescription.getToolPerTaskType(k);
                        foreach (Tool tool in compatibleTools)
                        {
                            boll[c] = randomDuration.Next(13, 17) * 10;;
                            t.Durations[tool.Id] = boll[c];
                        }
                        factoryDescription.Locations[i].Tasks[t.TaskPosition] = t;
                        c++;
                    }
                }
            }

            factoryDescription.SanityCheck();
            return(factoryDescription);
        }
コード例 #4
0
ファイル: issue33.cs プロジェクト: RickOne16/or-tools
  public FactoryDescription FetchData() {
    // deterministic seed for result reproducibility
    Random randomDuration = new Random(2);

    // FactoryDescription(nbTools, nblocations, nbTasks per cycle)
    FactoryDescription factoryDescription = new FactoryDescription(5, 4, 3);

    // Travelling time and distance are temporarily identical and they
    // are no different for different tools
    int[,] travellingTime = new int[factoryDescription.NbWorkLocations,
                                    factoryDescription.NbWorkLocations];
    for (int i = 0; i < travellingTime.GetLength(0); i++) {
      for (int j = 0; j < travellingTime.GetLength(1); j++) {
        if (i == j)
          travellingTime[i, j] = 0;
        else
            travellingTime[i, j] = (5 * Math.Abs(i - j)) * 10;
      }
    }

    factoryDescription.Tools[0].AddTaskType(0);
    factoryDescription.Tools[1].AddTaskType(0);
    factoryDescription.Tools[2].AddTaskType(1);
    factoryDescription.Tools[3].AddTaskType(1);
    factoryDescription.Tools[4].AddTaskType(2);
    factoryDescription.Tools[1].AddTaskType(1);

    foreach (Tool tool in factoryDescription.Tools)
      tool.TravellingTime = travellingTime;

    int c = 0;
    int nbCyclePerWorkLocation = 2;
    int[] boll = new int[100];
    for (int i = 0; i < factoryDescription.NbWorkLocations; i++) {
      factoryDescription.Locations[i].NbTasks =
          nbCyclePerWorkLocation * factoryDescription.NbTaskPerCycle;
      for (int j = 0; j < nbCyclePerWorkLocation; j++) {
        for (int k = 0; k < factoryDescription.NbTaskPerCycle; k++) {
          Task t = new Task(c, k, i, k + j * factoryDescription.NbTaskPerCycle);

          // Filling in tool-dependent durations
          Tool[] compatibleTools = factoryDescription.getToolPerTaskType(k);
          foreach (Tool tool in compatibleTools) {
            boll[c] = randomDuration.Next(13, 17) * 10; ;
            t.Durations[tool.Id] = boll[c];
          }
          factoryDescription.Locations[i].Tasks[t.TaskPosition] = t;
          c++;
        }
      }
    }

    factoryDescription.SanityCheck();
    return factoryDescription;
  }