Skip to content

Class Documentation

Yao Jian Yap edited this page Aug 24, 2017 · 27 revisions

Welcome to 306A1 Code Documentation

Packages

scheduler package

Classes: Main

Main

The main entry point for the Task Scheduler program.

What it does to produce the optimal schedule

  1. Instantiate InputParser to parse the command line arguments.
  2. Instantiate OutputWriter to write to the output file.
  3. Instantiate DataReader to read the input file.
  4. Find optimal solution for all the input task graphs.
while there are more graphs to read from the input file
    if visualization is opted for
        instantiate a Visualizer to display the graph
    find optimal schedule using A* algorithm
    write the optimal schedule to the output file
    if visualization is opted for // under development
        instatntiate a Chart to display the optimal solution

io package

Classes: InputParser, DataReader, OutputWriter, ErrorMessenger, InputFileCorrector

Deals with file input/output.

  • Input arguments parsing and checking
  • Reading in the input graph
  • Outputting the optimal solution

InputParser

Parses the command line arguments and provide get/set methods to obtain argument values. Also checks the validity of the input arguments.

Uses Apache Commons Cli library to parse the optional commands that starts with a dash "-" and followed by the option's alphabet.

DataReader

Reads the input file and populate fields to hold task digraph information.

OutputWriter

Outputs the optimal schedule to a file. It considers the initially recorded information for ordering of the node and edges in the output file.

ErrorMessenger

Has a single static method which takes in an error message. The message is then printed out and the task scheduler exits.

astar package

Classes: AStar, AStarParallelised, AStarThread, Processor, ProcessInfo, Solution

AStar

Solves task scheduling problem using A* branch & bound.

Based off the following pseudocode;

OPEN : priority list of unexamined states
CLOSED : set of already examined states

Init
OPEN <= initial state
CLOSED <= Ø

Loop
Pop best state s from OPEN (with lowest f(s))
Test if s is goal state
    If yes, finished
Expand s => create new states
    Calculate f for states
    Insert in OPEN
Insert s in CLOSED

AStarParallelised

AStarThread

Extends AStar and implements Runnable to allow the A* branch & bound to be executed in different threads for multi-threading purposes.

Processor

Stores a list of ProcessInfo, which is a list of tasks ran on the processor.

ProcessInfo

Store a task's start/end time. ProcessInfo is to be stored on a Processor for tasks represented as vertices.

graphstructures package

Classes: DefaultDirectedWeightedGraph, DefaultWeightedEdge, Vertex

Represent the input task graph. It contains data structures for weighted DAG and a weighted edge to be used by the DAG.

The class names and methods resemble the JGraphT classes as the classes are created to replace JGraphT classes.

DefaultDirectedWeightedGraph

Stores the list of tasks as vertices and the dependencies as edges. Functions are implemented to support getting in/out degree, in/out going edges and source/destination vertices of an edge.

DefaultWeightedEdge

Edge with information on source/destination vertices and weight.

Vertex

Contains get/set methods to set name, weight, bottom level and touch count. the last 2 fields mentioned might not be used at all

visualization package

Classes: Visualizer, NodeClickListener

Displays task digraph on the screen. Tasks are coloured based on the processor it has been scheduled on.

Visualizer

NodeClickListener

gantt package

Classes: Gantt, GanttChartFactory, TaskNumeric

Gantt

GanttChartFactory

TaskNumeric

dfsbranchandbound package

(under consideration) Classes: SolutionGenerator

Creates an optimal solution using Depth First Search Branch Branch & Bound.

Based off the following pseudocode:

B <- upperBound
DFS on state space (depth until f(s) >= B):
if complete solution sc found & f(sc) < B then
    B <- f(sc)

SolutionGenerator

Uses recursion to carry out state space search and also takes into account of bottom levels when bounding.

topologicalsort package

(in development)

Classes: Schedule, ScheduleGenerator, Sorter, VertexInfo

Performs topological sort of the task digraph.

Schedule

ScheduleGenerator

Sorter

VertexInfo

Clone this wiki locally