RsBundle  Diff

Differences From Artifact [16b1460343]:

  • File src/mcf/problem.rs — part of check-in [4e64e6a06c] at 2019-07-25 14:50:22 on branch mmcf-separation — mmcf: add `set_separate_constraints` method (user: fifr size: 20318) [more...]

To Artifact [438a7ad4d0]:

  • File src/mcf/problem.rs — part of check-in [8cb260149c] at 2019-07-25 15:02:18 on branch problem-update — mmcf: fix some clippy warnings (user: fifr size: 20350) [more...]

279
280
281
282
283
284
285
286
287
288
289
290






291

292
293
294
295
296
297
298
279
280
281
282
283
284
285





286
287
288
289
290
291

292
293
294
295
296
297
298
299







-
-
-
-
-
+
+
+
+
+
+
-
+







            let mut data = line.split_whitespace();
            let mt = data.next().unwrap().parse::<usize>()? - 1;
            let cap = data.next().unwrap().parse::<Real>()?;
            rhs[mt] = cap;
        }

        // set lhs
        let mut lhs = vec![vec![vec![]; ncaps]; ncom];
        for fidx in 0..ncom {
            for i in 0..ncaps {
                lhs[fidx][i] = lhsidx[i][fidx].iter().map(|&j| Elem { ind: j, val: 1.0 }).collect();
            }
        let lhs = (0..ncom)
            .map(|fidx| {
                (0..ncaps)
                    .map(|i| lhsidx[i][fidx].iter().map(|&j| Elem { ind: j, val: 1.0 }).collect())
                    .collect::<Vec<_>>()
            })
        }
            .collect::<Vec<_>>();

        let subproblems = izip!(nets, cbase, lhs, iter::once(rhs).chain(iter::repeat(dvec![])))
            .map(|(net, cbase, lhs, rhs)| Subproblem {
                net,
                cbase,
                c: dvec![],
                lhs,
372
373
374
375
376
377
378
379
380


381
382
383
384
385
386
387
373
374
375
376
377
378
379


380
381
382
383
384
385
386
387
388







-
-
+
+







        if let Some((alpha, y)) = it.next() {
            x = y.borrow().iter().map(|yi| yi.scaled(alpha)).collect();
        } else {
            return vec![];
        }

        for (alpha, y) in it {
            for i in 0..x.len() {
                x[i].add_scaled(alpha, &y.borrow()[i]);
            for (x, y) in izip!(&mut x, y.borrow()) {
                x.add_scaled(alpha, y);
            }
        }

        x
    }
}