3 names
= ['s', 'a', 'b', 'c']
4 nodes
= range(len(names
))
6 ('s', 'a', 29), ('s', 'b', 21),
7 ('a', 's', 29), ('a', 'b', 17), ('a', 'c', 32),
8 ('b', 's', 21), ('b', 'a', 17), ('b', 'c', 37),
9 ('c', 'a', 32), ('c', 'b', 37)]
10 maxes
= [120, 120, 200]
20 time: 0..TIMEBOUND;""".format(timebound
, len(nodes
), truck
))
21 for stock
, name
in zip(maxes
, names
[1:]):
22 print('{}stock: 0..{};'.format(name
, stock
))
24 for init
, name
in zip(inits
, names
[1:]):
25 print('{}stock= {} &'.format(name
, init
))
33 for node
, name
in zip(nodes
, names
):
34 print('FALSE & truck={} & time+50<TIMEBOUND:'.format(node
))
36 for fr
, to
, time
in connections
:
41 print('next(time)=time+{}'.format(time
))
45 # The case where time already passed over the bound
47 for name
in names
[1:]:
48 print('\tnext({0}stock)={0}stock &'.format(name
))
50 \tnext(time)=time & next(tstock)=tstock & next(truck)=truck; esac
51 LTLSPEC G ({})""".format(' & '.join('{}stock>0'.format(n
) for n
in names
[1:])))
53 truck={} & time<={}: (
56 next(time)=time+29 & next(truck)=1 &
58 tstock=0 & astock-0<=120:
59 next(astock)=astock+0 &
62 next(tstock)=tstock-0;
63 tstock=1 & astock-1<=120:
64 next(astock)=astock+1 &
67 next(tstock)=tstock-1;
69 tstock=120 & astock-1<=120:
70 next(astock)=astock+1 &
73 next(tstock)=tstock-1;
78 (next(time)=time+21 & next(truck)=2 &
83 truck=1 & time<=TIMEBOUND:(
85 (next(time)=time+21 & next(truck)=0) |
87 (next(time)=time+17 & next(truck)=2) |
89 (next(time)=time+32 & next(truck)=3)
92 truck=2 & time<=TIMEBOUND:(
94 (next(time)=time+21 & next(truck)=0) |
96 (next(time)=time+17 & next(truck)=1) |
98 (next(time)=time+32 & next(truck)=3)
101 truck=3 & time<=TIMEBOUND:(
103 (next(time)=time+32 & next(truck)=1) |
105 (next(time)=time+37 & next(truck)=2)
107 -- Time bound has passed...
111 next(astock)=astock &
112 next(bstock)=bstock &
113 next(cstock)=cstock &