1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use crate::construction::constraints::ConstraintPipeline;
use crate::models::problem::*;
use crate::models::solution::{Registry, Route};
use hashbrown::HashMap;
use std::any::Any;
use std::sync::Arc;
pub type Extras = HashMap<String, Arc<dyn Any + Send + Sync>>;
pub struct Problem {
pub fleet: Arc<Fleet>,
pub jobs: Arc<Jobs>,
pub locks: Vec<Arc<Lock>>,
pub constraint: Arc<ConstraintPipeline>,
pub activity: Arc<dyn ActivityCost + Send + Sync>,
pub transport: Arc<dyn TransportCost + Send + Sync>,
pub objective: Arc<ObjectiveCost>,
pub extras: Arc<Extras>,
}
pub struct Solution {
pub registry: Registry,
pub routes: Vec<Route>,
pub unassigned: Vec<(Job, i32)>,
pub extras: Arc<Extras>,
}
pub enum LockOrder {
Any,
Sequence,
Strict,
}
#[derive(Clone)]
pub enum LockPosition {
Any,
Departure,
Arrival,
Fixed,
}
pub struct LockDetail {
pub order: LockOrder,
pub position: LockPosition,
pub jobs: Vec<Job>,
}
pub struct Lock {
pub condition: Arc<dyn Fn(&Actor) -> bool + Sync + Send>,
pub details: Vec<LockDetail>,
pub is_lazy: bool,
}
impl LockDetail {
pub fn new(order: LockOrder, position: LockPosition, jobs: Vec<Job>) -> Self {
Self { order, position, jobs }
}
}
impl Lock {
pub fn new(condition: Arc<dyn Fn(&Actor) -> bool + Sync + Send>, details: Vec<LockDetail>, is_lazy: bool) -> Self {
Self { condition, details, is_lazy }
}
}