jieunbyun / BNS-JT

Reference: Byun, J.-E. and Song, J. (2021). A general framework of Bayesian network for system reliability analysis using junction tree. Reliability Engineering & System Safety, 216, 107952.
MIT License
5 stars 3 forks source link

Replacing B of a Variable afterwards #34

Closed jieunbyun closed 9 months ago

jieunbyun commented 9 months ago

I am tryiing to build a function that automatically builds CPM from B&B result. And regarding that, how can I update the "B" when a new composite state needs to be added?

At the moment, if I type in (for some existing var1) var1.B = B_new I get an error message reading AttributeError: can't set attribute

Could you help me with this..? Thank you so much!

dynaryu commented 9 months ago

I've used namedtuple for Variable class, so it cannot be modified once it's created (i.e., immutable). If that's not the behavior you want, then let me know.

jieunbyun commented 9 months ago

Yes, I hope it can be changed so that they can be updated by B&B results (since B&B function requires variables to be defined beforehand).

dynaryu commented 9 months ago

It should work as intended. Otherwise let me know.

jieunbyun commented 9 months ago

Yes it works! Thank you : D