Browse Source
			
			
			Added Mdp Region checking in storm.h, Some STORM_LOG_DEBUGs, fixes for sampling to work on Mdps
			
				
		Added Mdp Region checking in storm.h, Some STORM_LOG_DEBUGs, fixes for sampling to work on Mdps
	
		
	
			
				Former-commit-id: ab42fefd92
			
			
				main
			
			
		
				 11 changed files with 133 additions and 30 deletions
			
			
		- 
					65examples/pmdp/consensus/coin2_2.nm
 - 
					5src/modelchecker/region/AbstractSparseRegionModelChecker.cpp
 - 
					2src/modelchecker/region/ApproximationModel.h
 - 
					15src/modelchecker/region/SamplingModel.cpp
 - 
					2src/modelchecker/region/SamplingModel.h
 - 
					10src/modelchecker/region/SparseDtmcRegionModelChecker.cpp
 - 
					15src/modelchecker/region/SparseMdpRegionModelChecker.cpp
 - 
					10src/modelchecker/region/SparseMdpRegionModelChecker.h
 - 
					0src/utility/region.cpp
 - 
					8src/utility/region.h
 - 
					31src/utility/storm.h
 
@ -0,0 +1,65 @@ | 
				
			|||
// COIN FLIPPING PROTOCOL FOR POLYNOMIAL RANDOMIZED CONSENSUS [AH90]  | 
				
			|||
// gxn/dxp 20/11/00 | 
				
			|||
 | 
				
			|||
mdp | 
				
			|||
 | 
				
			|||
// constants | 
				
			|||
const int N=2; | 
				
			|||
const int K=2; | 
				
			|||
const int range = 2*(K+1)*N; | 
				
			|||
const int counter_init = (K+1)*N; | 
				
			|||
const int left = N; | 
				
			|||
const int right = 2*(K+1)*N - N; | 
				
			|||
 | 
				
			|||
//Coin Probabilities | 
				
			|||
const double p; | 
				
			|||
const double q; | 
				
			|||
 | 
				
			|||
// shared coin | 
				
			|||
global counter : [0..range] init counter_init; | 
				
			|||
 | 
				
			|||
module process1 | 
				
			|||
	 | 
				
			|||
	// program counter | 
				
			|||
	pc1 : [0..3]; | 
				
			|||
	// 0 - flip | 
				
			|||
	// 1 - write  | 
				
			|||
	// 2 - check | 
				
			|||
	// 3 - finished | 
				
			|||
	 | 
				
			|||
	// local coin | 
				
			|||
	coin1 : [0..1];	 | 
				
			|||
 | 
				
			|||
	// flip coin | 
				
			|||
	[] (pc1=0)  -> p : (coin1'=0) & (pc1'=1) + 1-p : (coin1'=1) & (pc1'=1); | 
				
			|||
	// write tails -1  (reset coin to add regularity) | 
				
			|||
	[] (pc1=1) & (coin1=0) & (counter>0) -> 1 : (counter'=counter-1) & (pc1'=2) & (coin1'=0); | 
				
			|||
	// write heads +1 (reset coin to add regularity) | 
				
			|||
	[] (pc1=1) & (coin1=1) & (counter<range) -> 1 : (counter'=counter+1) & (pc1'=2) & (coin1'=0); | 
				
			|||
	// check | 
				
			|||
	// decide tails | 
				
			|||
	[] (pc1=2) & (counter<=left) -> 1 : (pc1'=3) & (coin1'=0); | 
				
			|||
	// decide heads | 
				
			|||
	[] (pc1=2) & (counter>=right) -> 1 : (pc1'=3) & (coin1'=1); | 
				
			|||
	// flip again | 
				
			|||
	[] (pc1=2) & (counter>left) & (counter<right) -> 1 : (pc1'=0); | 
				
			|||
	// loop (all loop together when done) | 
				
			|||
	[done] (pc1=3) -> 1 : (pc1'=3); | 
				
			|||
 | 
				
			|||
endmodule | 
				
			|||
 | 
				
			|||
// construct remaining processes through renaming | 
				
			|||
module process2 = process1[pc1=pc2,coin1=coin2,p=q] endmodule | 
				
			|||
 | 
				
			|||
// labels | 
				
			|||
label "finished" = pc1=3 & pc2=3 ; | 
				
			|||
label "all_coins_equal_0" = coin1=0 & coin2=0 ; | 
				
			|||
label "all_coins_equal_1" = coin1=1 & coin2=1 ; | 
				
			|||
label "agree" = coin1=coin2 ; | 
				
			|||
label "finish_with_1" = pc1=3 & pc2=3 & coin1=1 & coin2=1 ; | 
				
			|||
 | 
				
			|||
// rewards | 
				
			|||
rewards "steps" | 
				
			|||
	true : 1; | 
				
			|||
endrewards | 
				
			|||
 | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue