216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
/// The first order problem.
problem: P,
/// The algorithm data.
data: SolverData,
/// The master problem process.
master: Option<MasterProcess<P, M::MasterProblem>>,
/// The channel to receive the evaluation results from subproblems.
client_tx: Option<ClientSender<P>>,
/// The channel to receive the evaluation results from subproblems.
client_rx: Option<ClientReceiver<P>>,
|
|
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
/// The first order problem.
problem: P,
/// The algorithm data.
data: SolverData,
/// The master problem process.
master_proc: Option<MasterProcess<P, M::MasterProblem>>,
/// The channel to receive the evaluation results from subproblems.
client_tx: Option<ClientSender<P>>,
/// The channel to receive the evaluation results from subproblems.
client_rx: Option<ClientReceiver<P>>,
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
expected_progress: 0.0,
sgnorm: 0.0,
cur_weight: 1.0,
},
threadpool: ThreadPool::with_name("Parallel bundle solver".to_string(), num_cpus::get()),
master_builder: M::default(),
master: None,
client_tx: None,
client_rx: None,
cnt_descent: 0,
cnt_null: 0,
cnt_evals: 0,
|
|
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
expected_progress: 0.0,
sgnorm: 0.0,
cur_weight: 1.0,
},
threadpool: ThreadPool::with_name("Parallel bundle solver".to_string(), num_cpus::get()),
master_builder: M::default(),
master_proc: None,
client_tx: None,
client_rx: None,
cnt_descent: 0,
cnt_null: 0,
cnt_evals: 0,
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
.map(|ub| ub.len() != n)
.unwrap_or(false)
{
return Err(Error::Dimension("upper bounds".to_string()));
}
debug!("Start master process");
self.master = Some(MasterProcess::start(
self.master_builder
.build()
.map_err(|err| Error::BuildMaster(err.into()))?,
master_config,
&mut self.threadpool,
));
|
|
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
.map(|ub| ub.len() != n)
.unwrap_or(false)
{
return Err(Error::Dimension("upper bounds".to_string()));
}
debug!("Start master process");
self.master_proc = Some(MasterProcess::start(
self.master_builder
.build()
.map_err(|err| Error::BuildMaster(err.into()))?,
master_config,
&mut self.threadpool,
));
|
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
///
/// If this function is called again, the solution process is
/// continued from the previous point. Because of this one *must*
/// call `init()` before the first call to this function.
pub fn solve_iter(&mut self, niter: usize) -> Result<bool, Error<P::Err>> {
debug!("Start solving up to {} iterations", niter);
let master = self.master.as_mut().ok_or(Error::NotInitialized)?;
let client_tx = self.client_tx.as_ref().ok_or(Error::NotInitialized)?;
let client_rx = self.client_rx.as_ref().ok_or(Error::NotInitialized)?;
let mut cnt_iter = 0;
let mut cnt_updates = 0;
let mut nxt_ubs = vec![Real::infinity(); self.problem.num_subproblems()];
let mut cnt_remaining_ubs = self.problem.num_subproblems();
|
|
|
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
///
/// If this function is called again, the solution process is
/// continued from the previous point. Because of this one *must*
/// call `init()` before the first call to this function.
pub fn solve_iter(&mut self, niter: usize) -> Result<bool, Error<P::Err>> {
debug!("Start solving up to {} iterations", niter);
let master = self.master_proc.as_mut().ok_or(Error::NotInitialized)?;
let client_tx = self.client_tx.as_ref().ok_or(Error::NotInitialized)?;
let client_rx = self.client_rx.as_ref().ok_or(Error::NotInitialized)?;
let mut cnt_iter = 0;
let mut cnt_updates = 0;
let mut nxt_ubs = vec![Real::infinity(); self.problem.num_subproblems()];
let mut cnt_remaining_ubs = self.problem.num_subproblems();
|