ctmc
const int N;
const int left_mx = N;
const int right_mx = N;
const int k = floor(0.75*N);
formula minimum = (left_n>=k & toleft_n) |
(right_n>=k & toright_n) |
((left_n+right_n)>=k & toleft_n & line_n & toright_n);
const double ws_fail = 1/500;
const double switch_fail = 1/4000;
const double line_fail = 1/5000;
module Left
left_n : [0..left_mx] init left_mx;
left : bool;
[startLeft] !left & (left_n<left_mx) -> 1 : (left'=true);
[repairLeft] left & (left_n<left_mx) -> 1 : (left'=false) & (left_n'=left_n+1);
[] (left_n>0) -> ws_fail*left_n : (left_n'=left_n-1);
endmodule
module Right = Left[left_n=right_n,
left=right,
left_mx=right_mx,
startLeft=startRight,
repairLeft=repairRight ]
endmodule
module Repairman
r : bool;
[startLeft] !r -> 10 : (r'=true);
[startRight] !r -> 10 : (r'=true);
[startToLeft] !r -> 10 : (r'=true);
[startToRight] !r -> 10 : (r'=true);
[startLine] !r -> 10 : (r'=true);
[repairLeft] r -> 2 : (r'=false);
[repairRight] r -> 2 : (r'=false);
[repairToLeft] r -> 0.25 : (r'=false);
[repairToRight] r -> 0.25 : (r'=false);
[repairLine] r -> 0.125 : (r'=false);
endmodule
module Line
line : bool;
line_n : bool init true;
[startLine] !line & !line_n -> 1 : (line'=true);
[repairLine] line & !line_n -> 1 : (line'=false) & (line_n'=true);
[] line_n -> line_fail : (line_n'=false);
endmodule
module ToLeft = Line[line=toleft,
line_n=toleft_n,
line_fail=switch_fail,
startLine=startToLeft,
repairLine=repairToLeft ]
endmodule
module ToRight = Line[line=toright,
line_n=toright_n,
line_fail=switch_fail,
startLine=startToRight,
repairLine=repairToRight ]
endmodule
rewards "percent_op"
true : 100*(left_n+right_n)/(2*N);
endrewards
rewards "time_not_min"
!minimum : 1;
endrewards
rewards "num_repairs"
[repairLeft] true : 1;
[repairRight] true : 1;
[repairToLeft] true : 1;
[repairToRight] true : 1;
[repairLine] true : 1;
endrewards