ORELSEObservations of Redshift Evolution in Large Scale Environments (astronomy survey)
References in periodicals archive ?
Then S is equivalent to EITHER i := m1 ORELSE i := m1+1 .
In contrast, in our language, we can use both guessing (realized by means of the ORELSE and SOME statements) and assignment; therefore we can produce a conceptually simpler and more readable solution.
NumActions] OF ActionType; PROCEDURE ChooseGoal(VAR goal: CHAR; goals: List; state: List); BEGIN EITHER goal := Head(goals); NOT Member (goal, state) ORELSE ChooseGoal(goal, Tail(goals), state) END END ChooseGoal; PROCEDURE ApplyRule(action: ActionType; VAR state: List; VAR plan: List); BEGIN Delete (state, action.
Notice that the guess of a goal, typically performed in Prolog using the query member (Goal,Goals) with Goals instantiated and Goal a variable, is implemented here by means of the ORELSE statement combined with recursion.
Notice also that the prescribed semantics of the ORELSE statement is essential for the correct functioning of the program.
COMMIT EITHER x > 0; y := x ORELSE y := a END; y > 0 END; y >= a
For example, if the FOP, ALL statement is inside a branch of an ORELSE statement, and eventually a failure takes place, the state of the variables before entering a new branch is restored, thus removing the effects of the DO part of the FORALL statement.
y := 0; x := 0; FORALL x := x + a; EITHER x := x + b ORELSE x := x + c ORELSE x := x + d END DO WRITELN (x); y:=y+x END;
x := 0; FORALL EITHER x := a ORELSE x := b END DO x=b END;
The branch-and-bound algorithm is implemented by means of a FORALL statement over a FOR loop with an ORELSE statement inside.
0; FORALL FOR i := 1 TO N DO EITHER current_solution[i] := 1; current_volume : = current_volume + volume [i]; current_volume <= capacity; ORELSE current_solution[i] := O; waste := waste + value[i]; waste < total_value--current_best; END END DO current_best := total_value--waste; solution := current_solution; END; END knapsack;
EITHER SOME i := 1 TO N DO FOR j := 1 TO N DO a[i,j] = 0 END END; found = i ORELSE S END