solution2assignment :: Environment -> Solution -> Maybe Assignment
solution2assignment env (Solution sol) =
  let lookup = flip BM.lookup (bimap env)
  in Just
     $ sortBy (comparing (jobID . fst))
     $ sortBy (comparing (vmIndex . fst))
     $ map swap
     $ mapMaybe lookup sol
solution2assignment :: Environment -> Solution -> Maybe Assignment
solution2assignment env (Solution sol) =
  let lookup = flip BM.lookup (bimap env)
  in Just
     $ sortBy (comparing (jobID . fst))
     $ sortBy (comparing (vmIndex . fst))
     $ map swap
     $ mapMaybe lookup sol
solution2assignment env (Solution sol) =
  let lookup = flip BM.lookup (bimap env)
  in Just
     $ sortBy (comparing (jobID . fst))
     $ sortBy (comparing (vmIndex . fst))
     $ map swap
     $ mapMaybe lookup sol