@jetta/cargo-stabilizer 0.1.0-10
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 +39 -0
- package/README.md +144 -0
- package/build/core/adapters/axle_adapter.d.ts +16 -0
- package/build/core/adapters/axle_adapter.d.ts.map +1 -0
- package/build/core/adapters/axle_adapter.js +35 -0
- package/build/core/adapters/build_axle_request.d.ts +15 -0
- package/build/core/adapters/build_axle_request.d.ts.map +1 -0
- package/build/core/adapters/build_axle_request.js +39 -0
- package/build/core/adapters/coordinate_mapper.d.ts +36 -0
- package/build/core/adapters/coordinate_mapper.d.ts.map +1 -0
- package/build/core/adapters/coordinate_mapper.js +40 -0
- 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/run_axle_calculator.d.ts +16 -0
- package/build/core/adapters/run_axle_calculator.d.ts.map +1 -0
- package/build/core/adapters/run_axle_calculator.js +32 -0
- package/build/core/adapters/stability_adapter.d.ts +36 -0
- package/build/core/adapters/stability_adapter.d.ts.map +1 -0
- package/build/core/adapters/stability_adapter.js +61 -0
- package/build/core/candidates/build_candidate_context.d.ts +13 -0
- package/build/core/candidates/build_candidate_context.d.ts.map +1 -0
- package/build/core/candidates/build_candidate_context.js +17 -0
- package/build/core/candidates/candidate_context.d.ts +13 -0
- package/build/core/candidates/candidate_context.d.ts.map +1 -0
- package/build/core/candidates/candidate_context.js +1 -0
- package/build/core/candidates/candidate_generator.d.ts +9 -0
- package/build/core/candidates/candidate_generator.d.ts.map +1 -0
- package/build/core/candidates/candidate_generator.js +42 -0
- package/build/core/candidates/candidate_validation.d.ts +14 -0
- package/build/core/candidates/candidate_validation.d.ts.map +1 -0
- package/build/core/candidates/candidate_validation.js +72 -0
- package/build/core/candidates/collect_container_slots.d.ts +16 -0
- package/build/core/candidates/collect_container_slots.d.ts.map +1 -0
- package/build/core/candidates/collect_container_slots.js +20 -0
- 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/enumerate_supporter_top_slots.d.ts +11 -0
- package/build/core/candidates/enumerate_supporter_top_slots.d.ts.map +1 -0
- package/build/core/candidates/enumerate_supporter_top_slots.js +36 -0
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts +14 -0
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts.map +1 -0
- package/build/core/candidates/is_elevated_on_supporter_origin.js +28 -0
- package/build/core/candidates/rank_candidates.d.ts +9 -0
- package/build/core/candidates/rank_candidates.d.ts.map +1 -0
- package/build/core/candidates/rank_candidates.js +22 -0
- package/build/core/constants/ReorderStrategy.d.ts +11 -0
- package/build/core/constants/ReorderStrategy.d.ts.map +1 -0
- package/build/core/constants/ReorderStrategy.js +9 -0
- package/build/core/constants/TieRatioOrientation.d.ts +6 -0
- package/build/core/constants/TieRatioOrientation.d.ts.map +1 -0
- package/build/core/constants/TieRatioOrientation.js +5 -0
- package/build/core/evaluation/compute_reorder_objective.d.ts +13 -0
- package/build/core/evaluation/compute_reorder_objective.d.ts.map +1 -0
- package/build/core/evaluation/compute_reorder_objective.js +13 -0
- package/build/core/evaluation/evaluation_context.d.ts +14 -0
- package/build/core/evaluation/evaluation_context.d.ts.map +1 -0
- package/build/core/evaluation/evaluation_context.js +1 -0
- package/build/core/evaluation/state_evaluator.d.ts +50 -0
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -0
- package/build/core/evaluation/state_evaluator.js +95 -0
- package/build/core/exceptions/AxleCalculationError.d.ts +4 -0
- package/build/core/exceptions/AxleCalculationError.d.ts.map +1 -0
- package/build/core/exceptions/AxleCalculationError.js +6 -0
- package/build/core/exceptions/InvalidStabilizerInputError.d.ts +4 -0
- package/build/core/exceptions/InvalidStabilizerInputError.d.ts.map +1 -0
- package/build/core/exceptions/InvalidStabilizerInputError.js +6 -0
- 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/exceptions/MixedWaypointIdError.d.ts +4 -0
- package/build/core/exceptions/MixedWaypointIdError.d.ts.map +1 -0
- package/build/core/exceptions/MixedWaypointIdError.js +6 -0
- package/build/core/exceptions/UnknownReorderStrategyError.d.ts +4 -0
- package/build/core/exceptions/UnknownReorderStrategyError.d.ts.map +1 -0
- package/build/core/exceptions/UnknownReorderStrategyError.js +6 -0
- package/build/core/factory/read_stabilizer_config.d.ts +10 -0
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -0
- package/build/core/factory/read_stabilizer_config.js +26 -0
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +29 -0
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -0
- package/build/core/factory/read_stabilizer_config_helpers.js +73 -0
- package/build/core/factory/strategy_factory.d.ts +9 -0
- package/build/core/factory/strategy_factory.d.ts.map +1 -0
- package/build/core/factory/strategy_factory.js +29 -0
- package/build/core/filters/collect_movable_items.d.ts +18 -0
- package/build/core/filters/collect_movable_items.d.ts.map +1 -0
- package/build/core/filters/collect_movable_items.js +72 -0
- package/build/core/filters/loose_item_filter.d.ts +20 -0
- package/build/core/filters/loose_item_filter.d.ts.map +1 -0
- package/build/core/filters/loose_item_filter.js +28 -0
- package/build/core/geometry/box_geometry.d.ts +48 -0
- package/build/core/geometry/box_geometry.d.ts.map +1 -0
- package/build/core/geometry/box_geometry.js +98 -0
- package/build/core/logging/stabilizer_logger.d.ts +3 -0
- package/build/core/logging/stabilizer_logger.d.ts.map +1 -0
- package/build/core/logging/stabilizer_logger.js +2 -0
- package/build/core/move/apply_move.d.ts +26 -0
- package/build/core/move/apply_move.d.ts.map +1 -0
- package/build/core/move/apply_move.js +26 -0
- package/build/core/orchestration/StabilizerFlow.d.ts +15 -0
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -0
- package/build/core/orchestration/StabilizerFlow.js +29 -0
- 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 +11 -0
- package/build/core/orchestration/build_reorder_context.d.ts.map +1 -0
- package/build/core/orchestration/build_reorder_context.js +27 -0
- 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 +9 -0
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -0
- package/build/core/strategies/reorder/BeamSearchReorder.js +68 -0
- package/build/core/strategies/reorder/GeneticReorder.d.ts +9 -0
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -0
- package/build/core/strategies/reorder/GeneticReorder.js +43 -0
- package/build/core/strategies/reorder/GravityCompaction.d.ts +9 -0
- package/build/core/strategies/reorder/GravityCompaction.d.ts.map +1 -0
- package/build/core/strategies/reorder/GravityCompaction.js +48 -0
- package/build/core/strategies/reorder/GreedyReorder.d.ts +9 -0
- package/build/core/strategies/reorder/GreedyReorder.d.ts.map +1 -0
- package/build/core/strategies/reorder/GreedyReorder.js +20 -0
- package/build/core/strategies/reorder/ReorderStrategy.d.ts +19 -0
- package/build/core/strategies/reorder/ReorderStrategy.d.ts.map +1 -0
- package/build/core/strategies/reorder/ReorderStrategy.js +1 -0
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts +9 -0
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -0
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.js +61 -0
- package/build/core/strategies/reorder/anneal_helpers.d.ts +18 -0
- package/build/core/strategies/reorder/anneal_helpers.d.ts.map +1 -0
- package/build/core/strategies/reorder/anneal_helpers.js +39 -0
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts +12 -0
- package/build/core/strategies/reorder/apply_if_gates_pass.d.ts.map +1 -0
- package/build/core/strategies/reorder/apply_if_gates_pass.js +19 -0
- package/build/core/strategies/reorder/beam_context.d.ts +16 -0
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -0
- package/build/core/strategies/reorder/beam_context.js +1 -0
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts +39 -0
- package/build/core/strategies/reorder/genetic/Chromosome.d.ts.map +1 -0
- package/build/core/strategies/reorder/genetic/Chromosome.js +84 -0
- package/build/core/strategies/reorder/greedy_improvement.d.ts +12 -0
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -0
- package/build/core/strategies/reorder/greedy_improvement.js +63 -0
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts +9 -0
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts.map +1 -0
- package/build/core/strategies/reorder/select_beam_expansion_candidates.js +28 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +37 -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 +43 -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 +42 -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 +60 -0
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +12 -0
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_item_to_contract.js +49 -0
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +48 -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 +50 -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 +101 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_domain_schema.js +64 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +36 -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 +76 -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 +34 -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 +66 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +20 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -0
- package/build/core/validation/schemas/stabilizer_config_schema.js +17 -0
- package/build/core/waypoint/WaypointMode.d.ts +16 -0
- package/build/core/waypoint/WaypointMode.d.ts.map +1 -0
- package/build/core/waypoint/WaypointMode.js +1 -0
- package/build/core/waypoint/build_waypoint_zones.d.ts +21 -0
- package/build/core/waypoint/build_waypoint_zones.d.ts.map +1 -0
- package/build/core/waypoint/build_waypoint_zones.js +48 -0
- 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 +24 -0
- package/build/core/waypoint/preserves_waypoint_order.d.ts.map +1 -0
- package/build/core/waypoint/preserves_waypoint_order.js +49 -0
- package/build/core/waypoint/validate_waypoint_ids.d.ts +16 -0
- package/build/core/waypoint/validate_waypoint_ids.d.ts.map +1 -0
- package/build/core/waypoint/validate_waypoint_ids.js +30 -0
- package/build/index.d.ts +27 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +75 -0
- package/package.json +51 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
3
|
+
import type { WaypointMode, WaypointZone } from '../waypoint/WaypointMode.js';
|
|
4
|
+
import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation.js';
|
|
5
|
+
export interface CandidateGenerationContext {
|
|
6
|
+
containers: StabilizerContainer[];
|
|
7
|
+
loose: LooseItemRef;
|
|
8
|
+
mode: WaypointMode;
|
|
9
|
+
zones: WaypointZone[];
|
|
10
|
+
preserve_tie_block_organization: boolean;
|
|
11
|
+
milkrun_reserved_z_bands: MilkrunReservedBand[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=candidate_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate_context.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/candidate_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAElF,MAAM,WAAW,0BAA0B;IAEvC,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,KAAK,EAAE,YAAY,CAAA;IACnB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,+BAA+B,EAAE,OAAO,CAAA;IACxC,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MoveCandidate } from '../move/apply_move.js';
|
|
2
|
+
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Generates ranked candidate slots from empty-space regions and supporter tops.
|
|
5
|
+
* @param context - Candidate generation context.
|
|
6
|
+
* @returns Candidate moves sorted floor-first, same container preferred.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generate_candidates(context: CandidateGenerationContext): MoveCandidate[];
|
|
9
|
+
//# sourceMappingURL=candidate_generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate_generator.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/candidate_generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAKxE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,aAAa,EAAE,CAMxF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { collect_container_slots } from './collect_container_slots.js';
|
|
2
|
+
import { is_candidate_valid } from './candidate_validation.js';
|
|
3
|
+
import { rank_candidates } from './rank_candidates.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generates ranked candidate slots from empty-space regions and supporter tops.
|
|
6
|
+
* @param context - Candidate generation context.
|
|
7
|
+
* @returns Candidate moves sorted floor-first, same container preferred.
|
|
8
|
+
*/
|
|
9
|
+
export function generate_candidates(context) {
|
|
10
|
+
const candidates = context.containers.flatMap((container, target_index) => build_container_candidates(context, container, target_index));
|
|
11
|
+
return rank_candidates(candidates, context.loose.container_index);
|
|
12
|
+
}
|
|
13
|
+
function build_container_candidates(context, container, target_index) {
|
|
14
|
+
const candidates = [];
|
|
15
|
+
for (const tagged of collect_container_slots(container, context.loose.item, context.loose.item_id)) {
|
|
16
|
+
if (!is_candidate_valid(context, target_index, tagged.position)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
candidates.push({
|
|
20
|
+
item_id: context.loose.item_id,
|
|
21
|
+
source_container_index: context.loose.container_index,
|
|
22
|
+
target_container_index: target_index,
|
|
23
|
+
new_position: tagged.position,
|
|
24
|
+
slot_kind: tagged.slot_kind
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return unique_kind_positions(candidates);
|
|
28
|
+
}
|
|
29
|
+
function unique_kind_positions(candidates) {
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
const unique = [];
|
|
32
|
+
for (const candidate of candidates) {
|
|
33
|
+
const position = candidate.new_position;
|
|
34
|
+
const key = `${position.x}:${position.y}:${position.z}:${candidate.target_container_index}`;
|
|
35
|
+
if (seen.has(key)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
seen.add(key);
|
|
39
|
+
unique.push(candidate);
|
|
40
|
+
}
|
|
41
|
+
return unique;
|
|
42
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates geometry and waypoint constraints for a candidate position.
|
|
4
|
+
* @param context - Candidate generation context.
|
|
5
|
+
* @param target_index - Target container index.
|
|
6
|
+
* @param position - Candidate position.
|
|
7
|
+
* @returns True when candidate is valid.
|
|
8
|
+
*/
|
|
9
|
+
export declare function is_candidate_valid(context: CandidateGenerationContext, target_index: number, position: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
}): boolean;
|
|
14
|
+
//# sourceMappingURL=candidate_validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate_validation.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/candidate_validation.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAGxE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAeT"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { collect_container_boxes } from '../adapters/coordinate_mapper.js';
|
|
2
|
+
import { has_overlap, is_fully_supported, is_inside_container } from '../geometry/box_geometry.js';
|
|
3
|
+
import { is_position_in_zone } from '../waypoint/build_waypoint_zones.js';
|
|
4
|
+
import { is_position_in_milkrun_reserved_band } from '../waypoint/milkrun_wall_reservation.js';
|
|
5
|
+
import { resolve_item_waypoint_id } from '../waypoint/validate_waypoint_ids.js';
|
|
6
|
+
import { is_elevated_on_supporter_origin } from './is_elevated_on_supporter_origin.js';
|
|
7
|
+
/**
|
|
8
|
+
* Validates geometry and waypoint constraints for a candidate position.
|
|
9
|
+
* @param context - Candidate generation context.
|
|
10
|
+
* @param target_index - Target container index.
|
|
11
|
+
* @param position - Candidate position.
|
|
12
|
+
* @returns True when candidate is valid.
|
|
13
|
+
*/
|
|
14
|
+
export function is_candidate_valid(context, target_index, position) {
|
|
15
|
+
if (!is_candidate_geometry_valid(context, target_index, position)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (!is_elevated_on_supporter_origin(context, target_index, position)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (!is_candidate_milkrun_valid(context, target_index, position)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return is_candidate_waypoint_valid(context, target_index, position);
|
|
25
|
+
}
|
|
26
|
+
function is_candidate_milkrun_valid(context, target_index, position) {
|
|
27
|
+
if (context.milkrun_reserved_z_bands.length === 0) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return !is_position_in_milkrun_reserved_band({
|
|
31
|
+
bands: context.milkrun_reserved_z_bands,
|
|
32
|
+
container_index: target_index,
|
|
33
|
+
item: context.loose.item,
|
|
34
|
+
position
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function is_candidate_geometry_valid(context, target_index, position) {
|
|
38
|
+
const candidate_box = build_candidate_box(context, position);
|
|
39
|
+
const target = context.containers[target_index];
|
|
40
|
+
const boxes = collect_container_boxes(target, context.loose.item_id);
|
|
41
|
+
return is_valid_candidate_box(candidate_box, target, boxes);
|
|
42
|
+
}
|
|
43
|
+
function build_candidate_box(context, position) {
|
|
44
|
+
return {
|
|
45
|
+
x: position.x,
|
|
46
|
+
y: position.y,
|
|
47
|
+
z: position.z,
|
|
48
|
+
w: context.loose.item.width,
|
|
49
|
+
h: context.loose.item.height,
|
|
50
|
+
d: context.loose.item.depth
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function is_valid_candidate_box(candidate_box, target, boxes) {
|
|
54
|
+
if (!is_inside_container(candidate_box, target)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (!is_fully_supported(candidate_box, boxes)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return !has_overlap(candidate_box, boxes);
|
|
61
|
+
}
|
|
62
|
+
function is_candidate_waypoint_valid(context, target_index, position) {
|
|
63
|
+
if (context.mode.kind === 'SINGLE_WAYPOINT' || !context.preserve_tie_block_organization) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
const waypoint_id = resolve_item_waypoint_id(context.loose.item, context.mode);
|
|
67
|
+
const zone = context.zones.find(entry => entry.waypoint_id === waypoint_id && entry.container_index === target_index);
|
|
68
|
+
if (!zone) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return is_position_in_zone(zone, context.loose.item, position);
|
|
72
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { CandidateSlotKind } from '../move/apply_move.js';
|
|
3
|
+
import type { EmptySpaceSlot } from './enumerate_empty_space_slots.js';
|
|
4
|
+
export interface TaggedSlot {
|
|
5
|
+
position: EmptySpaceSlot;
|
|
6
|
+
slot_kind: CandidateSlotKind;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Collects empty-space origins and per-supporter top origins, supporter first.
|
|
10
|
+
* @param container - Target container layout.
|
|
11
|
+
* @param item - Loose item to place.
|
|
12
|
+
* @param exclude_item_id - Loose item id omitted from obstacles and supporters.
|
|
13
|
+
* @returns Tagged slots with supporter-top entries before empty-space entries.
|
|
14
|
+
*/
|
|
15
|
+
export declare function collect_container_slots(container: StabilizerContainer, item: StabilizerContainer['items'][number], exclude_item_id: string): TaggedSlot[];
|
|
16
|
+
//# sourceMappingURL=collect_container_slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect_container_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/collect_container_slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAItE,MAAM,WAAW,UAAU;IAEvB,QAAQ,EAAE,cAAc,CAAA;IACxB,SAAS,EAAE,iBAAiB,CAAA;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAC1C,eAAe,EAAE,MAAM,GACxB,UAAU,EAAE,CAQd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { enumerate_empty_space_slots } from './enumerate_empty_space_slots.js';
|
|
2
|
+
import { enumerate_supporter_top_slots } from './enumerate_supporter_top_slots.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collects empty-space origins and per-supporter top origins, supporter first.
|
|
5
|
+
* @param container - Target container layout.
|
|
6
|
+
* @param item - Loose item to place.
|
|
7
|
+
* @param exclude_item_id - Loose item id omitted from obstacles and supporters.
|
|
8
|
+
* @returns Tagged slots with supporter-top entries before empty-space entries.
|
|
9
|
+
*/
|
|
10
|
+
export function collect_container_slots(container, item, exclude_item_id) {
|
|
11
|
+
const supporter = enumerate_supporter_top_slots(container, item, exclude_item_id);
|
|
12
|
+
const empty = enumerate_empty_space_slots(container, item, exclude_item_id);
|
|
13
|
+
return [
|
|
14
|
+
...tag_slots(supporter, 'supporter_top'),
|
|
15
|
+
...tag_slots(empty, 'empty_space')
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
function tag_slots(slots, slot_kind) {
|
|
19
|
+
return slots.map(position => ({ position, slot_kind }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StabilizerContainer, StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
export interface EmptySpaceSlot {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Enumerates candidate positions from empty-space regions where the item fits.
|
|
9
|
+
* @param container - Target container layout.
|
|
10
|
+
* @param item - Loose item dimensions.
|
|
11
|
+
* @param exclude_item_id - Item id to omit from obstacle list.
|
|
12
|
+
* @returns Slot positions at each fitting empty-space origin.
|
|
13
|
+
*/
|
|
14
|
+
export declare function enumerate_empty_space_slots(container: StabilizerContainer, item: StabilizerItem, exclude_item_id: string): EmptySpaceSlot[];
|
|
15
|
+
//# sourceMappingURL=enumerate_empty_space_slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumerate_empty_space_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/enumerate_empty_space_slots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAG7G,MAAM,WAAW,cAAc;IAE3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,MAAM,GACxB,cAAc,EAAE,CAmBlB"}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StabilizerContainer, StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { EmptySpaceSlot } from './enumerate_empty_space_slots.js';
|
|
3
|
+
/**
|
|
4
|
+
* Emits one candidate origin per supporter footprint (x, supporter top y, z).
|
|
5
|
+
* @param container - Target container layout.
|
|
6
|
+
* @param item - Loose item dimensions.
|
|
7
|
+
* @param exclude_item_id - Loose item id omitted as a supporter.
|
|
8
|
+
* @returns Slot positions aligned to each supporter origin.
|
|
9
|
+
*/
|
|
10
|
+
export declare function enumerate_supporter_top_slots(container: StabilizerContainer, item: StabilizerItem, exclude_item_id: string): EmptySpaceSlot[];
|
|
11
|
+
//# sourceMappingURL=enumerate_supporter_top_slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumerate_supporter_top_slots.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/enumerate_supporter_top_slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAC7G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAItE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,MAAM,GACxB,cAAc,EAAE,CAgBlB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const CONTAINER_EPSILON = 1e-6;
|
|
2
|
+
/**
|
|
3
|
+
* Emits one candidate origin per supporter footprint (x, supporter top y, z).
|
|
4
|
+
* @param container - Target container layout.
|
|
5
|
+
* @param item - Loose item dimensions.
|
|
6
|
+
* @param exclude_item_id - Loose item id omitted as a supporter.
|
|
7
|
+
* @returns Slot positions aligned to each supporter origin.
|
|
8
|
+
*/
|
|
9
|
+
export function enumerate_supporter_top_slots(container, item, exclude_item_id) {
|
|
10
|
+
const slots = [];
|
|
11
|
+
for (const supporter of container.items) {
|
|
12
|
+
if (supporter.item_id === exclude_item_id) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const slot = supporter_top_slot(supporter);
|
|
16
|
+
if (slot_fits_in_container(container, item, slot)) {
|
|
17
|
+
slots.push(slot);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return slots;
|
|
21
|
+
}
|
|
22
|
+
function supporter_top_slot(supporter) {
|
|
23
|
+
return {
|
|
24
|
+
x: supporter.x,
|
|
25
|
+
y: supporter.y + supporter.height,
|
|
26
|
+
z: supporter.z
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function slot_fits_in_container(container, item, slot) {
|
|
30
|
+
return slot.x >= -CONTAINER_EPSILON &&
|
|
31
|
+
slot.y >= -CONTAINER_EPSILON &&
|
|
32
|
+
slot.z >= -CONTAINER_EPSILON &&
|
|
33
|
+
slot.x + item.width <= container.width + CONTAINER_EPSILON &&
|
|
34
|
+
slot.y + item.height <= container.height + CONTAINER_EPSILON &&
|
|
35
|
+
slot.z + item.depth <= container.length + CONTAINER_EPSILON;
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Floor candidates stay free; elevated ones must copy a supporter (x, z) origin.
|
|
4
|
+
* @param context - Candidate generation context.
|
|
5
|
+
* @param target_index - Target container index.
|
|
6
|
+
* @param position - Candidate position.
|
|
7
|
+
* @returns True when the candidate is on the floor or on a supporter origin.
|
|
8
|
+
*/
|
|
9
|
+
export declare function is_elevated_on_supporter_origin(context: CandidateGenerationContext, target_index: number, position: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
}): boolean;
|
|
14
|
+
//# sourceMappingURL=is_elevated_on_supporter_origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_elevated_on_supporter_origin.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/is_elevated_on_supporter_origin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAIxE;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC3C,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAQT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const ORIGIN_EPSILON = 1e-6;
|
|
2
|
+
/**
|
|
3
|
+
* Floor candidates stay free; elevated ones must copy a supporter (x, z) origin.
|
|
4
|
+
* @param context - Candidate generation context.
|
|
5
|
+
* @param target_index - Target container index.
|
|
6
|
+
* @param position - Candidate position.
|
|
7
|
+
* @returns True when the candidate is on the floor or on a supporter origin.
|
|
8
|
+
*/
|
|
9
|
+
export function is_elevated_on_supporter_origin(context, target_index, position) {
|
|
10
|
+
if (position.y <= ORIGIN_EPSILON) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const items = context.containers[target_index].items;
|
|
14
|
+
return items.some(item => matches_supporter_origin(item, context.loose.item_id, position));
|
|
15
|
+
}
|
|
16
|
+
function matches_supporter_origin(item, exclude_item_id, position) {
|
|
17
|
+
if (item.item_id === exclude_item_id) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return is_same_origin(item, position) && is_supporter_top(item, position.y);
|
|
21
|
+
}
|
|
22
|
+
function is_same_origin(item, position) {
|
|
23
|
+
return Math.abs(item.x - position.x) <= ORIGIN_EPSILON
|
|
24
|
+
&& Math.abs(item.z - position.z) <= ORIGIN_EPSILON;
|
|
25
|
+
}
|
|
26
|
+
function is_supporter_top(item, candidate_y) {
|
|
27
|
+
return Math.abs(item.y + item.height - candidate_y) <= ORIGIN_EPSILON;
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MoveCandidate } from '../move/apply_move.js';
|
|
2
|
+
/**
|
|
3
|
+
* Ranks candidates floor-first with same-container preference.
|
|
4
|
+
* @param candidates - Unsorted candidates.
|
|
5
|
+
* @param source_index - Source container index.
|
|
6
|
+
* @returns Sorted candidates.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rank_candidates(candidates: MoveCandidate[], source_index: number): MoveCandidate[];
|
|
9
|
+
//# sourceMappingURL=rank_candidates.d.ts.map
|
|
@@ -0,0 +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,CAqBlG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ranks candidates floor-first with same-container preference.
|
|
3
|
+
* @param candidates - Unsorted candidates.
|
|
4
|
+
* @param source_index - Source container index.
|
|
5
|
+
* @returns Sorted candidates.
|
|
6
|
+
*/
|
|
7
|
+
export function rank_candidates(candidates, source_index) {
|
|
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
|
+
}
|
|
12
|
+
const same_left = left.target_container_index === source_index ? 0 : 1;
|
|
13
|
+
const same_right = right.target_container_index === source_index ? 0 : 1;
|
|
14
|
+
if (same_left !== same_right) {
|
|
15
|
+
return same_left - same_right;
|
|
16
|
+
}
|
|
17
|
+
if (left.new_position.z !== right.new_position.z) {
|
|
18
|
+
return left.new_position.z - right.new_position.z;
|
|
19
|
+
}
|
|
20
|
+
return left.new_position.x - right.new_position.x;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const REORDER_STRATEGY: Readonly<{
|
|
2
|
+
readonly GREEDY: "greedy";
|
|
3
|
+
readonly GENETIC: "genetic";
|
|
4
|
+
readonly GRAVITY: "gravity";
|
|
5
|
+
readonly SIMULATED_ANNEALING: "simulated_annealing";
|
|
6
|
+
readonly BEAM_SEARCH: "beam_search";
|
|
7
|
+
}>;
|
|
8
|
+
export type ReorderStrategyValue = typeof REORDER_STRATEGY[keyof typeof REORDER_STRATEGY];
|
|
9
|
+
export declare const REORDER_STRATEGY_VALUES: readonly ReorderStrategyValue[];
|
|
10
|
+
export declare const DEFAULT_SYNTHETIC_WAYPOINT_ID = "__default__";
|
|
11
|
+
//# sourceMappingURL=ReorderStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderStrategy.d.ts","sourceRoot":"","sources":["../../../src/core/constants/ReorderStrategy.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;EAMlB,CAAA;AAEX,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAEzF,eAAO,MAAM,uBAAuB,iCAEnC,CAAA;AAED,eAAO,MAAM,6BAA6B,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const REORDER_STRATEGY = Object.freeze({
|
|
2
|
+
GREEDY: 'greedy',
|
|
3
|
+
GENETIC: 'genetic',
|
|
4
|
+
GRAVITY: 'gravity',
|
|
5
|
+
SIMULATED_ANNEALING: 'simulated_annealing',
|
|
6
|
+
BEAM_SEARCH: 'beam_search'
|
|
7
|
+
});
|
|
8
|
+
export const REORDER_STRATEGY_VALUES = Object.freeze(Object.values(REORDER_STRATEGY));
|
|
9
|
+
export const DEFAULT_SYNTHETIC_WAYPOINT_ID = '__default__';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TieRatioOrientation.d.ts","sourceRoot":"","sources":["../../../src/core/constants/TieRatioOrientation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;EAGhC,CAAA;AAEF,eAAO,MAAM,4BAA4B,4BAExC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type StabilityEvaluation } from '../adapters/stability_adapter.js';
|
|
2
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
3
|
+
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
4
|
+
export declare const LOOSE_SUM_TIE_BREAK_SCALE = 0.000001;
|
|
5
|
+
/**
|
|
6
|
+
* Computes the reorder objective: maximize transport stability, then loose-item sum.
|
|
7
|
+
* @param stability - Transport stability evaluation.
|
|
8
|
+
* @param containers - Container layout used for loose-item index lookup.
|
|
9
|
+
* @param loose_items - Loose items included in the tie-break term.
|
|
10
|
+
* @returns Scalar objective; higher is better.
|
|
11
|
+
*/
|
|
12
|
+
export declare function compute_reorder_objective(stability: StabilityEvaluation, containers: StabilizerContainer[], loose_items: LooseItemRef[]): number;
|
|
13
|
+
//# sourceMappingURL=compute_reorder_objective.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_reorder_objective.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/compute_reorder_objective.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,mBAAmB,EAC3B,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAEnE,eAAO,MAAM,yBAAyB,WAAO,CAAA;AAE7C;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,mBAAmB,EAAE,EACjC,WAAW,EAAE,YAAY,EAAE,GAC5B,MAAM,CAIR"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { sum_loose_item_scores } from '../adapters/stability_adapter.js';
|
|
2
|
+
export const LOOSE_SUM_TIE_BREAK_SCALE = 1e-6;
|
|
3
|
+
/**
|
|
4
|
+
* Computes the reorder objective: maximize transport stability, then loose-item sum.
|
|
5
|
+
* @param stability - Transport stability evaluation.
|
|
6
|
+
* @param containers - Container layout used for loose-item index lookup.
|
|
7
|
+
* @param loose_items - Loose items included in the tie-break term.
|
|
8
|
+
* @returns Scalar objective; higher is better.
|
|
9
|
+
*/
|
|
10
|
+
export function compute_reorder_objective(stability, containers, loose_items) {
|
|
11
|
+
const loose_sum = sum_loose_item_scores(stability, containers, loose_items);
|
|
12
|
+
return stability.transport_score + loose_sum * LOOSE_SUM_TIE_BREAK_SCALE;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StabilizerContainer, StabilizerEnv } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
3
|
+
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
4
|
+
import type { WaypointMode } from '../waypoint/WaypointMode.js';
|
|
5
|
+
import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation.js';
|
|
6
|
+
export interface StateEvaluationContext {
|
|
7
|
+
env: StabilizerEnv;
|
|
8
|
+
loose_items: LooseItemRef[];
|
|
9
|
+
config: StabilizerConfig;
|
|
10
|
+
waypoint_mode: WaypointMode;
|
|
11
|
+
baseline_containers: StabilizerContainer[];
|
|
12
|
+
milkrun_reserved_z_bands: MilkrunReservedBand[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=evaluation_context.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import { type StabilityEvaluation } from '../adapters/stability_adapter.js';
|
|
3
|
+
import type { StateEvaluationContext } from './evaluation_context.js';
|
|
4
|
+
import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
|
|
5
|
+
export interface EvaluationResult {
|
|
6
|
+
stability: StabilityEvaluation;
|
|
7
|
+
objective: number;
|
|
8
|
+
transport_floor_valid: boolean;
|
|
9
|
+
axle_valid: boolean;
|
|
10
|
+
waypoint_valid: boolean;
|
|
11
|
+
milkrun_valid: boolean;
|
|
12
|
+
all_gates_pass: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Evaluates a container layout against all stabilizer gates.
|
|
16
|
+
* @param containers - Container layout to evaluate.
|
|
17
|
+
* @param context - Evaluation context.
|
|
18
|
+
* @returns Evaluation result with gate flags.
|
|
19
|
+
*/
|
|
20
|
+
export declare function evaluate_state(containers: StabilizerContainer[], context: StateEvaluationContext): EvaluationResult;
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates a trial layout cloned from baseline with a move applied elsewhere.
|
|
23
|
+
* @param trial - Trial containers after move.
|
|
24
|
+
* @param context - Evaluation context.
|
|
25
|
+
* @returns Evaluation result.
|
|
26
|
+
*/
|
|
27
|
+
export declare function evaluate_trial_layout(trial: StabilizerContainer[], context: StateEvaluationContext): EvaluationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Builds evaluation context from reorder context.
|
|
30
|
+
* @param context - Reorder context.
|
|
31
|
+
* @returns State evaluation context.
|
|
32
|
+
*/
|
|
33
|
+
export declare function evaluation_context_from_reorder(context: ReorderContext): StateEvaluationContext;
|
|
34
|
+
/**
|
|
35
|
+
* Clones baseline containers for safe trial mutation.
|
|
36
|
+
* @param containers - Source containers.
|
|
37
|
+
* @returns Deep clone.
|
|
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
|
+
};
|
|
50
|
+
//# sourceMappingURL=state_evaluator.d.ts.map
|
|
@@ -0,0 +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,oDAAoD,CAAA;AAC7F,OAAO,EAEH,KAAK,mBAAmB,EAC3B,MAAM,kCAAkC,CAAA;AAMzC,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"}
|