Can Mathematica 9 convert a Boolean representation of an RBD to its symbolic algebraic form?
If I have a simple series Reliability Block Diagram made up of 2 components, c1 and c2
bexpr1=And[c1,c2]
and the corresponding symbolic representation for the system would be RS1 = R1*R2
The system I am interested in is more complex and contains 7 components in a 4 path architecture:
path1=And[c1,c2,c5,c7]
path2=And[c1,c3,c5,c7]
path3=And[c1,c3,c6,c7]
path4=And[c1,c4,c6,c7]
bexpr2=Or[path1,path2,path3,path4]
How can the algebraic form of the reliability function be obtained for bexpr2 using Mathematica?
The solution can be seen on page 5 of the PDF file at the following link
http://www.reliasoft.com/newsletter/2Q2000/index.htm
Thank you.
Daniel,
Thank you for your reply but I think it too is not correct and I' m not sure why. See below for a comparision of the two solution methods. Am I mis-interpreting something here ?
Also, I agree that Eq.(3) is undersimplified. Perhaps the author intentionally left it in that form to help show how this problem can be solved manually (pencil & paper).
equation3 = (r1*r4*r6*r7) + (r1*r3*r6*r7) - (r1*r3*r4*r6*r7) + (r1*r2*r3*r4*
r5*r6*r7) + (r1*r3*r4*r5*r6*r7) - (r1*r2*r3*r4*r5*r6*r7) - (r1*r2*r3*r5*
r6*r7) - (r1*r3*r5*r6*r7) + (r1*r2*r3*r5*r6*r7) - (r1*r2*r4*r5*r6*
r7) - (r1*r3*r4*r5*r6*r7) + (r1*r2*r3*r4*r5*r6*r7) + (r1*r2*r5*r7) + (r1*
r3*r5*r7) - (r1*r2*r3*r5*r7) (* Eq.(3) ReliabilityEdge volume 1, Issue 1 *)
r1 r2 r5 r7 + r1 r3 r5 r7 - r1 r2 r3 r5 r7 + r1 r3 r6 r7 + r1 r4 r6 r7 - r1 r3 r4 r6 r7 - r1 r3 r5 r6 r7 - r1 r2 r4 r5 r6 r7 + r1 r2 r3 r4 r5 r6 r7
Original Problem
path1 = And[c1, c2, c5, c7];
path2 = And[c1, c3, c5, c7];
path3 = And[c1, c3, c6, c7];
path4 = And[c1, c4, c6, c7];
bexpr = Or[path1, path2, path3, path4]
(c1 && c2 && c5 && c7) || (c1 && c3 && c5 && c7) || (c1 && c3 && c6 && c7) || (c1 && c4 && c6 && c7)
Ilian' s Solution (1)
dists = Table[{ToExpression["c" ~~ ToString[i]],
BernoulliDistribution[ToExpression["r" ~~ ToString[i]]]}, {i, 7}]
{{c1, BernoulliDistribution[r1]}, {c2, BernoulliDistribution[r2]}, {c3, BernoulliDistribution[r3]}, {c4, BernoulliDistribution[r4]}, {c5, BernoulliDistribution[r5]}, {c6, BernoulliDistribution[r6]}, {c7, BernoulliDistribution[r7]}}
survivalfunction1 = Expand[PDF[ReliabilityDistribution[bexpr, dists], 1]]
r1 r2 r5 r7 + r1 r3 r5 r7 - r1 r2 r3 r5 r7 + r1 r3 r6 r7 + r1 r4 r6 r7 - r1 r3 r4 r6 r7 - r1 r3 r5 r6 r7 - r1 r2 r4 r5 r6 r7 + r1 r2 r3 r4 r5 r6 r7
Simplify[survivalfunction1/
equation3] (* This show that the results are equivalent *)
1
Daniel' s Solution (2)
bexpr2 = BooleanConvert[bexpr, "ANF"]
(c1 && c2 && c5 && c7) [Xor] (c1 && c3 && c5 && c7) [Xor] (c1 && c3 && c6 && c7) [Xor] (c1 && c4 && c6 && c7) [Xor] (c1 && c2 && c3 && c5 && c7) [Xor] (c1 && c3 && c4 && c6 && c7) [Xor] (c1 && c3 && c5 && c6 && c7) [Xor] (c1 && c2 && c4 && c5 && c6 && c7) [Xor] (c1 && c2 && c3 && c4 && c5 && c6 && c7)
survivalfunction2temp = bexpr2 /. {And -> Times, Xor -> Plus}
c1 c2 c5 c7 + c1 c3 c5 c7 + c1 c2 c3 c5 c7 + c1 c3 c6 c7 + c1 c4 c6 c7 + c1 c3 c4 c6 c7 + c1 c3 c5 c6 c7 + c1 c2 c4 c5 c6 c7 + c1 c2 c3 c4 c5 c6 c7
survivalfunction2stringtemp = ToString[survivalfunction2temp]
"c1 c2 c5 c7 + c1 c3 c5 c7 + c1 c2 c3 c5 c7 + c1 c3 c6 c7 + c1 c4 c6 c7 + c1 \ c3 c4 c6 c7 + c1 c3 c5 c6 c7 + c1 c2 c4 c5 c6 c7 + c1 c2 c3 c4 c5 c6 c7"
survivalfunction2string =
StringReplace[survivalfunction2stringtemp, "c" -> "r"]
"r1 r2 r5 r7 + r1 r3 r5 r7 + r1 r2 r3 r5 r7 + r1 r3 r6 r7 + r1 r4 r6 r7 + r1 \ r3 r4 r6 r7 + r1 r3 r5 r6 r7 + r1 r2 r4 r5 r6 r7 + r1 r2 r3 r4 r5 r6 r7"
survivalfunction2 = ToExpression[survivalfunction2string]
r1 r2 r5 r7 + r1 r3 r5 r7 + r1 r2 r3 r5 r7 + r1 r3 r6 r7 + r1 r4 r6 r7 + r1 r3 r4 r6 r7 + r1 r3 r5 r6 r7 + r1 r2 r4 r5 r6 r7 + r1 r2 r3 r4 r5 r6 r7
Simplify[survivalfunction2/
equation3](* This show that the results are not equivalent *)
(r4 r6 + r2 (1 + r3) r5 (1 + r4 r6) + r3 (r5 + r6 + r4 r6 + r5 r6))/( r4 r6 + r2 (-1 + r3) r5 (-1 + r4 r6) + r3 (r5 + r6 - r4 r6 - r5 r6))
Let' s do a quick numerical sanity check.
r1 = r2 = r3 = r4 = r5 = r6 = r7 = 1;
survivalfunction1 (* This is the correct numerical value *)
1
survivalfunction2 (* This is numerically not possible, must be less than or
equal to one *)
9
Upon examination of survivalfunction2 I notice there are no negative signs in the algebra . . . not sure why. Also, I apologize here if everything is not formatted with all proper formatting, I'm still unfamiliar with much at StackExchange.
Clay,
Thank you for the reply. I believe there may be a problem with your code as it produces a result that differs from Eq.(3) in the referenced PDF file.
I tested the following code on the system architecture that I posted (associated with Eq.(3) ) and other simpler systems and it appears to accurately produce the algebra for the reliability function.
dists = Table[{ToExpression["c" ~~ ToString[i]], BernoulliDistribution[ToExpression["r" ~~ ToString[i]]]}, {i, 7}];
Expand[PDF[ReliabilityDistribution[bexpr2, dists], 1]]
The above code was produced by Ilian Gachevski in his posting at Wolfram Community. Thanks again for your inputs.