Commit 001cf6e2 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

found pb

parent f57ad96b
Pipeline #1681 passed with stages
in 34 seconds
......@@ -180,11 +180,15 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
let comp_exp target s (f,df,ddf) =
Format.printf "f: %a df: %a ddf:%a@." P.print f P.print f P.print ddf;
match to_float ~smp:s f ,to_float ~smp:s df, to_float ~smp:s ddf with
Some v,Some dv,Some ddv -> -. dv /. v -.target , -.ddv /. v +. dv*.dv /. (v*.v)
| _ -> failwith "fail to evaluate"
let comp_lim (cl,dl,vl) (dcl,ddl,dvl) =
let print_dom f (i,j,v) =
Format.printf "dom: %i,%i,%s" i j (F.to_string v)
let comp_lim_inf (cl,dl,vl) (dcl,ddl,dvl) =
(*Format.printf "dom1: %i,%i,%s, dom2: %i:%i:%s@." cl dl (F.to_string vl) dcl ddl (F.to_string dvl);*)
if dcl - cl < 0 then F.zero
else if dcl -cl = 0 then (
......@@ -192,7 +196,16 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
else if ddl-dl = 0 then F.sub F.zero (F.div dvl vl)
else F.infinity
) else F.infinity
let comp_lim_zero_p (cl,dl,vl) (dcl,ddl,dvl) =
(* cl mal calculer *)
if dcl - cl > 0 then F.zero
else if dcl -cl = 0 then (
if ddl - dl > 0 then F.zero
else if ddl-dl = 0 then F.sub F.zero (F.div dvl vl)
else F.infinity
) else F.infinity
let compute_s expected_duration weights rg =
let svar = var_of_int (nb_var-1) in
(* Weight in initial location *)
......@@ -204,8 +217,8 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
(* computing limit for s -> -infty and s -> + infty *)
let low_w,high_w = dominating_s w in
let low_dw,high_dw = dominating_s dw in
let liminf = F.to_float @@ comp_lim low_w low_dw in
let limsup = F.to_float @@ comp_lim high_w high_dw in
let liminf = F.to_float @@ comp_lim_inf low_w low_dw in
let limsup = F.to_float @@ comp_lim_inf high_w high_dw in
let compv s =
(*Format.printf "test s: %g@." s;*)
......@@ -216,10 +229,20 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
(*Format.printf "vte: %a@." P.print we;*)
let de = taylor_exp_s dw (rg.nb_poly+1) in
let dde = taylor_exp_s ddw (rg.nb_poly+2) in
let w0 = apply_const ~smp:s we svar (F.of_float s) in
let d0 = apply_const ~smp:s de svar (F.of_float s) in
let dd0 = apply_const ~smp:s dde svar (F.of_float s) in
w0,d0,dd0
if s=0.0 then
let _,low_we = dominating_s we in
let _,low_dw = dominating_s de in
let lim = comp_lim_zero_p low_we low_dw in
(*Format.printf "f: %a df: %a ddf:%a@." P.print we P.print de P.print dde;
Format.printf "dominating f: %a df: %a -> %s@." print_dom low_we print_dom low_dw (F.to_string lim);*)
(P.const F.one, P.const lim, P.const F.one)
else
let w0 = apply_const ~smp:s we svar (F.of_float s) in
let d0 = apply_const ~smp:s de svar (F.of_float s) in
let dd0 = apply_const ~smp:s dde svar (F.of_float s) in
w0,d0,dd0
else w,dw,ddw in
comp_exp expected_duration s calc in
......@@ -236,6 +259,7 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
)
(* ----------------------- Sampling -----------------------------------------*)
(* State instantiation for simulation
!! first element of the array is the first clock not the var 0 *)
type state = int* float array
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment