Ascend FD-23R Manual de usuario Pagina 41

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 81
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 40
2.3. More Complex Examples 29
2.3 More Complex Examples
2.3.1 A Scheduling Problem
Here, we consider the problem of scheduling tasks that require resources to complete,
and have to fulfill precedence constraints
3
. Figure 2.1 shows a precedence graph for
six tasks which are labelled as tX
Y
mZ
, where X stands for the identifier of a task t, Y
for its time to complete (duration), and Z for the identifier of a machine m (a resource
needed for performing task tX).
3
1
1
4
2
6
3
2
5
8
1
3
6
2
4
8
1
2
Figure 2.1: Precedence Graph.
The following program (included in the distribution in the directory Examples in the
file scheduling.toy) models the posed scheduling problem. Observe in the syntax that
function arguments are not enclosed in parentheses to allow higher order applications.
Also, syntactic sugar is provided for expressing Boolean functions `a la Prolog. The
rules that define a function follow its type declaration. The type declaration consists
of the types for each argument and for the result separated by ->. Lists adhere to the
syntax as Prolog lists and int is a predefined type for the integers. Note also functional
applications in arguments, such as (End-D) in the second rule defining horizon. (Logic)
Variables start with uppercase, whereas the remaining symbols start with lowercase.
include "cflpfd.toy"
include "misc.toy"
data taskName = t1 | t2 | t3 | t4 | t5 | t6
data resourceName = m1 | m2
type durationType = int
type startType = int
type precedencesType = [taskName]
type resourcesType = [resourceName]
type task = (taskName, durationType, precedencesType, resourcesType, startType)
start :: task -> int
start (Name, Duration, Precedences, Resources, Start) = Start
duration :: task -> int
duration (Name, Duration, Precedences, Resources, Start) = Duration
3
Adapted from Marriot and Stuckey, 1998.
Vista de pagina 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 80 81

Comentarios a estos manuales

Sin comentarios