No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainTest.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package jobshop;
  2. import jobshop.encodings.JobNumbers;
  3. import jobshop.encodings.ResourceOrder;
  4. import jobshop.encodings.Schedule;
  5. import jobshop.encodings.Task;
  6. import java.io.IOException;
  7. import java.nio.file.Paths;
  8. /** A java main classes for testing purposes. */
  9. public class MainTest {
  10. public static void main(String[] args) {
  11. try {
  12. // load the aaa1 instance
  13. Instance instance = Instance.fromFile(Paths.get("instances/aaa1"));
  14. // builds a solution in the job-numbers encoding [0 0 1 1 0 1]
  15. JobNumbers enc = new JobNumbers(instance);
  16. enc.addTaskOfJob(0);
  17. enc.addTaskOfJob(0);
  18. enc.addTaskOfJob(1);
  19. enc.addTaskOfJob(1);
  20. enc.addTaskOfJob(0);
  21. enc.addTaskOfJob(1);
  22. System.out.println("\nENCODING: " + enc);
  23. // convert to a schedule and display
  24. Schedule schedule = enc.toSchedule().get();
  25. System.out.println("VALID: " + schedule.isValid());
  26. System.out.println("MAKESPAN: " + schedule.makespan());
  27. System.out.println("SCHEDULE: " + schedule.toString());
  28. System.out.println("GANTT: " + schedule.asciiGantt());
  29. Schedule manualSchedule = new Schedule(instance);
  30. // TODO: encode the same solution
  31. //manualSchedule.setStartTime(....);
  32. ResourceOrder manualRO = new ResourceOrder(instance);
  33. // TODO: encode the same solution
  34. //manualRO.addTaskToMachine(..., new Task(..., ...));
  35. } catch (IOException e) {
  36. e.printStackTrace();
  37. System.exit(1);
  38. }
  39. }
  40. }