Skip to content

Commit e9dd51a

Browse files
committed
extra documentation
1 parent 84d155e commit e9dd51a

18 files changed

+84440
-78609
lines changed

examples/large_example_result.html

Lines changed: 19936 additions & 19183 deletions
Large diffs are not rendered by default.

examples/large_example_result.json

Lines changed: 64415 additions & 59389 deletions
Large diffs are not rendered by default.

src/core/entities/sendable_layout.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use crate::core::entities::layout::Layout;
33
use crate::core::insertion::node_blueprint::NodeBlueprint;
44
use crate::Instance;
55

6+
///Representation of a layout that can be sent across threads
7+
68
#[derive(Debug, Clone)]
79
pub struct SendableLayout {
810
sheettype_id: usize,

src/core/insertion/insertion_blueprint.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use crate::core::insertion::node_blueprint::NodeBlueprint;
55
use crate::core::layout_index::LayoutIndex;
66
use crate::PartType;
77

8+
/// Representation of how a part can be inserted into a Node of a Layout
9+
/// Layouts can use InsertionBlueprints to insert parts
10+
811
#[derive(Debug, Clone)]
912
pub struct InsertionBlueprint<'a> {
1013
layout_i: LayoutIndex,

src/core/insertion/insertion_option.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ use crate::core::insertion::insertion_blueprint::InsertionBlueprint;
99
use crate::core::layout_index::LayoutIndex;
1010
use crate::optimization::problem::Problem;
1111

12+
/// Represents the possibility to insert a parttype into a node with a certain rotation
13+
/// Does not define how exactly, just that it is possible
14+
///
15+
/// InsertionOptions can generate InsertionBlueprints which define exactly how a part is inserted
16+
1217
#[derive(Debug, PartialEq, Eq)]
1318
pub struct InsertionOption<'a> {
1419
layout_i: LayoutIndex,
1520
original_node_i: Index,
1621
parttype: &'a PartType,
17-
rotation: Option<Rotation>,
22+
rotation: Option<Rotation>, // None means both rotations are possible
1823
}
1924

2025
impl<'a> InsertionOption<'a> {

src/core/insertion/node_blueprint.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use crate::core::cost::Cost;
66
use crate::core::entities::node::Node;
77
use crate::core::leftover_valuator;
88

9+
/// Represents a node in an InsertionBlueprint
10+
911
#[derive(Debug, Clone)]
1012
pub struct NodeBlueprint {
1113
width: u64,

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ fn main() {
8888

8989

9090
let handle = thread::Builder::new().name(thread_name).spawn(move || {
91-
let local_sol_collector = LocalSolCollector::new(rx_sync, tx_solution_report_thread);
91+
let local_sol_collector = LocalSolCollector::new(instance_thread.clone(), rx_sync, tx_solution_report_thread, COST_COMPARATOR);
9292
let mut gdrr = GDRR::new(&instance_thread, &config_thread, local_sol_collector);
9393
gdrr.lahc();
9494
});
9595
gdrr_thread_handlers.push(handle.expect("could not spawn thread"));
9696
}
9797

98-
let mut global_sol_collector = GlobalSolCollector::new(instance, config, tx_syncs, rx_solution_report);
98+
let mut global_sol_collector = GlobalSolCollector::new(instance, config, tx_syncs, rx_solution_report, COST_COMPARATOR);
9999

100100
global_sol_collector.monitor(gdrr_thread_handlers);
101101

src/optimization/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use serde::{Deserialize, Serialize};
22

3+
/// Contains all the configurable parameters of the algorithm
4+
35
#[derive(Serialize, Deserialize)]
46
#[serde(rename_all = "camelCase")]
57
pub struct Config {

src/optimization/gdrr.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ use crate::util::biased_sampler::{BiasedSampler, BiasMode};
2424
use crate::util::macros::timed_thread_println;
2525
use crate::util::util;
2626

27+
/// Goal-Driven Ruin and Recreate algorithm
28+
2729
pub struct GDRR<'a> {
2830
config: &'a Config,
2931
instance: &'a Instance,
@@ -47,6 +49,7 @@ impl<'a> GDRR<'a> {
4749
}
4850
}
4951

52+
// Late Acceptance Hill Climbing metaheuristic
5053
pub fn lahc(&'a mut self) {
5154
let start_time = std::time::Instant::now();
5255

src/optimization/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::core::entities::sheettype::SheetType;
33
use crate::util::assertions;
44

55
#[derive(Debug)]
6-
/// Instance is a static representation of a collection of parts and sheets to be optimized.
6+
/// Instance is a immutable representation of the collection of parts and sheets that need to be optimized.
77
pub struct Instance {
88
parts: Vec<(PartType, usize)>,
99
sheets: Vec<(SheetType, usize)>,

0 commit comments

Comments
 (0)