Serialisation des etapes
[mist@savage mroProject]$ diff FFModified.py FFSerialiser.py
1 2c2
2 < Algorithm of Ford-Fulkerson modified
3 ---
4 > Algorithm of Ford-Fulkerson modified for serialising
5 7c7,9
6 < class FFModified:
7 ---
8 > from GrhWriter import GrhWriter
9 >
10 > class FFSerialiser:
11 16c18
12 <
13 ---
14 > self.n=0 # iteration
15 90a93,95
16 > writer=GrhWriter(self.graph)
17 > writer.write("serial_" + str(self.n) + ".grh")
18 > self.n=self.n + 1
[mist@savage mroProject]$
[mist@savage mroProject]$ cd exemple/
[mist@savage exemple]$ python ../serial.py Simple.grh out.grh
GrhReader .graph='Graph .arcsList=[Arc .fromV='SOURCE' .toV='B' .flow='0.0' .capacity='3.0' .cost='0.0', Arc .fromV='SOURCE' .toV='C' .flow='0.0' .capacity='7.0' .cost='0.0', Arc .fromV='B' .toV='C' .flow='0.0' .capacity='2.0' .cost='0.0', Arc .fromV='C' .toV='D' .flow='0.0' .capacity='1.0' .cost='0.0', Arc .fromV='D' .toV='SINK' .flow='0.0' .capacity='8.0' .cost='0.0', Arc .fromV='B' .toV='D' .flow='0.0' .capacity='5.0' .cost='0.0', Arc .fromV='B' .toV='E' .flow='0.0' .capacity='4.0' .cost='0.0', Arc .fromV='E' .toV='SINK' .flow='0.0' .capacity='3.0' .cost='0.0', Arc .fromV='C' .toV='E' .flow='0.0' .capacity='4.0' .cost='0.0', Arc .fromV='D' .toV='E' .flow='0.0' .capacity='2.0' .cost='0.0']'
[...]
found optimal flow
[mist@savage exemple]$ ls
dia2grh.xsl out2.grh out.grh out.txt serial_0.grh serial_2.grh Simple.dia Simple.png
grh2dia.xsl out.dia out.png out.txt~ serial_1.grh serial_3.grh Simple.grh
[mist@savage exemple]$
[mist@savage exemple]$ cat serial.sh
1 #!/bin/sh
2
3 for i in serial_*.grh
4 do
5 sabcmd grh2dia.xsl $i `basename $i .grh`.dia
6 /usr/local/bin/dia -e `basename $i .grh`.png `basename $i .grh`.dia
7 done
[mist@savage exemple]$ ./serial.sh
** (process:8273): WARNING **: No attribute type ((nil)) or no data((nil)) in this attribute
serial_0.dia --> serial_0.png
** (process:8278): WARNING **: No attribute type ((nil)) or no data((nil)) in this attribute
serial_1.dia --> serial_1.png
** (process:8283): WARNING **: No attribute type ((nil)) or no data((nil)) in this attribute
serial_2.dia --> serial_2.png
** (process:8288): WARNING **: No attribute type ((nil)) or no data((nil)) in this attribute
serial_3.dia --> serial_3.png
[mist@savage exemple]$ ls
dia2grh.xsl out.dia out.txt serial_0.grh serial_1.grh serial_2.grh serial_3.grh Simple.dia
grh2dia.xsl out.grh out.txt~ serial_0.png serial_1.png serial_2.png serial_3.png Simple.grh
out2.grh out.png serial_0.dia serial_1.dia serial_2.dia serial_3.dia serial.sh* Simple.png
[mist@savage exemple]$
l'exemple précédent
Un exemple du cours