RsBundle  Changes On Branch garbage

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

Changes In Branch garbage Excluding Merge-Ins

This is equivalent to a diff from a7fd644048 to 4172eb9476

2023-05-07
15:28
sync: show time for master and subproblem evaluations check-in: 9522695066 user: fifr tags: mpi-cvx
15:21
sync: show time for master and subproblem evaluations Closed-Leaf check-in: 4172eb9476 user: fifr tags: garbage
2023-05-06
16:35
Merge check-in: a7fd644048 user: fifr tags: mpi-cvx
16:33
hkweighter: use `clamp` for weight computation. check-in: 0fc852f605 user: fifr tags: mpi-cvx
2023-04-30
11:02
Ignore vendor/ directory check-in: f75c260f25 user: fifr tags: mpi-cvx

Changes to src/solver/sync.rs.
394
395
396
397
398
399
400






401
402
403
404
405
406
407
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413







+
+
+
+
+
+







    /// Number of function evaluation.
    cnt_evals: usize,

    /// Time when the solution process started.
    ///
    /// This is actually the time of the last call to `Solver::init`.
    start_time: Instant,

    /// Time when the last master problem evaluation started.
    start_master_time: Instant,

    /// Time when the last subproblem evaluation started.
    start_eval_time: Instant,
}

impl<P, T, W, M> Solver<P, T, W, M>
where
    P: FirstOrderProblem,
    T: Terminator<SolverData> + Default,
    W: Weighter<SolverData> + Default,
433
434
435
436
437
438
439


440
441
442
443
444
445
446
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454







+
+







            client_rx: None,

            cnt_descent: 0,
            cnt_null: 0,
            cnt_evals: 0,

            start_time: Instant::now(),
            start_master_time: Instant::now(),
            start_eval_time: Instant::now(),
        }
    }

    /// Return the underlying threadpool.
    ///
    /// In order to use the same threadpool for concurrent processes,
    /// just clone the returned `ThreadPool`.
612
613
614
615
616
617
618

619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637

638



639
640
641
642
643
644
645
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647

648
649
650
651
652
653
654
655
656
657







+



















+
-
+
+
+







    pub fn solve_iter(&mut self, niter: usize) -> Result<bool, P, M> {
        debug!("Start solving up to {} iterations", niter);

        if let Some(ref mut master_proc) = self.master_proc {
            // Continue the solution process, start with a new master
            // problem evaluation.
            if !self.data.cur_val.is_infinite() {
                self.start_master_time = Instant::now();
                master_proc.solve(self.data.cur_val)?;
            }
        } else {
            // No master problem, initialize solver.
            self.init()?;
        }

        self.reset_iteration_data(niter);

        loop {
            let msg = self.client_rx.as_ref().ok_or(Error::NotInitialized)?.recv()?;
            match msg {
                Message::Eval(m) => {
                    if self.handle_client_response(m)? {
                        return Ok(false);
                    }
                }
                Message::Update(_) => warn!("Ignore unexpected problem update message from client"),
                Message::Master(mresponse) => {
                    debug!(
                    debug!("Receive master response");
                        "Receive master response (time: {})",
                        self.start_master_time.elapsed().as_millis() as f64 / 1000.0
                    );
                    // Receive result (new candidate) from the master
                    if self.handle_master_response(mresponse)? {
                        return Ok(true);
                    }
                }
            }
        }
683
684
685
686
687
688
689
690




691
692
693
694
695
696
697
695
696
697
698
699
700
701

702
703
704
705
706
707
708
709
710
711
712







-
+
+
+
+







        // All subproblems have been evaluated, do a step.
        let nxt_ub = self.data.nxt_ubs.iter().sum::<Real>();
        let descent_bnd = Self::get_descent_bound(self.params.acceptance_factor, &self.data);

        self.data.nxt_val = nxt_ub;
        self.data.new_cutval = self.data.nxt_cutvals.iter().sum::<Real>();

        debug!("Step");
        debug!(
            "Step (time: {)",
            self.start_eval_time.elapsed().as_millis() as f64 / 1000.0
        );
        debug!("  cur_val    ={}", self.data.cur_val);
        debug!("  nxt_mod    ={}", self.data.nxt_mod);
        debug!("  nxt_ub     ={}", nxt_ub);
        debug!("  descent_bnd={}", descent_bnd);

        self.data.updated = false;
        let step;
741
742
743
744
745
746
747

748
749
750
751
752
753
754
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770







+







        if self.update_problem(step)? {
            self.data.updated = true;
        }

        if self.data.cnt_iter < self.data.max_iter {
            // Compute the new candidate. The main loop will wait for the result of
            // this solution process of the master problem.
            self.start_master_time = Instant::now();
            self.master_proc.as_mut().unwrap().solve(self.data.cur_val)?;
            Ok(false)
        } else {
            Ok(true)
        }
    }

807
808
809
810
811
812
813

814
815
816
817
818
819
820
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837







+







        self.data
            .nxt_cutvals
            .resize(self.problem.num_subproblems(), -Real::infinity());
        self.data.cnt_remaining_mins = self.problem.num_subproblems();

        // Start evaluation of all subproblems at the new candidate.
        let client_tx = self.client_tx.as_ref().ok_or(Error::NotInitialized)?;
        self.start_eval_time = Instant::now();
        for i in 0..self.problem.num_subproblems() {
            self.problem
                .evaluate(
                    i,
                    self.data.nxt_y.clone(),
                    ChannelResultSender::new(i, client_tx.clone()),
                )