Skip to content

Finds a optimal schedule when given a list of task times and the associated profit or priority of each task.

Notifications You must be signed in to change notification settings

RyanZurrin/WeightedOptimalScheduler

Repository files navigation

WeightedOptimalScheduler

Finds a optimal schedule when given a list of task times and the associated profit or priority of each task.
For simplicity when adding times input using 24 hour standard. This saves from having to use a extra string flag for each time input. Times are implicity converted to 12 hour format when displayed.

Example Useage

    Task t1(10, 0, 12, 0, 7, "drop off food");
    Task t2(13, 0, 15, 0, 3);
    Task t3(16, 0, 18, 0, 2);
    Task t4(11, 0, 16, 0, 15);
    Task t5(15, 0, 17, 0, 5);
    Task t6(17, 0, 20, 0, 10, "netflix and chill");
    Task t7(11, 30, 14, 0, 11, "Basketball");
    Task t8(14, 0, 20, 0, 10);
    Task t9(5, 0, 6, 0, 5);
    Task t10(8, 0, 10, 0, 3, "training");
    Task t11(20, 0, 22, 0, 20, "hack cia");
    Task t12(18, 30, 21, 0, 25, "girl friend");
    Task t13(4, 0, 7, 0, 12);
    Task t14(8, 30, 11, 30, 15, "newspapers");
    // add all the tasks to vector
    vector<Task> tasks = {t1,t2,t3,t4,t5,t6,t7,t8,t8,t9,t10,t11,t12,t13,t14};


    OptimalScheduler scheduler(tasks);
    cout << scheduler.toString() << endl;

    scheduler.addTask(Task(5, 45, 9, 0, 7, "tutoring"));
    scheduler.addTask(Task(15, 0, 18, 0, 30, "visit mom"));
    cout << scheduler.toString() << endl;

will Output the Following

Optimal Scheduler:
Max Profit: 73
Schedule:
Job        1: 4:00 AM  to 7:00 AM,   earning: $12
newspapers    : 8:30 AM  to 11:30 AM,  earning: $15
Basketball    : 11:30 AM to 2:00 PM,   earning: $11
Job       4: 3:00 PM   to 5:00 PM,   earning: $5
netflix and chill  : 5:00 PM  to 8:00 PM,   earning: $10
hack cia     : 8:00 PM  to 10:00 PM, earning: $20

Optimal Scheduler:
Max Profit: 93
Schedule:
Job        1: 4:00 AM   to 7:00 AM,  earning: $12
newspapers    : 8:30 AM   to 11:30 AM,  earning: $15
Basketball    : 11:30 AM  to 2:00 PM,  earning: $11
visit mom     : 3:00 PM   to 6:00 PM,  earning: $30
girl friend     : 6:30 PM   to 9:00 PM,  earning: $25

About

Finds a optimal schedule when given a list of task times and the associated profit or priority of each task.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published