RsBundle  Diff

Differences From Artifact [ae593954f6]:

  • File src/mcf/problem.rs — part of check-in [4c8b43ef8f] at 2022-03-28 10:21:30 on branch trunk — Merge release (user: fifr size: 18723) [more...]

To Artifact [01befe0aa0]:

  • File src/mcf/problem.rs — part of check-in [7c74440116] at 2022-06-08 20:19:21 on branch trunk — mcf::problem: fix selecting the user choosen mcf solver (user: fifr size: 18770)

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    /// The coefficient
    val: Real,
}

/// A single MMCF subproblem, i.e. one network.
struct Subproblem {
    /// The (net, cost) pair.
    net: mcf::NetSpxSolver,
    c: DVector,
}

/// Constraint data of one subproblem.
///
/// This information is used to create the augmented objective function, i.e.
/// cbase - lhs'* y as well as the constant term rhs' * y







|







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    /// The coefficient
    val: Real,
}

/// A single MMCF subproblem, i.e. one network.
struct Subproblem {
    /// The (net, cost) pair.
    net: Box<dyn mcf::Solver>,
    c: DVector,
}

/// Constraint data of one subproblem.
///
/// This information is used to create the augmented objective function, i.e.
/// cbase - lhs'* y as well as the constant term rhs' * y
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
                return Err(ExtraNodField);
            }
        }

        // read nodes
        let mut nets = Vec::with_capacity(ncom);
        for i in 0..ncom {
            nets.push(mcf::NetSpxSolver::new(i, nnodes)?)
        }
        for line in File::open(&format!("{}.sup", basename)).map(BufReader::new)?.lines() {
            let line = line?;
            let mut data = line.split_whitespace();
            let node = data.next().ok_or(MissingSupField("node"))?.parse::<usize>()?;
            let com = data.next().ok_or(MissingSupField("com"))?.parse::<usize>()?;
            let supply = data.next().ok_or(MissingSupField("supply"))?.parse::<Real>()?;







|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
                return Err(ExtraNodField);
            }
        }

        // read nodes
        let mut nets = Vec::with_capacity(ncom);
        for i in 0..ncom {
            nets.push(S::new(i, nnodes)?)
        }
        for line in File::open(&format!("{}.sup", basename)).map(BufReader::new)?.lines() {
            let line = line?;
            let mut data = line.split_whitespace();
            let node = data.next().ok_or(MissingSupField("node"))?.parse::<usize>()?;
            let com = data.next().ok_or(MissingSupField("com"))?.parse::<usize>()?;
            let supply = data.next().ok_or(MissingSupField("supply"))?.parse::<Real>()?;
340
341
342
343
344
345
346
347



348
349
350
351
352
353
354
            .zip(std::iter::once(rhs).chain(std::iter::repeat(dvec![])))
            .map(|((cbase, lhs), rhs)| SubData { lhs, rhs, cbase })
            .map(Arc::new)
            .collect();

        let subproblems = nets
            .into_iter()
            .map(|net| Subproblem { net, c: dvec![] })



            .map(RwLock::new)
            .map(Arc::new)
            .collect();

        Ok(MMCFProblem {
            subs: subproblems,
            subdatas,







|
>
>
>







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
            .zip(std::iter::once(rhs).chain(std::iter::repeat(dvec![])))
            .map(|((cbase, lhs), rhs)| SubData { lhs, rhs, cbase })
            .map(Arc::new)
            .collect();

        let subproblems = nets
            .into_iter()
            .map(|net| Subproblem {
                net: Box::new(net),
                c: dvec![],
            })
            .map(RwLock::new)
            .map(Arc::new)
            .collect();

        Ok(MMCFProblem {
            subs: subproblems,
            subdatas,