
! document history
   ! 17Jan2020
   ! C:18Jan2020
   ! C:19Jan2020

! https://orgmode.org/worg/exporters/taskjuggler/ox-taskjuggler.html
! http://taskjuggler.org/tj3/manual/task.html
   > list of task attributes

+ class Task
    Node *org_node
    initFromNode(Node _n)

+ class Resource

+ class Schedule
   Array<Task> tasks;

   initFromOrg(Org _org)


o org properties
   + task_id
      - default name is auto-generated from MD-anchorified topic title (globally unique)
   + depends
      + single property with comma separated list
      ? support multiple 'depends' properties
   + allocate
      - support multiple allocations per task ?
         ! not really useful (would have to assume a 50:50 split which is usually not the case)
         ! always better to create separate sub-tasks for each additional resource
         - add multi_resource_duration_scale_tbl
            ! in theory: effort / num_resources
            ! in practice: [1.0, 0.7, 0.5, 0.4, 0.3, 0.23, 0.2, 0.17, ..] (or something along these lines)
               ! "mystical man month"
   + effort
      + hours (8h)
      + days (9d)
      + months (10m, 10mo)
      + years (5y)
   + effortleft
      + verify that effortleft does not exceed 'effort'
   + effortdone
      + verify that effortleft+effortdone does not exceed 'effort'
   + effortrisk
      + scale effort, e.g. 1.2 = 20% risk
   + risk
      + scale effort or duration (or both)
   + duration
      ! e.g. grow a tree
      + automatic duration calculation requires assigned resource(s)
      + duration is set in normalized working hours, e.g. 2 days = 16h
         ? also add a calendar-duration ? (but: the length of e.g. a month depends on the month and the year)
   + start 
      ! same as SCHEDULED
   + milestone
      ! has no duration
   x limits
      ! http://taskjuggler.org/tj3/manual/limits.task.html
      ! working hours
   + workinghours
      "mon,tue,wed,thu" or
      "mon-thu, fri off" or
      "mon 8:00-12:00, tue 8:00-16:00, wed off, thu 8:00-15:00, fr 10:00-16:00"
      "mon 4h, tue 8h, wed off, thu 7h, fr 6h"
      (note) default is 8h per day

   + vacation
      ! http://taskjuggler.org/tj3/manual/interval3.html
   - ordered
      ! consider sub/nodes to be dependent on each other (c depends on b, b on a, ..)
   + resource_id
   - resource_effort_risk
      ! scales all estimated efforts for this resource by a factor


+ find resource nodes
   + must have 'resource_id' property

+ find task nodes
   + must have 'effort' and 'allocate' properties
   + add nodes w/o resource_id or effort as taskgroups

+ find milestone nodes
   + must have 'milestone' property

+ find task dependencies
   + child/sub nodes are implicit dependencies to their parent node
   + detect circular dependencies

x Node.scheduleDependsOn(Node _o)

x Task.findDependency(String id)
   - search from leaf to root

+ build non-unique dependencies
   + including all sub-tasks

t order tasks by dependencies
   ! output is a tree
      x "left" links parallel (independent) tasks
      x "right" links to dependent tasks
   ? order "left" nodes by priority
      ! first node has highest priority

   + start with milestones
      + recursively find all dependent tasks
      + recursively iterate dependencies
         - recursively find all dependent tasks
            - when a task is also a dependent node dependency, remove from parent node

+ parallel_deps
   ! all sub-tasks that can be parallelized

+ serial_deps
   ! must be processed before first parallel dep

+ eliminate common sub-tasks
   + add shared task as serial dependency

x convert effort to duration
   - need assigned resource
      - when multiple resources are assigned use max(dur(res1_effort), dur(res2_effort))
   ! this is _not_ the same thing as, a task may need only little initial effort but may then take a long while (e.g. grow a tree)

+ -ms,--milestone cmdline option
   + match milestone id
   + match milestone org node title
      + case-insensitive

+ calc (leaf) task durations
   + check that all tasks have been assigned at least one resource
   + use multi_resource_duration_scale_tbl when multiple resources are assigned

+ calc total task durations
   + max(parallel_deps)

o schedule tasks (calendar)
   + "#+project-start" global property
   + parse resource availability
      + 'workinghours' property
      + 'vacation' property
   + calc task scheduled_start and scheduled_end fields
   + consider out-of-office periods
   ! multiple resources = _any_ of them can work on the task
   - (external) duration
      - block dependent tasks


