@jetta/cargo-stabilizer 0.1.0-3 → 0.1.0-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/README.md +51 -11
- package/build/core/adapters/axle_adapter.d.ts +4 -4
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +7 -5
- package/build/core/adapters/coordinate_mapper.d.ts +5 -5
- package/build/core/adapters/coordinate_mapper.d.ts.map +1 -1
- package/build/core/adapters/coordinate_mapper.js +11 -11
- package/build/core/adapters/empty_space_adapter.d.ts +10 -0
- package/build/core/adapters/empty_space_adapter.d.ts.map +1 -0
- package/build/core/adapters/empty_space_adapter.js +24 -0
- package/build/core/adapters/map_item_to_positioned_cube.d.ts +9 -0
- package/build/core/adapters/map_item_to_positioned_cube.d.ts.map +1 -0
- package/build/core/adapters/map_item_to_positioned_cube.js +16 -0
- package/build/core/adapters/stability_adapter.d.ts +1 -1
- package/build/core/adapters/stability_adapter.d.ts.map +1 -1
- package/build/core/adapters/stability_adapter.js +1 -1
- package/build/core/candidates/build_candidate_context.d.ts +1 -1
- package/build/core/candidates/build_candidate_context.d.ts.map +1 -1
- package/build/core/candidates/build_candidate_context.js +3 -1
- package/build/core/candidates/candidate_context.d.ts +4 -1
- package/build/core/candidates/candidate_context.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.d.ts +1 -1
- package/build/core/candidates/candidate_generator.d.ts.map +1 -1
- package/build/core/candidates/candidate_generator.js +19 -16
- package/build/core/candidates/candidate_validation.d.ts +0 -12
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +32 -26
- package/build/core/candidates/enumerate_empty_space_slots.d.ts +15 -0
- package/build/core/candidates/enumerate_empty_space_slots.d.ts.map +1 -0
- package/build/core/candidates/enumerate_empty_space_slots.js +44 -0
- package/build/core/candidates/rank_candidates.d.ts.map +1 -1
- package/build/core/candidates/rank_candidates.js +3 -0
- package/build/core/evaluation/evaluation_context.d.ts +3 -1
- package/build/core/evaluation/evaluation_context.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.d.ts +12 -1
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +28 -5
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts +4 -0
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts.map +1 -0
- package/build/core/exceptions/InvalidStabilizerOutputError.js +6 -0
- package/build/core/factory/read_stabilizer_config.d.ts +4 -2
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config.js +6 -25
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +28 -0
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -0
- package/build/core/factory/read_stabilizer_config_helpers.js +62 -0
- package/build/core/filters/loose_item_filter.d.ts +2 -2
- package/build/core/filters/loose_item_filter.d.ts.map +1 -1
- package/build/core/filters/loose_item_filter.js +3 -3
- package/build/core/geometry/box_geometry.d.ts +17 -1
- package/build/core/geometry/box_geometry.d.ts.map +1 -1
- package/build/core/geometry/box_geometry.js +67 -2
- package/build/core/move/apply_move.d.ts +1 -1
- package/build/core/move/apply_move.d.ts.map +1 -1
- package/build/core/move/apply_move.js +1 -1
- package/build/core/orchestration/StabilizerFlow.d.ts +2 -1
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
- package/build/core/orchestration/StabilizerFlow.js +2 -2
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts +13 -0
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts.map +1 -0
- package/build/core/orchestration/build_milkrun_bands_from_config.js +14 -0
- package/build/core/orchestration/build_reorder_context.d.ts +1 -1
- package/build/core/orchestration/build_reorder_context.d.ts.map +1 -1
- package/build/core/orchestration/build_reorder_context.js +7 -7
- package/build/core/orchestration/read_primary_env.d.ts +9 -0
- package/build/core/orchestration/read_primary_env.d.ts.map +1 -0
- package/build/core/orchestration/read_primary_env.js +13 -0
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +3 -3
- package/build/core/strategies/reorder/GeneticReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GravityCompaction.d.ts +1 -1
- package/build/core/strategies/reorder/GravityCompaction.d.ts.map +1 -1
- package/build/core/strategies/reorder/GravityCompaction.js +2 -2
- package/build/core/strategies/reorder/GreedyReorder.d.ts +1 -1
- package/build/core/strategies/reorder/GreedyReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/ReorderStrategy.d.ts +3 -1
- package/build/core/strategies/reorder/ReorderStrategy.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/anneal_helpers.d.ts +1 -1
- package/build/core/strategies/reorder/anneal_helpers.d.ts.map +1 -1
- package/build/core/strategies/reorder/anneal_helpers.js +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts +1 -1
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts.map +1 -1
- package/build/core/strategies/reorder/beam_context.d.ts +1 -1
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts.map +1 -1
- package/build/core/strategies/reorder/genetic/Chromosome.js +2 -2
- package/build/core/strategies/reorder/greedy_improvement.d.ts +1 -1
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +2 -2
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +21 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +27 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts +14 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -0
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +34 -0
- package/build/core/validation/contract/format_zod_error.d.ts +8 -0
- package/build/core/validation/contract/format_zod_error.d.ts.map +1 -0
- package/build/core/validation/contract/format_zod_error.js +11 -0
- package/build/core/validation/contract/index.d.ts +9 -0
- package/build/core/validation/contract/index.d.ts.map +1 -0
- package/build/core/validation/contract/index.js +8 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts +3 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -0
- package/build/core/validation/contract/map_contract_to_wire_shape.js +28 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts +2 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +62 -0
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +45 -0
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -0
- package/build/core/validation/contract/parse_stabilizer_input.js +26 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +47 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -0
- package/build/core/validation/contract/parse_stabilizer_output.js +24 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +92 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_domain_schema.js +61 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +33 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_input_schema.js +11 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +70 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_output_schema.js +16 -0
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts +20 -0
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts.map +1 -0
- package/build/core/validation/contract/wire_mapper_record_utils.js +36 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +4 -1
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +4 -1
- package/build/core/waypoint/build_waypoint_zones.d.ts +1 -1
- package/build/core/waypoint/build_waypoint_zones.d.ts.map +1 -1
- package/build/core/waypoint/build_waypoint_zones.js +2 -2
- package/build/core/waypoint/milkrun_wall_reservation.d.ts +24 -0
- package/build/core/waypoint/milkrun_wall_reservation.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation.js +57 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts +15 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation_helpers.js +48 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts +16 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts.map +1 -0
- package/build/core/waypoint/milkrun_wall_reservation_types.js +1 -0
- package/build/core/waypoint/preserves_waypoint_order.d.ts +1 -1
- package/build/core/waypoint/preserves_waypoint_order.d.ts.map +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts +1 -1
- package/build/core/waypoint/validate_waypoint_ids.d.ts.map +1 -1
- package/build/index.d.ts +15 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +30 -7
- package/package.json +1 -1
- package/build/core/validation/parse_stabilizer_input.d.ts +0 -8
- package/build/core/validation/parse_stabilizer_input.d.ts.map +0 -1
- package/build/core/validation/parse_stabilizer_input.js +0 -20
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts +0 -110
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts.map +0 -1
- package/build/core/validation/schemas/stabilizer_input_schema.js +0 -34
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts +0 -13
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts.map +0 -1
- package/build/core/validation/schemas/stabilizer_output_schema.js +0 -6
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { find_empty_spaces_in_container } from '../adapters/empty_space_adapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Enumerates candidate positions from empty-space regions where the item fits.
|
|
4
|
+
* @param container - Target container layout.
|
|
5
|
+
* @param item - Loose item dimensions.
|
|
6
|
+
* @param exclude_item_id - Item id to omit from obstacle list.
|
|
7
|
+
* @returns Slot positions at each fitting empty-space origin.
|
|
8
|
+
*/
|
|
9
|
+
export function enumerate_empty_space_slots(container, item, exclude_item_id) {
|
|
10
|
+
const spaces = find_empty_spaces_in_container(container, exclude_item_id);
|
|
11
|
+
const slots = [];
|
|
12
|
+
for (const space of spaces) {
|
|
13
|
+
if (!space_fits_item(space, item)) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
slots.push({
|
|
17
|
+
x: space.get_x(),
|
|
18
|
+
y: space.get_y(),
|
|
19
|
+
z: space.get_z()
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return dedupe_slots(slots);
|
|
23
|
+
}
|
|
24
|
+
function space_fits_item(space, item) {
|
|
25
|
+
return space.get_width() >= item.width - 1e-6 &&
|
|
26
|
+
space.get_height() >= item.height - 1e-6 &&
|
|
27
|
+
space.get_length() >= item.depth - 1e-6;
|
|
28
|
+
}
|
|
29
|
+
function dedupe_slots(slots) {
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
const unique = [];
|
|
32
|
+
for (const slot of slots) {
|
|
33
|
+
const key = `${round_coord(slot.x)}:${round_coord(slot.y)}:${round_coord(slot.z)}`;
|
|
34
|
+
if (seen.has(key)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
seen.add(key);
|
|
38
|
+
unique.push(slot);
|
|
39
|
+
}
|
|
40
|
+
return unique;
|
|
41
|
+
}
|
|
42
|
+
function round_coord(value) {
|
|
43
|
+
return Math.round(value * 1000) / 1000;
|
|
44
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rank_candidates.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/rank_candidates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"rank_candidates.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/rank_candidates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,CAqBlG"}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function rank_candidates(candidates, source_index) {
|
|
8
8
|
return candidates.sort((left, right) => {
|
|
9
|
+
if (left.new_position.y !== right.new_position.y) {
|
|
10
|
+
return left.new_position.y - right.new_position.y;
|
|
11
|
+
}
|
|
9
12
|
const same_left = left.target_container_index === source_index ? 0 : 1;
|
|
10
13
|
const same_right = right.target_container_index === source_index ? 0 : 1;
|
|
11
14
|
if (same_left !== same_right) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerEnv } from '../validation/
|
|
1
|
+
import type { StabilizerContainer, StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
3
3
|
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
4
4
|
import type { WaypointMode } from '../waypoint/WaypointMode.js';
|
|
5
|
+
import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation.js';
|
|
5
6
|
export interface StateEvaluationContext {
|
|
6
7
|
env: StabilizerEnv;
|
|
7
8
|
loose_items: LooseItemRef[];
|
|
8
9
|
config: StabilizerConfig;
|
|
9
10
|
waypoint_mode: WaypointMode;
|
|
10
11
|
baseline_containers: StabilizerContainer[];
|
|
12
|
+
milkrun_reserved_z_bands: MilkrunReservedBand[];
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=evaluation_context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation_context.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/evaluation_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"evaluation_context.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/evaluation_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AAC5G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAElF,MAAM,WAAW,sBAAsB;IAEnC,GAAG,EAAE,aAAa,CAAA;IAClB,WAAW,EAAE,YAAY,EAAE,CAAA;IAC3B,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,YAAY,CAAA;IAC3B,mBAAmB,EAAE,mBAAmB,EAAE,CAAA;IAC1C,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;CAClD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
import { type StabilityEvaluation } from '../adapters/stability_adapter.js';
|
|
3
3
|
import type { StateEvaluationContext } from './evaluation_context.js';
|
|
4
4
|
import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
|
|
@@ -8,6 +8,7 @@ export interface EvaluationResult {
|
|
|
8
8
|
transport_floor_valid: boolean;
|
|
9
9
|
axle_valid: boolean;
|
|
10
10
|
waypoint_valid: boolean;
|
|
11
|
+
milkrun_valid: boolean;
|
|
11
12
|
all_gates_pass: boolean;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -36,4 +37,14 @@ export declare function evaluation_context_from_reorder(context: ReorderContext)
|
|
|
36
37
|
* @returns Deep clone.
|
|
37
38
|
*/
|
|
38
39
|
export declare function clone_baseline(containers: StabilizerContainer[]): StabilizerContainer[];
|
|
40
|
+
/**
|
|
41
|
+
* Evaluates organization constraint gates without stability or axle checks.
|
|
42
|
+
* @param containers - Container layout to evaluate.
|
|
43
|
+
* @param context - Evaluation context.
|
|
44
|
+
* @returns Waypoint and milkrun gate flags.
|
|
45
|
+
*/
|
|
46
|
+
export declare function evaluate_organization_gates(containers: StabilizerContainer[], context: StateEvaluationContext): {
|
|
47
|
+
waypoint_valid: boolean;
|
|
48
|
+
milkrun_valid: boolean;
|
|
49
|
+
};
|
|
39
50
|
//# sourceMappingURL=state_evaluator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state_evaluator.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/state_evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"state_evaluator.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/state_evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,kCAAkC,CAAA;AAKzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAE9E,MAAM,WAAW,gBAAgB;IAE7B,SAAS,EAAE,mBAAmB,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,UAAU,EAAE,OAAO,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;IACtB,cAAc,EAAE,OAAO,CAAA;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,sBAAsB,GAChC,gBAAgB,CAUlB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,mBAAmB,EAAE,EAC5B,OAAO,EAAE,sBAAsB,GAChC,gBAAgB,CAGlB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,cAAc,GAAG,sBAAsB,CAU/F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAGvF;AAwBD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,sBAAsB,GAChC;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAMrD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { try_evaluate_transport_stability, sum_loose_item_scores } from '../adapters/stability_adapter.js';
|
|
2
2
|
import { is_axle_load_valid } from '../adapters/axle_adapter.js';
|
|
3
3
|
import { preserves_waypoint_order } from '../waypoint/preserves_waypoint_order.js';
|
|
4
|
+
import { is_layout_milkrun_valid } from '../waypoint/milkrun_wall_reservation.js';
|
|
4
5
|
import { clone_containers } from '../move/apply_move.js';
|
|
5
6
|
/**
|
|
6
7
|
* Evaluates a container layout against all stabilizer gates.
|
|
@@ -36,7 +37,8 @@ export function evaluation_context_from_reorder(context) {
|
|
|
36
37
|
loose_items: context.loose_items,
|
|
37
38
|
config: context.config,
|
|
38
39
|
waypoint_mode: context.waypoint_mode,
|
|
39
|
-
baseline_containers: context.baseline_containers
|
|
40
|
+
baseline_containers: context.baseline_containers,
|
|
41
|
+
milkrun_reserved_z_bands: context.milkrun_reserved_z_bands
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
@@ -50,15 +52,35 @@ export function clone_baseline(containers) {
|
|
|
50
52
|
function evaluate_gates(containers, context, stability) {
|
|
51
53
|
const objective = sum_loose_item_scores(stability, containers, context.loose_items);
|
|
52
54
|
const transport_floor_valid = stability.transport_score >= context.config.transport_stability_floor;
|
|
53
|
-
const axle_valid = is_axle_load_valid({ ...context.env, containers }, context.config.
|
|
54
|
-
const waypoint_valid =
|
|
55
|
-
const
|
|
55
|
+
const axle_valid = is_axle_load_valid({ ...context.env, containers }, context.config.axle_load_margin_percent);
|
|
56
|
+
const waypoint_valid = is_waypoint_order_valid(containers, context);
|
|
57
|
+
const milkrun_valid = is_layout_milkrun_valid(containers, context.milkrun_reserved_z_bands);
|
|
58
|
+
const flags = { transport_floor_valid, axle_valid, waypoint_valid, milkrun_valid };
|
|
56
59
|
return {
|
|
57
60
|
objective,
|
|
58
|
-
pass: transport_floor_valid && axle_valid && waypoint_valid,
|
|
61
|
+
pass: transport_floor_valid && axle_valid && waypoint_valid && milkrun_valid,
|
|
59
62
|
flags
|
|
60
63
|
};
|
|
61
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Evaluates organization constraint gates without stability or axle checks.
|
|
67
|
+
* @param containers - Container layout to evaluate.
|
|
68
|
+
* @param context - Evaluation context.
|
|
69
|
+
* @returns Waypoint and milkrun gate flags.
|
|
70
|
+
*/
|
|
71
|
+
export function evaluate_organization_gates(containers, context) {
|
|
72
|
+
return {
|
|
73
|
+
waypoint_valid: is_waypoint_order_valid(containers, context),
|
|
74
|
+
milkrun_valid: is_layout_milkrun_valid(containers, context.milkrun_reserved_z_bands)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function is_waypoint_order_valid(containers, context) {
|
|
78
|
+
if (context.waypoint_mode.kind === 'SINGLE_WAYPOINT' ||
|
|
79
|
+
!context.config.preserve_tie_block_organization) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return preserves_waypoint_order(context.baseline_containers, containers, context.waypoint_mode);
|
|
83
|
+
}
|
|
62
84
|
function invalid_evaluation_result() {
|
|
63
85
|
return {
|
|
64
86
|
stability: { item_scores: [], container_scores: [], transport_score: 0 },
|
|
@@ -66,6 +88,7 @@ function invalid_evaluation_result() {
|
|
|
66
88
|
transport_floor_valid: false,
|
|
67
89
|
axle_valid: false,
|
|
68
90
|
waypoint_valid: false,
|
|
91
|
+
milkrun_valid: false,
|
|
69
92
|
all_gates_pass: false
|
|
70
93
|
};
|
|
71
94
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidStabilizerOutputError.d.ts","sourceRoot":"","sources":["../../../src/core/exceptions/InvalidStabilizerOutputError.ts"],"names":[],"mappings":"AAAA,qBAAa,4BAA6B,SAAQ,KAAK;gBAEvC,OAAO,EAAE,MAAM;CAK9B"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
2
|
+
import type { StabilizerCargoState } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
3
|
/**
|
|
3
|
-
* Reads stabilizer config from cargo-movement config
|
|
4
|
+
* Reads stabilizer config from cargo-movement config and cargo profile algoritmo maps.
|
|
4
5
|
* @param config - Top-level stabilizer input config object.
|
|
6
|
+
* @param cargo_state - Cargo profile (optional) for merged algoritmo keys.
|
|
5
7
|
* @returns Parsed stabilizer configuration.
|
|
6
8
|
*/
|
|
7
|
-
export declare function read_stabilizer_config(config: Record<string, unknown> | undefined): StabilizerConfig;
|
|
9
|
+
export declare function read_stabilizer_config(config: Record<string, unknown> | undefined, cargo_state?: StabilizerCargoState): StabilizerConfig;
|
|
8
10
|
//# sourceMappingURL=read_stabilizer_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read_stabilizer_config.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,mDAAmD,CAAA;
|
|
1
|
+
{"version":3,"file":"read_stabilizer_config.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAG9F;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,WAAW,CAAC,EAAE,oBAAoB,GACnC,gBAAgB,CAYlB"}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { REORDER_STRATEGY } from '../constants/ReorderStrategy.js';
|
|
2
2
|
import { UnknownReorderStrategyError } from '../exceptions/UnknownReorderStrategyError.js';
|
|
3
3
|
import { stabilizer_config_schema } from '../validation/schemas/stabilizer_config_schema.js';
|
|
4
|
-
|
|
4
|
+
import { merge_algoritmo_maps, read_raw_stabilizer_config } from './read_stabilizer_config_helpers.js';
|
|
5
5
|
/**
|
|
6
|
-
* Reads stabilizer config from cargo-movement config
|
|
6
|
+
* Reads stabilizer config from cargo-movement config and cargo profile algoritmo maps.
|
|
7
7
|
* @param config - Top-level stabilizer input config object.
|
|
8
|
+
* @param cargo_state - Cargo profile (optional) for merged algoritmo keys.
|
|
8
9
|
* @returns Parsed stabilizer configuration.
|
|
9
10
|
*/
|
|
10
|
-
export function read_stabilizer_config(config) {
|
|
11
|
-
const algoritmo = (config
|
|
12
|
-
const raw =
|
|
13
|
-
reorder_strategy: read_config_string(algoritmo, 'reorder_strategy', REORDER_STRATEGY.GRAVITY),
|
|
14
|
-
transport_stability_floor: read_config_number(algoritmo, 'transport_stability_floor', 0),
|
|
15
|
-
max_iteration: read_config_number(algoritmo, 'max_iteration', 10),
|
|
16
|
-
genetic_population: read_config_number(algoritmo, 'genetic_population', 30),
|
|
17
|
-
genetic_generations: read_config_number(algoritmo, 'genetic_generations', 50),
|
|
18
|
-
genetic_mutation_rate: read_config_number(algoritmo, 'genetic_mutation_rate', 0.15),
|
|
19
|
-
beam_width: read_config_number(algoritmo, 'beam_width', 5),
|
|
20
|
-
beam_top_k: read_config_number(algoritmo, 'beam_top_k', 3),
|
|
21
|
-
folga_de_peso_nos_eixos: read_config_number(algoritmo, 'folga_de_peso_nos_eixos', 0)
|
|
22
|
-
};
|
|
11
|
+
export function read_stabilizer_config(config, cargo_state) {
|
|
12
|
+
const algoritmo = merge_algoritmo_maps(config, cargo_state);
|
|
13
|
+
const raw = read_raw_stabilizer_config(algoritmo);
|
|
23
14
|
const parsed = stabilizer_config_schema.safeParse(raw);
|
|
24
15
|
if (!parsed.success) {
|
|
25
16
|
throw new UnknownReorderStrategyError(String(raw.reorder_strategy));
|
|
@@ -27,16 +18,6 @@ export function read_stabilizer_config(config) {
|
|
|
27
18
|
assert_known_strategy(parsed.data.reorder_strategy);
|
|
28
19
|
return parsed.data;
|
|
29
20
|
}
|
|
30
|
-
function read_config_string(algoritmo, key, default_value) {
|
|
31
|
-
const full_key = CONFIG_PREFIX + key;
|
|
32
|
-
const value = algoritmo[full_key] ?? algoritmo[key];
|
|
33
|
-
return typeof value === 'string' ? value : default_value;
|
|
34
|
-
}
|
|
35
|
-
function read_config_number(algoritmo, key, default_value) {
|
|
36
|
-
const full_key = CONFIG_PREFIX + key;
|
|
37
|
-
const value = algoritmo[full_key] ?? algoritmo[key];
|
|
38
|
-
return typeof value === 'number' ? value : default_value;
|
|
39
|
-
}
|
|
40
21
|
function assert_known_strategy(strategy) {
|
|
41
22
|
const values = Object.values(REORDER_STRATEGY);
|
|
42
23
|
if (!values.includes(strategy)) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StabilizerCargoState } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Merges root and cargo profile algoritmo maps (profile overrides root).
|
|
4
|
+
* @param config - Root stabilizer input config.
|
|
5
|
+
* @param cargo_state - Cargo profile state.
|
|
6
|
+
* @returns Merged algoritmo map.
|
|
7
|
+
*/
|
|
8
|
+
export declare function merge_algoritmo_maps(config: Record<string, unknown> | undefined, cargo_state?: StabilizerCargoState): Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Reads raw stabilizer config fields from merged algoritmo map.
|
|
11
|
+
* @param algoritmo - Merged algoritmo configuration map.
|
|
12
|
+
* @returns Raw config object for schema parsing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function read_raw_stabilizer_config(algoritmo: Record<string, unknown>): {
|
|
15
|
+
reorder_strategy: string;
|
|
16
|
+
transport_stability_floor: number;
|
|
17
|
+
max_iteration: number;
|
|
18
|
+
genetic_population: number;
|
|
19
|
+
genetic_generations: number;
|
|
20
|
+
genetic_mutation_rate: number;
|
|
21
|
+
beam_width: number;
|
|
22
|
+
beam_top_k: number;
|
|
23
|
+
axle_load_margin_percent: number;
|
|
24
|
+
preserve_tie_block_organization: boolean;
|
|
25
|
+
enforce_milkrun_wall_reservation: boolean;
|
|
26
|
+
number_of_wall_to_allocate_from_last_waypoints: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=read_stabilizer_config_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_stabilizer_config_helpers.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config_helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAK9F;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,WAAW,CAAC,EAAE,oBAAoB,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;EAwB5E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { REORDER_STRATEGY } from '../constants/ReorderStrategy.js';
|
|
2
|
+
const CONFIG_PREFIX = 'cargo_stabilizer.';
|
|
3
|
+
const MILKRUN_WALL_COUNT_KEY = 'number_of_wall_to_allocate_from_last_waypoints';
|
|
4
|
+
/**
|
|
5
|
+
* Merges root and cargo profile algoritmo maps (profile overrides root).
|
|
6
|
+
* @param config - Root stabilizer input config.
|
|
7
|
+
* @param cargo_state - Cargo profile state.
|
|
8
|
+
* @returns Merged algoritmo map.
|
|
9
|
+
*/
|
|
10
|
+
export function merge_algoritmo_maps(config, cargo_state) {
|
|
11
|
+
const root_algoritmo = (config?.algoritmo ?? config ?? {});
|
|
12
|
+
const profile_config = cargo_state?.config;
|
|
13
|
+
const profile_algoritmo = (profile_config?.algoritmo ?? {});
|
|
14
|
+
return { ...root_algoritmo, ...profile_algoritmo };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads raw stabilizer config fields from merged algoritmo map.
|
|
18
|
+
* @param algoritmo - Merged algoritmo configuration map.
|
|
19
|
+
* @returns Raw config object for schema parsing.
|
|
20
|
+
*/
|
|
21
|
+
export function read_raw_stabilizer_config(algoritmo) {
|
|
22
|
+
return {
|
|
23
|
+
reorder_strategy: read_config_string(algoritmo, 'reorder_strategy', REORDER_STRATEGY.GRAVITY),
|
|
24
|
+
transport_stability_floor: read_config_number(algoritmo, 'transport_stability_floor', 0),
|
|
25
|
+
max_iteration: read_config_number(algoritmo, 'max_iteration', 10),
|
|
26
|
+
genetic_population: read_config_number(algoritmo, 'genetic_population', 30),
|
|
27
|
+
genetic_generations: read_config_number(algoritmo, 'genetic_generations', 50),
|
|
28
|
+
genetic_mutation_rate: read_config_number(algoritmo, 'genetic_mutation_rate', 0.15),
|
|
29
|
+
beam_width: read_config_number(algoritmo, 'beam_width', 5),
|
|
30
|
+
beam_top_k: read_config_number(algoritmo, 'beam_top_k', 3),
|
|
31
|
+
axle_load_margin_percent: read_config_number(algoritmo, 'folga_de_peso_nos_eixos', 0),
|
|
32
|
+
preserve_tie_block_organization: read_config_boolean(algoritmo, 'preserve_tie_block_organization', true),
|
|
33
|
+
enforce_milkrun_wall_reservation: read_config_boolean(algoritmo, 'enforce_milkrun_wall_reservation', false),
|
|
34
|
+
number_of_wall_to_allocate_from_last_waypoints: read_milkrun_wall_count(algoritmo)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function read_config_string(algoritmo, key, default_value) {
|
|
38
|
+
const full_key = CONFIG_PREFIX + key;
|
|
39
|
+
const value = algoritmo[full_key] ?? algoritmo[key];
|
|
40
|
+
return typeof value === 'string' ? value : default_value;
|
|
41
|
+
}
|
|
42
|
+
function read_config_number(algoritmo, key, default_value) {
|
|
43
|
+
const full_key = CONFIG_PREFIX + key;
|
|
44
|
+
const value = algoritmo[full_key] ?? algoritmo[key];
|
|
45
|
+
return typeof value === 'number' ? value : default_value;
|
|
46
|
+
}
|
|
47
|
+
function read_config_boolean(algoritmo, key, default_value) {
|
|
48
|
+
const full_key = CONFIG_PREFIX + key;
|
|
49
|
+
const value = algoritmo[full_key] ?? algoritmo[key];
|
|
50
|
+
return typeof value === 'boolean' ? value : default_value;
|
|
51
|
+
}
|
|
52
|
+
function read_milkrun_wall_count(algoritmo) {
|
|
53
|
+
const value = algoritmo[MILKRUN_WALL_COUNT_KEY];
|
|
54
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
55
|
+
return Math.max(0, Math.trunc(value));
|
|
56
|
+
}
|
|
57
|
+
if (typeof value === 'string') {
|
|
58
|
+
const parsed = Number.parseInt(value, 10);
|
|
59
|
+
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerItem } from '../validation/
|
|
1
|
+
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
export interface LooseItemRef {
|
|
3
3
|
item_id: string;
|
|
4
4
|
container_index: number;
|
|
@@ -6,7 +6,7 @@ export interface LooseItemRef {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* @param item - Item record from cargo_state.
|
|
9
|
-
* @returns True when item is loose (no
|
|
9
|
+
* @returns True when item is loose (no group_id).
|
|
10
10
|
*/
|
|
11
11
|
export declare function is_loose_item(item: StabilizerItem): boolean;
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loose_item_filter.d.ts","sourceRoot":"","sources":["../../../src/core/filters/loose_item_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"loose_item_filter.d.ts","sourceRoot":"","sources":["../../../src/core/filters/loose_item_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAExF,MAAM,WAAW,YAAY;IAEzB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,cAAc,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE;IAAE,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,EAAE,GAC1C,YAAY,EAAE,CAqBhB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param item - Item record from cargo_state.
|
|
3
|
-
* @returns True when item is loose (no
|
|
3
|
+
* @returns True when item is loose (no group_id).
|
|
4
4
|
*/
|
|
5
5
|
export function is_loose_item(item) {
|
|
6
|
-
return item.
|
|
6
|
+
return item.group_id === null || item.group_id === undefined;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Collects loose items across all containers in one env.
|
|
@@ -18,7 +18,7 @@ export function collect_loose_items(containers) {
|
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
loose_items.push({
|
|
21
|
-
item_id: item.
|
|
21
|
+
item_id: item.item_id,
|
|
22
22
|
container_index,
|
|
23
23
|
item
|
|
24
24
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerItem } from '../validation/
|
|
1
|
+
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
export interface AxisAlignedBox {
|
|
3
3
|
x: number;
|
|
4
4
|
y: number;
|
|
@@ -29,4 +29,20 @@ export declare function has_overlap(candidate: AxisAlignedBox, others: AxisAlign
|
|
|
29
29
|
* @returns True when candidate rests on container floor.
|
|
30
30
|
*/
|
|
31
31
|
export declare function is_on_floor(candidate: AxisAlignedBox): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @param candidate - Candidate placement box.
|
|
34
|
+
* @param container - Container dimensions.
|
|
35
|
+
* @returns True when candidate fits inside container bounds.
|
|
36
|
+
*/
|
|
37
|
+
export declare function is_inside_container(candidate: AxisAlignedBox, container: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
length: number;
|
|
41
|
+
}): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @param candidate - Candidate placement box.
|
|
44
|
+
* @param supporters - Existing item boxes (excluding candidate).
|
|
45
|
+
* @returns True when bottom face is on floor or supporter tops.
|
|
46
|
+
*/
|
|
47
|
+
export declare function is_fully_supported(candidate: AxisAlignedBox, supporters: AxisAlignedBox[]): boolean;
|
|
32
48
|
//# sourceMappingURL=box_geometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box_geometry.d.ts","sourceRoot":"","sources":["../../../src/core/geometry/box_geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"box_geometry.d.ts","sourceRoot":"","sources":["../../../src/core/geometry/box_geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAExF,MAAM,WAAW,cAAc;IAE3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAUhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAMlF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAGxF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CAG9D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D,OAAO,CAeT;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,OAAO,CAUnG"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
const GEOMETRY_EPSILON = 1e-6;
|
|
1
2
|
/**
|
|
2
3
|
* @param item - Cargo item with position and dimensions.
|
|
3
4
|
* @returns Axis-aligned bounding box.
|
|
4
5
|
*/
|
|
5
6
|
export function item_to_box(item) {
|
|
6
|
-
return {
|
|
7
|
+
return {
|
|
8
|
+
x: item.x,
|
|
9
|
+
y: item.y,
|
|
10
|
+
z: item.z,
|
|
11
|
+
w: item.width,
|
|
12
|
+
h: item.height,
|
|
13
|
+
d: item.depth
|
|
14
|
+
};
|
|
7
15
|
}
|
|
8
16
|
/**
|
|
9
17
|
* @param left - First box.
|
|
@@ -29,5 +37,62 @@ export function has_overlap(candidate, others) {
|
|
|
29
37
|
* @returns True when candidate rests on container floor.
|
|
30
38
|
*/
|
|
31
39
|
export function is_on_floor(candidate) {
|
|
32
|
-
return candidate.y <=
|
|
40
|
+
return candidate.y <= GEOMETRY_EPSILON;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @param candidate - Candidate placement box.
|
|
44
|
+
* @param container - Container dimensions.
|
|
45
|
+
* @returns True when candidate fits inside container bounds.
|
|
46
|
+
*/
|
|
47
|
+
export function is_inside_container(candidate, container) {
|
|
48
|
+
if (candidate.x < -GEOMETRY_EPSILON || candidate.y < -GEOMETRY_EPSILON || candidate.z < -GEOMETRY_EPSILON) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (candidate.x + candidate.w > container.width + GEOMETRY_EPSILON) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (candidate.y + candidate.h > container.height + GEOMETRY_EPSILON) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return candidate.z + candidate.d <= container.length + GEOMETRY_EPSILON;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param candidate - Candidate placement box.
|
|
61
|
+
* @param supporters - Existing item boxes (excluding candidate).
|
|
62
|
+
* @returns True when bottom face is on floor or supporter tops.
|
|
63
|
+
*/
|
|
64
|
+
export function is_fully_supported(candidate, supporters) {
|
|
65
|
+
if (is_on_floor(candidate)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return sample_bottom_support_points(candidate).every(point => is_support_point_supported(point, supporters));
|
|
69
|
+
}
|
|
70
|
+
function sample_bottom_support_points(candidate) {
|
|
71
|
+
const { x, y, z, w, d } = candidate;
|
|
72
|
+
const mid_x = x + w / 2;
|
|
73
|
+
const mid_z = z + d / 2;
|
|
74
|
+
return [
|
|
75
|
+
{ x, y, z },
|
|
76
|
+
{ x: x + w, y, z },
|
|
77
|
+
{ x, y, z: z + d },
|
|
78
|
+
{ x: x + w, y, z: z + d },
|
|
79
|
+
{ x: mid_x, y, z: mid_z }
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
function is_support_point_supported(point, supporters) {
|
|
83
|
+
if (point.y <= GEOMETRY_EPSILON) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return supporters.some(supporter => is_point_on_supporter_top(point, supporter));
|
|
87
|
+
}
|
|
88
|
+
function is_point_on_supporter_top(point, supporter) {
|
|
89
|
+
const top_y = supporter.y + supporter.h;
|
|
90
|
+
if (Math.abs(point.y - top_y) > GEOMETRY_EPSILON) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const within_x = point.x >= supporter.x - GEOMETRY_EPSILON &&
|
|
94
|
+
point.x <= supporter.x + supporter.w + GEOMETRY_EPSILON;
|
|
95
|
+
const within_z = point.z >= supporter.z - GEOMETRY_EPSILON &&
|
|
96
|
+
point.z <= supporter.z + supporter.d + GEOMETRY_EPSILON;
|
|
97
|
+
return within_x && within_z;
|
|
33
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
2
|
export interface MoveCandidate {
|
|
3
3
|
item_id: string;
|
|
4
4
|
source_container_index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply_move.d.ts","sourceRoot":"","sources":["../../../src/core/move/apply_move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"apply_move.d.ts","sourceRoot":"","sources":["../../../src/core/move/apply_move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAE7F,MAAM,WAAW,aAAa;IAE1B,OAAO,EAAE,MAAM,CAAA;IACf,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,UAAU,EAAE,mBAAmB,EAAE,EACjC,SAAS,EAAE,aAAa,GACzB,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAGzF"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function apply_move(containers, candidate) {
|
|
7
7
|
const source = containers[candidate.source_container_index];
|
|
8
|
-
const item_index = source.items.findIndex(item => item.
|
|
8
|
+
const item_index = source.items.findIndex(item => item.item_id === candidate.item_id);
|
|
9
9
|
if (item_index < 0) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { StabilizerInput
|
|
1
|
+
import type { StabilizerInput } from '../validation/contract/stabilizer_input_schema.js';
|
|
2
|
+
import type { StabilizerCargoState } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
3
|
/**
|
|
3
4
|
* Runs stabilizer flow on validated input.
|
|
4
5
|
* @param input - Raw stabilizer input.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAO9F;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,CAiBhF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,OAAO,GAAG,oBAAoB,CAI1F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse_stabilizer_input } from '../validation/parse_stabilizer_input.js';
|
|
1
|
+
import { parse_stabilizer_input } from '../validation/contract/parse_stabilizer_input.js';
|
|
2
2
|
import { read_stabilizer_config } from '../factory/read_stabilizer_config.js';
|
|
3
3
|
import { create_reorder_strategy } from '../factory/strategy_factory.js';
|
|
4
4
|
import { build_reorder_context } from './build_reorder_context.js';
|
|
@@ -9,7 +9,7 @@ import { stabilizer_logger } from '../logging/stabilizer_logger.js';
|
|
|
9
9
|
* @returns Updated cargo_state.
|
|
10
10
|
*/
|
|
11
11
|
export function run_stabilizer_flow(input) {
|
|
12
|
-
const config = read_stabilizer_config(input.config);
|
|
12
|
+
const config = read_stabilizer_config(input.config, input.cargo_state);
|
|
13
13
|
const context = build_reorder_context(input, config);
|
|
14
14
|
stabilizer_logger.debug('reorder_strategy=' + config.reorder_strategy);
|
|
15
15
|
stabilizer_logger.debug('container_count=' + context.containers.length +
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
3
|
+
import type { WaypointMode } from '../waypoint/WaypointMode.js';
|
|
4
|
+
import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation_types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Builds milkrun reserved bands when enforcement is enabled in config.
|
|
7
|
+
* @param baseline_containers - Baseline container layout.
|
|
8
|
+
* @param waypoint_mode - Resolved waypoint mode.
|
|
9
|
+
* @param config - Parsed stabilizer config.
|
|
10
|
+
* @returns Reserved Z bands (empty when milkrun enforcement is disabled).
|
|
11
|
+
*/
|
|
12
|
+
export declare function build_milkrun_bands_from_config(baseline_containers: StabilizerContainer[], waypoint_mode: WaypointMode, config: StabilizerConfig): MilkrunReservedBand[];
|
|
13
|
+
//# sourceMappingURL=build_milkrun_bands_from_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_milkrun_bands_from_config.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_milkrun_bands_from_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AAExF;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC3C,mBAAmB,EAAE,mBAAmB,EAAE,EAC1C,aAAa,EAAE,YAAY,EAC3B,MAAM,EAAE,gBAAgB,GACzB,mBAAmB,EAAE,CAMvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { build_milkrun_reserved_z_bands } from '../waypoint/milkrun_wall_reservation.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds milkrun reserved bands when enforcement is enabled in config.
|
|
4
|
+
* @param baseline_containers - Baseline container layout.
|
|
5
|
+
* @param waypoint_mode - Resolved waypoint mode.
|
|
6
|
+
* @param config - Parsed stabilizer config.
|
|
7
|
+
* @returns Reserved Z bands (empty when milkrun enforcement is disabled).
|
|
8
|
+
*/
|
|
9
|
+
export function build_milkrun_bands_from_config(baseline_containers, waypoint_mode, config) {
|
|
10
|
+
const wall_count = config.enforce_milkrun_wall_reservation
|
|
11
|
+
? config.number_of_wall_to_allocate_from_last_waypoints
|
|
12
|
+
: 0;
|
|
13
|
+
return build_milkrun_reserved_z_bands(baseline_containers, waypoint_mode, wall_count);
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerInput } from '../validation/
|
|
1
|
+
import type { StabilizerInput } from '../validation/contract/stabilizer_input_schema.js';
|
|
2
2
|
import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
3
3
|
import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAQ9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACzB,cAAc,CAsBhB"}
|