Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
/ APS-app Public archive

A self-made demo for Advance Scheduling using branch and bound method

License

Notifications You must be signed in to change notification settings

RPIFisherman/APS-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Planning and Scheduling(APS) Application

JavaDocs APS-JavaDocs README-Chinese

         _                   _          _                 _                   _          _
        / /\                /\ \       / /\              / /\                /\ \       /\ \
       / /  \              /  \ \     / /  \            / /  \              /  \ \     /  \ \
      / / /\ \            / /\ \ \   / / /\ \__        / / /\ \            / /\ \ \   / /\ \ \
     / / /\ \ \          / / /\ \_\ / / /\ \___\      / / /\ \ \          / / /\ \_\ / / /\ \_\
    / / /  \ \ \        / / /_/ / / \ \ \ \/___/     / / /  \ \ \        / / /_/ / // / /_/ / /
   / / /___/ /\ \      / / /__\/ /   \ \ \          / / /___/ /\ \      / / /__\/ // / /__\/ /
  / / /_____/ /\ \    / / /_____/_    \ \ \        / / /_____/ /\ \    / / /_____// / /_____/
 / /_________/\ \ \  / / /      /_/\__/ / /       / /_________/\ \ \  / / /      / / /
/ / /_       __\ \_\/ / /       \ \/___/ /       / / /_       __\ \_\/ / /      / / /
\_\___\     /____/_/\/_/         \_____\/        \_\___\     /____/_/\/_/       \/_/
                                                                 

Introduction

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.

Qodana Mirror GitHub Auto Queried Repos to Gitee codecov

Thanks to Roland's Gantt Plot code, which helps me a lot on JavaFX.

Requirements

  • 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.

APSDemo:

APSDemo Structure

APSDemo Output:

APSDemo Output

Project Structure:

Scheduler Structure

Concise Diagram:

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
Loading

Project Workflow:

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.]
Loading