diff --git a/Makefile b/Makefile index 5ed0d91..ec96651 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,17 @@ advanced: @echo "\n==== COMPILING ====\n" ocamlbuild ftest_advanced.native -demo: build +demo_advanced: build @echo "\n==== EXECUTING ====\n" - ./ftest.native graphs/graph1 1 2 outfile + ./ftest_advanced.native graphs/graph2 graphs/graph4 @echo "\n==== RESULT ==== (content of outfile) \n" - @cat outfile + @cat graphs/graph4 + +demo_basic: build + @echo "\n==== EXECUTING ====\n" + ./ftest_basic.native graphs/graph1 graphs/graph3 1 5 + @echo "\n==== RESULT ==== (content of outfile) \n" + @cat graphs/graph3 clean: -rm -rf _build/ diff --git a/src/BLF.ml b/src/BLF.ml index 5844a14..faa3feb 100644 --- a/src/BLF.ml +++ b/src/BLF.ml @@ -35,11 +35,17 @@ let blf gr id_src id_dest= |(id,(lcout,lcapa))::d-> (*let () = printf "id=%d, cout=%d, capacite=%d\n" id lcout lcapa in*) if lcapa <> 0 && (Int.add blf_tab.(a).cout lcout)<(blf_tab.(id).cout) then - begin + begin blf_tab.(id).cout<-(Int.add blf_tab.(a).cout lcout); blf_tab.(id).father<-a; if not (List.mem id file_marque) then loop_suc d blf_tab (id::file) else loop_suc d blf_tab file - end + end + (*else if lcapa <> 0 && (Int.add blf_tab.(a).cout lcout)=(blf_tab.(id).cout) && ((Random.int 2)=0) then + begin + blf_tab.(id).cout<-(Int.add blf_tab.(a).cout lcout); + blf_tab.(id).father<-a; + if not (List.mem id file_marque) then loop_suc d blf_tab (id::file) else loop_suc d blf_tab file + end*) else loop_suc d blf_tab file in loop_suc l_out_arc blf_tab b in blf_rec gr file_id file_marque diff --git a/src/ftest_advanced.ml b/src/ftest_advanced.ml index 7fbd929..fb51677 100644 --- a/src/ftest_advanced.ml +++ b/src/ftest_advanced.ml @@ -10,8 +10,8 @@ open Bp let () = (*/!\ Format de la commande pour lancer le test : - ./ftest.native [nom_fichier_lecture] [id_source] [id_dest] [nom_fichier_ecriture] - ex : ./ftest.native graphs/graph1 0 5 graphs/graph3 *) + ./ftest_advanced.native [nom_fichier_lecture] [nom_fichier_ecriture] + ex : ./ftest_advanced.native graphs/graph2 graphs/graph4 *) (* Check the number of command-line arguments *) if Array.length Sys.argv <> 3 then diff --git a/src/ftest_basic.ml b/src/ftest_basic.ml index 1f8c0ae..48f160b 100644 --- a/src/ftest_basic.ml +++ b/src/ftest_basic.ml @@ -10,8 +10,8 @@ open Bp let () = (*/!\ Format de la commande pour lancer le test : - ./ftest.native [nom_fichier_lecture] [id_source] [id_dest] [nom_fichier_ecriture] - ex : ./ftest.native graphs/graph1 0 5 graphs/graph3 *) + ./ftest_basic.native [nom_fichier_lecture] [nom_fichier_ecriture] [id_source] [id_dest] + ex : ./ftest_basic.native graphs/graph1 graphs/graph3 0 5 *) (* Check the number of command-line arguments *) if Array.length Sys.argv <> 5 then @@ -21,7 +21,7 @@ let () = end ; - (* Arguments are : infile(1) source-id(2) sink-id(3) outfile(4) *) + (* Arguments are : infile(1) outfile(2) source-id(3) sink-id(4) *) @@ -56,6 +56,6 @@ let () = (*Uncomment the following line if you have graphviz installed *) - (*let retour = command ("dot -Tsvg "^outfile^".dot > "^outfile^".svg") in *) + let retour = command ("dot -Tsvg "^outfile^".dot > "^outfile^".svg") in ()