 trace (str ++ ": " ++ show x) x


findOptimalObjectiveStates ::
  (Vec.Zipper vec,Ord a,Vec.Storage vec Bool,Show (vec Bool),
   Vec.Singleton vec,Show (vec a),RealFloat a,Show a,
   Arith.Sum a,
   Vec.Walker vec,
   Vec.Storage vec a) =>
  Balance.StateForcing ->
  Type.InterpolationOfAllStates node vec a -> Map Idx.State (Sig.UTSignal vec Bool)
findOptimalObjectiveStates statForcing interpolation =
  Map.map (g . f . Type.optObjectiveSignalOfState) interpolation
  where opt = genOptimalObjectiveSignal interpolation
        f = forceOptimalStateSignal statForcing opt
        g = Sig.zipWith (==) opt


findOptimalObjectiveStates ::
  (Vec.Zipper vec,Ord a,Vec.Storage vec Bool,Show (vec Bool),
   Vec.Singleton vec,Show (vec a),RealFloat a,Show a,
   Arith.Sum a,
   Vec.Walker vec,
   Vec.Storage vec a) =>
  Balance.StateForcing ->
  Type.InterpolationOfAllStates node vec a -> Map Idx.State (Sig.UTSignal vec Bool)
findOptimalObjectiveStates statForcing interpolation =
  Map.map (g . f . Type.optObjectiveSignalOfState) interpolation
  where opt = genOptimalObjectiveSignal interpolation
        f = forceOptimalStateSignal statForcing opt
        g = Sig.zipWith (==) opt
findOptimalObjectiveStates statForcing interpolation =
  Map.map (g . f . Type.optObjectiveSignalOfState) interpolation
  where opt = genOptimalObjectiveSignal interpolation
        f = forceOptimalStateSignal statForcing opt
        g = Sig.zipWith (==) opt