     }
 
     /*
-     * public func generateSubtask() -> [PVRTask]
-     * - Generate subtasks from tasks
-     * [Return]
-     * Array<PVRTask> - Array of Subtasks to schedule
-    */
-    public func generateSubtask() -> [PVRTask]
+     * public func generateSubtask(task:PVRTask) -> [PVRTask]
+     * - Generate subtasks from task
+     * [Return]
+     * Array<PVRTask> - Array of subtasks of task, sorted by time
+     */
+    public func generateSubtask(task:PVRTask) -> [PVRTask]
+    {
+        //Prepar Data
+        var arr_stsk = Array<PVRTask>()
+        let stsk_cnt = Int(floor(Double(task.duration / task.duration_affinity)))
+        var duration_left = task.duration
+        var completion_left = task.completion
+
+        //Generate Subtasks
+        for stsk_idx in 0..<stsk_cnt
+        {
+            let stsk = PVRTask(name: task.name, deadline: task.deadline, duration:task.duration, duration_affinity: task.duration_affinity, subject: task.subject, description: task.descript)
+
+            if stsk_idx == (stsk_cnt - 1)
+            {
+                //Last Subtask
+                stsk.duration = duration_left
+                stsk.completion = completion_left
+            }
+            else
+            {
+                stsk.duration = task.duration_affinity
+                stsk.completion = Double(task.duration_affinity)/Double(task.duration)
+                completion_left -= Double(task.duration_affinity)/Double(task.duration)
+            }
+
+            duration_left -= stsk.duration
+            arr_stsk.append(stsk)
+        }
+
+        return arr_stsk
+    }
+
+    /*
+     * public func genrateAllSubtask() -> [PVRTask]
+     * - Generate subtasks from all tasks
+     * [Return]
+     * Array<PVRTask> - Array of subtasks
+    */
+    public func genrateAllSubtask() -> [PVRTask]
     {
         //Prepare Data
         self.dataCtrl.updateTask()


    /*
     * public func generateSchedulableDuration()
     * - Genrate an Array of PVRDuration where tasks may be scheduled
     * [Return]
     * Array<PVRDuration> - Array of PVRDuration where tasks may be scheduled
    */

        var sch_drsn = 0
        var stsk_drsn = 0
        let arr_sch_drsn = self.generateSchedulableDuration()
        let arr_stsk =  self.genrateAllSubtask()

        //Compute Total Schedulable duration
        for drsn in arr_sch_drsn
