533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
self.pool = Some(pool);
}
fn stop(&mut self) {
self.pool.take();
}
fn evaluate<S>(&mut self, i: usize, y: Arc<DVector>, tx: S) -> Result<()>
where
S: ResultSender<Self> + 'static,
{
if self.pool.is_none() {
self.start()
}
let sub = self.subs[i].clone();
let subdatas = self.subdatas.clone();
// Attention: `y` might be shorter than the set of active constraints
// because evaluation and problem update are not synchronized, i.e. the
|
|
<
<
<
|
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
|
self.pool = Some(pool);
}
fn stop(&mut self) {
self.pool.take();
}
fn evaluate(&mut self, i: usize, y: Arc<DVector>, tx: impl ResultSender<Self> + 'static) -> Result<()> {
if self.pool.is_none() {
self.start()
}
let sub = self.subs[i].clone();
let subdatas = self.subdatas.clone();
// Attention: `y` might be shorter than the set of active constraints
// because evaluation and problem update are not synchronized, i.e. the
|
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
}
Err(err) => tx.error(err).unwrap(),
}
});
Ok(())
}
fn update<U, S>(&mut self, state: U, tx: S) -> Result<()>
where
U: ParallelUpdateState<<Self::Minorant as Minorant>::Primal>,
S: UpdateSender<Self> + 'static,
{
if self.inactive_constraints.read().unwrap().is_empty() {
return Ok(());
}
let inactive_constraints = self.inactive_constraints.clone();
let active_constraints = self.active_constraints.clone();
let subdatas = self.subdatas.clone();
|
|
|
|
|
<
>
|
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
}
Err(err) => tx.error(err).unwrap(),
}
});
Ok(())
}
fn update(
&mut self,
state: impl ParallelUpdateState<<Self::Minorant as Minorant>::Primal>,
tx: impl UpdateSender<Self> + 'static,
) -> Result<()> {
if self.inactive_constraints.read().unwrap().is_empty() {
return Ok(());
}
let inactive_constraints = self.inactive_constraints.clone();
let active_constraints = self.active_constraints.clone();
let subdatas = self.subdatas.clone();
|