-
Notifications
You must be signed in to change notification settings - Fork 0
/
algorithm_schdule_tasks.js
42 lines (33 loc) · 1.36 KB
/
algorithm_schdule_tasks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function taskNames, tasks = schedule_tasks(skill):
/*
Algorithm: Schedule tasks
Schedule tasks with dependence of pre/post and TA.
Run tasks as well.
Args:
skill - given skill.
Returns:
taskNames - String list of task's class name.
tasks - Current arrangement of tasks
*/
foreach obj in skill.objects:
taskNames[obj.id] = mapObjById(obj.id).name
foreach op in skill.operations:
// SIMULATING RUN ...
check each satisfyXXX() inside when continuously in separated threads:
when satisfySRS(op.pre) and
satisfySRS(op.action.pA.pre) and
satisfyTA(op.action.TA, START) and
not satisfySRS(op.post) and
not satisfySRS(op.action.pA.post) and
not satisfyTA(B, op.action.TA, STOP):
task = do_A(op.action.A.innate_skill(op.action.A.args))
tasks.append(task)
when satisfySRS(op.pre) and
satisfySRS(op.action.pB.pre) and
satisfyTA(B, op.action.TA, START) and
not satisfySRS(op.post) and
not satisfySRS(op.action.pB.post) and
not satisfyTA(op.action.TA, STOP):
task = do_B(op.action.B.innate_skill(op.action.B.args))
tasks.append(task)
return taskNames, tasks