RsBundle  Check-in [8d95c5134e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:solver: Remove duplicate method `update_problem`.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d95c5134e4ccc6d2d45ec7e9b88ff01cff58deb
User & Date: fifr 2016-10-05 20:14:35.369
Context
2016-10-05
20:20
solver: Enlarge vectors when adding new variables. check-in: 039c268628 user: fifr tags: trunk
20:14
solver: Remove duplicate method `update_problem`. check-in: 8d95c5134e user: fifr tags: trunk
20:11
solver: Do not terminate of problem has been changed. check-in: 3248967d1a user: fifr tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/solver.rs.
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
            if changed && term == Step::Term { term = Step::Null }
            try!(self.update_problem(term));
            self.show_info(term);
            if term == Step::Term {
                break;
            }
        }
        Ok(())
    }

    /// Called to update the problem.
    ///
    /// Calling this function typically triggers the problem to
    /// separate new constraints depending on the current solution.
    fn update_problem(&mut self, term: Step) -> Result<()> {
        let state = UpdateState {minorants: &self.minorants, step: term};
        let updates = match self.problem.update(&state) {
            Ok(updates) => updates,
            Err(err) => return Err(Error::Update(Box::new(err))),
        };

        let mut newvars = Vec::with_capacity(updates.len());
        for u in updates {
            match u {
                Update::AddVariable{lower, upper} => {
                    newvars.push((lower, upper));
                },
            }
        }

        if !newvars.is_empty() {
            let mut problem = &mut self.problem;
            let minorants = &self.minorants;
            self.master.add_vars(&newvars, &mut move |fidx, minidx, vars| {
                problem.extend_subgradient(minorants[fidx][minidx].primal.as_ref().unwrap(), vars).unwrap()
            });
        }

        Ok(())
    }

    /// Called to update the problem.
    ///
    /// Calling this function typically triggers the problem to
    /// separate new constraints depending on the current solution.







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







509
510
511
512
513
514
515































516
517
518
519
520
521
522
            if changed && term == Step::Term { term = Step::Null }
            try!(self.update_problem(term));
            self.show_info(term);
            if term == Step::Term {
                break;
            }
        }































        Ok(())
    }

    /// Called to update the problem.
    ///
    /// Calling this function typically triggers the problem to
    /// separate new constraints depending on the current solution.