Browse Source
Merge branch 'multi-objective' into future
Merge branch 'multi-objective' into future
Former-commit-id:tempestpy_adaptions2be06f51ca
[formerly44b6855fea
] Former-commit-id:cf79ec79b6
TimQu
8 years ago
228 changed files with 15744 additions and 795 deletions
-
2CMakeLists.txt
-
18examples/fractions.sh
-
51examples/list.sh
-
61examples/list2.sh
-
54examples/listBenchmarks.sh
-
23examples/multiobjective/display_exported_plot.tex
-
93examples/multiobjective/ma/mutex/mutex2.ma
-
98examples/multiobjective/ma/mutex/mutex3.ma
-
103examples/multiobjective/ma/mutex/mutex4.ma
-
110examples/multiobjective/ma/mutex/mutex5.ma
-
101examples/multiobjective/ma/polling/polling.ma
-
1examples/multiobjective/ma/server/server.csl
-
34examples/multiobjective/ma/server/server.ma
-
1examples/multiobjective/ma/simple/simple.csl
-
15examples/multiobjective/ma/simple/simple.ma
-
45examples/multiobjective/ma/stream/stream.ma
-
1examples/multiobjective/ma/stream/stream_bounded_pareto.csl
-
2examples/multiobjective/ma/stream/stream_mixed_pareto.csl
-
1examples/multiobjective/ma/stream/stream_unbounded_pareto.csl
-
88examples/multiobjective/mdp/consensus/consensus2_3_2.nm
-
1examples/multiobjective/mdp/consensus/consensus2_3_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus2_3_2_pareto.pctl
-
114examples/multiobjective/mdp/consensus/consensus2_4_2.nm
-
1examples/multiobjective/mdp/consensus/consensus2_4_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus2_4_2_pareto.pctl
-
140examples/multiobjective/mdp/consensus/consensus2_5_2.nm
-
1examples/multiobjective/mdp/consensus/consensus2_5_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus2_5_2_pareto.pctl
-
100examples/multiobjective/mdp/consensus/consensus3_3_2.nm
-
1examples/multiobjective/mdp/consensus/consensus3_3_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus3_3_2_pareto.pctl
-
131examples/multiobjective/mdp/consensus/consensus3_4_2.nm
-
1examples/multiobjective/mdp/consensus/consensus3_4_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus3_4_2_pareto.pctl
-
162examples/multiobjective/mdp/consensus/consensus3_5_2.nm
-
1examples/multiobjective/mdp/consensus/consensus3_5_2_numerical.pctl
-
1examples/multiobjective/mdp/consensus/consensus3_5_2_pareto.pctl
-
87examples/multiobjective/mdp/consensus/origFiles/consensus2_multi3.nm
-
113examples/multiobjective/mdp/consensus/origFiles/consensus2_multi4.nm
-
139examples/multiobjective/mdp/consensus/origFiles/consensus2_multi5.nm
-
99examples/multiobjective/mdp/consensus/origFiles/consensus3_multi3.nm
-
130examples/multiobjective/mdp/consensus/origFiles/consensus3_multi4.nm
-
161examples/multiobjective/mdp/consensus/origFiles/consensus3_multi5.nm
-
27examples/multiobjective/mdp/consensus/origFiles/consensus_multi.pctl
-
160examples/multiobjective/mdp/dpm/dpm100.nm
-
3examples/multiobjective/mdp/dpm/dpm100_numerical.pctl
-
1examples/multiobjective/mdp/dpm/dpm100_pareto.pctl
-
160examples/multiobjective/mdp/dpm/dpm200.nm
-
3examples/multiobjective/mdp/dpm/dpm200_numerical.pctl
-
1examples/multiobjective/mdp/dpm/dpm200_pareto.pctl
-
160examples/multiobjective/mdp/dpm/dpm300.nm
-
3examples/multiobjective/mdp/dpm/dpm300_numerical.pctl
-
1examples/multiobjective/mdp/dpm/dpm300_pareto.pctl
-
160examples/multiobjective/mdp/dpm/origFiles/power-timed.nm
-
11examples/multiobjective/mdp/dpm/origFiles/power-timed.pctl
-
8examples/multiobjective/mdp/scheduler/origFiles/scheduler.pctl
-
95examples/multiobjective/mdp/scheduler/origFiles/scheduler_prob2_K.nm
-
95examples/multiobjective/mdp/scheduler/scheduler05.nm
-
4examples/multiobjective/mdp/scheduler/scheduler05_numerical.pctl
-
4examples/multiobjective/mdp/scheduler/scheduler05_pareto.pctl
-
95examples/multiobjective/mdp/scheduler/scheduler25.nm
-
4examples/multiobjective/mdp/scheduler/scheduler25_numerical.pctl
-
4examples/multiobjective/mdp/scheduler/scheduler25_pareto.pctl
-
95examples/multiobjective/mdp/scheduler/scheduler50.nm
-
4examples/multiobjective/mdp/scheduler/scheduler50_numerical.pctl
-
4examples/multiobjective/mdp/scheduler/scheduler50_pareto.pctl
-
25examples/multiobjective/mdp/simple/simple.nm
-
2examples/multiobjective/mdp/simple/simple.pctl
-
231examples/multiobjective/mdp/team/origFiles/MDP_a2_r3_t2_full_exp.nm
-
287examples/multiobjective/mdp/team/origFiles/MDP_a3_r3_t2_full_exp.nm
-
364examples/multiobjective/mdp/team/origFiles/MDP_a4_r3_t2_full_exp.nm
-
531examples/multiobjective/mdp/team/origFiles/MDP_a5_r3_t2_full_exp.nm
-
45examples/multiobjective/mdp/team/origFiles/team.pctl
-
286examples/multiobjective/mdp/team/team2obj_3.nm
-
1examples/multiobjective/mdp/team/team2obj_3_numerical.pctl
-
1examples/multiobjective/mdp/team/team2obj_3_pareto.pctl
-
368examples/multiobjective/mdp/team/team2obj_4.nm
-
1examples/multiobjective/mdp/team/team2obj_4_numerical.pctl
-
1examples/multiobjective/mdp/team/team2obj_4_pareto.pctl
-
532examples/multiobjective/mdp/team/team2obj_5.nm
-
1examples/multiobjective/mdp/team/team2obj_5_numerical.pctl
-
1examples/multiobjective/mdp/team/team2obj_5_pareto.pctl
-
288examples/multiobjective/mdp/team/team3obj_3.nm
-
1examples/multiobjective/mdp/team/team3obj_3_numerical.pctl
-
1examples/multiobjective/mdp/team/team3obj_3_pareto.pctl
-
366examples/multiobjective/mdp/team/team3obj_4.nm
-
1examples/multiobjective/mdp/team/team3obj_4_numerical.pctl
-
1examples/multiobjective/mdp/team/team3obj_4_pareto.pctl
-
532examples/multiobjective/mdp/team/team3obj_5.nm
-
1examples/multiobjective/mdp/team/team3obj_5_numerical.pctl
-
1examples/multiobjective/mdp/team/team3obj_5_pareto.pctl
-
169examples/multiobjective/mdp/zeroconf-tb/origFiles/zeroconf_host_multi2_time.nm
-
174examples/multiobjective/mdp/zeroconf-tb/origFiles/zeroconf_host_multi4_time.nm
-
13examples/multiobjective/mdp/zeroconf-tb/origFiles/zeroconf_host_multi_time.pctl
-
169examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb2_14.nm
-
1examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb2_14_numerical.pctl
-
1examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb2_14_pareto.pctl
-
174examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb4_10.nm
-
1examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb4_10_numerical.pctl
-
1examples/multiobjective/mdp/zeroconf-tb/zeroconf-tb4_10_pareto.pctl
@ -1,18 +0,0 @@ |
|||
#!/bin/bash |
|||
executable="timeout 3600 ../build/src/storm" |
|||
arguments=" -i 1000000 --parametric --parametricRegion" |
|||
mkdir fractions |
|||
# pdtmcs |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=15,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regionfile ./pdtmc/crowds/crowds_regions.txt $arguments | tee ./fractions/pdtmc_crowds.pm-constCrowdSize_15_TotalRuns_5.log |
|||
$executable -s ./pdtmc/nand/nand.pm -const N=10,K=5 --prop ./pdtmc/nand/nand.prctl --region:regionfile ./pdtmc/nand/nand_regions.txt $arguments | tee ./fractions/pdtmc_nand.pm-constN_10_K_5.log |
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regionfile ./pdtmc/brp_rewards2/brp_rewards2_regions.txt $arguments | tee ./fractions/pdtmc_brp_rewards2.pm-constN_256_MAX_5.log |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regionfile ./pdtmc/brp_rewards4/brp_rewards4_regions.txt $arguments | tee ./fractions/pdtmc_brp_rewards4.pm-constN_256_MAX_5.log |
|||
|
|||
# pmdps |
|||
$executable -s ./pmdp/brp/brp.pm -const N=256,MAX=5 --prop ./pmdp/brp/brp.prctl --region:regionfile ./pmdp/brp/brp_regions.txt $arguments | tee ./fractions/pmdp_brp.pm-constN_256_MAX_5.log |
|||
$executable -s ./pmdp/coin4/coin4.pm -const K=2 --prop ./pmdp/coin4/coin4.prctl --region:regionfile ./pmdp/coin4/coin4_regions.txt $arguments | tee ./fractions/pmdp_coin4.pm-constK_4.log |
|||
$executable -s ./pmdp/zeroconf/zeroconf.pm -const K=2 --prop ./pmdp/zeroconf/zeroconf.prctl --region:regionfile ./pmdp/zeroconf/zeroconf_regions.txt $arguments | tee ./fractions/pmdp_zeroconf.pm-constK_5.log |
|||
$executable -s ./pmdp/reporter4/reporter4.pm -const Xsize=6,Ysize=6,MAXTRIES=2,B=2 --prop ./pmdp/reporter4/reporter4.prctl --region:regionfile ./pmdp/reporter4/reporter4_regions.txt $arguments | tee ./fractions/pmdp_reporter4.pm-constXsize_6_Ysize_6_MAXTRIES_2_B_2.log |
|||
wait |
|||
|
|||
echo "done" |
@ -1,51 +0,0 @@ |
|||
#!/bin/bash |
|||
executable="timeout 3600 ../build/src/storm" |
|||
arguments="-bisim -i 1000000 --parametric --parametricRegion --region:refinement 0.05 --region:samplemode off" |
|||
mkdir results |
|||
# pdtmcs |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=10,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./results/pdtmc_crowds.pm-constCrowdSize_10_TotalRuns_5.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=10 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./results/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_10.log & |
|||
|
|||
|
|||
$executable -s ./pdtmc/nand/nand.pm -const N=10,K=5 --prop ./pdtmc/nand/nand.prctl --region:regions "0.000010<=perr<=0.999990,0.000010<=prob1<=0.999990;" $arguments | tee ./results/pdtmc_nand.pm-constN_10_K_5.log & |
|||
$executable -s ./pdtmc/nand/nand.pm -const N=25,K=5 --prop ./pdtmc/nand/nand.prctl --region:regions "0.000010<=perr<=0.999990,0.000010<=prob1<=0.999990;" $arguments | tee ./results/pdtmc_nand.pm-constN_25_K_5.log & |
|||
|
|||
wait |
|||
|
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=512,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pdtmc_brp_rewards2.pm-constN_512_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=4096,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pdtmc_brp_rewards2.pm-constN_4096_MAX_5.log & |
|||
|
|||
|
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./results/pdtmc_brp_rewards4.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=5012,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./results/pdtmc_brp_rewards4.pm-constN_5012_MAX_5.log & |
|||
|
|||
$executable -s ./pdtmc/brp/brp.pm -const N=256,MAX=5 --prop ./pdtmc/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pdtmc_brp.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pdtmc/brp/brp.pm -const N=4096,MAX=5 --prop ./pdtmc/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pdtmc_brp.pm-constN_4096_MAX_5.log & |
|||
|
|||
wait |
|||
|
|||
# pmdps |
|||
arguments="-i 1000000 --parametric --parametricRegion --region:refinement 0.05 --region:samplemode off" |
|||
|
|||
$executable -s ./pmdp/brp/brp.pm -const N=256,MAX=5 --prop ./pmdp/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pmdp_brp.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pmdp/brp/brp.pm -const N=4096,MAX=5 --prop ./pmdp/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./results/pmdp_brp.pm-constN_4096_MAX_5.log & |
|||
|
|||
$executable -s ./pmdp/coin2/coin2.pm -const K=2 --prop ./pmdp/coin2/coin2.prctl --region:regions "0.000010<=p1<=0.999990,0.000010<=p2<=0.999990;" $arguments | tee ./results/pmdp_coin2.pm-constK_2.log & |
|||
$executable -s ./pmdp/coin2/coin2.pm -const K=32 --prop ./pmdp/coin2/coin2.prctl --region:regions "0.000010<=p1<=0.999990,0.000010<=p2<=0.999990;" $arguments | tee ./results/pmdp_coin2.pm-constK_32.log & |
|||
|
|||
$executable -s ./pmdp/coin4/coin4.pm -const K=2 --prop ./pmdp/coin4/coin4.prctl --region:regions "0.000010<=p1<=0.999990,0.000010<=p2<=0.999990,0.000010<=p3<=0.999990,0.000010<=p4<=0.999990;" $arguments | tee ./results/pmdp_coin4.pm-constK_2.log & |
|||
$executable -s ./pmdp/coin4/coin4.pm -const K=4 --prop ./pmdp/coin4/coin4.prctl --region:regions "0.000010<=p1<=0.999990,0.000010<=p2<=0.999990,0.000010<=p3<=0.999990,0.000010<=p4<=0.999990;" $arguments | tee ./results/pmdp_coin4.pm-constK_4.log & |
|||
|
|||
wait |
|||
|
|||
$executable -s ./pmdp/zeroconf/zeroconf.pm -const K=2 --prop ./pmdp/zeroconf/zeroconf.prctl --region:regions "0.000010<=loss<=0.999990,0.000010<=old<=0.999990;" $arguments | tee ./results/pmdp_zeroconf.pm-constK_2.log & |
|||
$executable -s ./pmdp/zeroconf/zeroconf.pm -const K=5 --prop ./pmdp/zeroconf/zeroconf.prctl --region:regions "0.000010<=loss<=0.999990,0.000010<=old<=0.999990;" $arguments | tee ./results/pmdp_zeroconf.pm-constK_5.log & |
|||
|
|||
$executable -s ./pmdp/reporter2/reporter2.pm -const Xsize=6,Ysize=6,MAXTRIES=2,B=2 --prop ./pmdp/reporter2/reporter2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pH<=0.999990;" $arguments | tee ./results/pmdp_reporter2.pm-constXsize_6_Ysize_6_MAXTRIES_2_B_2.log & |
|||
$executable -s ./pmdp/reporter2/reporter2.pm -const Xsize=100,Ysize=100,MAXTRIES=10,B=10 --prop ./pmdp/reporter2/reporter2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pH<=0.999990;" $arguments | tee ./results/pmdp_reporter2.pm-constXsize_100_Ysize_100_MAXTRIES_10_B_10.log & |
|||
|
|||
$executable -s ./pmdp/reporter4/reporter4.pm -const Xsize=6,Ysize=6,MAXTRIES=2,B=2 --prop ./pmdp/reporter4/reporter4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pH<=0.999990,0.000010<=pLDiff<=0.999990,0.000010<=pHDiff<=0.999990;" $arguments | tee ./results/pmdp_reporter4.pm-constXsize_6_Ysize_6_MAXTRIES_2_B_2.log & |
|||
$executable -s ./pmdp/reporter4/reporter4.pm -const Xsize=10,Ysize=10,MAXTRIES=3,B=3 --prop ./pmdp/reporter4/reporter4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pH<=0.999990,0.000010<=pLDiff<=0.999990,0.000010<=pHDiff<=0.999990;" $arguments | tee ./results/pmdp_reporter4.pm-constXsize_10_Ysize_10_MAXTRIES_3_B_3.log & |
|||
|
|||
wait |
|||
echo "done!" |
@ -1,61 +0,0 @@ |
|||
#!/bin/bash |
|||
executable="timeout 3600 ../build/src/storm" |
|||
arguments="-i 1000000 --parametric --parametricRegion --region:refinement 0.05 --region:samplemode off" |
|||
resultfolder=res |
|||
|
|||
mkdir $resultfolder |
|||
# pdtmcs |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=10,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_10_TotalRuns_5.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=15,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_15_TotalRuns_5.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=15,TotalRuns=7 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_15_TotalRuns_7.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_5.log & |
|||
wait |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=7 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_7.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=10 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_10.log & |
|||
|
|||
$executable -s ./pdtmc/nand/nand.pm -const N=10,K=5 --prop ./pdtmc/nand/nand.prctl --region:regions "0.000010<=perr<=0.999990,0.000010<=prob1<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_nand.pm-constN_10_K_5.log & |
|||
$executable -s ./pdtmc/nand/nand.pm -const N=25,K=5 --prop ./pdtmc/nand/nand.prctl --region:regions "0.000010<=perr<=0.999990,0.000010<=prob1<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_nand.pm-constN_25_K_5.log & |
|||
wait |
|||
|
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards2.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=512,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards2.pm-constN_512_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=4096,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards2.pm-constN_4096_MAX_5.log & |
|||
|
|||
wait |
|||
|
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=64,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_64_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=128,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_128_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regionso "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=5012,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regionso "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_5012_MAX_5.log & |
|||
wait |
|||
|
|||
|
|||
$executable -s ./pdtmc/brp/brp.pm -const N=256,MAX=5 --prop ./pdtmc/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp.pm-constN_256_MAX_5.log & |
|||
$executable -s ./pdtmc/brp/brp.pm -const N=4096,MAX=5 --prop ./pdtmc/brp/brp.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp.pm-constN_4096_MAX_5.log & |
|||
|
|||
wait |
|||
|
|||
|
|||
# New instances!!!!! (tested here also with bisim) |
|||
|
|||
arguments="-bisim -i 1000000 --parametric --parametricRegion --region:refinement 0.05 --region:samplemode off" |
|||
resultfolder=res_bisim |
|||
mkdir $resultfolder |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=15,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_15_TotalRuns_5.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=15,TotalRuns=7 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_15_TotalRuns_7.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=5 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_5.log & |
|||
wait |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=7 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_7.log & |
|||
$executable -s ./pdtmc/crowds/crowds.pm -const CrowdSize=20,TotalRuns=10 --prop ./pdtmc/crowds/crowds.prctl --region:regions "0.000010<=PF<=0.999990,0.000010<=badC<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_crowds.pm-constCrowdSize_20_TotalRuns_10.log & |
|||
wait |
|||
|
|||
$executable -s ./pdtmc/brp_rewards2/brp_rewards2.pm -const N=256,MAX=5 --prop ./pdtmc/brp_rewards2/brp_rewards2.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards2.pm-constN_256_MAX_5.log & |
|||
|
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=64,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_64_MAX_5.log & |
|||
$executable -s ./pdtmc/brp_rewards4/brp_rewards4.pm -const N=128,MAX=5 --prop ./pdtmc/brp_rewards4/brp_rewards4.prctl --region:regions "0.000010<=pL<=0.999990,0.000010<=pK<=0.999990,0.000010<=TOMsg<=0.999990,0.000010<=TOAck<=0.999990;" $arguments | tee ./$resultfolder/pdtmc_brp_rewards4.pm-constN_128_MAX_5.log & |
|||
|
|||
|
|||
wait |
|||
|
|||
|
|||
echo "done!" |
@ -1,54 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
if [ "$#" != 1 ]; |
|||
then |
|||
echo "Wrong number of arguments! Provide a filename for the results!" |
|||
elif [ -a $1 ]; then |
|||
echo "File for results already exists!" |
|||
else |
|||
|
|||
|
|||
DIR="." |
|||
|
|||
echo '#!/bin/bash' >> $1 |
|||
echo 'executable="timeout 3600 ../build/src/storm"' >> $1 |
|||
echo 'arguments="-bisim -i 1000000 --parametric --parametricRegion --region:refinement 0.05 --region:samplemode off"' >> $1 |
|||
echo "mkdir results" >> $1 |
|||
|
|||
|
|||
declare -a modeltypes=("pdtmc" "pmdp") |
|||
|
|||
for modeltype in "${modeltypes[@]}" |
|||
do |
|||
if [ "$modeltype" == "pdtmc" ]; |
|||
then |
|||
declare -a models=("crowds" "nand" "brp_rewards2" "brp_rewards4" "brp") |
|||
dobisim="-bisim" |
|||
else |
|||
declare -a models=("brp" "coin2" "coin4" "zeroconf" "reporter2" "reporter4") |
|||
dobisim="" |
|||
fi |
|||
echo "# $modeltype""s" >> $1 |
|||
for model in "${models[@]}" |
|||
do |
|||
modelfolder="$DIR/$modeltype/$model" |
|||
suffix="-" |
|||
while read instance; |
|||
do |
|||
|
|||
output='$executable ' |
|||
output="$output""-s $modelfolder/$instance --prop $modelfolder/$model.prctl --region:regions " |
|||
region=$(head -n 1 $modelfolder/$model"_space.txt") |
|||
region="$(echo -e "${region}" | tr -d '[[:space:]]')" |
|||
output="$output"'"'$region'" $arguments | tee ' |
|||
instanceString="$(echo -e "${instance}" | tr -d '[[:space:]]')" |
|||
instanceString=${instanceString//[,=]/_} |
|||
output="$output""./results/$modeltype""_$instanceString.log &" |
|||
echo $output >> $1 |
|||
|
|||
done < "$modelfolder/models" |
|||
|
|||
done |
|||
done |
|||
echo 'wait' >> $1 |
|||
fi |
@ -0,0 +1,23 @@ |
|||
% This file can be used to display the exported plots from multi-objective model checking |
|||
|
|||
\documentclass{article} |
|||
\usepackage{pgfplots} |
|||
\usepackage{filecontents} |
|||
|
|||
\newcommand{\resultPath}{../ma/stream/results/} |
|||
|
|||
\begin{document} |
|||
\centering |
|||
\begin{tikzpicture}[scale=1.75] |
|||
\begin{axis}[ |
|||
enlargelimits=false, |
|||
axis background/.style={fill=red!50} |
|||
] |
|||
\addplot[fill=white, very thin] table [col sep=comma] {\resultPath overapproximation.csv} -- cycle; |
|||
\addplot[fill=green, very thin] table [col sep=comma] {\resultPath underapproximation.csv} -- cycle; |
|||
\addplot[mark=o, mark options={blue, scale=1.3, thick}, only marks] table [col sep=comma] {\resultPath paretopoints.csv}; |
|||
\addplot[mark=false] table [col sep=comma] {\resultPath boundaries.csv}; |
|||
\end{axis} |
|||
\end{tikzpicture} |
|||
|
|||
\end{document} |
@ -0,0 +1,93 @@ |
|||
// Translation of the MAPA Specification of a mutex system into PRISM code |
|||
// http://wwwhome.cs.utwente.nl/~timmer/scoop/papers/qest13/index.html |
|||
|
|||
ma |
|||
|
|||
const int N; // The size of the data (should be at most 6) |
|||
|
|||
formula someEnter = s1=1 | s2=1; |
|||
formula someWait = s1=2 | s2=2; |
|||
formula someLow = s1=3 | s2=3; |
|||
formula someHigh = s1=4 | s2=4; |
|||
formula someTie = s1=5 | s2=5; |
|||
formula someAdmit = s1=6 | s2=6; |
|||
formula otherHigh = s2=4; |
|||
|
|||
formula someLowTie = someLow | someTie; |
|||
formula someLowHighTie = someLow | someHigh | someTie; |
|||
formula someAdmitHighTie = someAdmit | someHigh | someTie; |
|||
formula someEnterWait = someEnter | someWait; |
|||
|
|||
|
|||
module process1 |
|||
|
|||
// The internal state of the process |
|||
// 0: uninterested |
|||
// 1: enter |
|||
// 2: wait |
|||
// 3: low |
|||
// 4: high |
|||
// 5: tie |
|||
// 6: admit |
|||
s1 : [0..6]; |
|||
|
|||
// the phase of the protocol |
|||
phase1 : [1..12]; |
|||
|
|||
// The considered data |
|||
data1 : [1..N]; |
|||
|
|||
// The result of a coin flip |
|||
h1 : bool; |
|||
|
|||
//[] phase1=1 -> 1 : true; |
|||
[] phase1=1 -> 1 : (phase1'=2); |
|||
|
|||
[] phase1=2 & N>=1 -> 1 : (data1'=1) & (phase1'=3); |
|||
[] phase1=2 & N>=2 -> 1 : (data1'=2) & (phase1'=3); |
|||
[] phase1=2 & N>=3 -> 1 : (data1'=3) & (phase1'=3); |
|||
[] phase1=2 & N>=4 -> 1 : (data1'=4) & (phase1'=3); |
|||
[] phase1=2 & N>=5 -> 1 : (data1'=5) & (phase1'=3); |
|||
[] phase1=2 & N>=6 -> 1 : (data1'=6) & (phase1'=3); |
|||
|
|||
[] phase1=3 & (someLowHighTie & !someAdmit) -> 1 : (s1'=2) & (phase1'=4); |
|||
[] phase1=3 & (!someLowHighTie | someAdmit) -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=4 & (!someLowHighTie | someAdmit) -> 1 : (s1'=1) & (phase1'=3); |
|||
|
|||
[] phase1=5 & h1=false -> 1 : (s1'=3) & (phase1'=6); |
|||
[] phase1=5 & h1=true -> 1 : (s1'=4) & (phase1'=7) & (h1'=false); |
|||
|
|||
[] phase1=6 & !someAdmitHighTie -> 1 : (s1'=5) & (phase1'=8); |
|||
|
|||
[] phase1=7 & (someAdmit | otherHigh) -> 1 : (s1'=5) & (phase1'=9); |
|||
[] phase1=7 & (!someAdmit & !otherHigh) -> 1 : (phase1'=10); |
|||
|
|||
[] phase1=8 -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=9 & !someAdmit & !otherHigh -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
<> phase1=10 -> data1 : (phase1'=11) & (data1'=1); |
|||
|
|||
[] phase1=11 & (someLowTie | otherHigh) & !someEnter -> 1 : (s1'=0) & (phase1'=1); |
|||
[] phase1=11 & !someLowTie & !otherHigh -> 1 : (s1'=6) & (phase1'=12); |
|||
|
|||
[] phase1=12 & !someEnterWait -> 1 : (s1'=0) & (phase1'=1); |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1 [ s1=s2, phase1=phase2, data1=data2, h1=h2, s2=s1] endmodule |
|||
|
|||
label "crit1" = phase1=10; |
|||
label "crit2" = phase2=10; |
|||
|
|||
|
|||
rewards "timeInCrit1" |
|||
phase1=10 : 1; |
|||
endrewards |
|||
|
|||
|
|||
rewards "timeInCrit2" |
|||
phase2=10 : 1; |
|||
endrewards |
|||
|
@ -0,0 +1,98 @@ |
|||
// Translation of the MAPA Specification of a mutex system into PRISM code |
|||
// http://wwwhome.cs.utwente.nl/~timmer/scoop/papers/qest13/index.html |
|||
|
|||
ma |
|||
|
|||
const int N; // The size of the data (should be at most 6) |
|||
|
|||
formula someEnter = s1=1 | s2=1 | s3=1; |
|||
formula someWait = s1=2 | s2=2 | s3=2; |
|||
formula someLow = s1=3 | s2=3 | s3=3; |
|||
formula someHigh = s1=4 | s2=4 | s3=4; |
|||
formula someTie = s1=5 | s2=5 | s3=5; |
|||
formula someAdmit = s1=6 | s2=6 | s3=6; |
|||
formula otherHigh = s2=4 | s3=4; |
|||
|
|||
formula someLowTie = someLow | someTie; |
|||
formula someLowHighTie = someLow | someHigh | someTie; |
|||
formula someAdmitHighTie = someAdmit | someHigh | someTie; |
|||
formula someEnterWait = someEnter | someWait; |
|||
|
|||
|
|||
module process1 |
|||
|
|||
// The internal state of the process |
|||
// 0: uninterested |
|||
// 1: enter |
|||
// 2: wait |
|||
// 3: low |
|||
// 4: high |
|||
// 5: tie |
|||
// 6: admit |
|||
s1 : [0..6]; |
|||
|
|||
// the phase of the protocol |
|||
phase1 : [1..12]; |
|||
|
|||
// The considered data |
|||
data1 : [1..N]; |
|||
|
|||
// The result of a coin flip |
|||
h1 : bool; |
|||
|
|||
//[] phase1=1 -> 1 : true; |
|||
[] phase1=1 -> 1 : (phase1'=2); |
|||
|
|||
[] phase1=2 & N>=1 -> 1 : (data1'=1) & (phase1'=3); |
|||
[] phase1=2 & N>=2 -> 1 : (data1'=2) & (phase1'=3); |
|||
[] phase1=2 & N>=3 -> 1 : (data1'=3) & (phase1'=3); |
|||
[] phase1=2 & N>=4 -> 1 : (data1'=4) & (phase1'=3); |
|||
[] phase1=2 & N>=5 -> 1 : (data1'=5) & (phase1'=3); |
|||
[] phase1=2 & N>=6 -> 1 : (data1'=6) & (phase1'=3); |
|||
|
|||
[] phase1=3 & (someLowHighTie & !someAdmit) -> 1 : (s1'=2) & (phase1'=4); |
|||
[] phase1=3 & (!someLowHighTie | someAdmit) -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=4 & (!someLowHighTie | someAdmit) -> 1 : (s1'=1) & (phase1'=3); |
|||
|
|||
[] phase1=5 & h1=false -> 1 : (s1'=3) & (phase1'=6); |
|||
[] phase1=5 & h1=true -> 1 : (s1'=4) & (phase1'=7) & (h1'=false); |
|||
|
|||
[] phase1=6 & !someAdmitHighTie -> 1 : (s1'=5) & (phase1'=8); |
|||
|
|||
[] phase1=7 & (someAdmit | otherHigh) -> 1 : (s1'=5) & (phase1'=9); |
|||
[] phase1=7 & (!someAdmit & !otherHigh) -> 1 : (phase1'=10); |
|||
|
|||
[] phase1=8 -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=9 & !someAdmit & !otherHigh -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
<> phase1=10 -> data1 : (phase1'=11) & (data1'=1); |
|||
|
|||
[] phase1=11 & (someLowTie | otherHigh) & !someEnter -> 1 : (s1'=0) & (phase1'=1); |
|||
[] phase1=11 & !someLowTie & !otherHigh -> 1 : (s1'=6) & (phase1'=12); |
|||
|
|||
[] phase1=12 & !someEnterWait -> 1 : (s1'=0) & (phase1'=1); |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1 [ s1=s2, phase1=phase2, data1=data2, h1=h2, s2=s1] endmodule |
|||
module process3 = process1 [ s1=s3, phase1=phase3, data1=data3, h1=h3, s3=s1] endmodule |
|||
|
|||
label "crit1" = phase1=10; |
|||
label "crit2" = phase2=10; |
|||
label "crit3" = phase3=10; |
|||
|
|||
|
|||
rewards "timeInCrit1" |
|||
phase1=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit2" |
|||
phase2=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit3" |
|||
phase3=10 : 1; |
|||
endrewards |
|||
|
@ -0,0 +1,103 @@ |
|||
// Translation of the MAPA Specification of a mutex system into PRISM code |
|||
// http://wwwhome.cs.utwente.nl/~timmer/scoop/papers/qest13/index.html |
|||
|
|||
ma |
|||
|
|||
const int N; // The size of the data (should be at most 6) |
|||
|
|||
formula someEnter = s1=1 | s2=1 | s3=1 | s4=1; |
|||
formula someWait = s1=2 | s2=2 | s3=2 | s4=2; |
|||
formula someLow = s1=3 | s2=3 | s3=3 | s4=3; |
|||
formula someHigh = s1=4 | s2=4 | s3=4 | s4=4; |
|||
formula someTie = s1=5 | s2=5 | s3=5 | s4=5; |
|||
formula someAdmit = s1=6 | s2=6 | s3=6 | s4=6; |
|||
formula otherHigh = s2=4 | s3=4 | s4=4; |
|||
|
|||
formula someLowTie = someLow | someTie; |
|||
formula someLowHighTie = someLow | someHigh | someTie; |
|||
formula someAdmitHighTie = someAdmit | someHigh | someTie; |
|||
formula someEnterWait = someEnter | someWait; |
|||
|
|||
|
|||
module process1 |
|||
|
|||
// The internal state of the process |
|||
// 0: uninterested |
|||
// 1: enter |
|||
// 2: wait |
|||
// 3: low |
|||
// 4: high |
|||
// 5: tie |
|||
// 6: admit |
|||
s1 : [0..6]; |
|||
|
|||
// the phase of the protocol |
|||
phase1 : [1..12]; |
|||
|
|||
// The considered data |
|||
data1 : [1..N]; |
|||
|
|||
// The result of a coin flip |
|||
h1 : bool; |
|||
|
|||
//[] phase1=1 -> 1 : true; |
|||
[] phase1=1 -> 1 : (phase1'=2); |
|||
|
|||
[] phase1=2 & N>=1 -> 1 : (data1'=1) & (phase1'=3); |
|||
[] phase1=2 & N>=2 -> 1 : (data1'=2) & (phase1'=3); |
|||
[] phase1=2 & N>=3 -> 1 : (data1'=3) & (phase1'=3); |
|||
[] phase1=2 & N>=4 -> 1 : (data1'=4) & (phase1'=3); |
|||
[] phase1=2 & N>=5 -> 1 : (data1'=5) & (phase1'=3); |
|||
[] phase1=2 & N>=6 -> 1 : (data1'=6) & (phase1'=3); |
|||
|
|||
[] phase1=3 & (someLowHighTie & !someAdmit) -> 1 : (s1'=2) & (phase1'=4); |
|||
[] phase1=3 & (!someLowHighTie | someAdmit) -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=4 & (!someLowHighTie | someAdmit) -> 1 : (s1'=1) & (phase1'=3); |
|||
|
|||
[] phase1=5 & h1=false -> 1 : (s1'=3) & (phase1'=6); |
|||
[] phase1=5 & h1=true -> 1 : (s1'=4) & (phase1'=7) & (h1'=false); |
|||
|
|||
[] phase1=6 & !someAdmitHighTie -> 1 : (s1'=5) & (phase1'=8); |
|||
|
|||
[] phase1=7 & (someAdmit | otherHigh) -> 1 : (s1'=5) & (phase1'=9); |
|||
[] phase1=7 & (!someAdmit & !otherHigh) -> 1 : (phase1'=10); |
|||
|
|||
[] phase1=8 -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=9 & !someAdmit & !otherHigh -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
<> phase1=10 -> data1 : (phase1'=11) & (data1'=1); |
|||
|
|||
[] phase1=11 & (someLowTie | otherHigh) & !someEnter -> 1 : (s1'=0) & (phase1'=1); |
|||
[] phase1=11 & !someLowTie & !otherHigh -> 1 : (s1'=6) & (phase1'=12); |
|||
|
|||
[] phase1=12 & !someEnterWait -> 1 : (s1'=0) & (phase1'=1); |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1 [ s1=s2, phase1=phase2, data1=data2, h1=h2, s2=s1] endmodule |
|||
module process3 = process1 [ s1=s3, phase1=phase3, data1=data3, h1=h3, s3=s1] endmodule |
|||
module process4 = process1 [ s1=s4, phase1=phase4, data1=data4, h1=h4, s4=s1] endmodule |
|||
|
|||
label "crit1" = phase1=10; |
|||
label "crit2" = phase2=10; |
|||
label "crit3" = phase3=10; |
|||
label "crit4" = phase4=10; |
|||
|
|||
|
|||
rewards "timeInCrit1" |
|||
phase1=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit2" |
|||
phase2=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit3" |
|||
phase3=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit4" |
|||
phase4=10 : 1; |
|||
endrewards |
@ -0,0 +1,110 @@ |
|||
// Translation of the MAPA Specification of a mutex system into PRISM code |
|||
// http://wwwhome.cs.utwente.nl/~timmer/scoop/papers/qest13/index.html |
|||
|
|||
ma |
|||
|
|||
const int N; // The size of the data (should be at most 6) |
|||
|
|||
formula someEnter = s1=1 | s2=1 | s3=1 | s4=1 | s5=1; |
|||
formula someWait = s1=2 | s2=2 | s3=2 | s4=2 | s5=2; |
|||
formula someLow = s1=3 | s2=3 | s3=3 | s4=3 | s5=3; |
|||
formula someHigh = s1=4 | s2=4 | s3=4 | s4=4 | s5=4; |
|||
formula someTie = s1=5 | s2=5 | s3=5 | s4=5 | s5=5; |
|||
formula someAdmit = s1=6 | s2=6 | s3=6 | s4=6 | s5=6; |
|||
formula otherHigh = s2=4 | s3=4 | s4=4 | s5=4; |
|||
|
|||
formula someLowTie = someLow | someTie; |
|||
formula someLowHighTie = someLow | someHigh | someTie; |
|||
formula someAdmitHighTie = someAdmit | someHigh | someTie; |
|||
formula someEnterWait = someEnter | someWait; |
|||
|
|||
module process1 |
|||
|
|||
// The internal state of the process |
|||
// 0: uninterested |
|||
// 1: enter |
|||
// 2: wait |
|||
// 3: low |
|||
// 4: high |
|||
// 5: tie |
|||
// 6: admit |
|||
s1 : [0..6]; |
|||
|
|||
// the phase of the protocol |
|||
phase1 : [1..12]; |
|||
|
|||
// The considered data |
|||
data1 : [1..N]; |
|||
|
|||
// The result of a coin flip |
|||
h1 : bool; |
|||
|
|||
//[] phase1=1 -> 1 : true; |
|||
[] phase1=1 -> 1 : (phase1'=2); |
|||
|
|||
[] phase1=2 & N>=1 -> 1 : (data1'=1) & (phase1'=3); |
|||
[] phase1=2 & N>=2 -> 1 : (data1'=2) & (phase1'=3); |
|||
[] phase1=2 & N>=3 -> 1 : (data1'=3) & (phase1'=3); |
|||
[] phase1=2 & N>=4 -> 1 : (data1'=4) & (phase1'=3); |
|||
[] phase1=2 & N>=5 -> 1 : (data1'=5) & (phase1'=3); |
|||
[] phase1=2 & N>=6 -> 1 : (data1'=6) & (phase1'=3); |
|||
|
|||
[] phase1=3 & (someLowHighTie & !someAdmit) -> 1 : (s1'=2) & (phase1'=4); |
|||
[] phase1=3 & (!someLowHighTie | someAdmit) -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=4 & (!someLowHighTie | someAdmit) -> 1 : (s1'=1) & (phase1'=3); |
|||
|
|||
[] phase1=5 & h1=false -> 1 : (s1'=3) & (phase1'=6); |
|||
[] phase1=5 & h1=true -> 1 : (s1'=4) & (phase1'=7) & (h1'=false); |
|||
|
|||
[] phase1=6 & !someAdmitHighTie -> 1 : (s1'=5) & (phase1'=8); |
|||
|
|||
[] phase1=7 & (someAdmit | otherHigh) -> 1 : (s1'=5) & (phase1'=9); |
|||
[] phase1=7 & (!someAdmit & !otherHigh) -> 1 : (phase1'=10); |
|||
|
|||
[] phase1=8 -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
[] phase1=9 & !someAdmit & !otherHigh -> 0.5 : (phase1'=5) & (h1'=false) + 0.5 : (phase1'=5) & (h1'=true); |
|||
|
|||
<> phase1=10 -> data1 : (phase1'=11) & (data1'=1); |
|||
|
|||
[] phase1=11 & (someLowTie | otherHigh) & !someEnter -> 1 : (s1'=0) & (phase1'=1); |
|||
[] phase1=11 & !someLowTie & !otherHigh -> 1 : (s1'=6) & (phase1'=12); |
|||
|
|||
[] phase1=12 & !someEnterWait -> 1 : (s1'=0) & (phase1'=1); |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1 [ s1=s2, phase1=phase2, data1=data2, h1=h2, s2=s1] endmodule |
|||
module process3 = process1 [ s1=s3, phase1=phase3, data1=data3, h1=h3, s3=s1] endmodule |
|||
module process4 = process1 [ s1=s4, phase1=phase4, data1=data4, h1=h4, s4=s1] endmodule |
|||
module process5 = process1 [ s1=s5, phase1=phase5, data1=data5, h1=h5, s5=s1] endmodule |
|||
|
|||
|
|||
label "crit1" = phase1=10; |
|||
label "crit2" = phase2=10; |
|||
label "crit3" = phase3=10; |
|||
label "crit4" = phase4=10; |
|||
label "crit5" = phase5=10; |
|||
|
|||
|
|||
rewards "timeInCrit1" |
|||
phase1=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit2" |
|||
phase2=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit3" |
|||
phase3=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit4" |
|||
phase4=10 : 1; |
|||
endrewards |
|||
|
|||
rewards "timeInCrit5" |
|||
phase5=10 : 1; |
|||
endrewards |
|||
|
@ -0,0 +1,101 @@ |
|||
// Translation of the MAPA Specification of a polling system into PRISM code |
|||
// http://wwwhome.cs.utwente.nl/~timmer/scoop/papers/qest13/index.html |
|||
|
|||
ma |
|||
|
|||
const int N; // number of job types (should be at most 6) |
|||
const int Q; // Maximum queue size in each station |
|||
|
|||
// Formulae to control the LIFO queue of the stations. |
|||
// The queue is represented by some integer whose base N representation has at most Q digits, each representing one of the job types 0, 1, ..., N-1. |
|||
// In addition, we store the current size of the queue which is needed to distinguish an empty queue from a queue holding job of type 0 |
|||
formula queue1_empty = q1Size=0; |
|||
formula queue1_full = q1Size=Q; |
|||
formula queue1_pop = floor(q1/N); |
|||
formula queue1_head = q1 - (queue1_pop * N); // i.e. q1 modulo N |
|||
formula queue1_push = q1*N; |
|||
formula queue2_empty = q2Size=0; |
|||
formula queue2_full = q2Size=Q; |
|||
formula queue2_pop = floor(q2/N); |
|||
formula queue2_head = q2 - (queue2_pop * N); // i.e. q2 modulo N |
|||
formula queue2_push = q2*N; |
|||
|
|||
const int queue_maxValue = (N^Q)-1; |
|||
|
|||
const double inRate1 = 3; // = (2 * #station) + 1; |
|||
const double inRate2 = 5; // = (2 * #station) + 1; |
|||
|
|||
module pollingsys |
|||
// The queues for the stations |
|||
q1 : [0..queue_maxValue]; |
|||
q1Size : [0..Q]; |
|||
q2 : [0..queue_maxValue]; |
|||
q2Size : [0..Q]; |
|||
|
|||
// Store the job that is currently processed by the server. j=N means that no job is processed. |
|||
j : [0..N] init N; |
|||
|
|||
// Flag indicating whether a new job arrived |
|||
newJob1 : bool init false; |
|||
newJob2 : bool init false; |
|||
|
|||
//<> !newJob1 & !newJob2 & !queue1_full & queue2_full & j=N -> inRate1 : (newJob1'=true); |
|||
//<> !newJob1 & !newJob2 & queue1_full & !queue2_full & j=N -> inRate2 : (newJob2'=true); |
|||
<> !newJob1 & !newJob2 & !queue1_full & !queue2_full & j=N -> inRate1 : (newJob1'=true) + inRate2 : (newJob2'=true); |
|||
<> !newJob1 & !newJob2 & queue1_full & queue2_full & j<N -> 2*(j+1) : (j'=N); |
|||
<> !newJob1 & !newJob2 & !queue1_full & queue2_full & j<N -> inRate1 : (newJob1'=true) + 2*(j+1) : (j'=N); |
|||
<> !newJob1 & !newJob2 & queue1_full & !queue2_full & j<N -> inRate2 : (newJob2'=true) + 2*(j+1) : (j'=N); |
|||
<> !newJob1 & !newJob2 & !queue1_full & !queue2_full & j<N -> inRate1 : (newJob1'=true) + inRate2 : (newJob2'=true) + 2*(j+1) : (j'=N); |
|||
|
|||
[] newJob1 & N>=1 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+0) & (newJob1'=false); |
|||
[] newJob1 & N>=2 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+1) & (newJob1'=false); |
|||
[] newJob1 & N>=3 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+2) & (newJob1'=false); |
|||
[] newJob1 & N>=4 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+3) & (newJob1'=false); |
|||
[] newJob1 & N>=5 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+4) & (newJob1'=false); |
|||
[] newJob1 & N>=6 -> 1 : (q1Size'=q1Size+1) & (q1'=queue1_push+5) & (newJob1'=false); |
|||
|
|||
[] newJob2 & N>=1 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+0) & (newJob2'=false); |
|||
[] newJob2 & N>=2 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+1) & (newJob2'=false); |
|||
[] newJob2 & N>=3 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+2) & (newJob2'=false); |
|||
[] newJob2 & N>=4 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+3) & (newJob2'=false); |
|||
[] newJob2 & N>=5 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+4) & (newJob2'=false); |
|||
[] newJob2 & N>=6 -> 1 : (q2Size'=q2Size+1) & (q2'=queue2_push+5) & (newJob2'=false); |
|||
|
|||
[copy1] !newJob1 & !newJob2 & !queue1_empty & j=N -> 0.9 : (j'=queue1_head) & (q1Size'=q1Size-1) & (q1'=queue1_pop) + 0.1 : (j'=queue1_head); |
|||
[copy2] !newJob1 & !newJob2 & !queue2_empty & j=N -> 0.9 : (j'=queue2_head) & (q2Size'=q2Size-1) & (q2'=queue2_pop) + 0.1 : (j'=queue2_head); |
|||
|
|||
endmodule |
|||
|
|||
|
|||
|
|||
label "q1full" = q1Size=Q; |
|||
label "q2full" = q2Size=Q; |
|||
label "allqueuesfull" = q1Size=Q & q2Size=Q; |
|||
|
|||
|
|||
// Rewards adapted from Guck et al.: Modelling and Analysis of Markov Reward Automata |
|||
|
|||
rewards "processedjobs1" |
|||
[copy1] true : 0.1; |
|||
endrewards |
|||
|
|||
rewards "processedjobs2" |
|||
[copy1] true : 0.1; |
|||
endrewards |
|||
|
|||
rewards "processedjobs" |
|||
[copy1] true : 1; |
|||
[copy2] true : 1; |
|||
endrewards |
|||
|
|||
rewards "waiting1" |
|||
true : (q1Size); |
|||
endrewards |
|||
|
|||
rewards "waiting2" |
|||
true : (q2Size); |
|||
endrewards |
|||
|
|||
rewards "waiting" |
|||
true : (q1Size + q2Size); |
|||
endrewards |
@ -0,0 +1 @@ |
|||
multi(Tmax=? [ F "error" ], Pmax=? [ F "processB" ]) |
@ -0,0 +1,34 @@ |
|||
|
|||
ma |
|||
|
|||
const double rateProcessing = 2; |
|||
const double rateA = 1; |
|||
const double rateB = 1; |
|||
|
|||
module server |
|||
|
|||
s : [0..5]; // current state: |
|||
// 0: wait for request |
|||
// 1: received request from A |
|||
// 2: received request from B |
|||
// 3: starting to process request of B |
|||
// 4: processing request |
|||
// 5: error |
|||
|
|||
|
|||
|
|||
<> s=0 -> rateA : (s'=1) + rateB : (s'=2); |
|||
[alpha] s=1 -> 1 : (s'=4); |
|||
[alpha] s=2 -> 1 : (s'=3); |
|||
[beta] s=2 -> 0.5 : (s'=0) + 0.5 : (s'=3); |
|||
[] s=3 -> 1 : (s'=4); |
|||
<> s=4 -> rateProcessing : (s'=0) + (rateA+rateB) : (s'=5); |
|||
<> s=5 -> 1 : true; |
|||
|
|||
endmodule |
|||
|
|||
|
|||
label "error" = (s=5); |
|||
label "processB" = (s=3); |
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F s=3 ], Pmax=? [ F s=4 ]) |
@ -0,0 +1,15 @@ |
|||
|
|||
ma |
|||
|
|||
module simple |
|||
|
|||
s : [0..4]; |
|||
|
|||
|
|||
[alpha] (s=0) -> 1 : (s' = 1); |
|||
[beta] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2); |
|||
<> (s=1) -> 9 : (s'=0) + 1 : (s'=3); |
|||
<> (s=2) -> 12 : (s'=4); |
|||
<> (s>2) -> 1 : true; |
|||
|
|||
endmodule |
@ -0,0 +1,45 @@ |
|||
|
|||
ma |
|||
|
|||
const int N; // num packages |
|||
|
|||
const double inRate = 4; |
|||
const double processingRate = 4; |
|||
|
|||
module streamingclient |
|||
|
|||
s : [0..3]; // current state: |
|||
// 0: decide whether to start |
|||
// 1: buffering |
|||
// 2: running |
|||
// 3: success |
|||
|
|||
n : [0..N]; // number of received packages |
|||
k : [0..N]; // number of processed packages |
|||
|
|||
[buffer] s=0 & n<N & k=n -> 1 : (s'=1); |
|||
[buffer] s=0 & n<N & k<n -> 0.99: (s'=1) + 0.01 : (s'=2) & (k'=k+1); |
|||
[start] s=0 & k<n -> 1 : (s'=2) & (k'=k+1); |
|||
|
|||
<> s=1 -> inRate : (n'=n+1) & (s'=0); |
|||
|
|||
<> s=2 & n<N & k<n -> inRate : (n'=n+1) + processingRate : (k'=k+1); |
|||
<> s=2 & n<N & k=n -> inRate : (n'=n+1) + processingRate : (s'=0); |
|||
<> s=2 & n=N & k<n -> processingRate : (k'=k+1); |
|||
<> s=2 & n=N & k=N -> processingRate : (s'=3); |
|||
|
|||
<> s=3 -> 1 : true; |
|||
endmodule |
|||
|
|||
|
|||
label "underrun" = (s=0 & k>0); |
|||
label "running" = (s=2); |
|||
label "done" = (s=3); |
|||
|
|||
rewards "buffering" |
|||
s=1 : 1; |
|||
endrewards |
|||
|
|||
rewards "numrestarts" |
|||
[start] k > 0 : 1; |
|||
endrewards |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F<=3.5 "done" ], Pmax=? [ F<=1 s=2 ]) |
@ -0,0 +1,2 @@ |
|||
multi(Pmax=? [ F<=2.5 s=2], R{"numrestarts"}min=? [ F "done"]) |
|||
// best looking on stream50 |
@ -0,0 +1 @@ |
|||
multi(R{"initialbuffering"}min=? [ F "done" ], R{"numRestarts"}min=? [ F "done" ]) |
@ -0,0 +1,88 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 3; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coins 2 and 3 are of no use as there are not enough rounds afterwards to decide |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.8916673903 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,114 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 4; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coin 3 is of no use because of number of rounds |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.9882640457 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,140 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 5; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
[coin4_s1_start] s1=2 & r1=4 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin4_s1_p1] s1=3 & r1=4 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin4_s1_p2] s1=3 & r1=4 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start,coin4_s1_start=coin4_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1,coin4_s1_p1=coin4_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2,coin4_s1_p2=coin4_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin3_error |
|||
|
|||
c3 : [0..1]; // 1 is the error state |
|||
v3 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin3_s1_p1] v3=0 -> (v3'=1); |
|||
[coin3_s2_p1] v3=0 -> (v3'=1); |
|||
[coin3_s1_p2] v3=0 -> (v3'=2); |
|||
[coin3_s2_p2] v3=0 -> (v3'=2); |
|||
// later values returned |
|||
[coin3_s1_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s2_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s1_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s2_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s1_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s2_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s1_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s2_p2] v3=1 -> (c3'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coin 4 is of no use because of number of rounds |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0 | c3=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.9987286134 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,100 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 3; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.7709112445 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,131 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 4; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start,coin3_s1_start=coin3_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1,coin3_s1_p1=coin3_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2,coin3_s1_p2=coin3_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s3_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
[coin2_s3_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s3_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s3_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s3_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s3_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.9475183421 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,162 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 5; // num rounds (R) |
|||
const int K = 2; // Parameter for coins |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
[coin4_s1_start] s1=2 & r1=4 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin4_s1_p1] s1=3 & r1=4 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin4_s1_p2] s1=3 & r1=4 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start,coin4_s1_start=coin4_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1,coin4_s1_p1=coin4_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2,coin4_s1_p2=coin4_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start,coin3_s1_start=coin3_s3_start,coin4_s1_start=coin4_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1,coin3_s1_p1=coin3_s3_p1,coin4_s1_p1=coin4_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2,coin3_s1_p2=coin3_s3_p2,coin4_s1_p2=coin4_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s3_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
[coin2_s3_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s3_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s3_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s3_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s3_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin3_error |
|||
|
|||
c3 : [0..1]; // 1 is the error state |
|||
v3 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin3_s1_p1] v3=0 -> (v3'=1); |
|||
[coin3_s2_p1] v3=0 -> (v3'=1); |
|||
[coin3_s3_p1] v3=0 -> (v3'=1); |
|||
[coin3_s1_p2] v3=0 -> (v3'=2); |
|||
[coin3_s2_p2] v3=0 -> (v3'=2); |
|||
[coin3_s3_p2] v3=0 -> (v3'=2); |
|||
// later values returned |
|||
[coin3_s1_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s2_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s3_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s1_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s2_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s3_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s1_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s2_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s3_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s1_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s2_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s3_p2] v3=1 -> (c3'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0 | c3=0); |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], P>=0.9879770423 [ G "one_coin_ok" ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,87 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 3; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coins 2 and 3 are of no use as there are not enough rounds afterwards to decide |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0); |
@ -0,0 +1,113 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 4; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coin 3 is of no use because of number of rounds |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0); |
@ -0,0 +1,139 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 2; // num processes |
|||
const int MAX = 5; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2)) & (p2=1 | r2<max(r1,r2)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2)) & (p2=2 | r2<max(r1,r2)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2)-1) & (p2=1 | r2<max(r1,r2)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2)-1) & (p2=2 | r2<max(r1,r2)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
[coin4_s1_start] s1=2 & r1=4 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin4_s1_p1] s1=3 & r1=4 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin4_s1_p2] s1=3 & r1=4 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p1, |
|||
r1=r2,r2=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start,coin4_s1_start=coin4_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1,coin4_s1_p1=coin4_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2,coin4_s1_p2=coin4_s2_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// could do with renaming |
|||
module coin3_error |
|||
|
|||
c3 : [0..1]; // 1 is the error state |
|||
v3 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin3_s1_p1] v3=0 -> (v3'=1); |
|||
[coin3_s2_p1] v3=0 -> (v3'=1); |
|||
[coin3_s1_p2] v3=0 -> (v3'=2); |
|||
[coin3_s2_p2] v3=0 -> (v3'=2); |
|||
// later values returned |
|||
[coin3_s1_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s2_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s1_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s2_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s1_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s2_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s1_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s2_p2] v3=1 -> (c3'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// coin 4 is of no use because of number of rounds |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0 | c3=0); |
@ -0,0 +1,99 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 3; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0); |
@ -0,0 +1,130 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 4; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start,coin3_s1_start=coin3_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1,coin3_s1_p1=coin3_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2,coin3_s1_p2=coin3_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s3_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
[coin2_s3_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s3_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s3_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s3_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s3_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0); |
@ -0,0 +1,161 @@ |
|||
// model of randomised consensus |
|||
|
|||
mdp |
|||
|
|||
const int N = 3; // num processes |
|||
const int MAX = 5; // num rounds (R) |
|||
|
|||
// need to turn these into local copies later so the reading phase is complete? |
|||
formula leaders_agree1 = (p1=1 | r1<max(r1,r2,r3)) & (p2=1 | r2<max(r1,r2,r3)) & (p3=1 | r3<max(r1,r2,r3)); |
|||
formula leaders_agree2 = (p1=2 | r1<max(r1,r2,r3)) & (p2=2 | r2<max(r1,r2,r3)) & (p3=2 | r3<max(r1,r2,r3)); |
|||
|
|||
formula decide1 = leaders_agree1 & (p1=1 | r1<max(r1,r2,r3)-1) & (p2=1 | r2<max(r1,r2,r3)-1) & (p3=1 | r3<max(r1,r2,r3)-1); |
|||
formula decide2 = leaders_agree2 & (p1=2 | r1<max(r1,r2,r3)-1) & (p2=2 | r2<max(r1,r2,r3)-1) & (p3=2 | r3<max(r1,r2,r3)-1); |
|||
|
|||
module process1 |
|||
|
|||
s1 : [0..5]; // local state |
|||
// 0 initialise/read registers |
|||
// 1 finish reading registers (make a decision) |
|||
// 1 warn of change |
|||
// 2 enter shared coin protocol |
|||
// 4 finished |
|||
// 5 error (reached max round and cannot decide) |
|||
r1 : [0..MAX]; // round of the process |
|||
p1 : [0..2]; // preference (0 corresponds to null) |
|||
|
|||
// nondeterministic choice as to initial preference |
|||
[] s1=0 & r1=0 -> (p1'=1) & (r1'=1); |
|||
[] s1=0 & r1=0 -> (p1'=2) & (r1'=1); |
|||
|
|||
// read registers (currently does nothing because read vs from other processes |
|||
[] s1=0 & r1>0 & r1<=MAX -> (s1'=1); |
|||
// maxke a decision |
|||
[] s1=1 & decide1 -> (s1'=4) & (p1'=1); |
|||
[] s1=1 & decide2 -> (s1'=4) & (p1'=2); |
|||
[] s1=1 & r1<MAX & leaders_agree1 & !decide1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & leaders_agree2 & !decide2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[] s1=1 & r1<MAX & !(leaders_agree1 | leaders_agree2) -> (s1'=2) & (p1'=0); |
|||
[] s1=1 & r1=MAX & !(decide1 | decide2) -> (s1'=5); // run out of rounds so error |
|||
// enter the coin procotol for the current round |
|||
[coin1_s1_start] s1=2 & r1=1 -> (s1'=3); |
|||
[coin2_s1_start] s1=2 & r1=2 -> (s1'=3); |
|||
[coin3_s1_start] s1=2 & r1=3 -> (s1'=3); |
|||
[coin4_s1_start] s1=2 & r1=4 -> (s1'=3); |
|||
// get response from the coin protocol |
|||
[coin1_s1_p1] s1=3 & r1=1 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin1_s1_p2] s1=3 & r1=1 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin2_s1_p1] s1=3 & r1=2 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin2_s1_p2] s1=3 & r1=2 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin3_s1_p1] s1=3 & r1=3 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin3_s1_p2] s1=3 & r1=3 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
[coin4_s1_p1] s1=3 & r1=4 -> (s1'=0) & (p1'=1) & (r1'=r1+1); |
|||
[coin4_s1_p2] s1=3 & r1=4 -> (s1'=0) & (p1'=2) & (r1'=r1+1); |
|||
// done so loop |
|||
[done] s1>=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module process2 = process1[ s1=s2, |
|||
p1=p2,p2=p3,p3=p1, |
|||
r1=r2,r2=r3,r3=r1, |
|||
coin1_s1_start=coin1_s2_start,coin2_s1_start=coin2_s2_start,coin3_s1_start=coin3_s2_start,coin4_s1_start=coin4_s2_start, |
|||
coin1_s1_p1=coin1_s2_p1,coin2_s1_p1=coin2_s2_p1,coin3_s1_p1=coin3_s2_p1,coin4_s1_p1=coin4_s2_p1, |
|||
coin1_s1_p2=coin1_s2_p2,coin2_s1_p2=coin2_s2_p2,coin3_s1_p2=coin3_s2_p2,coin4_s1_p2=coin4_s2_p2 ] |
|||
endmodule |
|||
|
|||
module process3 = process1[ s1=s3, |
|||
p1=p3,p2=p1,p3=p2, |
|||
r1=r3,r2=r1,r3=r2, |
|||
coin1_s1_start=coin1_s3_start,coin2_s1_start=coin2_s3_start,coin3_s1_start=coin3_s3_start,coin4_s1_start=coin4_s3_start, |
|||
coin1_s1_p1=coin1_s3_p1,coin2_s1_p1=coin2_s3_p1,coin3_s1_p1=coin3_s3_p1,coin4_s1_p1=coin4_s3_p1, |
|||
coin1_s1_p2=coin1_s3_p2,coin2_s1_p2=coin2_s3_p2,coin3_s1_p2=coin3_s3_p2,coin4_s1_p2=coin4_s3_p2 ] |
|||
endmodule |
|||
|
|||
module coin1_error |
|||
|
|||
c1 : [0..1]; // 1 is the error state |
|||
v1 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin1_s1_p1] v1=0 -> (v1'=1); |
|||
[coin1_s2_p1] v1=0 -> (v1'=1); |
|||
[coin1_s3_p1] v1=0 -> (v1'=1); |
|||
[coin1_s1_p2] v1=0 -> (v1'=2); |
|||
[coin1_s2_p2] v1=0 -> (v1'=2); |
|||
[coin1_s3_p2] v1=0 -> (v1'=2); |
|||
// later values returned |
|||
[coin1_s1_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s2_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s3_p1] v1=1 -> true; // good behaviour |
|||
[coin1_s1_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s2_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s3_p2] v1=2 -> true; // good behaviour |
|||
[coin1_s1_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s2_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s3_p1] v1=2 -> (c1'=1); // error |
|||
[coin1_s1_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s2_p2] v1=1 -> (c1'=1); // error |
|||
[coin1_s3_p2] v1=1 -> (c1'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin2_error |
|||
|
|||
c2 : [0..1]; // 1 is the error state |
|||
v2 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin2_s1_p1] v2=0 -> (v2'=1); |
|||
[coin2_s2_p1] v2=0 -> (v2'=1); |
|||
[coin2_s3_p1] v2=0 -> (v2'=1); |
|||
[coin2_s1_p2] v2=0 -> (v2'=2); |
|||
[coin2_s2_p2] v2=0 -> (v2'=2); |
|||
[coin2_s3_p2] v2=0 -> (v2'=2); |
|||
// later values returned |
|||
[coin2_s1_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s2_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s3_p1] v2=1 -> true; // good behaviour |
|||
[coin2_s1_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s2_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s3_p2] v2=2 -> true; // good behaviour |
|||
[coin2_s1_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s2_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s3_p1] v2=2 -> (c2'=1); // error |
|||
[coin2_s1_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s2_p2] v2=1 -> (c2'=1); // error |
|||
[coin2_s3_p2] v2=1 -> (c2'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
module coin3_error |
|||
|
|||
c3 : [0..1]; // 1 is the error state |
|||
v3 : [0..2]; // value of the coin returned the first time |
|||
|
|||
// first returned value (any processes) |
|||
[coin3_s1_p1] v3=0 -> (v3'=1); |
|||
[coin3_s2_p1] v3=0 -> (v3'=1); |
|||
[coin3_s3_p1] v3=0 -> (v3'=1); |
|||
[coin3_s1_p2] v3=0 -> (v3'=2); |
|||
[coin3_s2_p2] v3=0 -> (v3'=2); |
|||
[coin3_s3_p2] v3=0 -> (v3'=2); |
|||
// later values returned |
|||
[coin3_s1_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s2_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s3_p1] v3=1 -> true; // good behaviour |
|||
[coin3_s1_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s2_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s3_p2] v3=2 -> true; // good behaviour |
|||
[coin3_s1_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s2_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s3_p1] v3=2 -> (c3'=1); // error |
|||
[coin3_s1_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s2_p2] v3=1 -> (c3'=1); // error |
|||
[coin3_s3_p2] v3=1 -> (c3'=1); // error |
|||
|
|||
endmodule |
|||
|
|||
// Labels |
|||
label "one_proc_err" = (s1=5 | s2=5 | s3=5); |
|||
label "one_coin_ok" = (c1=0 | c2=0 | c3=0); |
@ -0,0 +1,27 @@ |
|||
// Parameter K for coins |
|||
const int K; |
|||
|
|||
// Max probability of component (coins) violating assumption property (checked separately) |
|||
const double p_coin_fail = |
|||
N=2 ? ( |
|||
K=2 ? 0.10833260973166493 : |
|||
K=12 ? 0.04164301267240658 : |
|||
K=20 ? 0.01249126244810821 : |
|||
0 ) : |
|||
N=3 ? ( |
|||
K=2 ? 0.22908875545788154 : |
|||
K=4 ? 0.12450138796380239 : |
|||
K=8 ? 0.06248479880890645 : |
|||
K=12 ? 0.04164365757451993 : |
|||
K=16 ? 0.031218839562495382 : |
|||
K=20 ? 0.024960596483605935 : |
|||
0 ) : 0; |
|||
|
|||
// Probability bound for assumption, derived from above |
|||
const double p_one_coin_ok = 1 - pow(p_coin_fail, MAX-2); |
|||
|
|||
// Assume-guarantee check via multi-objective (using ASYM rule) |
|||
"num_ag": multi(Pmax=? [ F "one_proc_err" ], P>=p_one_coin_ok [ G "one_coin_ok" ]) |
|||
|
|||
// Pareto query for assume-guarantee check |
|||
"pareto": multi(Pmax=? [ F "one_proc_err" ], Pmax=? [ G "one_coin_ok" ]) |
@ -0,0 +1,160 @@ |
|||
// power manager example |
|||
mdp |
|||
|
|||
const int QMAX =2; // max queue size |
|||
|
|||
// to model the pm making a choice and then a move being made we need |
|||
// two clock ticks for each transition |
|||
// first the pm decides tick1 and then the system moves tick2 |
|||
|
|||
module timer |
|||
|
|||
c : [0..1]; |
|||
|
|||
[tick1] c=0 -> (c'=1); |
|||
[tick2] c=1 -> (c'=0); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// POWER MANAGER |
|||
module PM |
|||
|
|||
pm : [0..4] init 4; |
|||
// 0 - go to active |
|||
// 1 - go to idle |
|||
// 2 - go to idlelp |
|||
// 3 - go to stby |
|||
// 4 - go to sleep |
|||
|
|||
[tick1] true -> (pm'=0); |
|||
[tick1] true -> (pm'=1); |
|||
[tick1] true -> (pm'=2); |
|||
[tick1] true -> (pm'=3); |
|||
[tick1] true -> (pm'=4); |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE REQUESTER |
|||
module SR |
|||
|
|||
sr : [0..1] init 0; |
|||
// 0 idle |
|||
// 1 1req |
|||
|
|||
[tick2] sr=0 -> 0.898: (sr'=0) + 0.102: (sr'=1); |
|||
[tick2] sr=1 -> 0.454: (sr'=0) + 0.546: (sr'=1); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE PROVIDER |
|||
|
|||
module SP |
|||
|
|||
sp : [0..10] init 9; |
|||
// 0 active |
|||
// 1 idle |
|||
// 2 active_idlelp |
|||
// 3 idlelp |
|||
// 4 idlelp_active |
|||
// 5 active_stby |
|||
// 6 stby |
|||
// 7 stby_active |
|||
// 8 active_sleep |
|||
// 9 sleep |
|||
// 10 sleep_active |
|||
|
|||
// states where PM has no control (transient states) |
|||
[tick2] sp=2 -> 0.75 : (sp'=2) + 0.25 : (sp'=3); // active_idlelp |
|||
[tick2] sp=4 -> 0.25 : (sp'=0) + 0.75 : (sp'=4); // idlelp_active |
|||
[tick2] sp=5 -> 0.995 : (sp'=5) + 0.005 : (sp'=6); // active_stby |
|||
[tick2] sp=7 -> 0.005 : (sp'=0) + 0.995 : (sp'=7); // stby_active |
|||
[tick2] sp=8 -> 0.9983 : (sp'=8) + 0.0017 : (sp'=9); // active_sleep |
|||
[tick2] sp=10 -> 0.0017 : (sp'=0) + 0.9983 : (sp'=10); // sleep_active |
|||
|
|||
// states where PM has control |
|||
// goto_active |
|||
[tick2] sp=0 & pm=0 -> (sp'=0); // active |
|||
[tick2] sp=1 & pm=0 -> (sp'=0); // idle |
|||
[tick2] sp=3 & pm=0 -> (sp'=4); // idlelp |
|||
[tick2] sp=6 & pm=0 -> (sp'=7); // stby |
|||
[tick2] sp=9 & pm=0 -> (sp'=10); // sleep |
|||
// goto_idle |
|||
[tick2] sp=0 & pm=1 -> (sp'=1); // active |
|||
[tick2] sp=1 & pm=1 -> (sp'=1); // idle |
|||
[tick2] sp=3 & pm=1 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=1 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=1 -> (sp'=9); // sleep |
|||
// goto_idlelp |
|||
[tick2] sp=0 & pm=2 -> (sp'=2); // active |
|||
[tick2] sp=1 & pm=2 -> (sp'=2); // idle |
|||
[tick2] sp=3 & pm=2 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=2 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=2 -> (sp'=9); // sleep |
|||
// goto_stby |
|||
[tick2] sp=0 & pm=3 -> (sp'=5); // active |
|||
[tick2] sp=1 & pm=3 -> (sp'=5); // idle |
|||
[tick2] sp=3 & pm=3 -> (sp'=5); // idlelp |
|||
[tick2] sp=6 & pm=3 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=3 -> (sp'=9); // sleep |
|||
// goto_sleep |
|||
[tick2] sp=0 & pm=4 -> (sp'=8); // active |
|||
[tick2] sp=1 & pm=4 -> (sp'=8); // idle |
|||
[tick2] sp=3 & pm=4 -> (sp'=8); // idlelp |
|||
[tick2] sp=6 & pm=4 -> (sp'=8); // stby |
|||
[tick2] sp=9 & pm=4 -> (sp'=9); // sleep |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SQ |
|||
module SQ |
|||
|
|||
q : [0..QMAX] init 0; |
|||
|
|||
// serve if busy |
|||
[tick2] sr=0 & sp=0 -> (q'=max(q-1,0)); |
|||
[tick2] sr=1 & sp=0 -> (q'=q); |
|||
|
|||
// otherwise do nothing |
|||
[tick2] sr=0 & sp>0 -> (q'=q); |
|||
[tick2] sr=1 & sp>0 -> (q'=min(q+1,QMAX)); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
//rewards "time" |
|||
// [tick2] bat=1 : 1; |
|||
//endrewards |
|||
|
|||
rewards "power" |
|||
[tick2] sp=0 & c=1 : 2.5; |
|||
[tick2] sp=1 & c=1 : 1.5; |
|||
[tick2] sp=2 & c=1 : 2.5; |
|||
[tick2] sp=3 & c=1 : 0.8; |
|||
[tick2] sp=4 & c=1 : 2.5; |
|||
[tick2] sp=5 & c=1 : 2.5; |
|||
[tick2] sp=6 & c=1 : 0.3; |
|||
[tick2] sp=7 & c=1 : 2.5; |
|||
[tick2] sp=8 & c=1 : 2.5; |
|||
[tick2] sp=9 & c=1 : 0.1; |
|||
[tick2] sp=10 & c=1 : 2.5; |
|||
endrewards |
|||
|
|||
// is an instantaneous property but I suppose we can look at average size |
|||
// i.e. divide by the expected number of time steps |
|||
rewards "queue" |
|||
[tick2] c=1 : q; |
|||
endrewards |
|||
|
|||
rewards "lost" |
|||
[tick2] sr=1 & sp>0 & q=2 : 1; |
|||
endrewards |
@ -0,0 +1,3 @@ |
|||
multi(R{"power"}min=? [ C<=100 ], R{"queue"}<=70 [ C<=100 ]) |
|||
// Note: The property file from http://www.prismmodelchecker.org/files/atva12mo/ does not provide a threshold for the second objective. |
|||
// We pick a threshold that intersects the pareto curve. |
@ -0,0 +1 @@ |
|||
multi(R{"power"}min=? [ C<=100 ], R{"queue"}min=? [ C<=100 ]) |
@ -0,0 +1,160 @@ |
|||
// power manager example |
|||
mdp |
|||
|
|||
const int QMAX =2; // max queue size |
|||
|
|||
// to model the pm making a choice and then a move being made we need |
|||
// two clock ticks for each transition |
|||
// first the pm decides tick1 and then the system moves tick2 |
|||
|
|||
module timer |
|||
|
|||
c : [0..1]; |
|||
|
|||
[tick1] c=0 -> (c'=1); |
|||
[tick2] c=1 -> (c'=0); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// POWER MANAGER |
|||
module PM |
|||
|
|||
pm : [0..4] init 4; |
|||
// 0 - go to active |
|||
// 1 - go to idle |
|||
// 2 - go to idlelp |
|||
// 3 - go to stby |
|||
// 4 - go to sleep |
|||
|
|||
[tick1] true -> (pm'=0); |
|||
[tick1] true -> (pm'=1); |
|||
[tick1] true -> (pm'=2); |
|||
[tick1] true -> (pm'=3); |
|||
[tick1] true -> (pm'=4); |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE REQUESTER |
|||
module SR |
|||
|
|||
sr : [0..1] init 0; |
|||
// 0 idle |
|||
// 1 1req |
|||
|
|||
[tick2] sr=0 -> 0.898: (sr'=0) + 0.102: (sr'=1); |
|||
[tick2] sr=1 -> 0.454: (sr'=0) + 0.546: (sr'=1); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE PROVIDER |
|||
|
|||
module SP |
|||
|
|||
sp : [0..10] init 9; |
|||
// 0 active |
|||
// 1 idle |
|||
// 2 active_idlelp |
|||
// 3 idlelp |
|||
// 4 idlelp_active |
|||
// 5 active_stby |
|||
// 6 stby |
|||
// 7 stby_active |
|||
// 8 active_sleep |
|||
// 9 sleep |
|||
// 10 sleep_active |
|||
|
|||
// states where PM has no control (transient states) |
|||
[tick2] sp=2 -> 0.75 : (sp'=2) + 0.25 : (sp'=3); // active_idlelp |
|||
[tick2] sp=4 -> 0.25 : (sp'=0) + 0.75 : (sp'=4); // idlelp_active |
|||
[tick2] sp=5 -> 0.995 : (sp'=5) + 0.005 : (sp'=6); // active_stby |
|||
[tick2] sp=7 -> 0.005 : (sp'=0) + 0.995 : (sp'=7); // stby_active |
|||
[tick2] sp=8 -> 0.9983 : (sp'=8) + 0.0017 : (sp'=9); // active_sleep |
|||
[tick2] sp=10 -> 0.0017 : (sp'=0) + 0.9983 : (sp'=10); // sleep_active |
|||
|
|||
// states where PM has control |
|||
// goto_active |
|||
[tick2] sp=0 & pm=0 -> (sp'=0); // active |
|||
[tick2] sp=1 & pm=0 -> (sp'=0); // idle |
|||
[tick2] sp=3 & pm=0 -> (sp'=4); // idlelp |
|||
[tick2] sp=6 & pm=0 -> (sp'=7); // stby |
|||
[tick2] sp=9 & pm=0 -> (sp'=10); // sleep |
|||
// goto_idle |
|||
[tick2] sp=0 & pm=1 -> (sp'=1); // active |
|||
[tick2] sp=1 & pm=1 -> (sp'=1); // idle |
|||
[tick2] sp=3 & pm=1 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=1 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=1 -> (sp'=9); // sleep |
|||
// goto_idlelp |
|||
[tick2] sp=0 & pm=2 -> (sp'=2); // active |
|||
[tick2] sp=1 & pm=2 -> (sp'=2); // idle |
|||
[tick2] sp=3 & pm=2 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=2 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=2 -> (sp'=9); // sleep |
|||
// goto_stby |
|||
[tick2] sp=0 & pm=3 -> (sp'=5); // active |
|||
[tick2] sp=1 & pm=3 -> (sp'=5); // idle |
|||
[tick2] sp=3 & pm=3 -> (sp'=5); // idlelp |
|||
[tick2] sp=6 & pm=3 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=3 -> (sp'=9); // sleep |
|||
// goto_sleep |
|||
[tick2] sp=0 & pm=4 -> (sp'=8); // active |
|||
[tick2] sp=1 & pm=4 -> (sp'=8); // idle |
|||
[tick2] sp=3 & pm=4 -> (sp'=8); // idlelp |
|||
[tick2] sp=6 & pm=4 -> (sp'=8); // stby |
|||
[tick2] sp=9 & pm=4 -> (sp'=9); // sleep |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SQ |
|||
module SQ |
|||
|
|||
q : [0..QMAX] init 0; |
|||
|
|||
// serve if busy |
|||
[tick2] sr=0 & sp=0 -> (q'=max(q-1,0)); |
|||
[tick2] sr=1 & sp=0 -> (q'=q); |
|||
|
|||
// otherwise do nothing |
|||
[tick2] sr=0 & sp>0 -> (q'=q); |
|||
[tick2] sr=1 & sp>0 -> (q'=min(q+1,QMAX)); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
//rewards "time" |
|||
// [tick2] bat=1 : 1; |
|||
//endrewards |
|||
|
|||
rewards "power" |
|||
[tick2] sp=0 & c=1 : 2.5; |
|||
[tick2] sp=1 & c=1 : 1.5; |
|||
[tick2] sp=2 & c=1 : 2.5; |
|||
[tick2] sp=3 & c=1 : 0.8; |
|||
[tick2] sp=4 & c=1 : 2.5; |
|||
[tick2] sp=5 & c=1 : 2.5; |
|||
[tick2] sp=6 & c=1 : 0.3; |
|||
[tick2] sp=7 & c=1 : 2.5; |
|||
[tick2] sp=8 & c=1 : 2.5; |
|||
[tick2] sp=9 & c=1 : 0.1; |
|||
[tick2] sp=10 & c=1 : 2.5; |
|||
endrewards |
|||
|
|||
// is an instantaneous property but I suppose we can look at average size |
|||
// i.e. divide by the expected number of time steps |
|||
rewards "queue" |
|||
[tick2] c=1 : q; |
|||
endrewards |
|||
|
|||
rewards "lost" |
|||
[tick2] sr=1 & sp>0 & q=2 : 1; |
|||
endrewards |
@ -0,0 +1,3 @@ |
|||
multi(R{"power"}min=? [ C<=200 ], R{"queue"}<=170 [ C<=200 ]) |
|||
// Note: The property file from http://www.prismmodelchecker.org/files/atva12mo/ does not provide a threshold for the second objective. |
|||
// We pick a threshold that intersects the pareto curve. |
@ -0,0 +1 @@ |
|||
multi(R{"power"}min=? [ C<=200 ], R{"queue"}min=? [ C<=200 ]) |
@ -0,0 +1,160 @@ |
|||
// power manager example |
|||
mdp |
|||
|
|||
const int QMAX=2; // max queue size |
|||
|
|||
// to model the pm making a choice and then a move being made we need |
|||
// two clock ticks for each transition |
|||
// first the pm decides tick1 and then the system moves tick2 |
|||
|
|||
module timer |
|||
|
|||
c : [0..1]; |
|||
|
|||
[tick1] c=0 -> (c'=1); |
|||
[tick2] c=1 -> (c'=0); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// POWER MANAGER |
|||
module PM |
|||
|
|||
pm : [0..4] init 4; |
|||
// 0 - go to active |
|||
// 1 - go to idle |
|||
// 2 - go to idlelp |
|||
// 3 - go to stby |
|||
// 4 - go to sleep |
|||
|
|||
[tick1] true -> (pm'=0); |
|||
[tick1] true -> (pm'=1); |
|||
[tick1] true -> (pm'=2); |
|||
[tick1] true -> (pm'=3); |
|||
[tick1] true -> (pm'=4); |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE REQUESTER |
|||
module SR |
|||
|
|||
sr : [0..1] init 0; |
|||
// 0 idle |
|||
// 1 1req |
|||
|
|||
[tick2] sr=0 -> 0.898: (sr'=0) + 0.102: (sr'=1); |
|||
[tick2] sr=1 -> 0.454: (sr'=0) + 0.546: (sr'=1); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE PROVIDER |
|||
|
|||
module SP |
|||
|
|||
sp : [0..10] init 9; |
|||
// 0 active |
|||
// 1 idle |
|||
// 2 active_idlelp |
|||
// 3 idlelp |
|||
// 4 idlelp_active |
|||
// 5 active_stby |
|||
// 6 stby |
|||
// 7 stby_active |
|||
// 8 active_sleep |
|||
// 9 sleep |
|||
// 10 sleep_active |
|||
|
|||
// states where PM has no control (transient states) |
|||
[tick2] sp=2 -> 0.75 : (sp'=2) + 0.25 : (sp'=3); // active_idlelp |
|||
[tick2] sp=4 -> 0.25 : (sp'=0) + 0.75 : (sp'=4); // idlelp_active |
|||
[tick2] sp=5 -> 0.995 : (sp'=5) + 0.005 : (sp'=6); // active_stby |
|||
[tick2] sp=7 -> 0.005 : (sp'=0) + 0.995 : (sp'=7); // stby_active |
|||
[tick2] sp=8 -> 0.9983 : (sp'=8) + 0.0017 : (sp'=9); // active_sleep |
|||
[tick2] sp=10 -> 0.0017 : (sp'=0) + 0.9983 : (sp'=10); // sleep_active |
|||
|
|||
// states where PM has control |
|||
// goto_active |
|||
[tick2] sp=0 & pm=0 -> (sp'=0); // active |
|||
[tick2] sp=1 & pm=0 -> (sp'=0); // idle |
|||
[tick2] sp=3 & pm=0 -> (sp'=4); // idlelp |
|||
[tick2] sp=6 & pm=0 -> (sp'=7); // stby |
|||
[tick2] sp=9 & pm=0 -> (sp'=10); // sleep |
|||
// goto_idle |
|||
[tick2] sp=0 & pm=1 -> (sp'=1); // active |
|||
[tick2] sp=1 & pm=1 -> (sp'=1); // idle |
|||
[tick2] sp=3 & pm=1 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=1 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=1 -> (sp'=9); // sleep |
|||
// goto_idlelp |
|||
[tick2] sp=0 & pm=2 -> (sp'=2); // active |
|||
[tick2] sp=1 & pm=2 -> (sp'=2); // idle |
|||
[tick2] sp=3 & pm=2 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=2 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=2 -> (sp'=9); // sleep |
|||
// goto_stby |
|||
[tick2] sp=0 & pm=3 -> (sp'=5); // active |
|||
[tick2] sp=1 & pm=3 -> (sp'=5); // idle |
|||
[tick2] sp=3 & pm=3 -> (sp'=5); // idlelp |
|||
[tick2] sp=6 & pm=3 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=3 -> (sp'=9); // sleep |
|||
// goto_sleep |
|||
[tick2] sp=0 & pm=4 -> (sp'=8); // active |
|||
[tick2] sp=1 & pm=4 -> (sp'=8); // idle |
|||
[tick2] sp=3 & pm=4 -> (sp'=8); // idlelp |
|||
[tick2] sp=6 & pm=4 -> (sp'=8); // stby |
|||
[tick2] sp=9 & pm=4 -> (sp'=9); // sleep |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SQ |
|||
module SQ |
|||
|
|||
q : [0..QMAX] init 0; |
|||
|
|||
// serve if busy |
|||
[tick2] sr=0 & sp=0 -> (q'=max(q-1,0)); |
|||
[tick2] sr=1 & sp=0 -> (q'=q); |
|||
|
|||
// otherwise do nothing |
|||
[tick2] sr=0 & sp>0 -> (q'=q); |
|||
[tick2] sr=1 & sp>0 -> (q'=min(q+1,QMAX)); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
//rewards "time" |
|||
// [tick2] bat=1 : 1; |
|||
//endrewards |
|||
|
|||
rewards "power" |
|||
[tick2] sp=0 & c=1 : 2.5; |
|||
[tick2] sp=1 & c=1 : 1.5; |
|||
[tick2] sp=2 & c=1 : 2.5; |
|||
[tick2] sp=3 & c=1 : 0.8; |
|||
[tick2] sp=4 & c=1 : 2.5; |
|||
[tick2] sp=5 & c=1 : 2.5; |
|||
[tick2] sp=6 & c=1 : 0.3; |
|||
[tick2] sp=7 & c=1 : 2.5; |
|||
[tick2] sp=8 & c=1 : 2.5; |
|||
[tick2] sp=9 & c=1 : 0.1; |
|||
[tick2] sp=10 & c=1 : 2.5; |
|||
endrewards |
|||
|
|||
// is an instantaneous property but I suppose we can look at average size |
|||
// i.e. divide by the expected number of time steps |
|||
rewards "queue" |
|||
[tick2] c=1 : q; |
|||
endrewards |
|||
|
|||
rewards "lost" |
|||
[tick2] sr=1 & sp>0 & q=2 : 1; |
|||
endrewards |
@ -0,0 +1,3 @@ |
|||
multi(R{"power"}min=? [ C<=300 ], R{"queue"}<=270 [ C<=300 ]) |
|||
// Note: The property file from http://www.prismmodelchecker.org/files/atva12mo/ does not provide a threshold for the second objective. |
|||
// We pick a threshold that intersects the pareto curve. |
@ -0,0 +1 @@ |
|||
multi(R{"power"}min=? [ C<=300 ], R{"queue"}min=? [ C<=300 ]) |
@ -0,0 +1,160 @@ |
|||
// power manager example |
|||
mdp |
|||
|
|||
const int QMAX; // max queue size |
|||
|
|||
// to model the pm making a choice and then a move being made we need |
|||
// two clock ticks for each transition |
|||
// first the pm decides tick1 and then the system moves tick2 |
|||
|
|||
module timer |
|||
|
|||
c : [0..1]; |
|||
|
|||
[tick1] c=0 -> (c'=1); |
|||
[tick2] c=1 -> (c'=0); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// POWER MANAGER |
|||
module PM |
|||
|
|||
pm : [0..4] init 4; |
|||
// 0 - go to active |
|||
// 1 - go to idle |
|||
// 2 - go to idlelp |
|||
// 3 - go to stby |
|||
// 4 - go to sleep |
|||
|
|||
[tick1] true -> (pm'=0); |
|||
[tick1] true -> (pm'=1); |
|||
[tick1] true -> (pm'=2); |
|||
[tick1] true -> (pm'=3); |
|||
[tick1] true -> (pm'=4); |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE REQUESTER |
|||
module SR |
|||
|
|||
sr : [0..1] init 0; |
|||
// 0 idle |
|||
// 1 1req |
|||
|
|||
[tick2] sr=0 -> 0.898: (sr'=0) + 0.102: (sr'=1); |
|||
[tick2] sr=1 -> 0.454: (sr'=0) + 0.546: (sr'=1); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SERVICE PROVIDER |
|||
|
|||
module SP |
|||
|
|||
sp : [0..10] init 9; |
|||
// 0 active |
|||
// 1 idle |
|||
// 2 active_idlelp |
|||
// 3 idlelp |
|||
// 4 idlelp_active |
|||
// 5 active_stby |
|||
// 6 stby |
|||
// 7 stby_active |
|||
// 8 active_sleep |
|||
// 9 sleep |
|||
// 10 sleep_active |
|||
|
|||
// states where PM has no control (transient states) |
|||
[tick2] sp=2 -> 0.75 : (sp'=2) + 0.25 : (sp'=3); // active_idlelp |
|||
[tick2] sp=4 -> 0.25 : (sp'=0) + 0.75 : (sp'=4); // idlelp_active |
|||
[tick2] sp=5 -> 0.995 : (sp'=5) + 0.005 : (sp'=6); // active_stby |
|||
[tick2] sp=7 -> 0.005 : (sp'=0) + 0.995 : (sp'=7); // stby_active |
|||
[tick2] sp=8 -> 0.9983 : (sp'=8) + 0.0017 : (sp'=9); // active_sleep |
|||
[tick2] sp=10 -> 0.0017 : (sp'=0) + 0.9983 : (sp'=10); // sleep_active |
|||
|
|||
// states where PM has control |
|||
// goto_active |
|||
[tick2] sp=0 & pm=0 -> (sp'=0); // active |
|||
[tick2] sp=1 & pm=0 -> (sp'=0); // idle |
|||
[tick2] sp=3 & pm=0 -> (sp'=4); // idlelp |
|||
[tick2] sp=6 & pm=0 -> (sp'=7); // stby |
|||
[tick2] sp=9 & pm=0 -> (sp'=10); // sleep |
|||
// goto_idle |
|||
[tick2] sp=0 & pm=1 -> (sp'=1); // active |
|||
[tick2] sp=1 & pm=1 -> (sp'=1); // idle |
|||
[tick2] sp=3 & pm=1 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=1 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=1 -> (sp'=9); // sleep |
|||
// goto_idlelp |
|||
[tick2] sp=0 & pm=2 -> (sp'=2); // active |
|||
[tick2] sp=1 & pm=2 -> (sp'=2); // idle |
|||
[tick2] sp=3 & pm=2 -> (sp'=3); // idlelp |
|||
[tick2] sp=6 & pm=2 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=2 -> (sp'=9); // sleep |
|||
// goto_stby |
|||
[tick2] sp=0 & pm=3 -> (sp'=5); // active |
|||
[tick2] sp=1 & pm=3 -> (sp'=5); // idle |
|||
[tick2] sp=3 & pm=3 -> (sp'=5); // idlelp |
|||
[tick2] sp=6 & pm=3 -> (sp'=6); // stby |
|||
[tick2] sp=9 & pm=3 -> (sp'=9); // sleep |
|||
// goto_sleep |
|||
[tick2] sp=0 & pm=4 -> (sp'=8); // active |
|||
[tick2] sp=1 & pm=4 -> (sp'=8); // idle |
|||
[tick2] sp=3 & pm=4 -> (sp'=8); // idlelp |
|||
[tick2] sp=6 & pm=4 -> (sp'=8); // stby |
|||
[tick2] sp=9 & pm=4 -> (sp'=9); // sleep |
|||
|
|||
endmodule |
|||
|
|||
|
|||
//------------------------------------------------------------------------- |
|||
|
|||
// SQ |
|||
module SQ |
|||
|
|||
q : [0..QMAX] init 0; |
|||
|
|||
// serve if busy |
|||
[tick2] sr=0 & sp=0 -> (q'=max(q-1,0)); |
|||
[tick2] sr=1 & sp=0 -> (q'=q); |
|||
|
|||
// otherwise do nothing |
|||
[tick2] sr=0 & sp>0 -> (q'=q); |
|||
[tick2] sr=1 & sp>0 -> (q'=min(q+1,QMAX)); |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------------------- |
|||
//rewards "time" |
|||
// [tick2] bat=1 : 1; |
|||
//endrewards |
|||
|
|||
rewards "power" |
|||
[tick2] sp=0 & c=1 : 2.5; |
|||
[tick2] sp=1 & c=1 : 1.5; |
|||
[tick2] sp=2 & c=1 : 2.5; |
|||
[tick2] sp=3 & c=1 : 0.8; |
|||
[tick2] sp=4 & c=1 : 2.5; |
|||
[tick2] sp=5 & c=1 : 2.5; |
|||
[tick2] sp=6 & c=1 : 0.3; |
|||
[tick2] sp=7 & c=1 : 2.5; |
|||
[tick2] sp=8 & c=1 : 2.5; |
|||
[tick2] sp=9 & c=1 : 0.1; |
|||
[tick2] sp=10 & c=1 : 2.5; |
|||
endrewards |
|||
|
|||
// is an instantaneous property but I suppose we can look at average size |
|||
// i.e. divide by the expected number of time steps |
|||
rewards "queue" |
|||
[tick2] c=1 : q; |
|||
endrewards |
|||
|
|||
rewards "lost" |
|||
[tick2] sr=1 & sp>0 & q=2 : 1; |
|||
endrewards |
@ -0,0 +1,11 @@ |
|||
// Average queue size |
|||
const double Q; |
|||
|
|||
// Time bound |
|||
const int k; |
|||
|
|||
// Minimum energy usage over k time-steps, such that average queue size remains below Q |
|||
"num_energy": multi(R{"power"}min=? [ C<=k ], R{"queue"}<=Q*k [ C<=k ]) |
|||
|
|||
// Pareto query: minimum energy usage vs minimum average queue size |
|||
"pareto": multi(R{"power"}min=? [ C<=k ], R{"queue"}min=? [ C<=k ]) |
@ -0,0 +1,8 @@ |
|||
// Minimise expected completion time given a bound on expected energy usage |
|||
"num_time": multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) |
|||
|
|||
// Minimise expected energy usage given a bound on expected completion time |
|||
"num_energy": multi( R{"energy"}min=?[ C ], R{"time"}<=1000[ C ]) |
|||
|
|||
// Pareto query for assume-guarantee check |
|||
"pareto": multi(R{"energy"}min=?[ C ], R{"time"}min=? [ C ]) |
@ -0,0 +1,95 @@ |
|||
mdp |
|||
|
|||
label "tasks_complete" = (task6=3); |
|||
|
|||
const int K; |
|||
|
|||
module scheduler |
|||
|
|||
task1 : [0..3]; |
|||
task2 : [0..3]; |
|||
task3 : [0..3]; |
|||
task4 : [0..3]; |
|||
task5 : [0..3]; |
|||
task6 : [0..3]; |
|||
|
|||
[p1_add] task1=0 -> (task1'=1); |
|||
[p2_add] task1=0 -> (task1'=2); |
|||
[p1_mult] task2=0 -> (task2'=1); |
|||
[p2_mult] task2=0 -> (task2'=2); |
|||
[p1_mult] task3=0&task1=3 -> (task3'=1); |
|||
[p2_mult] task3=0&task1=3 -> (task3'=2); |
|||
[p1_add] task4=0&task1=3&task2=3 -> (task4'=1); |
|||
[p2_add] task4=0&task1=3&task2=3 -> (task4'=2); |
|||
[p1_mult] task5=0&task3=3 -> (task5'=1); |
|||
[p2_mult] task5=0&task3=3 -> (task5'=2); |
|||
[p1_add] task6=0&task4=3&task5=3 -> (task6'=1); |
|||
[p2_add] task6=0&task4=3&task5=3 -> (task6'=2); |
|||
[p1_done] task1=1 -> (task1'=3); |
|||
[p1_done] task2=1 -> (task2'=3); |
|||
[p1_done] task3=1 -> (task3'=3); |
|||
[p1_done] task4=1 -> (task4'=3); |
|||
[p1_done] task5=1 -> (task5'=3); |
|||
[p1_done] task6=1 -> (task6'=3); |
|||
[p2_done] task1=2 -> (task1'=3); |
|||
[p2_done] task2=2 -> (task2'=3); |
|||
[p2_done] task3=2 -> (task3'=3); |
|||
[p2_done] task4=2 -> (task4'=3); |
|||
[p2_done] task5=2 -> (task5'=3); |
|||
[p2_done] task6=2 -> (task6'=3); |
|||
[time] true -> 1.0 : true; |
|||
|
|||
endmodule |
|||
|
|||
module P1 |
|||
|
|||
p1 : [0..3]; |
|||
c1 : [0..2]; |
|||
x1 : [0..4*K+1]; |
|||
|
|||
[p1_add] (p1=0) -> (p1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=1)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_mult] (p1=0) -> (p1'=2) & (x1'=0); |
|||
[] (p1=2)&(x1=2*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=2)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=2)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_done] (p1=3) -> (p1'=0); |
|||
[time] (p1=1=>x1+1<=1*K)&((p1=2&c1=0)=>x1+1<=2*K)&((p1=2&c1>0)=>x1+1<=1*K)&(p1=3=>x1+1<=0) -> 1.0 : (x1'=min(x1+1,4*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
module P2 |
|||
|
|||
p2 : [0..3]; |
|||
c2 : [0..2]; |
|||
x2 : [0..6*K+1]; |
|||
|
|||
[p2_add] (p2=0) -> (p2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=4*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=1)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_mult] (p2=0) -> (p2'=2) & (x2'=0); |
|||
[] (p2=2)&(x2=6*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=2)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=2)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_done] (p2=3) -> (p2'=0); |
|||
[time] ((p2=1&c2=0)=>x2+1<=4*K)&((p2=1&c2>0)=>x2+1<=1)&((p2=2&c2=0)=>x2+1<=6*K)&((p2=2&c2>0)=>x2+1<=1)&(p2=3=>x2+1<=0) -> 1.0 : (x2'=min(x2+1,6*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
rewards "time" |
|||
|
|||
[time] true : 1/K; |
|||
|
|||
endrewards |
|||
|
|||
rewards "energy" |
|||
|
|||
[time] p1=0 : 10/(1000*K); |
|||
[time] p1>0 : 90/(1000*K); |
|||
[time] p2=0 : 20/(1000*K); |
|||
[time] p2>0 : 30/(1000*K); |
|||
|
|||
endrewards |
@ -0,0 +1,95 @@ |
|||
mdp |
|||
|
|||
label "tasks_complete" = (task6=3); |
|||
|
|||
const int K=5; |
|||
|
|||
module scheduler |
|||
|
|||
task1 : [0..3]; |
|||
task2 : [0..3]; |
|||
task3 : [0..3]; |
|||
task4 : [0..3]; |
|||
task5 : [0..3]; |
|||
task6 : [0..3]; |
|||
|
|||
[p1_add] task1=0 -> (task1'=1); |
|||
[p2_add] task1=0 -> (task1'=2); |
|||
[p1_mult] task2=0 -> (task2'=1); |
|||
[p2_mult] task2=0 -> (task2'=2); |
|||
[p1_mult] task3=0&task1=3 -> (task3'=1); |
|||
[p2_mult] task3=0&task1=3 -> (task3'=2); |
|||
[p1_add] task4=0&task1=3&task2=3 -> (task4'=1); |
|||
[p2_add] task4=0&task1=3&task2=3 -> (task4'=2); |
|||
[p1_mult] task5=0&task3=3 -> (task5'=1); |
|||
[p2_mult] task5=0&task3=3 -> (task5'=2); |
|||
[p1_add] task6=0&task4=3&task5=3 -> (task6'=1); |
|||
[p2_add] task6=0&task4=3&task5=3 -> (task6'=2); |
|||
[p1_done] task1=1 -> (task1'=3); |
|||
[p1_done] task2=1 -> (task2'=3); |
|||
[p1_done] task3=1 -> (task3'=3); |
|||
[p1_done] task4=1 -> (task4'=3); |
|||
[p1_done] task5=1 -> (task5'=3); |
|||
[p1_done] task6=1 -> (task6'=3); |
|||
[p2_done] task1=2 -> (task1'=3); |
|||
[p2_done] task2=2 -> (task2'=3); |
|||
[p2_done] task3=2 -> (task3'=3); |
|||
[p2_done] task4=2 -> (task4'=3); |
|||
[p2_done] task5=2 -> (task5'=3); |
|||
[p2_done] task6=2 -> (task6'=3); |
|||
[time] true -> 1.0 : true; |
|||
|
|||
endmodule |
|||
|
|||
module P1 |
|||
|
|||
p1 : [0..3]; |
|||
c1 : [0..2]; |
|||
x1 : [0..4*K+1]; |
|||
|
|||
[p1_add] (p1=0) -> (p1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=1)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_mult] (p1=0) -> (p1'=2) & (x1'=0); |
|||
[] (p1=2)&(x1=2*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=2)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=2)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_done] (p1=3) -> (p1'=0); |
|||
[time] (p1=1=>x1+1<=1*K)&((p1=2&c1=0)=>x1+1<=2*K)&((p1=2&c1>0)=>x1+1<=1*K)&(p1=3=>x1+1<=0) -> 1.0 : (x1'=min(x1+1,4*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
module P2 |
|||
|
|||
p2 : [0..3]; |
|||
c2 : [0..2]; |
|||
x2 : [0..6*K+1]; |
|||
|
|||
[p2_add] (p2=0) -> (p2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=4*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=1)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_mult] (p2=0) -> (p2'=2) & (x2'=0); |
|||
[] (p2=2)&(x2=6*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=2)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=2)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_done] (p2=3) -> (p2'=0); |
|||
[time] ((p2=1&c2=0)=>x2+1<=4*K)&((p2=1&c2>0)=>x2+1<=1)&((p2=2&c2=0)=>x2+1<=6*K)&((p2=2&c2>0)=>x2+1<=1)&(p2=3=>x2+1<=0) -> 1.0 : (x2'=min(x2+1,6*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
rewards "time" |
|||
|
|||
[time] true : 1/K; |
|||
|
|||
endrewards |
|||
|
|||
rewards "energy" |
|||
|
|||
[time] p1=0 : 10/(1000*K); |
|||
[time] p1>0 : 90/(1000*K); |
|||
[time] p2=0 : 20/(1000*K); |
|||
[time] p2>0 : 30/(1000*K); |
|||
|
|||
endrewards |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}<=1.45 [ F "tasks_complete" ]) |
|||
// Original query: |
|||
//multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}min=? [ F "tasks_complete" ]) |
|||
// Original query: |
|||
//multi(R{"energy"}min=?[ C ], R{"time"}min=? [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,95 @@ |
|||
mdp |
|||
|
|||
label "tasks_complete" = (task6=3); |
|||
|
|||
const int K=25; |
|||
|
|||
module scheduler |
|||
|
|||
task1 : [0..3]; |
|||
task2 : [0..3]; |
|||
task3 : [0..3]; |
|||
task4 : [0..3]; |
|||
task5 : [0..3]; |
|||
task6 : [0..3]; |
|||
|
|||
[p1_add] task1=0 -> (task1'=1); |
|||
[p2_add] task1=0 -> (task1'=2); |
|||
[p1_mult] task2=0 -> (task2'=1); |
|||
[p2_mult] task2=0 -> (task2'=2); |
|||
[p1_mult] task3=0&task1=3 -> (task3'=1); |
|||
[p2_mult] task3=0&task1=3 -> (task3'=2); |
|||
[p1_add] task4=0&task1=3&task2=3 -> (task4'=1); |
|||
[p2_add] task4=0&task1=3&task2=3 -> (task4'=2); |
|||
[p1_mult] task5=0&task3=3 -> (task5'=1); |
|||
[p2_mult] task5=0&task3=3 -> (task5'=2); |
|||
[p1_add] task6=0&task4=3&task5=3 -> (task6'=1); |
|||
[p2_add] task6=0&task4=3&task5=3 -> (task6'=2); |
|||
[p1_done] task1=1 -> (task1'=3); |
|||
[p1_done] task2=1 -> (task2'=3); |
|||
[p1_done] task3=1 -> (task3'=3); |
|||
[p1_done] task4=1 -> (task4'=3); |
|||
[p1_done] task5=1 -> (task5'=3); |
|||
[p1_done] task6=1 -> (task6'=3); |
|||
[p2_done] task1=2 -> (task1'=3); |
|||
[p2_done] task2=2 -> (task2'=3); |
|||
[p2_done] task3=2 -> (task3'=3); |
|||
[p2_done] task4=2 -> (task4'=3); |
|||
[p2_done] task5=2 -> (task5'=3); |
|||
[p2_done] task6=2 -> (task6'=3); |
|||
[time] true -> 1.0 : true; |
|||
|
|||
endmodule |
|||
|
|||
module P1 |
|||
|
|||
p1 : [0..3]; |
|||
c1 : [0..2]; |
|||
x1 : [0..4*K+1]; |
|||
|
|||
[p1_add] (p1=0) -> (p1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=1)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_mult] (p1=0) -> (p1'=2) & (x1'=0); |
|||
[] (p1=2)&(x1=2*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=2)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=2)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_done] (p1=3) -> (p1'=0); |
|||
[time] (p1=1=>x1+1<=1*K)&((p1=2&c1=0)=>x1+1<=2*K)&((p1=2&c1>0)=>x1+1<=1*K)&(p1=3=>x1+1<=0) -> 1.0 : (x1'=min(x1+1,4*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
module P2 |
|||
|
|||
p2 : [0..3]; |
|||
c2 : [0..2]; |
|||
x2 : [0..6*K+1]; |
|||
|
|||
[p2_add] (p2=0) -> (p2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=4*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=1)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_mult] (p2=0) -> (p2'=2) & (x2'=0); |
|||
[] (p2=2)&(x2=6*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=2)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=2)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_done] (p2=3) -> (p2'=0); |
|||
[time] ((p2=1&c2=0)=>x2+1<=4*K)&((p2=1&c2>0)=>x2+1<=1)&((p2=2&c2=0)=>x2+1<=6*K)&((p2=2&c2>0)=>x2+1<=1)&(p2=3=>x2+1<=0) -> 1.0 : (x2'=min(x2+1,6*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
rewards "time" |
|||
|
|||
[time] true : 1/K; |
|||
|
|||
endrewards |
|||
|
|||
rewards "energy" |
|||
|
|||
[time] p1=0 : 10/(1000*K); |
|||
[time] p1>0 : 90/(1000*K); |
|||
[time] p2=0 : 20/(1000*K); |
|||
[time] p2>0 : 30/(1000*K); |
|||
|
|||
endrewards |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}<=1.45 [ F "tasks_complete" ]) |
|||
// Original query: |
|||
// multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}min=? [ F "tasks_complete" ]) |
|||
// Original query: |
|||
// multi(R{"energy"}min=?[ C ], R{"time"}min=? [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,95 @@ |
|||
mdp |
|||
|
|||
label "tasks_complete" = (task6=3); |
|||
|
|||
const int K=50; |
|||
|
|||
module scheduler |
|||
|
|||
task1 : [0..3]; |
|||
task2 : [0..3]; |
|||
task3 : [0..3]; |
|||
task4 : [0..3]; |
|||
task5 : [0..3]; |
|||
task6 : [0..3]; |
|||
|
|||
[p1_add] task1=0 -> (task1'=1); |
|||
[p2_add] task1=0 -> (task1'=2); |
|||
[p1_mult] task2=0 -> (task2'=1); |
|||
[p2_mult] task2=0 -> (task2'=2); |
|||
[p1_mult] task3=0&task1=3 -> (task3'=1); |
|||
[p2_mult] task3=0&task1=3 -> (task3'=2); |
|||
[p1_add] task4=0&task1=3&task2=3 -> (task4'=1); |
|||
[p2_add] task4=0&task1=3&task2=3 -> (task4'=2); |
|||
[p1_mult] task5=0&task3=3 -> (task5'=1); |
|||
[p2_mult] task5=0&task3=3 -> (task5'=2); |
|||
[p1_add] task6=0&task4=3&task5=3 -> (task6'=1); |
|||
[p2_add] task6=0&task4=3&task5=3 -> (task6'=2); |
|||
[p1_done] task1=1 -> (task1'=3); |
|||
[p1_done] task2=1 -> (task2'=3); |
|||
[p1_done] task3=1 -> (task3'=3); |
|||
[p1_done] task4=1 -> (task4'=3); |
|||
[p1_done] task5=1 -> (task5'=3); |
|||
[p1_done] task6=1 -> (task6'=3); |
|||
[p2_done] task1=2 -> (task1'=3); |
|||
[p2_done] task2=2 -> (task2'=3); |
|||
[p2_done] task3=2 -> (task3'=3); |
|||
[p2_done] task4=2 -> (task4'=3); |
|||
[p2_done] task5=2 -> (task5'=3); |
|||
[p2_done] task6=2 -> (task6'=3); |
|||
[time] true -> 1.0 : true; |
|||
|
|||
endmodule |
|||
|
|||
module P1 |
|||
|
|||
p1 : [0..3]; |
|||
c1 : [0..2]; |
|||
x1 : [0..4*K+1]; |
|||
|
|||
[p1_add] (p1=0) -> (p1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=1)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=1)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_mult] (p1=0) -> (p1'=2) & (x1'=0); |
|||
[] (p1=2)&(x1=2*K)&(c1=0) -> 1/3 : (p1'=3) & (x1'=0) & (c1'=0) + 2/3 : (c1'=1) & (x1'=0); |
|||
[] (p1=2)&(x1=1*K)&(c1=1) -> 1/2 : (p1'=3) & (x1'=0) & (c1'=0) + 1/2 : (c1'=2) & (x1'=0); |
|||
[p1_done] (p1=2)&(x1=1*K)&(c1=2) -> (p1'=0) & (x1'=0) & (c1'=0); |
|||
[p1_done] (p1=3) -> (p1'=0); |
|||
[time] (p1=1=>x1+1<=1*K)&((p1=2&c1=0)=>x1+1<=2*K)&((p1=2&c1>0)=>x1+1<=1*K)&(p1=3=>x1+1<=0) -> 1.0 : (x1'=min(x1+1,4*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
module P2 |
|||
|
|||
p2 : [0..3]; |
|||
c2 : [0..2]; |
|||
x2 : [0..6*K+1]; |
|||
|
|||
[p2_add] (p2=0) -> (p2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=4*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=1)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=1)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_mult] (p2=0) -> (p2'=2) & (x2'=0); |
|||
[] (p2=2)&(x2=6*K)&(c2=0) -> 1/3 : (p2'=3) & (x2'=0) & (c2'=0) + 2/3 : (c2'=1) & (x2'=0); |
|||
[] (p2=2)&(x2=1)&(c2=1) -> 1/2 : (p2'=3) & (x2'=0) & (c2'=0) + 1/2 : (c2'=2) & (x2'=0); |
|||
[p2_done] (p2=2)&(x2=1)&(c2=2) -> (p2'=0) & (x2'=0) & (c2'=0); |
|||
[p2_done] (p2=3) -> (p2'=0); |
|||
[time] ((p2=1&c2=0)=>x2+1<=4*K)&((p2=1&c2>0)=>x2+1<=1)&((p2=2&c2=0)=>x2+1<=6*K)&((p2=2&c2>0)=>x2+1<=1)&(p2=3=>x2+1<=0) -> 1.0 : (x2'=min(x2+1,6*K+1)); |
|||
|
|||
endmodule |
|||
|
|||
rewards "time" |
|||
|
|||
[time] true : 1/K; |
|||
|
|||
endrewards |
|||
|
|||
rewards "energy" |
|||
|
|||
[time] p1=0 : 10/(1000*K); |
|||
[time] p1>0 : 90/(1000*K); |
|||
[time] p2=0 : 20/(1000*K); |
|||
[time] p2>0 : 30/(1000*K); |
|||
|
|||
endrewards |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}<=1.45 [ F "tasks_complete" ]) |
|||
// Original query: |
|||
// multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,4 @@ |
|||
multi(R{"time"}min=?[ F "tasks_complete" ], R{"energy"}min=? [ F "tasks_complete" ]) |
|||
// Original query: |
|||
// multi(R{"energy"}min=?[ C ], R{"time"}min=? [ C ]) |
|||
// Note that the min values are actually infinity and prism (currently) gives wrong results for this, e.g., R{"time"}min=?[ C<=2000 ] gives a larger value than multi(R{"time"}min=?[ C ], R{"energy"}<=1.45 [ C ]) . |
@ -0,0 +1,25 @@ |
|||
|
|||
mdp |
|||
|
|||
module simple |
|||
|
|||
// local state |
|||
s : [0..2] init 0; |
|||
|
|||
[A] s=0 -> 0.2 : (s'=1) + 0.8 : (s'=0); |
|||
[B] s=0 -> 1 : (s'=2); |
|||
[C] s=0 -> 1 : (s'=0); |
|||
[] s>0 -> 1 : (s'=s); |
|||
endmodule |
|||
|
|||
rewards "actA" |
|||
[A] true : 1; |
|||
endrewards |
|||
|
|||
rewards "actB" |
|||
[B] true : 2; |
|||
endrewards |
|||
|
|||
|
|||
label "a" = s=1; |
|||
label "b" = s=2; |
@ -0,0 +1,2 @@ |
|||
multi(P<0.4 [ F "a"], P<0.3 [ F "b"] ) |
|||
//multi(Pmin=? [ F<=10 "a"], R<0.3 [ F "b" | "a"] ) |
@ -0,0 +1,231 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 2; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e21=e12; |
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..5]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/2 : (turn1'=1) & (turn2'=2) & (status'=1) |
|||
+ 1/2 : (turn1'=2) & (turn2'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
|
|||
|
|||
[] status=4 -> (status'=5); |
|||
|
|||
[] status=5 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))) / (e12); |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=4); |
|||
label "end" = (status=5); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3))); |
|||
|
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,287 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 3; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..6]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/6 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
|
|||
[] status=5 -> (status'=6); |
|||
|
|||
[] status=6 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))) / (e12+e13); |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=5); |
|||
label "end" = (status=6); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3))); |
|||
|
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,364 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 4; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..7]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
|
|||
[] status=6 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=7); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))) / (e12+e13+e14); |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=6); |
|||
label "end" = (status=7); |
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3))); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,531 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 5; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
const int resource5=2; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
const int e15=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
const int e25=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
const int e35=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
const int e45=1; |
|||
|
|||
const int e51=e15; |
|||
const int e52=e25; |
|||
const int e53=e35; |
|||
const int e54=e45; |
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..8]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
[str5] status=2 & turn1=5 -> (status'=2); |
|||
[fin5] status=2 & turn1=5 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
[str5] status=3 & turn2=5 -> (status'=3); |
|||
[fin5] status=3 & turn2=5 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
[str5] status=4 & turn3=5 -> (status'=4); |
|||
[fin5] status=4 & turn3=5 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
[str5] status=5 & turn4=5 -> (status'=5); |
|||
[fin5] status=5 & turn4=5 -> (status'=6); |
|||
|
|||
// 5th round |
|||
[str1] status=6 & turn5=1 -> (status'=6); |
|||
[fin1] status=6 & turn5=1 -> (status'=7); |
|||
[str2] status=6 & turn5=2 -> (status'=6); |
|||
[fin2] status=6 & turn5=2 -> (status'=7); |
|||
[str3] status=6 & turn5=3 -> (status'=6); |
|||
[fin3] status=6 & turn5=3 -> (status'=7); |
|||
[str4] status=6 & turn5=4 -> (status'=6); |
|||
[fin4] status=6 & turn5=4 -> (status'=7); |
|||
[str5] status=6 & turn5=5 -> (status'=6); |
|||
[fin5] status=6 & turn5=5 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=8); |
|||
|
|||
[] status=8 -> (status'=8); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor5 = sensor1 |
|||
[ |
|||
state1=state5, |
|||
|
|||
str1=str5, |
|||
fin1=fin5, |
|||
|
|||
m1_t1=m5_t1, |
|||
m1_t2=m5_t2, |
|||
|
|||
m5_t1=m1_t1, |
|||
m5_t2=m1_t2, |
|||
|
|||
resource1=resource5, |
|||
resource5=resource1, |
|||
|
|||
e12=e52, |
|||
e13=e53, |
|||
e14=e54, |
|||
e15=e51, |
|||
|
|||
e51=e15, |
|||
e52=e12, |
|||
e53=e13, |
|||
e54=e14 |
|||
] |
|||
endmodule |
|||
|
|||
// formulae for scheduling |
|||
formula s1_sched = (turn1=1 | turn2=1 | turn3=1 | turn4=1 | turn5=1); |
|||
formula s2_sched = (turn1=2 | turn2=2 | turn3=2 | turn4=2 | turn5=2); |
|||
formula s3_sched = (turn1=3 | turn2=3 | turn3=3 | turn4=3 | turn5=3); |
|||
formula s4_sched = (turn1=4 | turn2=4 | turn3=4 | turn4=4 | turn5=4); |
|||
formula s5_sched = (turn1=5 | turn2=5 | turn3=5 | turn4=5 | turn5=5); |
|||
formula all_not_sched = !(s1_sched | s2_sched | s3_sched | s4_sched | s5_sched); |
|||
formula all_sched = (s1_sched & s2_sched & s3_sched & s4_sched & s5_sched); |
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1+m5_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2+m5_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 + e15*m5_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 + e15*m5_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4) | (m5_t1=1 & resource1=resource5); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4) | (m5_t2=1 & resource1=resource5); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))+e15*(1-((m5_t1+m5_t2)=0?0:1))) / (e12+e13+e14+e15); |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=7); |
|||
label "end" = (status=8); |
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent5_joins_successful_team = (task1_completed & m5_t1=1) | (task2_completed & m5_t2=1); |
|||
formula agent5_joins_successful_team_of_1 = (task1_completed & m5_t1=1 & team_size_t1=1) | (task2_completed & m5_t2=1 & team_size_t2=1); |
|||
formula agent5_joins_successful_team_of_2 = (task1_completed & m5_t1=1 & team_size_t1=2) | (task2_completed & m5_t2=1 & team_size_t2=2); |
|||
formula agent5_joins_successful_team_of_3 = (task1_completed & m5_t1=1 & team_size_t1=3) | (task2_completed & m5_t2=1 & team_size_t2=3); |
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1)|(m5_t1=1&resource5=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2)|(m5_t1=1&resource5=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3)|(m5_t1=1&resource5=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1)|(m5_t2=1&resource5=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2)|(m5_t2=1&resource5=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3)|(m5_t2=1&resource5=3))); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
[] agent5_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,45 @@ |
|||
|
|||
// Max probability of completing task 1 |
|||
"single_task1": Pmax=? [ F task1_completed ] |
|||
|
|||
// Max possible expected W1 (size of successful team) |
|||
"single_w1": R{"w_1_total"}max=? [ F "end" ] |
|||
|
|||
// Max possible expected W2 (num tasks completed) |
|||
"single_w2": R{"w_2_total"}max=? [ F "end" ] |
|||
|
|||
// Values computed using above queries: |
|||
const double q1 = |
|||
n_sensors=2 ? 0.9795918367346945 : |
|||
n_sensors=3 ? 2.3265306122448983 : |
|||
n_sensors=4 ? 2.551020408163265 : |
|||
n_sensors=5 ? 2.8979591836734775 : |
|||
0.0; |
|||
|
|||
const double q2 = |
|||
n_sensors=2 ? 0.7142857142857146 : |
|||
n_sensors=3 ? 1.2448979591836744 : |
|||
n_sensors=4 ? 1.4285714285714293 : |
|||
n_sensors=5 ? 1.6734693877551006 : |
|||
0.0; |
|||
|
|||
// Numerical: maximise probability of completing task 1 |
|||
// with 95% of possible value for expected W1 (size of successful team) |
|||
"num_task1": multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=(0.95*q1) [ F true ]) |
|||
|
|||
// Numerical (3-objective): maximise probability of completing task 1 |
|||
// with 95% of possible value for expected W1 (size of successful team) |
|||
// and also at least 0.5 probability of completing task 2 |
|||
"num_task1_3": multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=(0.95*q1) [ F true ], P>=0.5 [ F task2_completed ]) |
|||
|
|||
// Other numerical queries: |
|||
|
|||
multi(R{"w_1_total"}max=? [ F true ], R{"w_2_total"}>=(0.95*q2) [ F true ]) |
|||
|
|||
multi(R{"w_2_total"}max=? [ F true ], R{"w_1_total"}>=(0.95*q1) [ F true ]) |
|||
|
|||
// Pareto: maximise probability of completing task 1 and expected W1 (size of successful team) |
|||
"pareto": multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ F true ]) |
|||
|
|||
// Pareto (3-objective): maximise probability of completing tasks 1/2 and expected W1 (size of successful team) |
|||
"pareto3": multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ F true ], Pmax=? [ F task2_completed ]) |
@ -0,0 +1,286 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 3; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))) / (e12+e13); |
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..6]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/6 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
|
|||
[] status=5 -> (status'=6); |
|||
|
|||
[] status=6 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=5); |
|||
label "end" = (status=6); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3))); |
|||
|
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.210204082 [ C ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ]) |
@ -0,0 +1,368 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 4; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
|
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))) / (e12+e13+e14); |
|||
|
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..7]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
|
|||
[] status=6 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=7); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=6); |
|||
label "end" = (status=7); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3))); |
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.423469388 [ C ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ]) |
@ -0,0 +1,532 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 5; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
const int resource5=2; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
const int e15=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
const int e25=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
const int e35=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
const int e45=1; |
|||
|
|||
const int e51=e15; |
|||
const int e52=e25; |
|||
const int e53=e35; |
|||
const int e54=e45; |
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1+m5_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2+m5_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 + e15*m5_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 + e15*m5_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4) | (m5_t1=1 & resource1=resource5); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4) | (m5_t2=1 & resource1=resource5); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))+e15*(1-((m5_t1+m5_t2)=0?0:1))) / (e12+e13+e14+e15); |
|||
|
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..8]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
[str5] status=2 & turn1=5 -> (status'=2); |
|||
[fin5] status=2 & turn1=5 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
[str5] status=3 & turn2=5 -> (status'=3); |
|||
[fin5] status=3 & turn2=5 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
[str5] status=4 & turn3=5 -> (status'=4); |
|||
[fin5] status=4 & turn3=5 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
[str5] status=5 & turn4=5 -> (status'=5); |
|||
[fin5] status=5 & turn4=5 -> (status'=6); |
|||
|
|||
// 5th round |
|||
[str1] status=6 & turn5=1 -> (status'=6); |
|||
[fin1] status=6 & turn5=1 -> (status'=7); |
|||
[str2] status=6 & turn5=2 -> (status'=6); |
|||
[fin2] status=6 & turn5=2 -> (status'=7); |
|||
[str3] status=6 & turn5=3 -> (status'=6); |
|||
[fin3] status=6 & turn5=3 -> (status'=7); |
|||
[str4] status=6 & turn5=4 -> (status'=6); |
|||
[fin4] status=6 & turn5=4 -> (status'=7); |
|||
[str5] status=6 & turn5=5 -> (status'=6); |
|||
[fin5] status=6 & turn5=5 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=8); |
|||
|
|||
[] status=8 -> (status'=8); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor5 = sensor1 |
|||
[ |
|||
state1=state5, |
|||
|
|||
str1=str5, |
|||
fin1=fin5, |
|||
|
|||
m1_t1=m5_t1, |
|||
m1_t2=m5_t2, |
|||
|
|||
m5_t1=m1_t1, |
|||
m5_t2=m1_t2, |
|||
|
|||
resource1=resource5, |
|||
resource5=resource1, |
|||
|
|||
e12=e52, |
|||
e13=e53, |
|||
e14=e54, |
|||
e15=e51, |
|||
|
|||
e51=e15, |
|||
e52=e12, |
|||
e53=e13, |
|||
e54=e14 |
|||
] |
|||
endmodule |
|||
|
|||
// formulae for scheduling |
|||
formula s1_sched = (turn1=1 | turn2=1 | turn3=1 | turn4=1 | turn5=1); |
|||
formula s2_sched = (turn1=2 | turn2=2 | turn3=2 | turn4=2 | turn5=2); |
|||
formula s3_sched = (turn1=3 | turn2=3 | turn3=3 | turn4=3 | turn5=3); |
|||
formula s4_sched = (turn1=4 | turn2=4 | turn3=4 | turn4=4 | turn5=4); |
|||
formula s5_sched = (turn1=5 | turn2=5 | turn3=5 | turn4=5 | turn5=5); |
|||
formula all_not_sched = !(s1_sched | s2_sched | s3_sched | s4_sched | s5_sched); |
|||
formula all_sched = (s1_sched & s2_sched & s3_sched & s4_sched & s5_sched); |
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=7); |
|||
label "end" = (status=8); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1)|(m5_t1=1&resource5=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2)|(m5_t1=1&resource5=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3)|(m5_t1=1&resource5=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1)|(m5_t2=1&resource5=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2)|(m5_t2=1&resource5=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3)|(m5_t2=1&resource5=3))); |
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent5_joins_successful_team = (task1_completed & m5_t1=1) | (task2_completed & m5_t2=1); |
|||
formula agent5_joins_successful_team_of_1 = (task1_completed & m5_t1=1 & team_size_t1=1) | (task2_completed & m5_t2=1 & team_size_t2=1); |
|||
formula agent5_joins_successful_team_of_2 = (task1_completed & m5_t1=1 & team_size_t1=2) | (task2_completed & m5_t2=1 & team_size_t2=2); |
|||
formula agent5_joins_successful_team_of_3 = (task1_completed & m5_t1=1 & team_size_t1=3) | (task2_completed & m5_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
[] agent5_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.753061224 [ C ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ]) |
@ -0,0 +1,288 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 3; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
|
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))) / (e12+e13); |
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..6]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/6 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (status'=1) |
|||
+ 1/6 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (status'=1) |
|||
+ 1/6 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
|
|||
[] status=5 -> (status'=6); |
|||
|
|||
[] status=6 -> true; |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=5); |
|||
label "end" = (status=6); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3))); |
|||
|
|||
|
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.210204082 [ C ], P>=0.5 [ F task2_completed ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ], Pmax=? [ F task2_completed ]) |
@ -0,0 +1,366 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 4; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
|
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))) / (e12+e13+e14); |
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..7]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (status'=1) |
|||
+ 1/24 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
|
|||
[] status=6 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=7); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=6); |
|||
label "end" = (status=7); |
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3))); |
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.423469388 [ C ], P>=0.5 [ F task2_completed ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ], Pmax=? [ F task2_completed ]) |
@ -0,0 +1,532 @@ |
|||
mdp |
|||
|
|||
// parameters |
|||
const int n_resources = 3; |
|||
const int n_tasks = 2; |
|||
const int n_sensors = 5; |
|||
|
|||
|
|||
// sensor resources |
|||
const int resource1=1; |
|||
const int resource2=2; |
|||
const int resource3=3; |
|||
const int resource4=1; |
|||
const int resource5=2; |
|||
|
|||
// network configuration |
|||
const int e12=1; |
|||
const int e13=1; |
|||
const int e14=1; |
|||
const int e15=1; |
|||
|
|||
const int e21=e12; |
|||
const int e23=1; |
|||
const int e24=1; |
|||
const int e25=1; |
|||
|
|||
const int e31=e13; |
|||
const int e32=e23; |
|||
const int e34=1; |
|||
const int e35=1; |
|||
|
|||
const int e41=e14; |
|||
const int e42=e24; |
|||
const int e43=e34; |
|||
const int e45=1; |
|||
|
|||
const int e51=e15; |
|||
const int e52=e25; |
|||
const int e53=e35; |
|||
const int e54=e45; |
|||
|
|||
|
|||
// agent is committed to some team |
|||
formula committed = (m1_t1+m1_t2) > 0; |
|||
|
|||
// formulae to compute team sizes |
|||
formula team_size_t1 = m1_t1+m2_t1+m3_t1+m4_t1+m5_t1; |
|||
formula team_size_t2 = m1_t2+m2_t2+m3_t2+m4_t2+m5_t2; |
|||
|
|||
// formulae to check whether the agent can join the team |
|||
formula can_join_t1 = e12*m2_t1 + e13*m3_t1 + e14*m4_t1 + e15*m5_t1 > 0; |
|||
formula can_join_t2 = e12*m2_t2 + e13*m3_t2 + e14*m4_t2 + e15*m5_t2 > 0; |
|||
|
|||
// formulae to check whether agent has the resource required by the task |
|||
formula has_resource_t1 = ( (t1_r1=1&resource1=1) | (t1_r2=1&resource1=2) | (t1_r3=1&resource1=3) ); |
|||
formula has_resource_t2 = ( (t2_r1=1&resource1=1) | (t2_r2=1&resource1=2) | (t2_r3=1&resource1=3) ); |
|||
|
|||
// formulae to check whether the resource of an agent has been already filled in the team |
|||
formula resource_filled_t1 = (m2_t1=1 & resource1=resource2) | (m3_t1=1 & resource1=resource3) | (m4_t1=1 & resource1=resource4) | (m5_t1=1 & resource1=resource5); |
|||
formula resource_filled_t2 = (m2_t2=1 & resource1=resource2) | (m3_t2=1 & resource1=resource3) | (m4_t2=1 & resource1=resource4) | (m5_t2=1 & resource1=resource5); |
|||
|
|||
// formula to compute team initiation probability (assuming each agent has at least one connection) |
|||
formula IP = (e12*(1-((m2_t1+m2_t2)=0?0:1))+e13*(1-((m3_t1+m3_t2)=0?0:1))+e14*(1-((m4_t1+m4_t2)=0?0:1))+e15*(1-((m5_t1+m5_t2)=0?0:1))) / (e12+e13+e14+e15); |
|||
|
|||
|
|||
module controller // schedules the algorithm |
|||
|
|||
// algorithm status |
|||
status : [0..8]; |
|||
|
|||
// task resource indicator variables |
|||
t1_r1 : [0..1]; |
|||
t1_r2 : [0..1]; |
|||
t1_r3 : [0..1]; |
|||
|
|||
t2_r1 : [0..1]; |
|||
t2_r2 : [0..1]; |
|||
t2_r3 : [0..1]; |
|||
|
|||
// schedule placeholders |
|||
turn1 : [0..n_sensors]; |
|||
turn2 : [0..n_sensors]; |
|||
turn3 : [0..n_sensors]; |
|||
turn4 : [0..n_sensors]; |
|||
turn5 : [0..n_sensors]; |
|||
|
|||
// selecting schedule uniformly at random |
|||
[] status=0 -> 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=1) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=3) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=4) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=2) & (turn2'=5) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=4) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=1) & (turn3'=5) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=4) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=2) & (turn3'=5) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=4) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=3) & (turn2'=5) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=2) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=3) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=1) & (turn3'=5) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=1) & (turn4'=5) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=3) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=2) & (turn3'=5) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=1) & (turn4'=5) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=5) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=2) & (turn4'=5) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=3) & (turn3'=5) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=4) & (turn2'=5) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=2) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=3) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=1) & (turn3'=4) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=3) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=1) & (turn4'=4) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=3) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=2) & (turn3'=4) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=2) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=1) & (turn4'=4) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=1) & (turn5'=4) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=2) & (turn4'=4) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=3) & (turn3'=4) & (turn4'=2) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=2) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=1) & (turn4'=3) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=1) & (turn5'=3) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=2) & (turn4'=3) & (turn5'=1) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=1) & (turn5'=2) & (status'=1) |
|||
+ 1/120 : (turn1'=5) & (turn2'=4) & (turn3'=3) & (turn4'=2) & (turn5'=1) & (status'=1); |
|||
|
|||
|
|||
// initialising non-empty tasks uniformly at random |
|||
[] status=1 -> 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=0) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=0) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=0) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=0) & (t2_r2'=1) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=0) & (t2_r3'=1) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=0) & (status'=2) |
|||
+ 1/49 : (t1_r1'=1) & (t1_r2'=1) & (t1_r3'=1) & (t2_r1'=1) & (t2_r2'=1) & (t2_r3'=1) & (status'=2); |
|||
|
|||
// executing the schedule |
|||
|
|||
// 1st round |
|||
[str1] status=2 & turn1=1 -> (status'=2); |
|||
[fin1] status=2 & turn1=1 -> (status'=3); |
|||
[str2] status=2 & turn1=2 -> (status'=2); |
|||
[fin2] status=2 & turn1=2 -> (status'=3); |
|||
[str3] status=2 & turn1=3 -> (status'=2); |
|||
[fin3] status=2 & turn1=3 -> (status'=3); |
|||
[str4] status=2 & turn1=4 -> (status'=2); |
|||
[fin4] status=2 & turn1=4 -> (status'=3); |
|||
[str5] status=2 & turn1=5 -> (status'=2); |
|||
[fin5] status=2 & turn1=5 -> (status'=3); |
|||
|
|||
// 2nd round |
|||
[str1] status=3 & turn2=1 -> (status'=3); |
|||
[fin1] status=3 & turn2=1 -> (status'=4); |
|||
[str2] status=3 & turn2=2 -> (status'=3); |
|||
[fin2] status=3 & turn2=2 -> (status'=4); |
|||
[str3] status=3 & turn2=3 -> (status'=3); |
|||
[fin3] status=3 & turn2=3 -> (status'=4); |
|||
[str4] status=3 & turn2=4 -> (status'=3); |
|||
[fin4] status=3 & turn2=4 -> (status'=4); |
|||
[str5] status=3 & turn2=5 -> (status'=3); |
|||
[fin5] status=3 & turn2=5 -> (status'=4); |
|||
|
|||
// 3rd round |
|||
[str1] status=4 & turn3=1 -> (status'=4); |
|||
[fin1] status=4 & turn3=1 -> (status'=5); |
|||
[str2] status=4 & turn3=2 -> (status'=4); |
|||
[fin2] status=4 & turn3=2 -> (status'=5); |
|||
[str3] status=4 & turn3=3 -> (status'=4); |
|||
[fin3] status=4 & turn3=3 -> (status'=5); |
|||
[str4] status=4 & turn3=4 -> (status'=4); |
|||
[fin4] status=4 & turn3=4 -> (status'=5); |
|||
[str5] status=4 & turn3=5 -> (status'=4); |
|||
[fin5] status=4 & turn3=5 -> (status'=5); |
|||
|
|||
// 4th round |
|||
[str1] status=5 & turn4=1 -> (status'=5); |
|||
[fin1] status=5 & turn4=1 -> (status'=6); |
|||
[str2] status=5 & turn4=2 -> (status'=5); |
|||
[fin2] status=5 & turn4=2 -> (status'=6); |
|||
[str3] status=5 & turn4=3 -> (status'=5); |
|||
[fin3] status=5 & turn4=3 -> (status'=6); |
|||
[str4] status=5 & turn4=4 -> (status'=5); |
|||
[fin4] status=5 & turn4=4 -> (status'=6); |
|||
[str5] status=5 & turn4=5 -> (status'=5); |
|||
[fin5] status=5 & turn4=5 -> (status'=6); |
|||
|
|||
// 5th round |
|||
[str1] status=6 & turn5=1 -> (status'=6); |
|||
[fin1] status=6 & turn5=1 -> (status'=7); |
|||
[str2] status=6 & turn5=2 -> (status'=6); |
|||
[fin2] status=6 & turn5=2 -> (status'=7); |
|||
[str3] status=6 & turn5=3 -> (status'=6); |
|||
[fin3] status=6 & turn5=3 -> (status'=7); |
|||
[str4] status=6 & turn5=4 -> (status'=6); |
|||
[fin4] status=6 & turn5=4 -> (status'=7); |
|||
[str5] status=6 & turn5=5 -> (status'=6); |
|||
[fin5] status=6 & turn5=5 -> (status'=7); |
|||
|
|||
[] status=7 -> (status'=8); |
|||
|
|||
[] status=8 -> (status'=8); |
|||
|
|||
endmodule |
|||
|
|||
module sensor1 |
|||
|
|||
state1 : [0..1]; |
|||
|
|||
// team membership indicators |
|||
m1_t1 : [0..1]; |
|||
m1_t2 : [0..1]; |
|||
|
|||
// starting turn, selecting order of tasks |
|||
[str1] state1=0 -> (state1'=1); |
|||
|
|||
// if there is no team and has required skill - initiating the team |
|||
[] state1=1 & !committed & team_size_t1=0 & has_resource_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2=0 & has_resource_t2 -> (m1_t2'=1); |
|||
|
|||
// if team already exists and one of the neighbours is in it - joining the team |
|||
[] state1=1 & !committed & team_size_t1>0 & can_join_t1 & has_resource_t1 & !resource_filled_t1 -> (m1_t1'=1); |
|||
[] state1=1 & !committed & team_size_t2>0 & can_join_t2 & has_resource_t2 & !resource_filled_t2 -> (m1_t2'=1); |
|||
|
|||
[fin1] state1>0 -> (state1'=0); |
|||
|
|||
endmodule |
|||
|
|||
module sensor2 = sensor1 |
|||
[ |
|||
state1=state2, |
|||
|
|||
str1=str2, |
|||
fin1=fin2, |
|||
|
|||
m1_t1=m2_t1, |
|||
m1_t2=m2_t2, |
|||
|
|||
m2_t1=m1_t1, |
|||
m2_t2=m1_t2, |
|||
|
|||
resource1=resource2, |
|||
resource2=resource1, |
|||
|
|||
e12=e21, |
|||
e13=e23, |
|||
e14=e24, |
|||
e15=e25, |
|||
|
|||
e21=e12, |
|||
e23=e13, |
|||
e24=e14, |
|||
e25=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor3 = sensor1 |
|||
[ |
|||
state1=state3, |
|||
|
|||
str1=str3, |
|||
fin1=fin3, |
|||
|
|||
m1_t1=m3_t1, |
|||
m1_t2=m3_t2, |
|||
m3_t1=m1_t1, |
|||
m3_t2=m1_t2, |
|||
|
|||
resource1=resource3, |
|||
resource3=resource1, |
|||
|
|||
e12=e32, |
|||
e13=e31, |
|||
e14=e34, |
|||
e15=e35, |
|||
|
|||
e31=e13, |
|||
e32=e12, |
|||
e34=e14, |
|||
e35=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor4 = sensor1 |
|||
[ |
|||
state1=state4, |
|||
|
|||
str1=str4, |
|||
fin1=fin4, |
|||
|
|||
m1_t1=m4_t1, |
|||
m1_t2=m4_t2, |
|||
|
|||
m4_t1=m1_t1, |
|||
m4_t2=m1_t2, |
|||
|
|||
resource1=resource4, |
|||
resource4=resource1, |
|||
|
|||
e12=e42, |
|||
e13=e43, |
|||
e14=e41, |
|||
e15=e45, |
|||
|
|||
e41=e14, |
|||
e42=e12, |
|||
e43=e13, |
|||
e45=e15 |
|||
] |
|||
endmodule |
|||
|
|||
module sensor5 = sensor1 |
|||
[ |
|||
state1=state5, |
|||
|
|||
str1=str5, |
|||
fin1=fin5, |
|||
|
|||
m1_t1=m5_t1, |
|||
m1_t2=m5_t2, |
|||
|
|||
m5_t1=m1_t1, |
|||
m5_t2=m1_t2, |
|||
|
|||
resource1=resource5, |
|||
resource5=resource1, |
|||
|
|||
e12=e52, |
|||
e13=e53, |
|||
e14=e54, |
|||
e15=e51, |
|||
|
|||
e51=e15, |
|||
e52=e12, |
|||
e53=e13, |
|||
e54=e14 |
|||
] |
|||
endmodule |
|||
|
|||
// formulae for scheduling |
|||
formula s1_sched = (turn1=1 | turn2=1 | turn3=1 | turn4=1 | turn5=1); |
|||
formula s2_sched = (turn1=2 | turn2=2 | turn3=2 | turn4=2 | turn5=2); |
|||
formula s3_sched = (turn1=3 | turn2=3 | turn3=3 | turn4=3 | turn5=3); |
|||
formula s4_sched = (turn1=4 | turn2=4 | turn3=4 | turn4=4 | turn5=4); |
|||
formula s5_sched = (turn1=5 | turn2=5 | turn3=5 | turn4=5 | turn5=5); |
|||
formula all_not_sched = !(s1_sched | s2_sched | s3_sched | s4_sched | s5_sched); |
|||
formula all_sched = (s1_sched & s2_sched & s3_sched & s4_sched & s5_sched); |
|||
|
|||
|
|||
|
|||
|
|||
// labels and formulae for property specification |
|||
formula finished = (status=7); |
|||
label "end" = (status=8); |
|||
|
|||
|
|||
formula task1_completed = finished |
|||
& ((t1_r1=1)=>((m1_t1=1&resource1=1)|(m2_t1=1&resource2=1)|(m3_t1=1&resource3=1)|(m4_t1=1&resource4=1)|(m5_t1=1&resource5=1))) |
|||
& ((t1_r2=1)=>((m1_t1=1&resource1=2)|(m2_t1=1&resource2=2)|(m3_t1=1&resource3=2)|(m4_t1=1&resource4=2)|(m5_t1=1&resource5=2))) |
|||
& ((t1_r3=1)=>((m1_t1=1&resource1=3)|(m2_t1=1&resource2=3)|(m3_t1=1&resource3=3)|(m4_t1=1&resource4=3)|(m5_t1=1&resource5=3))); |
|||
|
|||
formula task2_completed = finished |
|||
& ((t2_r1=1)=>((m1_t2=1&resource1=1)|(m2_t2=1&resource2=1)|(m3_t2=1&resource3=1)|(m4_t2=1&resource4=1)|(m5_t2=1&resource5=1))) |
|||
& ((t2_r2=1)=>((m1_t2=1&resource1=2)|(m2_t2=1&resource2=2)|(m3_t2=1&resource3=2)|(m4_t2=1&resource4=2)|(m5_t2=1&resource5=2))) |
|||
& ((t2_r3=1)=>((m1_t2=1&resource1=3)|(m2_t2=1&resource2=3)|(m3_t2=1&resource3=3)|(m4_t2=1&resource4=3)|(m5_t2=1&resource5=3))); |
|||
|
|||
formula agent1_joins_successful_team = (task1_completed & m1_t1=1) | (task2_completed & m1_t2=1); |
|||
formula agent1_joins_successful_team_of_1 = (task1_completed & m1_t1=1 & team_size_t1=1) | (task2_completed & m1_t2=1 & team_size_t2=1); |
|||
formula agent1_joins_successful_team_of_2 = (task1_completed & m1_t1=1 & team_size_t1=2) | (task2_completed & m1_t2=1 & team_size_t2=2); |
|||
formula agent1_joins_successful_team_of_3 = (task1_completed & m1_t1=1 & team_size_t1=3) | (task2_completed & m1_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent2_joins_successful_team = (task1_completed & m2_t1=1) | (task2_completed & m2_t2=1); |
|||
formula agent2_joins_successful_team_of_1 = (task1_completed & m2_t1=1 & team_size_t1=1) | (task2_completed & m2_t2=1 & team_size_t2=1); |
|||
formula agent2_joins_successful_team_of_2 = (task1_completed & m2_t1=1 & team_size_t1=2) | (task2_completed & m2_t2=1 & team_size_t2=2); |
|||
formula agent2_joins_successful_team_of_3 = (task1_completed & m2_t1=1 & team_size_t1=3) | (task2_completed & m2_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent3_joins_successful_team = (task1_completed & m3_t1=1) | (task2_completed & m3_t2=1); |
|||
formula agent3_joins_successful_team_of_1 = (task1_completed & m3_t1=1 & team_size_t1=1) | (task2_completed & m3_t2=1 & team_size_t2=1); |
|||
formula agent3_joins_successful_team_of_2 = (task1_completed & m3_t1=1 & team_size_t1=2) | (task2_completed & m3_t2=1 & team_size_t2=2); |
|||
formula agent3_joins_successful_team_of_3 = (task1_completed & m3_t1=1 & team_size_t1=3) | (task2_completed & m3_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent4_joins_successful_team = (task1_completed & m4_t1=1) | (task2_completed & m4_t2=1); |
|||
formula agent4_joins_successful_team_of_1 = (task1_completed & m4_t1=1 & team_size_t1=1) | (task2_completed & m4_t2=1 & team_size_t2=1); |
|||
formula agent4_joins_successful_team_of_2 = (task1_completed & m4_t1=1 & team_size_t1=2) | (task2_completed & m4_t2=1 & team_size_t2=2); |
|||
formula agent4_joins_successful_team_of_3 = (task1_completed & m4_t1=1 & team_size_t1=3) | (task2_completed & m4_t2=1 & team_size_t2=3); |
|||
|
|||
formula agent5_joins_successful_team = (task1_completed & m5_t1=1) | (task2_completed & m5_t2=1); |
|||
formula agent5_joins_successful_team_of_1 = (task1_completed & m5_t1=1 & team_size_t1=1) | (task2_completed & m5_t2=1 & team_size_t2=1); |
|||
formula agent5_joins_successful_team_of_2 = (task1_completed & m5_t1=1 & team_size_t1=2) | (task2_completed & m5_t2=1 & team_size_t2=2); |
|||
formula agent5_joins_successful_team_of_3 = (task1_completed & m5_t1=1 & team_size_t1=3) | (task2_completed & m5_t2=1 & team_size_t2=3); |
|||
|
|||
// rewards |
|||
rewards "w_1_total" |
|||
[] agent1_joins_successful_team : 1; |
|||
[] agent2_joins_successful_team : 1; |
|||
[] agent3_joins_successful_team : 1; |
|||
[] agent4_joins_successful_team : 1; |
|||
[] agent5_joins_successful_team : 1; |
|||
endrewards |
|||
|
|||
rewards "w_2_total" |
|||
[] task1_completed : 1; |
|||
[] task2_completed : 1; |
|||
endrewards |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}>=2.753061224 [ C ], P>=0.5 [ F task2_completed ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F task1_completed ], R{"w_1_total"}max=? [ C ], Pmax=? [ F task2_completed ]) |
@ -0,0 +1,169 @@ |
|||
// IPv4: PTA model with digitial clocks |
|||
// multi-objective model of the host |
|||
// gxn/dxp 28/09/09 |
|||
|
|||
mdp |
|||
|
|||
//------------------------------------------------------------- |
|||
// VARIABLES |
|||
const int N=20; // number of abstract hosts |
|||
const int K=2; // number of probes to send |
|||
|
|||
// PROBABILITIES |
|||
const double old = N/65024; // probability pick an ip address being used |
|||
//const double old = 1/2; // probability pick an ip address being used |
|||
const double new = (1-old); // probability pick a new ip address |
|||
|
|||
// TIMING CONSTANTS |
|||
const int CONSEC = 2; // time interval between sending consecutive probles |
|||
const int TRANSTIME = 1; // upper bound on transmission time delay |
|||
const int LONGWAIT = 60; // minimum time delay after a high number of address collisions |
|||
const int DEFEND = 10; |
|||
|
|||
const int TIME_MAX_X = 60; // max value of clock x |
|||
const int TIME_MAX_Y = 10; // max value of clock y |
|||
const int TIME_MAX_Z = 1; // max value of clock z |
|||
|
|||
// OTHER CONSTANTS |
|||
const int MAXCOLL = 10; // maximum number of collisions before long wait |
|||
|
|||
|
|||
//------------------------------------------------------------- |
|||
// CONCRETE HOST |
|||
module host0 |
|||
|
|||
x : [0..TIME_MAX_X]; // first clock of the host |
|||
y : [0..TIME_MAX_Y]; // second clock of the host |
|||
|
|||
coll : [0..MAXCOLL]; // number of address collisions |
|||
probes : [0..K]; // counter (number of probes sent) |
|||
mess : [0..1]; // need to send a message or not |
|||
defend : [0..1]; // defend (if =1, try to defend IP address) |
|||
|
|||
ip : [1..2]; // ip address (1 - in use & 2 - fresh) |
|||
|
|||
l : [0..4] init 1; // location |
|||
// 0 : RECONFIGURE |
|||
// 1 : RANDOM |
|||
// 2 : WAITSP |
|||
// 3 : WAITSG |
|||
// 4 : USE |
|||
|
|||
// RECONFIGURE |
|||
[reset] l=0 -> (l'=1); |
|||
|
|||
// RANDOM (choose IP address) |
|||
[rec0] (l=1) -> true; // get message (ignore since have no ip address) |
|||
[rec1] (l=1) -> true; // get message (ignore since have no ip address) |
|||
// small number of collisions (choose straight away) |
|||
[] l=1 & coll<MAXCOLL -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
// large number of collisions: (wait for LONGWAIT) |
|||
[time] l=1 & coll=MAXCOLL & x<LONGWAIT -> (x'=min(x+1,TIME_MAX_X)); |
|||
[] l=1 & coll=MAXCOLL & x=LONGWAIT -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
|
|||
// WAITSP |
|||
// let time pass |
|||
[time] l=2 & x<2 -> (x'=min(x+1,2)); |
|||
// send probe |
|||
[send1] l=2 & ip=1 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=2 & ip=2 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
// sent K probes and waited 2 seconds |
|||
[configured] l=2 & x=2 & probes=K -> (l'=3) & (probes'=0) & (coll'=0) & (x'=0); |
|||
// get message and ip does not match: ignore |
|||
[rec0] l=2 & ip!=0 -> (l'=l); |
|||
[rec1] l=2 & ip!=1 -> (l'=l); |
|||
// get a message with matching ip: reconfigure |
|||
[rec1] l=2 & ip=1 -> (l'=0) & (coll'=min(coll+1,MAXCOLL)) & (x'=0) & (probes'=0); |
|||
|
|||
// WAITSG (sends two gratuitious arp probes) |
|||
// time passage |
|||
[time] l=3 & mess=0 & defend=0 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)); |
|||
[time] l=3 & mess=0 & defend=1 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)) & (y'=min(y+1,DEFEND)); |
|||
|
|||
// receive message and same ip: defend |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y>=DEFEND) -> (defend'=1) & (mess'=1) & (y'=0); |
|||
// receive message and same ip: defer |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y<DEFEND) -> (l'=0) & (probes'=0) & (defend'=0) & (x'=0) & (y'=0); |
|||
// receive message and different ip |
|||
[rec0] l=3 & mess=0 & ip!=0 -> (l'=l); |
|||
[rec1] l=3 & mess=0 & ip!=1 -> (l'=l); |
|||
|
|||
|
|||
// send probe reply or message for defence |
|||
[send1] l=3 & ip=1 & mess=1 -> (mess'=0); |
|||
[send2] l=3 & ip=2 & mess=1 -> (mess'=0); |
|||
// send first gratuitous arp message |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
// send second gratuitous arp message (move to use) |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
|
|||
// USE (only interested in reaching this state so do not need to add anything here) |
|||
[] l=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the environment assumption |
|||
// do not get a reply when K probes are sent |
|||
const int M; // time between sending and receiving a message |
|||
|
|||
module env_error2 |
|||
|
|||
env : [0..1]; // 0 active and 1 done |
|||
k : [0..2]; // counts the number of messages sent |
|||
c1 : [0..M+1]; // time since first message |
|||
c2 : [0..M+1]; // time since second message |
|||
error : [0..1]; |
|||
|
|||
// message with new ip address arrives so done |
|||
[send2] error=0 & env=0 -> (env'=1); |
|||
// message with old ip address arrives so count |
|||
[send1] error=0 & env=0 -> (k'=min(k+1,K)); |
|||
// time passgae so update relevant clocks |
|||
[time] error=0 & env=0 & k=0 -> true; |
|||
[time] error=0 & env=0 & k=1 & min(c1,c2)<M -> (c1'=min(c1+1,M+1)); |
|||
[time] error=0 & env=0 & k=2 & min(c1,c2)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)); |
|||
// all clocks reached their bound so an error |
|||
[time] error=0 & env=0 & min(c1,c2)=M -> (error'=1); |
|||
// send a reply (then done) |
|||
[rec1] error=0 & env=0 & k>0 & min(c1,c2)<=M -> (env'=1); |
|||
// finished so any action can be performed |
|||
[time] error=1 | env=1 -> true; |
|||
[send1] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[rec1] error=1 | env=1 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the time bounded assumption |
|||
// host does not send configured signal within T seconds |
|||
const int T; |
|||
|
|||
module time_error |
|||
|
|||
time_error : [0..1]; |
|||
done : [0..1]; |
|||
t : [0..T]; |
|||
|
|||
[time] t<T-1 & done=0 & time_error=0 -> (t'=t+1); // time passes and bound not reached |
|||
[time] t=T-1 & done=0 & time_error=0 -> (time_error'=1); // bound reached so error |
|||
[configured] time_error=0 -> (done'=1); // configured within the time bound |
|||
|
|||
// when in error or done state can loop with either action |
|||
[configured] time_error=1 | done=1 -> true; |
|||
[time] time_error=1 | done=1 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1,174 @@ |
|||
// IPv4: PTA model with digitial clocks |
|||
// multi-objective model of the host |
|||
// gxn/dxp 28/09/09 |
|||
|
|||
mdp |
|||
|
|||
//------------------------------------------------------------- |
|||
// VARIABLES |
|||
const int N=20; // number of abstract hosts |
|||
const int K=4; // number of probes to send |
|||
|
|||
// PROBABILITIES |
|||
const double old = N/65024; // probability pick an ip address being used |
|||
//const double old = 0.5; // probability pick an ip address being used |
|||
const double new = (1-old); // probability pick a new ip address |
|||
|
|||
// TIMING CONSTANTS |
|||
const int CONSEC = 2; // time interval between sending consecutive probles |
|||
const int TRANSTIME = 1; // upper bound on transmission time delay |
|||
const int LONGWAIT = 60; // minimum time delay after a high number of address collisions |
|||
const int DEFEND = 10; |
|||
|
|||
const int TIME_MAX_X = 60; // max value of clock x |
|||
const int TIME_MAX_Y = 10; // max value of clock y |
|||
const int TIME_MAX_Z = 1; // max value of clock z |
|||
|
|||
// OTHER CONSTANTS |
|||
const int MAXCOLL = 10; // maximum number of collisions before long wait |
|||
|
|||
|
|||
//------------------------------------------------------------- |
|||
// CONCRETE HOST |
|||
module host0 |
|||
|
|||
x : [0..TIME_MAX_X]; // first clock of the host |
|||
y : [0..TIME_MAX_Y]; // second clock of the host |
|||
|
|||
coll : [0..MAXCOLL]; // number of address collisions |
|||
probes : [0..K]; // counter (number of probes sent) |
|||
mess : [0..1]; // need to send a message or not |
|||
defend : [0..1]; // defend (if =1, try to defend IP address) |
|||
|
|||
ip : [1..2]; // ip address (1 - in use & 2 - fresh) |
|||
|
|||
l : [0..4] init 1; // location |
|||
// 0 : RECONFIGURE |
|||
// 1 : RANDOM |
|||
// 2 : WAITSP |
|||
// 3 : WAITSG |
|||
// 4 : USE |
|||
|
|||
// RECONFIGURE |
|||
[reset] l=0 -> (l'=1); |
|||
|
|||
// RANDOM (choose IP address) |
|||
[rec0] (l=1) -> true; // get message (ignore since have no ip address) |
|||
[rec1] (l=1) -> true; // get message (ignore since have no ip address) |
|||
// small number of collisions (choose straight away) |
|||
[] l=1 & coll<MAXCOLL -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
// large number of collisions: (wait for LONGWAIT) |
|||
[time] l=1 & coll=MAXCOLL & x<LONGWAIT -> (x'=min(x+1,TIME_MAX_X)); |
|||
[] l=1 & coll=MAXCOLL & x=LONGWAIT -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
|
|||
// WAITSP |
|||
// let time pass |
|||
[time] l=2 & x<2 -> (x'=min(x+1,2)); |
|||
// send probe |
|||
[send1] l=2 & ip=1 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=2 & ip=2 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
// sent K probes and waited 2 seconds |
|||
[configured] l=2 & x=2 & probes=K -> (l'=3) & (probes'=0) & (coll'=0) & (x'=0); |
|||
// get message and ip does not match: ignore |
|||
[rec0] l=2 & ip!=0 -> (l'=l); |
|||
[rec1] l=2 & ip!=1 -> (l'=l); |
|||
// get a message with matching ip: reconfigure |
|||
[rec1] l=2 & ip=1 -> (l'=0) & (coll'=min(coll+1,MAXCOLL)) & (x'=0) & (probes'=0); |
|||
|
|||
// WAITSG (sends two gratuitious arp probes) |
|||
// time passage |
|||
[time] l=3 & mess=0 & defend=0 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)); |
|||
[time] l=3 & mess=0 & defend=1 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)) & (y'=min(y+1,DEFEND)); |
|||
|
|||
// receive message and same ip: defend |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y>=DEFEND) -> (defend'=1) & (mess'=1) & (y'=0); |
|||
// receive message and same ip: defer |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y<DEFEND) -> (l'=0) & (probes'=0) & (defend'=0) & (x'=0) & (y'=0); |
|||
// receive message and different ip |
|||
[rec0] l=3 & mess=0 & ip!=0 -> (l'=l); |
|||
[rec1] l=3 & mess=0 & ip!=1 -> (l'=l); |
|||
|
|||
|
|||
// send probe reply or message for defence |
|||
[send1] l=3 & ip=1 & mess=1 -> (mess'=0); |
|||
[send2] l=3 & ip=2 & mess=1 -> (mess'=0); |
|||
// send first gratuitous arp message |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
// send second gratuitous arp message (move to use) |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
|
|||
// USE (only interested in reaching this state so do not need to add anything here) |
|||
[] l=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the environment assumption |
|||
// do not get a reply when K probes are sent |
|||
const int M; // time between sending and receiving a message |
|||
|
|||
module env_error4 |
|||
|
|||
env : [0..1]; // 0 active and 1 done |
|||
k : [0..4]; // counts the number of messages sent |
|||
c1 : [0..M+1]; // time since first message |
|||
c2 : [0..M+1]; // time since second message |
|||
c3 : [0..M+1]; // time since third message |
|||
c4 : [0..M+1]; // time since fourth message |
|||
error : [0..1]; |
|||
|
|||
// message with new ip address arrives so done |
|||
[send2] error=0 & env=0 -> (env'=1); |
|||
// message with old ip address arrives so count |
|||
[send1] error=0 & env=0 -> (k'=min(k+1,K)); |
|||
// time passgae so update relevant clocks |
|||
[time] error=0 & env=0 & k=0 -> true; |
|||
[time] error=0 & env=0 & k=1 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)); |
|||
[time] error=0 & env=0 & k=2 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)); |
|||
[time] error=0 & env=0 & k=3 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)) & (c3'=min(c3+1,M+1)); |
|||
[time] error=0 & env=0 & k=4 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)) & (c3'=min(c3+1,M+1)) & (c4'=min(c4+1,M+1)); |
|||
// all clocks reached their bound so an error |
|||
[time] error=0 & env=0 & min(c1,c2,c3,c4)=M -> (error'=1); |
|||
// send a reply (then done) |
|||
[rec1] error=0 & env=0 & k>0 & min(c1,c2,c3,c4)<=M -> (env'=1); |
|||
// finished so any action can be performed |
|||
[time] error=1 | env=1 -> true; |
|||
[send1] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[rec1] error=1 | env=1 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the time bounded assumption |
|||
// host does not send configured signal within T seconds |
|||
const int T; |
|||
|
|||
module time_error |
|||
|
|||
time_error : [0..1]; |
|||
done : [0..1]; |
|||
t : [0..T]; |
|||
|
|||
[time] t<T-1 & done=0 & time_error=0 -> (t'=t+1); // time passes and bound not reached |
|||
[time] t=T-1 & done=0 & time_error=0 -> (time_error'=1); // bound reached so error |
|||
[configured] time_error=0 -> (done'=1); // configured within the time bound |
|||
|
|||
// when in error or done state can loop with either action |
|||
[configured] time_error=1 | done=1 -> true; |
|||
[time] time_error=1 | done=1 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1,13 @@ |
|||
// Max probability of component violating assumption property (checked separately) |
|||
const double p_fail = |
|||
K=2 ? 0.19 : |
|||
K=4 ? 0.006859000000000001 : |
|||
K=6 ? 2.476099000000001E-4 : |
|||
K=8 ? 8.938717390000006E-6 : |
|||
0; |
|||
|
|||
// Assume-guarantee check via multi-objective |
|||
"num_ag": multi(Pmax=? [ F time_error=1 ] , P>=1-p_fail [ G (error=0) ]) |
|||
|
|||
// Pareto query for assume-guarantee check |
|||
"pareto": multi(Pmax=? [ F time_error=1 ] , Pmax=? [ G (error=0) ]) |
@ -0,0 +1,169 @@ |
|||
// IPv4: PTA model with digitial clocks |
|||
// multi-objective model of the host |
|||
// gxn/dxp 28/09/09 |
|||
|
|||
mdp |
|||
|
|||
//------------------------------------------------------------- |
|||
// VARIABLES |
|||
const int N=20; // number of abstract hosts |
|||
const int K=2; // number of probes to send |
|||
|
|||
// PROBABILITIES |
|||
const double old = N/65024; // probability pick an ip address being used |
|||
//const double old = 1/2; // probability pick an ip address being used |
|||
const double new = (1-old); // probability pick a new ip address |
|||
|
|||
// TIMING CONSTANTS |
|||
const int CONSEC = 2; // time interval between sending consecutive probles |
|||
const int TRANSTIME = 1; // upper bound on transmission time delay |
|||
const int LONGWAIT = 60; // minimum time delay after a high number of address collisions |
|||
const int DEFEND = 10; |
|||
|
|||
const int TIME_MAX_X = 60; // max value of clock x |
|||
const int TIME_MAX_Y = 10; // max value of clock y |
|||
const int TIME_MAX_Z = 1; // max value of clock z |
|||
|
|||
// OTHER CONSTANTS |
|||
const int MAXCOLL = 10; // maximum number of collisions before long wait |
|||
const int M=1; // time between sending and receiving a message |
|||
const int T=14; |
|||
|
|||
|
|||
//------------------------------------------------------------- |
|||
// CONCRETE HOST |
|||
module host0 |
|||
|
|||
x : [0..TIME_MAX_X]; // first clock of the host |
|||
y : [0..TIME_MAX_Y]; // second clock of the host |
|||
|
|||
coll : [0..MAXCOLL]; // number of address collisions |
|||
probes : [0..K]; // counter (number of probes sent) |
|||
mess : [0..1]; // need to send a message or not |
|||
defend : [0..1]; // defend (if =1, try to defend IP address) |
|||
|
|||
ip : [1..2]; // ip address (1 - in use & 2 - fresh) |
|||
|
|||
l : [0..4] init 1; // location |
|||
// 0 : RECONFIGURE |
|||
// 1 : RANDOM |
|||
// 2 : WAITSP |
|||
// 3 : WAITSG |
|||
// 4 : USE |
|||
|
|||
// RECONFIGURE |
|||
[reset] l=0 -> (l'=1); |
|||
|
|||
// RANDOM (choose IP address) |
|||
[rec0] (l=1) -> true; // get message (ignore since have no ip address) |
|||
[rec1] (l=1) -> true; // get message (ignore since have no ip address) |
|||
// small number of collisions (choose straight away) |
|||
[] l=1 & coll<MAXCOLL -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
// large number of collisions: (wait for LONGWAIT) |
|||
[time] l=1 & coll=MAXCOLL & x<LONGWAIT -> (x'=min(x+1,TIME_MAX_X)); |
|||
[] l=1 & coll=MAXCOLL & x=LONGWAIT -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
|
|||
// WAITSP |
|||
// let time pass |
|||
[time] l=2 & x<2 -> (x'=min(x+1,2)); |
|||
// send probe |
|||
[send1] l=2 & ip=1 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=2 & ip=2 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
// sent K probes and waited 2 seconds |
|||
[configured] l=2 & x=2 & probes=K -> (l'=3) & (probes'=0) & (coll'=0) & (x'=0); |
|||
// get message and ip does not match: ignore |
|||
[rec0] l=2 & ip!=0 -> (l'=l); |
|||
[rec1] l=2 & ip!=1 -> (l'=l); |
|||
// get a message with matching ip: reconfigure |
|||
[rec1] l=2 & ip=1 -> (l'=0) & (coll'=min(coll+1,MAXCOLL)) & (x'=0) & (probes'=0); |
|||
|
|||
// WAITSG (sends two gratuitious arp probes) |
|||
// time passage |
|||
[time] l=3 & mess=0 & defend=0 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)); |
|||
[time] l=3 & mess=0 & defend=1 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)) & (y'=min(y+1,DEFEND)); |
|||
|
|||
// receive message and same ip: defend |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y>=DEFEND) -> (defend'=1) & (mess'=1) & (y'=0); |
|||
// receive message and same ip: defer |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y<DEFEND) -> (l'=0) & (probes'=0) & (defend'=0) & (x'=0) & (y'=0); |
|||
// receive message and different ip |
|||
[rec0] l=3 & mess=0 & ip!=0 -> (l'=l); |
|||
[rec1] l=3 & mess=0 & ip!=1 -> (l'=l); |
|||
|
|||
|
|||
// send probe reply or message for defence |
|||
[send1] l=3 & ip=1 & mess=1 -> (mess'=0); |
|||
[send2] l=3 & ip=2 & mess=1 -> (mess'=0); |
|||
// send first gratuitous arp message |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
// send second gratuitous arp message (move to use) |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
|
|||
// USE (only interested in reaching this state so do not need to add anything here) |
|||
[] l=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the environment assumption |
|||
// do not get a reply when K probes are sent |
|||
|
|||
module env_error2 |
|||
|
|||
env : [0..1]; // 0 active and 1 done |
|||
k : [0..2]; // counts the number of messages sent |
|||
c1 : [0..M+1]; // time since first message |
|||
c2 : [0..M+1]; // time since second message |
|||
error : [0..1]; |
|||
|
|||
// message with new ip address arrives so done |
|||
[send2] error=0 & env=0 -> (env'=1); |
|||
// message with old ip address arrives so count |
|||
[send1] error=0 & env=0 -> (k'=min(k+1,K)); |
|||
// time passgae so update relevant clocks |
|||
[time] error=0 & env=0 & k=0 -> true; |
|||
[time] error=0 & env=0 & k=1 & min(c1,c2)<M -> (c1'=min(c1+1,M+1)); |
|||
[time] error=0 & env=0 & k=2 & min(c1,c2)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)); |
|||
// all clocks reached their bound so an error |
|||
[time] error=0 & env=0 & min(c1,c2)=M -> (error'=1); |
|||
// send a reply (then done) |
|||
[rec1] error=0 & env=0 & k>0 & min(c1,c2)<=M -> (env'=1); |
|||
// finished so any action can be performed |
|||
[time] error=1 | env=1 -> true; |
|||
[send1] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[rec1] error=1 | env=1 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the time bounded assumption |
|||
// host does not send configured signal within T seconds |
|||
|
|||
module time_error |
|||
|
|||
time_error : [0..1]; |
|||
done : [0..1]; |
|||
t : [0..T]; |
|||
|
|||
[time] t<T-1 & done=0 & time_error=0 -> (t'=t+1); // time passes and bound not reached |
|||
[time] t=T-1 & done=0 & time_error=0 -> (time_error'=1); // bound reached so error |
|||
[configured] time_error=0 -> (done'=1); // configured within the time bound |
|||
|
|||
// when in error or done state can loop with either action |
|||
[configured] time_error=1 | done=1 -> true; |
|||
[time] time_error=1 | done=1 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F time_error=1 ] , P>=0.81[ G (error=0) ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F time_error=1 ] , Pmax=? [ G (error=0) ]) |
@ -0,0 +1,174 @@ |
|||
// IPv4: PTA model with digitial clocks |
|||
// multi-objective model of the host |
|||
// gxn/dxp 28/09/09 |
|||
|
|||
mdp |
|||
|
|||
//------------------------------------------------------------- |
|||
// VARIABLES |
|||
const int N=20; // number of abstract hosts |
|||
const int K=4; // number of probes to send |
|||
|
|||
// PROBABILITIES |
|||
const double old = N/65024; // probability pick an ip address being used |
|||
//const double old = 0.5; // probability pick an ip address being used |
|||
const double new = (1-old); // probability pick a new ip address |
|||
|
|||
// TIMING CONSTANTS |
|||
const int CONSEC = 2; // time interval between sending consecutive probles |
|||
const int TRANSTIME = 1; // upper bound on transmission time delay |
|||
const int LONGWAIT = 60; // minimum time delay after a high number of address collisions |
|||
const int DEFEND = 10; |
|||
|
|||
const int TIME_MAX_X = 60; // max value of clock x |
|||
const int TIME_MAX_Y = 10; // max value of clock y |
|||
const int TIME_MAX_Z = 1; // max value of clock z |
|||
|
|||
// OTHER CONSTANTS |
|||
const int MAXCOLL = 10; // maximum number of collisions before long wait |
|||
const int M=1; // time between sending and receiving a message |
|||
const int T=10; |
|||
|
|||
//------------------------------------------------------------- |
|||
// CONCRETE HOST |
|||
module host0 |
|||
|
|||
x : [0..TIME_MAX_X]; // first clock of the host |
|||
y : [0..TIME_MAX_Y]; // second clock of the host |
|||
|
|||
coll : [0..MAXCOLL]; // number of address collisions |
|||
probes : [0..K]; // counter (number of probes sent) |
|||
mess : [0..1]; // need to send a message or not |
|||
defend : [0..1]; // defend (if =1, try to defend IP address) |
|||
|
|||
ip : [1..2]; // ip address (1 - in use & 2 - fresh) |
|||
|
|||
l : [0..4] init 1; // location |
|||
// 0 : RECONFIGURE |
|||
// 1 : RANDOM |
|||
// 2 : WAITSP |
|||
// 3 : WAITSG |
|||
// 4 : USE |
|||
|
|||
// RECONFIGURE |
|||
[reset] l=0 -> (l'=1); |
|||
|
|||
// RANDOM (choose IP address) |
|||
[rec0] (l=1) -> true; // get message (ignore since have no ip address) |
|||
[rec1] (l=1) -> true; // get message (ignore since have no ip address) |
|||
// small number of collisions (choose straight away) |
|||
[] l=1 & coll<MAXCOLL -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
// large number of collisions: (wait for LONGWAIT) |
|||
[time] l=1 & coll=MAXCOLL & x<LONGWAIT -> (x'=min(x+1,TIME_MAX_X)); |
|||
[] l=1 & coll=MAXCOLL & x=LONGWAIT -> 1/3*old : (l'=2) & (ip'=1) & (x'=0) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=1) |
|||
+ 1/3*old : (l'=2) & (ip'=1) & (x'=2) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=0) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=1) |
|||
+ 1/3*new : (l'=2) & (ip'=2) & (x'=2); |
|||
|
|||
// WAITSP |
|||
// let time pass |
|||
[time] l=2 & x<2 -> (x'=min(x+1,2)); |
|||
// send probe |
|||
[send1] l=2 & ip=1 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=2 & ip=2 & x=2 & probes<K -> (x'=0) & (probes'=probes+1); |
|||
// sent K probes and waited 2 seconds |
|||
[configured] l=2 & x=2 & probes=K -> (l'=3) & (probes'=0) & (coll'=0) & (x'=0); |
|||
// get message and ip does not match: ignore |
|||
[rec0] l=2 & ip!=0 -> (l'=l); |
|||
[rec1] l=2 & ip!=1 -> (l'=l); |
|||
// get a message with matching ip: reconfigure |
|||
[rec1] l=2 & ip=1 -> (l'=0) & (coll'=min(coll+1,MAXCOLL)) & (x'=0) & (probes'=0); |
|||
|
|||
// WAITSG (sends two gratuitious arp probes) |
|||
// time passage |
|||
[time] l=3 & mess=0 & defend=0 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)); |
|||
[time] l=3 & mess=0 & defend=1 & x<CONSEC -> (x'=min(x+1,TIME_MAX_X)) & (y'=min(y+1,DEFEND)); |
|||
|
|||
// receive message and same ip: defend |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y>=DEFEND) -> (defend'=1) & (mess'=1) & (y'=0); |
|||
// receive message and same ip: defer |
|||
[rec1] l=3 & mess=0 & ip=1 & (defend=0 | y<DEFEND) -> (l'=0) & (probes'=0) & (defend'=0) & (x'=0) & (y'=0); |
|||
// receive message and different ip |
|||
[rec0] l=3 & mess=0 & ip!=0 -> (l'=l); |
|||
[rec1] l=3 & mess=0 & ip!=1 -> (l'=l); |
|||
|
|||
|
|||
// send probe reply or message for defence |
|||
[send1] l=3 & ip=1 & mess=1 -> (mess'=0); |
|||
[send2] l=3 & ip=2 & mess=1 -> (mess'=0); |
|||
// send first gratuitous arp message |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes<1 -> (x'=0) & (probes'=probes+1); |
|||
// send second gratuitous arp message (move to use) |
|||
[send1] l=3 & ip=1 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
[send2] l=3 & ip=2 & mess=0 & x=CONSEC & probes=1 -> (l'=4) & (x'=0) & (y'=0) & (probes'=0); |
|||
|
|||
// USE (only interested in reaching this state so do not need to add anything here) |
|||
[] l=4 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the environment assumption |
|||
// do not get a reply when K probes are sent |
|||
|
|||
|
|||
module env_error4 |
|||
|
|||
env : [0..1]; // 0 active and 1 done |
|||
k : [0..4]; // counts the number of messages sent |
|||
c1 : [0..M+1]; // time since first message |
|||
c2 : [0..M+1]; // time since second message |
|||
c3 : [0..M+1]; // time since third message |
|||
c4 : [0..M+1]; // time since fourth message |
|||
error : [0..1]; |
|||
|
|||
// message with new ip address arrives so done |
|||
[send2] error=0 & env=0 -> (env'=1); |
|||
// message with old ip address arrives so count |
|||
[send1] error=0 & env=0 -> (k'=min(k+1,K)); |
|||
// time passgae so update relevant clocks |
|||
[time] error=0 & env=0 & k=0 -> true; |
|||
[time] error=0 & env=0 & k=1 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)); |
|||
[time] error=0 & env=0 & k=2 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)); |
|||
[time] error=0 & env=0 & k=3 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)) & (c3'=min(c3+1,M+1)); |
|||
[time] error=0 & env=0 & k=4 & min(c1,c2,c3,c4)<M -> (c1'=min(c1+1,M+1)) & (c2'=min(c2+1,M+1)) & (c3'=min(c3+1,M+1)) & (c4'=min(c4+1,M+1)); |
|||
// all clocks reached their bound so an error |
|||
[time] error=0 & env=0 & min(c1,c2,c3,c4)=M -> (error'=1); |
|||
// send a reply (then done) |
|||
[rec1] error=0 & env=0 & k>0 & min(c1,c2,c3,c4)<=M -> (env'=1); |
|||
// finished so any action can be performed |
|||
[time] error=1 | env=1 -> true; |
|||
[send1] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[send2] error=1 | env=1 -> true; |
|||
[rec1] error=1 | env=1 -> true; |
|||
|
|||
endmodule |
|||
|
|||
//------------------------------------------------------------- |
|||
// error automaton for the time bounded assumption |
|||
// host does not send configured signal within T seconds |
|||
|
|||
module time_error |
|||
|
|||
time_error : [0..1]; |
|||
done : [0..1]; |
|||
t : [0..T]; |
|||
|
|||
[time] t<T-1 & done=0 & time_error=0 -> (t'=t+1); // time passes and bound not reached |
|||
[time] t=T-1 & done=0 & time_error=0 -> (time_error'=1); // bound reached so error |
|||
[configured] time_error=0 -> (done'=1); // configured within the time bound |
|||
|
|||
// when in error or done state can loop with either action |
|||
[configured] time_error=1 | done=1 -> true; |
|||
[time] time_error=1 | done=1 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F time_error=1 ] , P>=0.993141[ G (error=0) ]) |
@ -0,0 +1 @@ |
|||
multi(Pmax=? [ F time_error=1 ] , Pmax=? [ G (error=0) ]) |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue