Ascend FD-23R Manual de usuario Pagina 42

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 81
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 41
30 CHAPTER 2. TOY(FD) Programming Examples
schedule :: [task] -> int -> int -> bool
schedule TL Start End = true <== horizon TL Start End,
scheduleTasks TL TL
horizon :: [task] -> int -> int -> bool
horizon [] S E = true
horizon [(N, D, P, R, S)|Ts] Start End = true <==
domain [S] Start (End#-D),
horizon Ts Start End
scheduleTasks :: [task] -> [task] -> bool
scheduleTasks [] TL = true
scheduleTasks [(N, D, P, R, S)|Ts] TL = true <==
precedeList (N, D, P, R, S) P TL,
requireList (N, D, P, R, S) R TL,
scheduleTasks Ts TL
precedeList :: task -> [taskName] -> [task] -> bool
precedeList T [] TL = true
precedeList T1 [TN|TNs] TL = true <== belongs (TN, D, P, R, S) TL,
precedes T1 (TN, D, P, R, S),
precedeList T1 TNs TL
precedes :: task -> task -> bool
precedes T1 T2 = true <== ST1 == start T1,
DT1 == duration T1,
ST2 == start T2,
ST1 #+ DT1 #<= ST2
requireList :: task -> [resourceName] -> [task] -> bool
requireList T [] TL = true
requireList T [R|Rs] TL = true <== requires T R TL, requireList T Rs TL
requires :: task -> resourceName -> [task] -> bool
requires T R [] = true
requires (N1, D1, P1, R1, S1) R [(N2, D2, P2, R2, S2)|Ts] = true <== N1 /= N2,
belongs R R2,
noOverlaps (N1, D1, P1, R1, S1) (N2, D2, P2, R2, S2),
requires (N1, D1, P1, R1, S1) R Ts
requires T1 R [T2|Ts] = true <== requires T1 R Ts
belongs :: A -> [A] -> bool
belongs R [] = false
belongs R [R|Rs] = true
belongs R [R1|Rs] = belongs R Rs
noOverlaps :: task -> task -> bool
noOverlaps T1 T2 = true <== precedes T1 T2
Vista de pagina 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 80 81

Comentarios a estos manuales

Sin comentarios