diff --git a/examples/facility.rs b/examples/facility.rs index f74cbb4..728a8dc 100644 --- a/examples/facility.rs +++ b/examples/facility.rs @@ -43,8 +43,8 @@ fn main() { }) .collect(); - let expr = Zip::new((open.iter().chain(transport.iter().flatten()), - fixed_costs.iter().chain(trans_costs.iter().flatten()))) + let expr = Zip::new((open.iter().chain(Itertools::flatten(transport.iter())), + fixed_costs.iter().chain(Itertools::flatten(trans_costs.iter())))) .fold(LinExpr::new(), |expr, (x, &c)| expr + c * x); model.set_objective(expr, Minimize).unwrap(); model.update().unwrap(); diff --git a/examples/workforce/mod.rs b/examples/workforce/mod.rs index 828279c..e569767 100644 --- a/examples/workforce/mod.rs +++ b/examples/workforce/mod.rs @@ -50,7 +50,8 @@ pub fn make_model(env: &Env) -> Result { try!(model.update()); let objterm = pays.iter().map(|pay| repeat(pay).take(shifts.len())); - let objexpr = Zip::new((x.iter().flatten(), objterm.flatten())).fold(LinExpr::new(), |expr, (x, &c)| expr + c * x); + let objexpr = Zip::new((Itertools::flatten(x.iter()), Itertools::flatten(objterm))) + .fold(LinExpr::new(), |expr, (x, &c)| expr + c * x); try!(model.set_objective(objexpr, Minimize)); for (s, (shift, &requirement)) in shifts.iter().zip(shift_requirements.iter()).enumerate() {