This commit is contained in:
Leonie Gallois 2020-12-11 13:34:04 +01:00
parent 33181d550a
commit e584f30f74
4 changed files with 23 additions and 11 deletions

View file

@ -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/

View file

@ -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

View file

@ -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

View file

@ -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
()