_ _ _ _ _ _
/ /\ /\ \ / /\ / /\ /\ \ /\ \
/ / \ / \ \ / / \ / / \ / \ \ / \ \
/ / /\ \ / /\ \ \ / / /\ \__ / / /\ \ / /\ \ \ / /\ \ \
/ / /\ \ \ / / /\ \_\ / / /\ \___\ / / /\ \ \ / / /\ \_\ / / /\ \_\
/ / / \ \ \ / / /_/ / / \ \ \ \/___/ / / / \ \ \ / / /_/ / // / /_/ / /
/ / /___/ /\ \ / / /__\/ / \ \ \ / / /___/ /\ \ / / /__\/ // / /__\/ /
/ / /_____/ /\ \ / / /_____/_ \ \ \ / / /_____/ /\ \ / / /_____// / /_____/
/ /_________/\ \ \ / / / /_/\__/ / / / /_________/\ \ \ / / / / / /
/ / /_ __\ \_\/ / / \ \/___/ / / / /_ __\ \_\/ / / / / /
\_\___\ /____/_/\/_/ \_____\/ \_\___\ /____/_/\/_/ \/_/
Extend from the APS-MES. This project add a graphical user interface (GUI) to the APS application. The GUI is implemented using the javafx library.
Thanks to Roland's Gantt Plot code, which helps me a lot on JavaFX.
- Java 21 is recommended, other version may not work.
- Java 8 can compile and run APSDemo.java but may not pass the test.
- Maven 3.9.6 is recommended, other version may not work.
classDiagram
class Schedule {
-ArrayList~MachineWithOrders~ _machines
-Grade _grade
+void calcStat(double min_makespan, int num_orders)
+Grade calcGradeByWeights(int on_time_weight, int makespan_weight, int est_weight, int ldt_weight)
+void scheduleAllOrders(Scheduler scheduler)
}
class Schedule_MachineWithOrders {
-Machine machine
-ArrayList~OrderWithTime~ orders
-double _approx_run_time
+boolean addOrder(Order o)
+boolean removeOrder(Order o)
+void scheduleAllOrders(Scheduler scheduler)
+void scheduleAllOrders()
}
class Schedule_OrderWithTime {
-Order order
-int _start_time
-int _end_time
-int status
+void setStartEndTime(int start_time, int end_time)
}
class Schedule_Grade {
-double on_time_percentage
-double makespan_percentage
-double est_percentage
-double ldt_percentage
-double grade
+void calcGradeByWeights(int on_time_weight, int makespan_weight, int est_weight, int ldt_weight)
}
class Machine {
+String name
+int machine_ID
-HashMap~Integer, Integer~ products_pace_per_hour
+boolean checkViableOrder(int production_type_ID)
+int getProductionPace(int production_type_id)
}
class Order {
+String name
+int order_ID
+int earliest_start_time
+int delivery_time
+int latest_due_time
+int quantity
+int production_type_ID
}
class Rules {
+static boolean belowCapacity(MachineWithOrders machine, double threshold)
+static boolean aboveCapacity(MachineWithOrders machine, double threshold)
+static boolean orderFitsMachine(MachineWithOrders machine, OrderWithTime order)
}
class Scheduler {
-List~Schedule~ _schedules
-ExecutorService _executor
-int _num_production_types
-int _num_machines
-int _num_orders
-int _max_hours_allowed
-double _max_capacity_per_machine
-double _min_capacity_per_machine
-double _min_makespan
-ArrayList~ArrayList~Double~~ _order_type_switch_times
-ArrayList~Order~ _orders
-ArrayList~Machine~ _machines
+void generateAllPossible()
+void calcAllSchedulesGrade(Integer... weights)
}
Schedule "1" *-- "many" Schedule_MachineWithOrders: Contains many machines
Schedule_MachineWithOrders "1" *-- "many" Schedule_OrderWithTime: Contains many orders
Schedule_OrderWithTime "1" *-- "1" Order: refers to one order
Schedule_MachineWithOrders "1" *-- "1" Machine: refers to one machine
Schedule "1" *-- "1" Schedule_Grade: has one grade
Scheduler "1" *-- "1" Rules: can apply many rules
Scheduler "1" *-- "many" Schedule: has many schedules
graph TD
A[Start] --> init["<strong>init()</strong><br> All the Machines with production pace per hour<br> All the Orders with earliest start time, delivery time, <br>latest due time, quantity, production type<br> Rules (belowCapacity, aboveCapacity, orderFitsMachine)<br> Switch Matrix"]
subgraph "Input"
init
rules["Hard Requirements"]
F[weights for grade]
end
subgraph "generateAllSchedules()"
init --> depthFirstSearch{"Recursion with Constrains<br>depthFirstSearch()"}
rules --> depthFirstSearch{"Recursion with Constrains<br>depthFirstSearch()"}
depthFirstSearch -->|Satisfied| C["Add to schedules"]
%%depthFirstSearch -->|Unsatisfied|depthFirstSearch
C --> D["Call scheduleAllOrders()"]
end
D --> E[Output Schedules]
F --> calcStat["Call calcStat()"]
E --> calcStat
subgraph "Call calcAllSchedulesGrade()"
subgraph "forEach schedules"
calcStat --> calcGradeByWeights["Call calcGradeByWeights()"]
calcGradeByWeights --> Grade[Grade]
end
Grade --> sort[Sort by Grade]
end
sort --> G[Output Schedule with Grade is descending order]
G --> H[Generate Plot etc.]