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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 jobshop.solvers.GreedySolver;
  7. import java.io.IOException;
  8. import java.nio.file.Paths;
  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 1 1 0 0 1]
  15. JobNumbers enc = new JobNumbers(instance);
  16. enc.addTask(0);
  17. enc.addTask(1);
  18. enc.addTask(1);
  19. enc.addTask(0);
  20. enc.addTask(0);
  21. enc.addTask(1);
  22. System.out.println("\nENCODING: " + enc);
  23. // convert to a schedule and display
  24. Schedule schedule = enc.toSchedule();
  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. ResourceOrder manualRO = new ResourceOrder(instance);
  32. // TODO: encode the same solution
  33. } catch (IOException e) {
  34. e.printStackTrace();
  35. System.exit(1);
  36. }
  37. }
  38. }