Skip to content

Commit ad81492

Browse files
WIP: Commit progress on rosomaxa crate
1 parent 03be6ad commit ad81492

File tree

4 files changed

+6
-31
lines changed

4 files changed

+6
-31
lines changed

vrp-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@
8181
//! let problem = create_example_problem();
8282
//! let environment = Arc::new(Environment::default());
8383
//! // build solver to run 10 secs or 1000 generation
84-
//! let solver = EvolutionConfigBuilder::new(problem, environment)
84+
//! let solver = SolverBuilder::new(problem, environment)
8585
//! .with_max_time(Some(10))
86-
//! .with_max_generations(Some(1000))
86+
//! .with_max_generations(Some(10))
8787
//! .build()?;
8888
//! // run solver and get the best known solution within its cost.
8989
//! let (solution, cost, _) = solver.solve()?;

vrp-core/src/prelude.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//! This module reimports a common used types.
22
33
// Reimport core types
4+
pub use crate::solver::Solver;
5+
pub use crate::solver::SolverBuilder;
6+
47
pub use crate::models::Problem;
58
pub use crate::models::Solution;
69

vrp-core/src/solver/builder.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ use crate::solver::search::Recreate;
1818
/// ```
1919
/// # use vrp_core::models::examples::create_example_problem;
2020
/// # use std::sync::Arc;
21-
/// use vrp_core::solver::Builder;
22-
/// use vrp_core::models::Problem;
23-
/// use vrp_core::utils::Environment;
21+
/// use vrp_core::prelude::*;
2422
///
2523
/// // create your VRP problem
2624
/// let problem: Arc<Problem> = create_example_problem();

vrp-core/src/solver/mod.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -216,32 +216,6 @@ pub struct Solver {
216216
impl Solver {
217217
/// Solves a Vehicle Routing Problem and returns a _(solution, its cost)_ pair in case of success
218218
/// or error description, if solution cannot be found.
219-
///
220-
/// # Examples
221-
///
222-
/// The most simple way to run solver is to use [`Builder`](./struct.Builder.html)
223-
/// which has preconfigured settings:
224-
///
225-
/// ```
226-
/// # use vrp_core::models::examples::create_example_problem;
227-
/// # use std::sync::Arc;
228-
/// use rosomaxa::prelude::Environment;
229-
/// use vrp_core::solver::EvolutionConfigBuilder;
230-
/// use vrp_core::models::Problem;
231-
///
232-
/// // create your VRP problem
233-
/// let problem: Arc<Problem> = create_example_problem();
234-
/// let environment = Arc::new(Environment::default());
235-
/// // build solver using builder with default settings
236-
/// let solver = EvolutionConfigBuilder::new(problem, environment).build()?;
237-
/// // run solver and get the best known solution within its cost.
238-
/// let (solution, cost, _) = solver.solve()?;
239-
///
240-
/// assert_eq!(cost, 42.);
241-
/// assert_eq!(solution.routes.len(), 1);
242-
/// assert_eq!(solution.unassigned.len(), 0);
243-
/// # Ok::<(), String>(())
244-
/// ```
245219
pub fn solve(self) -> Result<(Solution, Cost, Option<TelemetryMetrics>), String> {
246220
let config = self.config;
247221
let environment = config.environment.clone();

0 commit comments

Comments
 (0)