published in: Workshop on Software Engineering and Formal Methods, Petri Nets 2002, Adelaide, Australia
! "#$
! !
" !
! " ##$% & '
( ))
* ! + & ! ( &
(
, ( - &
# $%%$ & # ' ( ) ' * + , $- ( # & . /(#& .0$%%$1 & # 2 ( 3 4$ # 5 2 *
5 6 7 8 * 2 !
$ %& # # # # '' $ ! # ##$$
.
/
& " 0 1 "2 $33% 4( 1 "5 67 $38$%% ( 9
7
" $388%: ; ") )%
" Æ %
* & * "< 5 6= $33- = $38>% "2 $33% * 0 1 "0 1%
"7 $33>% * * ! 1 " 1% "7 $33- 7 $33/% ( (
1 * * : "
* * %
" "0 6? $33-% 0 1% @
" "7 $33A% % ! + "= $33A% * " % 9 (
BinOp(f)
Add2and3() First number Function: n = 2
In1
n
Second number Function: n = 3 In1
In1
n
Out
a
Function: c = f(a, b)
In2
c In2
Out
In2
Out
c
c
InitialTokens: [null]
b
c Move adder
Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
. $: Add2and3()
First number Function: n = 2
Add2and3() First number Function: n = 2
n
Second number Function: n = 3 In1
n
In2
InitialTokens: [null]
In1
n
Out
In2
In2
Out In2
c
c
c
InitialTokens: [null] c
Second number Function: n = 3 In1 Out
In1 Out
n
c
c Move adder
Create adder Function: c = new BinOp([lambda (a, b) a + b end])
. : . $
Move adder Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
BinOp(f) In1 a
1 " % )! ) 1 ! (
) ) " % ; * &
; & B * "2 $338%
"C 62 ##$ ##$% &
0 1 "2 $33% ; * ! B ( * . $ ; ;
;
* ( & & &
Function: c = f(a, b) c
In2
Out b
. ,: , "%
B
. : " % " %
1
;
) )
+
) ) . , - / . B &
; * *
( & 1
!
Add2and3()
Add2and3() First number Function: n = 2
n
Second number Function: n = 3 In1
n
Out In2
n
c
Second number Function: n = 3 In1
In1
Out
n
Out
In2
c
InitialTokens: [null]
First number Function: n = 2
In1
c
In2
c
c
InitialTokens: [null]
c
Move adder
Move adder
Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
BinOp(f)
BinOp(f)
In1
In1 a
Out
In2
a
Function: c = f(a, b)
Function: c = f(a, b)
c
c
In2
Out
In2
Out
b
b
Add2and3()
Add2and3() First number Function: n = 2
n
Second number Function: n = 3 In1
n
Out In2
c
n
Second number Function: n = 3 In1
In1
Out
c
n
Out
In2
c
InitialTokens: [null]
First number Function: n = 2
In1
In2
c
c
InitialTokens: [null]
c
Move adder Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
Move adder Create adder Function: c = initComponent(new BinOp([lambda (a, b) a + b end]))
BinOp(f)
BinOp(f)
In1
In1 a
a
Function: c = f(a, b) c
In2
Out
In2
Function: c = f(a, b) c
Out b
In2
Out b
. -: , "<%
. /: , "0%
*
( * "* -% 1
)) 1
*
* &
"* /% " % & 9 " %
D & " &
; &
0 &
?@ ?@ # E ?@ " & % ; # $ $% &&' ! ( ! )" *+ ! $*+ ,,)'
; 1
0
0
1
0 c
0
1
1
0
1
0
1
(
"
% ;
1 HDleaf(c)
h
b
e
a
f
1
0 g
In
d
c
. A: ?@
Select
D
. * A FF F##F FF F$##F FF F$$#$F HDnode(l, r)
InitialTokens: [if instanceof(l, java.util.List) then new HDnode([l(0), l(1)]) else new HDleaf([l]) end]
a
Select
Ack
In
Out
a
a
Guard: a = 0
. 8: ?@ . 8
" % 1
B
& /
Out
HuffmanDecoder1(t)
InitialTokens: [null]
InitialTokens: [new HDnode([t(0), t(1)])]
a
In
a
Guard: a = 1
Select a
Ack
a a
In
a
Out
In
Out
Select
Ack
Out In
Out
Select
Ack
Ack
a
InitialTokens: [if instanceof(r, java.util.List) then new HDnode([r(0), r(1)]) else new HDleaf([r]) end]
Req Next
. >: ?@ ?@
@ ?@ ;
9 * ?@ . > ;
" %
" % ;
# $ ; &
!
! ! ! .
. 3: ( ?@ . 3 9 ?@ ( 9 G & B
(
) )
C & B B
. ( & + C *
InitialTokens: [null] Sieve(k)
Function: sn = new sieve.Sieve([n]) Guard: (n mod k) <> 0
P
n sn
n
P
a
I
a
I n n
N
Guard: (n mod k) <> 0 N
n n
Guard: (n mod k) = 0
. $#: ( C
& ) ) . $$ G 9 ?@ . 3 & (
*
;
HDC(t, l, r) Function: next = new HDC([t, l(0), l(1)]) Guard: (a = 0) && instanceof(l, java.util.List) a
) ( . $# * " ,% " %
; .
;
.
;
!
; B / Iterator(init) InitialTokens: [init]
Req
Next
c c
Next
In In
Out Out
v
v
InitialTokens: [null]
. $$:
!"
( & " % 0 G B ! ! !!
! / 0
! 1
! / 1
next
Function: next = new HDC([t, r(0), r(1)]) Guard: (a = 1) && instanceof(r, java.util.List) next a next
In
Next
Function: next = new HDC([t, t(0), t(1)]) Guard: (a = 0) && ~ instanceof(l, java.util.List) a
l next
a
Out
r
Function: next = new HDC([t, t(0), t(1)]) Guard: (a = 1) && ~ instanceof(r, java.util.List)
. $: ?@
(
& ;
!
; *
;
&
?
"
% ; *
(
* . $ ?@
; :
?@ " % " % ;
9
DesignSpaceExplorer(runFactory, parameterSet)
Simulation run
start
result
Create run Function: run = runFactory(pars) Next parameters
next
pars
Start run out
pars
pars
pars
Parameters InitialTokens: parameterSet
result pars
result
Combine result and parameters Function: result = map["pars" -> pars, "output" -> out]
Signal done
done
. $-: & HuffmanDecoder2(t) Req Next
Next
Req
In
Out
In
Out
InitialTokens: [new Iterator([new HDC([t, t(0), t(1)])])]
. $,: ?@ 2 . $, ?@
# $
; 9
! B
"5 ? 2 6= $33/% 0 . $-3 ; ! " 9 & )
! " &
( # $
& C
! !
*
! 1 !
$4 56 &&&'
# $ ( B !
1 & & ( !
& B &
& 9
+ : ( " % # $ & . $/ @
# $ ( B
%
" 4 4 % # $
. $A " % & & &
"
% ?
& # $ * G& @ &
SimpleEvolutionaryStrategy( resultBetter, // resultBetter(newResOutput, oldResOutput) initialPop, mate, // mate(pars) popSize, selPopSize, dseFactory // dseFactory(pop) ) Add result Function: pop = if r in pop then pop else insertRes(r, pop) end, best = if resultBetter(r("output"), best("output")) then r else best end resultAck addResult r best
r InitialTokens: [null]
pop
Best Current population results
r Initialize elite best nextGen
pop InitialTokens: [null]
pop
Select population Function: selPop = [best("pars")] + [r("pars") : for r in cropTo(pop, selPopSize)], pop = []
selPop
selPop Initialize population Function: pop = [], selPop = initialPop
pop
dse
dseOut
Send new population Function: dse = dseFactory(pop) Guard: pop'size() >= popSize
pop
Add new inidividual Function: pop = pop + [mate(pick(pop, rand), pick(pop, rand))] Guard: pop'size() < popSize
. $/: &
result GenerationalDSE (strategy) Strategy InitialTokens: [strategy] result
next
addResult
resultAck
Finish generation
DSE done
Start new generation
nextGen
dseOut
start
. $A: & &
% #
+ & " %
( & ( " & % : & ' (
&
. $> & ' ( "
9 % & ;
H I ;
;
( " %
( & . $> (
": % & " & % ( "
%
B
, *
) < & @ @
9
& #
J & 7 8 ! /
! 9/ ! !! ! :
" & %
MandelbrotSlave(delay, maxIter) In task Guard: task(0) <> this
task
task
Function: data = [0, task(1)(0), task(1)(1), 0, 0] Guard: task(0) = this data
a
task Out
data
b
result
Delay: delay Function: b = [a(0) + 1, a(1), a(2), (a(3) * a(3)) - ((a(4) * a(4)) + a(1)), (2 * a(3) * a(4)) - a(2)] Guard: a(0) < maxIter
Function: result = [this, task, data(0)]
%Guard: data(0) >= maxIter || sqr(data(3)) + sqr(data(4)) >= 4 Master(slaves, initialTask, hasNextTask, nextTask) Function: slaveTask = [slave, task], newTask = nextTask(task) Guard: hasNextTask(task)
InitialTokens: slaves
Out
task
In
slaveTask
InitialTokens: [initialTask]
newTask slave
Function: slave = result(0), taskResult = [result(1), result(2)] slave
result
InitialTokens: slaves taskResult
%
TaskResult
. $>: B ) )
* ( & MandelbrotSlaveInstrumented(delay, maxIter, stopwatch) In task Guard: task(0) <> this
task InitialTokens: [stopwatch] this Start
task
Function: data = [0, task(1)(0), task(1)(1), 0, 0] Guard: task(0) = this data
Stop
task Out
this
data b
result
a Delay: delay Function: b = [a(0) + 1, a(1), a(2), (a(3) * a(3)) - ((a(4) * a(4)) + a(1)), (2 * a(3) * a(4)) - a(2)] Guard: a(0) < maxIter
Function: result = [this, task, data(0)] Guard: data(0) > maxIter || sqr(data(3)) + sqr(data(4)) >= 4
. $8: $>
. $8:
" % ))
" % "
% ( " %
% !
; (
1 +
& & *
( G& ( : * 4 ( 9 & ; & ( &
B ( 9 ( & & ( @ ( ! " ##$% ? &
&
" "1 62 $338 5 $33/%% " % < Æ
! "
:44 % E04DE 5 + E 0 "
:44 % ( &
! " ##$%
$ < 5 E 6= "$33-% + < C E* ) 1 ) 0 + 6? 1D "$33-% 0 1 C& 0 + 0 ) $/ ;
0 ( 1 ) = 8$/ $/3$>8 7 1 0 + + = C E 62 2 "###% C& C D 1 ) ? 0 ###) ,/>,A- + 0 + C E 62 2 "##$% : )+ ?0 0 "?00 )#$%) >>3 ;CCC 0 + 5 C ? E 2 E 6= 2 "$33/% )D
C E ! + ) 5 ? 2 67 K "$38$% + ?7 1 )( 0 +) = $, $#3$,A ( 0 + 1 ? 2 2 "$338% )0
) !
"# $ %& &'
2 K "$33% 0 1 : < 0 J = $: < 0 C(0+ 0 + += 7 0 "$33-% ! 1 D*
E 0 1
'# ( $ (
7 0 "$33/% . 0 1 ! 1 ) $/ ; 0 ( 1 ) = 8$/ 7 1 0 + += 7 0 "$33A% ( 0 J 1 C D* ! 1 )
$> ; 0 ( 1 ) = $#3$ ,8#,33 7 1 0 + += 7 0 "$33>% 0 1 ) $8 ;
0 ( 1 ) = $-8 -A$ 7 1 0 + += < "$388% )! + 0 ) ? "$333##$% ( !
0 C 0 7 C(? L " : % 1 62 2 "$338% D
1 + ) ;0C00+)38) ->/-
;(J( "$33A% )= ) ;(J( E ?A, = E "$33A% ) ! 1 ) )# (&
)%
= "$38>% < * )5( 0 0 +) = -A 83, 7 1 0 + +=