From 7c268e5739d537a7975771d1e9b74a44d4a3ba2e Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Thu, 12 Nov 2020 14:03:12 +0100 Subject: [PATCH] create ff algo functions definitions --- src/ffalgo.ml | 38 ++++++++++++++++++++++++++++++++++++++ src/ffalgo.mli | 9 +++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/ffalgo.ml create mode 100644 src/ffalgo.mli diff --git a/src/ffalgo.ml b/src/ffalgo.ml new file mode 100644 index 0000000..a71f235 --- /dev/null +++ b/src/ffalgo.ml @@ -0,0 +1,38 @@ +open Graph +open Printf +open Tools + +type 'a network = { + graph: 'a graph; + origin: id; + destination: id; +} + +type flow = { + current: int; + capacity: int; +} + +type path = (id * id) list + +(* int graph -> flow graph *) +let initialize_graph gr = gmap gr (fun c -> { current = 0; capacity = c }) + +(* flow graph -> int graph *) +let build_res_network gr = let gr_res = clone_nodes gr in + e_fold gr (fun g origin destination fl -> + let new_g = add_arc g origin destination (fl.capacity - fl.current) in + add_arc new_g destination origin fl.current ) gr_res + +(* int network -> path *) +let find_path network = assert false + +(* path -> int *) +let find_min path = assert false + +(* flow graph -> path -> aug -> flow graph *) +let apply_path graph path aug = assert false + + +let run_ff network = assert false + diff --git a/src/ffalgo.mli b/src/ffalgo.mli new file mode 100644 index 0000000..2f3f7db --- /dev/null +++ b/src/ffalgo.mli @@ -0,0 +1,9 @@ +open Graph + +type 'a network = { + graph: 'a graph; + origin: int; + destination: int; +} + +val run_ff: int network -> int \ No newline at end of file