1. Job scheduling

The jobs are defined as a sequence of triples: \begin{matrix}i & p_{i} & d_{i} & t_{i} \\ 1 & 5 & 1 & 1 \\ 2 & 10 & 2 & 3 \\ 3 & 6 & 2 & 1 \\ 4 & 3 & 1 & 1 \end{matrix}

The l is the lower bound for each node, also called estimated cost:

l(X) = ∑_{q(x)} p_{i}, where q(x) = i ∉ S_{x} ∧ i < max(S_{x})

The upper bound for each node is

u(X) = ∑_{q(x)} p_{i}, where q(x) = i ∉ S_{x}

2. PRAM search

Given an

X ∈ Int

and

S.0..M − 1 ∈ Int where ∀i, j : 0 ≤ i < j < M : S.i < S.j

one is required to calculate present such that

present ≡ ∃i : 0 ≤ i < M : X = S.i

Determining present is then relaxed to finding an i

R ≡ 0 ≤ i < M ∧ S.i ≤ X < S.i + 1

assuming that S.M is defined to be greater than X. Dijkstra’s program has the form

|[Var i ∈ Int ; S.M := X + 1 ; establish R ; present := (S.i = X) ]|

P ≡ 0 ≤ i < j ≤ M ∧ S.i ≤ X < S.j

P invariant

A progress condition:

(j − i) > (j − i)′

A fixed point:

(j − i) = 1

“establish R” is

|[Var j ∈ Int ; i, j := 0, M ; {P } ∗|[

j − i ≠ 1 → shrink(S, j, i){P } ]|{R}

]| {R} Shrinking (j − i) can be done by either:

• increasing i to some h, if S.h ≤ X;

• or decreasing j to h, if S.h < X;

• or both simultaneously, why not?

shrink(S, X, i, j) is |[Var h ∈ Int ; h := (i + j)/2 ; if S.h ≤ X → i := h ][ X < S.h → j := h fi ]|

Program correctnes?

• P is true initially;

• P holds after every transition;

• (j − i) > 0 and decreases with every transition;

• (j − i) = 1 X = S.i or X < S.0 and these conditions exclude each other.

3. (p+1)-ary search

The program becomes

|[Var i ∈ Int ; establish R ; |[∥ i : i ≤ k < min(i + p, M) :

q := (X = S.k) ]|

]|

The loop invariant is the same. The fixed point now is reached when (j − i) is less than or equal to p.

“establish R” is then refined to

|[Var j ∈ Int ; i, j := 0, M ; {P } ∗|[

j − i > p → pshrink(S, j, i, p){P } ]|{R}

]| {R}

This is performed by a parallel test.

pshrink(S, X, i, j) is |[Var h ∈ Int ; nel := (i + j)/(p + 1) ; |[∥ k : 1 ≤ k ≤ p :

Var h, hb ∈ Int

; h, hb := i + (nel ∗ k), i + (nel ∗ (k − 1)) ; if k = p ∧ X ≥ S.h → i := h ][ S.hb ≤ X ∧ X < S.h → i, j := hb, h fi

]| ]|

4. Sequence sums

Given

s_{i} = 0, for i ≤ 0
a_{1..m}, b_{1..m}

calculate

s_{i} = (a_{i} ∗ s_{i−1}) + b_{i}

s_{i} is reduced to:

∑_{1≤i<n}((∏ i < j ≤ na_{j}) ∗ b_{i})

; scanl(a, 1, n, s) ; |[∥ i : ≤≤ 1in :

s.h := s.h ∗ (b.i/a.i) ]| ; scanl(s, 1, n, s);