Skip to content

Commit

Permalink
Last version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dollars committed May 19, 2013
1 parent 0ebe6de commit 80ad416
Show file tree
Hide file tree
Showing 16 changed files with 505 additions and 11 deletions.
486 changes: 486 additions & 0 deletions MiniGame/mainGame.py

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@ svl
===

Optimisation du placement de valves dans un réseau hydraulique

===
Voici le code et les document du groupe5:

Pour lancer l'interface graphique:
- cd src/graphical_interface
- python graphical_interface.py

Pour un simple test de chaque algorithme sur le réseau de Ferrara en console:
- cd src/
- python test.py
(l'exécution prend +-6 minutes par algo)

Les autres fichiers .dot sont des réseaux déjà représentés
sur l'interface graphique.
Binary file added images/endsim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mainmenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/hydraulic_network/__init__.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/globalnetwork.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/networks.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/node.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/pipe.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/segmentgraph.pyc
Binary file not shown.
Binary file modified src/hydraulic_network/valve.pyc
Binary file not shown.
Binary file modified src/optimization/__init__.pyc
Binary file not shown.
Binary file modified src/optimization/backtracking.pyc
Binary file not shown.
Binary file modified src/optimization/genetic_algorithm.pyc
Binary file not shown.
Binary file modified src/optimization/simulated_annealing.pyc
Binary file not shown.
15 changes: 4 additions & 11 deletions src/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@

import time

def print_in_file(num, qual):
f = open('/home/dollars/Desktop/plouf.txt', 'a')
# total = 0.00
# for i in qual:
# total += i
f.write('{0} {1}\n'.format(num, qual))

if __name__=="__main__": #petit exemple
print("Test de Network")

Expand All @@ -22,7 +15,7 @@ def print_in_file(num, qual):
pattern = [(0,1) for i in range(myNetwork.network.nbrPipes*2)]

t0 = time.time()
test = GeneticAlgorithm(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation], print_in_file)
test = GeneticAlgorithm(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation])
print(time.time()-t0)

print(test.solution)
Expand All @@ -37,7 +30,7 @@ def print_in_file(num, qual):
print(myNetwork.segNetwork.str_segments())

t0 = time.time()
test = GeneticAlgorithmVariation(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation], print_in_file)
test = GeneticAlgorithmVariation(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation])
print(time.time()-t0)

print(test.solution)
Expand All @@ -52,7 +45,7 @@ def print_in_file(num, qual):
print(myNetwork.segNetwork.str_segments())

t0 = time.time()
test = SimulatedAnnealing(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation], print_in_file)
test = SimulatedAnnealing(pattern, [myNetwork.average_valves_per_segment, myNetwork.average_segment_size, myNetwork.standard_deviation_segment_size, myNetwork.nbr_valves, myNetwork.average_unintended_isolation])
print(time.time()-t0)

print(test.solution)
Expand All @@ -64,4 +57,4 @@ def print_in_file(num, qual):
print(myNetwork.nbr_valves())

print(myNetwork.segNetwork.str_valves())
print(myNetwork.segNetwork.str_segments())
print(myNetwork.segNetwork.str_segments())

0 comments on commit 80ad416

Please sign in to comment.