-
Notifications
You must be signed in to change notification settings - Fork 1
/
choice3.py
46 lines (37 loc) · 1.74 KB
/
choice3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 3 15:50:49 2019
@author: simsim
"""
from system import *
# choose the most successes path
def create(model):
plant = process("plant",["g1","g2","g3"],[],[],"g1",update_states = ["g1"])
environment = process("environment",["e1","e2","e3","e4","e5","e6"],[],[],"e1")
pve = plant_environment("syst",plant,environment,model = model)
pve.add_transition("a",["plant","environment"],[["g1"],["e1"]],[["g3"],["e2"]])
pve.add_transition("b",["plant","environment"],[["g1"],["e1"]],[["g2"],["e5"]])
pve.add_transition("c",["plant","environment"],[[],["e2","e5"]],[[],["e3","e6"]])
pve.add_transition("d",["plant","environment"],[["g3"],["e3"]],[["g2"],["e4"]])
pve.add_transition("e",["plant","environment"],[["g2"],["e4","e6"]],[["g1"],["e1","e1"]])
pve.create_RNN()
pve.reinitialize()
return pve
# =============================================================================
# # choose the least failures path
# def create(model):
# plant = process("plant",["g1","g2"],[],[],"g1")
# environment = process("environment",["e1","e2","e3","e4"],[],[],"e1")
#
# pve = plant_environment("syst",plant,environment,model = model)
#
# pve.add_transition("a",["plant","environment"],[["g1"],["e1"]],[["g2"],["e2"]])
# pve.add_transition("b",["plant","environment"],[["g1"],["e1"]],[["g2"],["e3"]])
# pve.add_transition("c",["plant","environment"],[[],["e3"]],[[],["e4"]])
# pve.add_transition("d",["plant","environment"],[["g2"],["e2","e4"]],[["g1"],["e1","e1"]])
#
# pve.create_RNN()
# pve.reinitialize()
# return pve
# =============================================================================