Browse Source

Make clone() work for variables without initial value.

tempestpy_adaptions
gereon 12 years ago
parent
commit
3ff9514f7b
  1. 24
      examples/dtmc/synchronous_leader/leader3_5.pm
  2. 8
      src/ir/Variable.cpp

24
examples/dtmc/synchronous_leader/leader3_5.pm

@ -15,15 +15,15 @@ module counter
c : [1..N-1]; c : [1..N-1];
// reading // reading
[read] c<N-1 -> (c'=c+1);
[read] c<N-1 -> 1:(c'=c+1);
// finished reading // finished reading
[read] c=N-1 -> (c'=c);
[read] c=N-1 -> 1:(c'=c);
//decide //decide
[done] u1|u2|u3 -> (c'=c);
[done] u1|u2|u3 -> 1:(c'=c);
// pick again reset counter // pick again reset counter
[retry] !(u1|u2|u3) -> (c'=1);
[retry] !(u1|u2|u3) -> 1:(c'=1);
// loop (when finished to avoid deadlocks) // loop (when finished to avoid deadlocks)
[loop] s1=3 -> (c'=c);
[loop] s1=3 -> 1:(c'=c);
endmodule endmodule
@ -56,18 +56,18 @@ module process1
+ 1/K : (s1'=1) & (p1'=3) & (v1'=3) & (u1'=true) + 1/K : (s1'=1) & (p1'=3) & (v1'=3) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=4) & (v1'=4) & (u1'=true); + 1/K : (s1'=1) & (p1'=4) & (v1'=4) & (u1'=true);
// read // read
[read] s1=1 & u1 & c<N-1 -> (u1'=(p1!=v2)) & (v1'=v2);
[read] s1=1 & !u1 & c<N-1 -> (u1'=false) & (v1'=v2) & (p1'=0);
[read] s1=1 & u1 & c<N-1 -> 1:(u1'=(p1!=v2)) & (v1'=v2);
[read] s1=1 & !u1 & c<N-1 -> 1:(u1'=false) & (v1'=v2) & (p1'=0);
// read and move to decide // read and move to decide
[read] s1=1 & u1 & c=N-1 -> (s1'=2) & (u1'=(p1!=v2)) & (v1'=0) & (p1'=0);
[read] s1=1 & !u1 & c=N-1 -> (s1'=2) & (u1'=false) & (v1'=0);
[read] s1=1 & u1 & c=N-1 -> 1:(s1'=2) & (u1'=(p1!=v2)) & (v1'=0) & (p1'=0);
[read] s1=1 & !u1 & c=N-1 -> 1:(s1'=2) & (u1'=false) & (v1'=0);
// deciding // deciding
// done // done
[done] s1=2 -> (s1'=3) & (u1'=false) & (v1'=0) & (p1'=0);
[done] s1=2 -> 1:(s1'=3) & (u1'=false) & (v1'=0) & (p1'=0);
//retry //retry
[retry] s1=2 -> (s1'=0) & (u1'=false) & (v1'=0) & (p1'=0);
[retry] s1=2 -> 1:(s1'=0) & (u1'=false) & (v1'=0) & (p1'=0);
// loop (when finished to avoid deadlocks) // loop (when finished to avoid deadlocks)
[loop] s1=3 -> (s1'=3);
[loop] s1=3 -> 1:(s1'=3);
endmodule endmodule

8
src/ir/Variable.cpp

@ -25,8 +25,12 @@ Variable::Variable(uint_fast64_t index, std::string variableName, std::shared_pt
// Nothing to do here. // Nothing to do here.
} }
Variable::Variable(const Variable& var, const std::string& newName, const std::map<std::string, std::string>& renaming, const std::map<std::string,uint_fast64_t>& bools, const std::map<std::string,uint_fast64_t>& ints)
: Variable(var.index, newName, var.initialValue->clone(renaming, bools, ints)) {
Variable::Variable(const Variable& var, const std::string& newName, const std::map<std::string, std::string>& renaming, const std::map<std::string,uint_fast64_t>& bools, const std::map<std::string,uint_fast64_t>& ints) {
this->index = var.index;
this->variableName = newName;
if (var.initialValue != nullptr) {
this->initialValue = var.initialValue->clone(renaming, bools, ints);
}
} }
// Return the name of the variable. // Return the name of the variable.

Loading…
Cancel
Save