@jetta/cargo-stabilizer 0.1.0-15 → 0.1.0-3
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 +1 -35
- package/README.md +16 -62
- package/build/core/adapters/axle_adapter.d.ts +4 -5
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +23 -6
- 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 +13 -13
- 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 +1 -3
- package/build/core/candidates/candidate_context.d.ts +1 -4
- 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 +16 -33
- package/build/core/candidates/candidate_validation.d.ts +12 -0
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +26 -40
- package/build/core/candidates/rank_candidates.d.ts.map +1 -1
- package/build/core/candidates/rank_candidates.js +0 -3
- package/build/core/evaluation/evaluation_context.d.ts +1 -3
- package/build/core/evaluation/evaluation_context.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.d.ts +10 -13
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +15 -19
- package/build/core/factory/read_stabilizer_config.d.ts +2 -5
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config.js +25 -6
- 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 +1 -17
- package/build/core/geometry/box_geometry.d.ts.map +1 -1
- package/build/core/geometry/box_geometry.js +2 -67
- package/build/core/move/apply_move.d.ts +1 -3
- 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 +1 -2
- package/build/core/orchestration/StabilizerFlow.d.ts.map +1 -1
- package/build/core/orchestration/StabilizerFlow.js +1 -1
- 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 +12 -10
- 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 +16 -15
- 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/GeneticReorder.js +1 -2
- 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 +1 -3
- 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/SimulatedAnnealingReorder.js +5 -14
- 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 -2
- 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 +4 -5
- package/build/core/validation/parse_stabilizer_input.d.ts +8 -0
- package/build/core/validation/parse_stabilizer_input.d.ts.map +1 -0
- package/build/core/validation/parse_stabilizer_input.js +20 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +2 -6
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +2 -6
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts +110 -0
- package/build/core/validation/schemas/stabilizer_input_schema.d.ts.map +1 -0
- package/build/core/validation/schemas/stabilizer_input_schema.js +34 -0
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts +13 -0
- package/build/core/validation/schemas/stabilizer_output_schema.d.ts.map +1 -0
- package/build/core/validation/schemas/stabilizer_output_schema.js +6 -0
- 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/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 +7 -15
- package/build/index.d.ts.map +1 -1
- package/build/index.js +11 -42
- package/package.json +10 -12
- package/build/core/adapters/axle_load_evaluation.d.ts +0 -8
- package/build/core/adapters/axle_load_evaluation.d.ts.map +0 -1
- package/build/core/adapters/axle_load_evaluation.js +0 -1
- package/build/core/adapters/build_axle_request.d.ts +0 -8
- package/build/core/adapters/build_axle_request.d.ts.map +0 -1
- package/build/core/adapters/build_axle_request.js +0 -67
- package/build/core/adapters/compute_axle_excess_kg.d.ts +0 -8
- package/build/core/adapters/compute_axle_excess_kg.d.ts.map +0 -1
- package/build/core/adapters/compute_axle_excess_kg.js +0 -19
- package/build/core/adapters/empty_space_adapter.d.ts +0 -10
- package/build/core/adapters/empty_space_adapter.d.ts.map +0 -1
- package/build/core/adapters/empty_space_adapter.js +0 -24
- package/build/core/adapters/evaluate_axle_load.d.ts +0 -10
- package/build/core/adapters/evaluate_axle_load.d.ts.map +0 -1
- package/build/core/adapters/evaluate_axle_load.js +0 -32
- package/build/core/adapters/map_item_to_positioned_cube.d.ts +0 -9
- package/build/core/adapters/map_item_to_positioned_cube.d.ts.map +0 -1
- package/build/core/adapters/map_item_to_positioned_cube.js +0 -16
- package/build/core/adapters/map_item_to_stacking_item.d.ts +0 -14
- package/build/core/adapters/map_item_to_stacking_item.d.ts.map +0 -1
- package/build/core/adapters/map_item_to_stacking_item.js +0 -40
- package/build/core/adapters/run_axle_calculator.d.ts +0 -16
- package/build/core/adapters/run_axle_calculator.d.ts.map +0 -1
- package/build/core/adapters/run_axle_calculator.js +0 -37
- package/build/core/candidates/collect_container_slots.d.ts +0 -16
- package/build/core/candidates/collect_container_slots.d.ts.map +0 -1
- package/build/core/candidates/collect_container_slots.js +0 -20
- package/build/core/candidates/enumerate_empty_space_slots.d.ts +0 -15
- package/build/core/candidates/enumerate_empty_space_slots.d.ts.map +0 -1
- package/build/core/candidates/enumerate_empty_space_slots.js +0 -44
- package/build/core/candidates/enumerate_supporter_top_slots.d.ts +0 -11
- package/build/core/candidates/enumerate_supporter_top_slots.d.ts.map +0 -1
- package/build/core/candidates/enumerate_supporter_top_slots.js +0 -36
- package/build/core/candidates/is_candidate_stacking_valid.d.ts +0 -14
- package/build/core/candidates/is_candidate_stacking_valid.d.ts.map +0 -1
- package/build/core/candidates/is_candidate_stacking_valid.js +0 -43
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts +0 -14
- package/build/core/candidates/is_elevated_on_supporter_origin.d.ts.map +0 -1
- package/build/core/candidates/is_elevated_on_supporter_origin.js +0 -28
- package/build/core/constants/TieRatioOrientation.d.ts +0 -6
- package/build/core/constants/TieRatioOrientation.d.ts.map +0 -1
- package/build/core/constants/TieRatioOrientation.js +0 -5
- package/build/core/evaluation/compare_search_states.d.ts +0 -12
- package/build/core/evaluation/compare_search_states.d.ts.map +0 -1
- package/build/core/evaluation/compare_search_states.js +0 -12
- package/build/core/evaluation/compute_reorder_objective.d.ts +0 -13
- package/build/core/evaluation/compute_reorder_objective.d.ts.map +0 -1
- package/build/core/evaluation/compute_reorder_objective.js +0 -13
- package/build/core/evaluation/evaluate_search_gates.d.ts +0 -18
- package/build/core/evaluation/evaluate_search_gates.d.ts.map +0 -1
- package/build/core/evaluation/evaluate_search_gates.js +0 -30
- package/build/core/evaluation/evaluation_result.d.ts +0 -15
- package/build/core/evaluation/evaluation_result.d.ts.map +0 -1
- package/build/core/evaluation/evaluation_result.js +0 -1
- package/build/core/evaluation/genetic_fitness.d.ts +0 -9
- package/build/core/evaluation/genetic_fitness.d.ts.map +0 -1
- package/build/core/evaluation/genetic_fitness.js +0 -16
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts +0 -8
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts.map +0 -1
- package/build/core/evaluation/is_non_axle_gates_pass.js +0 -8
- package/build/core/evaluation/is_search_trial_admissible.d.ts +0 -10
- package/build/core/evaluation/is_search_trial_admissible.d.ts.map +0 -1
- package/build/core/evaluation/is_search_trial_admissible.js +0 -17
- package/build/core/evaluation/is_waypoint_order_valid.d.ts +0 -10
- package/build/core/evaluation/is_waypoint_order_valid.d.ts.map +0 -1
- package/build/core/evaluation/is_waypoint_order_valid.js +0 -14
- package/build/core/exceptions/AxleCalculationError.d.ts +0 -4
- package/build/core/exceptions/AxleCalculationError.d.ts.map +0 -1
- package/build/core/exceptions/AxleCalculationError.js +0 -6
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts +0 -4
- package/build/core/exceptions/InvalidStabilizerOutputError.d.ts.map +0 -1
- package/build/core/exceptions/InvalidStabilizerOutputError.js +0 -6
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +0 -32
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +0 -1
- package/build/core/factory/read_stabilizer_config_helpers.js +0 -73
- package/build/core/filters/collect_movable_items.d.ts +0 -18
- package/build/core/filters/collect_movable_items.d.ts.map +0 -1
- package/build/core/filters/collect_movable_items.js +0 -53
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts +0 -8
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts.map +0 -1
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.js +0 -41
- package/build/core/filters/is_item_on_cm_floor.d.ts +0 -8
- package/build/core/filters/is_item_on_cm_floor.d.ts.map +0 -1
- package/build/core/filters/is_item_on_cm_floor.js +0 -9
- package/build/core/geometry/has_penetrating_overlap.d.ts +0 -9
- package/build/core/geometry/has_penetrating_overlap.d.ts.map +0 -1
- package/build/core/geometry/has_penetrating_overlap.js +0 -27
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts +0 -13
- package/build/core/orchestration/build_milkrun_bands_from_config.d.ts.map +0 -1
- package/build/core/orchestration/build_milkrun_bands_from_config.js +0 -14
- package/build/core/orchestration/read_primary_env.d.ts +0 -9
- package/build/core/orchestration/read_primary_env.d.ts.map +0 -1
- package/build/core/orchestration/read_primary_env.js +0 -13
- package/build/core/strategies/reorder/append_admitted_trial.d.ts +0 -11
- package/build/core/strategies/reorder/append_admitted_trial.d.ts.map +0 -1
- package/build/core/strategies/reorder/append_admitted_trial.js +0 -22
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts +0 -10
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts.map +0 -1
- package/build/core/strategies/reorder/is_improving_greedy_trial.js +0 -17
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts +0 -9
- package/build/core/strategies/reorder/select_beam_expansion_candidates.d.ts.map +0 -1
- package/build/core/strategies/reorder/select_beam_expansion_candidates.js +0 -28
- package/build/core/strategies/reorder/select_surviving_beam.d.ts +0 -11
- package/build/core/strategies/reorder/select_surviving_beam.d.ts.map +0 -1
- package/build/core/strategies/reorder/select_surviving_beam.js +0 -13
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +0 -71
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +0 -1
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +0 -77
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts +0 -14
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +0 -1
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +0 -43
- package/build/core/validation/contract/format_zod_error.d.ts +0 -8
- package/build/core/validation/contract/format_zod_error.d.ts.map +0 -1
- package/build/core/validation/contract/format_zod_error.js +0 -11
- package/build/core/validation/contract/index.d.ts +0 -9
- package/build/core/validation/contract/index.d.ts.map +0 -1
- package/build/core/validation/contract/index.js +0 -8
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts +0 -3
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +0 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.js +0 -33
- package/build/core/validation/contract/map_input_config.d.ts +0 -9
- package/build/core/validation/contract/map_input_config.d.ts.map +0 -1
- package/build/core/validation/contract/map_input_config.js +0 -40
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts +0 -2
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +0 -66
- package/build/core/validation/contract/map_wire_item_stacking.d.ts +0 -7
- package/build/core/validation/contract/map_wire_item_stacking.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_item_stacking.js +0 -40
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +0 -8
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +0 -1
- package/build/core/validation/contract/map_wire_item_to_contract.js +0 -51
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +0 -90
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +0 -1
- package/build/core/validation/contract/parse_stabilizer_input.js +0 -28
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +0 -79
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +0 -1
- package/build/core/validation/contract/parse_stabilizer_output.js +0 -24
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts +0 -6
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts.map +0 -1
- package/build/core/validation/contract/reject_forbidden_input_fields.js +0 -53
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +0 -72
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_domain_schema.js +0 -42
- package/build/core/validation/contract/stabilizer_env_schema.d.ts +0 -112
- package/build/core/validation/contract/stabilizer_env_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_env_schema.js +0 -38
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +0 -80
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_input_schema.js +0 -11
- package/build/core/validation/contract/stabilizer_item_schema.d.ts +0 -25
- package/build/core/validation/contract/stabilizer_item_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_item_schema.js +0 -23
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +0 -134
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +0 -1
- package/build/core/validation/contract/stabilizer_output_schema.js +0 -16
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts +0 -14
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts.map +0 -1
- package/build/core/validation/contract/uniquify_contract_item_ids.js +0 -54
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts +0 -34
- package/build/core/validation/contract/wire_mapper_record_utils.d.ts.map +0 -1
- package/build/core/validation/contract/wire_mapper_record_utils.js +0 -66
- package/build/core/waypoint/milkrun_wall_reservation.d.ts +0 -24
- package/build/core/waypoint/milkrun_wall_reservation.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation.js +0 -57
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts +0 -15
- package/build/core/waypoint/milkrun_wall_reservation_helpers.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation_helpers.js +0 -48
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts +0 -16
- package/build/core/waypoint/milkrun_wall_reservation_types.d.ts.map +0 -1
- package/build/core/waypoint/milkrun_wall_reservation_types.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,42 +8,8 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
10
|
|
|
11
|
-
- Strict English internal I/O contract with bidirectional cargo-movement wire mapper (`map_wire_input_to_contract`, `map_contract_to_wire_output`).
|
|
12
|
-
- Organization gates: waypoint Z zones, macro delivery order (`preserve_tie_block_organization`), and milkrun wall reservation (`enforce_milkrun_wall_reservation`).
|
|
13
|
-
- Empty-space candidate discovery for floor and elevated slots via `@jetta/empty-spaces-manager`.
|
|
14
|
-
- Supporter-top candidate slots aligned to each stacked item footprint, included in beam expansion (`top_k ∪ supporter_top`).
|
|
15
|
-
- Elevated candidates must sit on a supporter `(x, z)` origin so stacked loose items copy the supporter footprint.
|
|
16
|
-
- `cargo_stabilizer.pin_tie_ratio_blocks` (default `false`): when true, only **floor five-slot** `3_2`/`2_3` walls stay pinned; stacked tie-ratio items and generic groups stay movable.
|
|
17
|
-
- Public contract exports: `parse_stabilizer_input`, `parse_stabilizer_output`, `safe_parse_stabilizer_input`, `safe_parse_stabilizer_output`, `run_stabilize`, and related domain types.
|
|
18
|
-
- Closed English I/O: `parse_stabilizer_input` is the only `unknown` boundary; `run_stabilize` takes `StabilizerInput`. Wire aliases are mapped then stripped; `original_input` and item `attributes` bags are rejected.
|
|
19
|
-
- Candidate moves are gated with `@jetta/stacking-constraints` `validate_stackings` so illegal family or supported-weight stacks are never emitted.
|
|
20
|
-
|
|
21
|
-
### Changed
|
|
22
|
-
|
|
23
|
-
- From an overloaded start, beam, greedy, SA, and genetic keep a one-item trial when non-axle gates pass and `axle_excess_kg` is strictly smaller. Once every axle is within `folga`, the hard axle gate returns and overload cannot be re-entered. Ranking prefers lower excess, then higher stability.
|
|
24
|
-
- README documents I/O contract mapping, configuration keys, dependencies, and test/coverage commands.
|
|
25
|
-
- Reorder objective is whole-cargo `transport_score`; loose-item score sum is only a tie-break. Axle, waypoint, and milkrun gates are unchanged.
|
|
26
|
-
- `pin_tie_ratio_blocks` pins only floor five-slot `3_2`/`2_3` walls; stacked members of the same group stay movable.
|
|
27
|
-
- Axle calculator is called with the object API. `ItemOverlapError` fails the axle gate instead of skipping kg.
|
|
28
|
-
- `has_penetrating_overlap` uses `@jetta/number-compare` `lt` for face-touch.
|
|
29
|
-
|
|
30
|
-
### Fixed
|
|
31
|
-
|
|
32
|
-
- Face-touching items no longer skip axle kg checks, so beam search cannot shove more mass forward on that skip.
|
|
33
|
-
|
|
34
|
-
### Testing
|
|
35
|
-
|
|
36
|
-
- Expanded Mocha suite to 208 tests mirroring `src/` under `test/src/`.
|
|
37
|
-
- Local coverage gate at 80% on lines, functions, branches, and statements (`npm run coverage`).
|
|
38
|
-
- CI coverage gate at 75% (`npm run coverage:ci`).
|
|
39
|
-
- Mocha setup preloads core modules so c8 attributes coverage consistently across the full suite.
|
|
40
|
-
|
|
41
|
-
## [0.1.0-3] - 2026-08-14
|
|
42
|
-
|
|
43
|
-
### Added
|
|
44
|
-
|
|
45
11
|
- Initial library scaffold (JET-2262).
|
|
46
12
|
- Five config-selectable reorder strategies: gravity, greedy, beam search, simulated annealing, genetic.
|
|
47
|
-
- Zod-validated input contract with
|
|
13
|
+
- Zod-validated input contract with waypoint_id rules and multi-container support.
|
|
48
14
|
- Shared evaluator: cargo-stability transport gate, axle-load-calculator folga gate, waypoint order.
|
|
49
15
|
- Public `stabilize()` API compatible with cargo-movement legacy response shape.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jetta/cargo-stabilizer
|
|
2
2
|
|
|
3
|
-
TypeScript library that reorders items to improve
|
|
3
|
+
TypeScript library that reorders **loose items only** to improve cargo stability while keeping compound blocks pinned. Implements five config-selectable strategies (JET-2262).
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ npm ci
|
|
|
14
14
|
npm run build
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Local monorepo development uses `file:` links to `cargo-stability`, `@jetta/axle-load-calculator`, `@jetta/empty-spaces-manager
|
|
17
|
+
Local monorepo development uses `file:` links to `cargo-stability`, `@jetta/axle-load-calculator`, and `@jetta/empty-spaces-manager`.
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
@@ -47,37 +47,13 @@ if (response.status === 'success') {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
## I/O contract
|
|
51
|
-
|
|
52
|
-
`parse_stabilizer_input(unknown)` is the only untyped boundary. `run_stabilize(input: StabilizerInput)` returns a typed `StabilizerResponse`. Wire aliases (`_id`, `w`/`h`/`d`, `eixos`, `algoritmo`) are mapped then stripped; `original_input` and item `attributes` bags are rejected.
|
|
53
|
-
|
|
54
|
-
Success `data` is English `cargo_state` (items mutated in `x,y,z` only). Cargo-movement copies those poses onto existing items by `_id`.
|
|
55
|
-
|
|
56
|
-
| CM wire | Contract (English) |
|
|
57
|
-
|---------|-------------------|
|
|
58
|
-
| `_id` | `item_id` |
|
|
59
|
-
| `groupId` | `group_id` |
|
|
60
|
-
| `w`, `h`, `d` | `width`, `height`, `depth` |
|
|
61
|
-
| `peso` / `wg` | `weight` |
|
|
62
|
-
| `sequencia` | `sequence` |
|
|
63
|
-
| `largura`, `altura`, `comprimento` | `width`, `height`, `length` |
|
|
64
|
-
| `eixos` | `axles` |
|
|
65
|
-
|
|
66
|
-
Flow: `map_wire_input_to_contract` → strict Zod parse → `run_stabilize` → output validation.
|
|
67
|
-
|
|
68
|
-
Exported parsers: `parse_stabilizer_input`, `parse_stabilizer_output`, `safe_parse_*`, `run_stabilize`.
|
|
69
|
-
|
|
70
50
|
## Configuration
|
|
71
51
|
|
|
72
52
|
| Key | Default | Description |
|
|
73
53
|
|-----|---------|-------------|
|
|
74
54
|
| `cargo_stabilizer.reorder_strategy` | `gravity` | `gravity`, `greedy`, `beam_search`, `simulated_annealing`, `genetic` |
|
|
75
|
-
| `cargo_stabilizer.transport_stability_floor` | `0` | Hard minimum transport stability score
|
|
55
|
+
| `cargo_stabilizer.transport_stability_floor` | `0` | Hard minimum transport stability score |
|
|
76
56
|
| `cargo_stabilizer.max_iteration` | `10` | Greedy / SA iteration budget |
|
|
77
|
-
| `cargo_stabilizer.preserve_tie_block_organization` | `true` | When true, enforce waypoint Z zones and macro delivery order |
|
|
78
|
-
| `cargo_stabilizer.pin_tie_ratio_blocks` | `false` | When true, do not move floor five-slot `3_2`/`2_3` walls; stacked tie-ratio items and other groups remain movable |
|
|
79
|
-
| `cargo_stabilizer.enforce_milkrun_wall_reservation` | `false` | When true, reserve rear compound-wall Z bands using profile key below |
|
|
80
|
-
| `number_of_wall_to_allocate_from_last_waypoints` | `0` | Count of trailing waypoints whose compound walls are reserved (read from `cargo_state.config.algoritmo` when milkrun enforcement is enabled) |
|
|
81
57
|
| `folga_de_peso_nos_eixos` | `0` | Axle folga percent |
|
|
82
58
|
|
|
83
59
|
## Errors
|
|
@@ -85,7 +61,6 @@ Exported parsers: `parse_stabilizer_input`, `parse_stabilizer_output`, `safe_par
|
|
|
85
61
|
| Error | When |
|
|
86
62
|
|-------|------|
|
|
87
63
|
| `InvalidStabilizerInputError` | Zod validation failure on input |
|
|
88
|
-
| `InvalidStabilizerOutputError` | Internal response failed output contract parse |
|
|
89
64
|
| `MixedWaypointIdError` | Some items have `waypoint_id` and others omit it |
|
|
90
65
|
| `UnknownReorderStrategyError` | Invalid `cargo_stabilizer.reorder_strategy` |
|
|
91
66
|
|
|
@@ -93,57 +68,36 @@ Import `ZodError` from `zod` when validating externally.
|
|
|
93
68
|
|
|
94
69
|
## Dependencies
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- `@jetta/
|
|
99
|
-
- `@jetta/
|
|
100
|
-
-
|
|
101
|
-
- `@jetta/number-compare` — face-touch interval tests (`has_penetrating_overlap`)
|
|
102
|
-
- `@jetta/stacking-constraints` — family and supported-weight gate on candidate moves
|
|
103
|
-
- `@jetta/logger` — structured logging at orchestration boundary (transitive via cargo-stability)
|
|
104
|
-
- `zod` — I/O contract validation
|
|
71
|
+
- `cargo-stability` — transport stability scoring
|
|
72
|
+
- `@jetta/axle-load-calculator` — axle weight validation
|
|
73
|
+
- `@jetta/empty-spaces-manager` — empty region discovery (future slot expansion)
|
|
74
|
+
- `@jetta/logger` — structured logging at orchestration boundary
|
|
75
|
+
- `zod` — input validation
|
|
105
76
|
|
|
106
77
|
## Scripts
|
|
107
78
|
|
|
108
79
|
| Command | Description |
|
|
109
80
|
|---------|-------------|
|
|
110
|
-
| `npm test` | Mocha tests
|
|
81
|
+
| `npm test` | Mocha tests |
|
|
111
82
|
| `npm run lint` | ESLint |
|
|
112
83
|
| `npm run build` | TypeScript compile to `build/` |
|
|
113
|
-
| `npm run coverage` | Tests with
|
|
114
|
-
| `npm run coverage:ci` | Tests with **75%** coverage gate (CI) |
|
|
84
|
+
| `npm run coverage:ci` | Tests with 75% coverage gate |
|
|
115
85
|
| `npm run lint:package` | publint strict check |
|
|
116
86
|
|
|
117
87
|
## Layout
|
|
118
88
|
|
|
119
|
-
- `src/index.ts` — public API (`stabilize
|
|
120
|
-
- `src/core/validation
|
|
89
|
+
- `src/index.ts` — public API (`stabilize`)
|
|
90
|
+
- `src/core/validation/` — Zod schemas
|
|
121
91
|
- `src/core/strategies/reorder/` — five reorder algorithms
|
|
122
|
-
- `src/core/evaluation/` — shared stability + axle + waypoint gates
|
|
123
|
-
- `src
|
|
124
|
-
- `test/src/` — mirrors `src/`; fixtures under `test/data/src/`
|
|
125
|
-
|
|
126
|
-
## Testing and coverage
|
|
127
|
-
|
|
128
|
-
Tests run via Mocha + Chai with quiet logging (`test/mocha_setup.ts`). Core modules are preloaded at startup so `c8` reports accurate coverage when the full suite runs.
|
|
129
|
-
|
|
130
|
-
| Gate | Command | Threshold |
|
|
131
|
-
|------|---------|-----------|
|
|
132
|
-
| Local | `npm run coverage` | 80% lines, functions, branches, statements |
|
|
133
|
-
| CI | `npm run coverage:ci` | 75% on all metrics |
|
|
92
|
+
- `src/core/evaluation/` — shared stability + axle + waypoint gates
|
|
93
|
+
- `test/src/` — mirrors `src/`
|
|
134
94
|
|
|
135
95
|
## Test plan
|
|
136
96
|
|
|
137
97
|
```bash
|
|
138
|
-
npm test -- --grep "wire_mapper_shape"
|
|
139
98
|
npm test -- --grep "input_validation"
|
|
140
99
|
npm test -- --grep "waypoint_order"
|
|
141
|
-
npm test -- --grep "milkrun_wall_reservation"
|
|
142
|
-
npm test -- --grep "apply_move"
|
|
143
|
-
npm test -- --grep "state_evaluator"
|
|
144
100
|
npm test -- --grep "gravity_compaction"
|
|
145
|
-
npm test -- --grep "
|
|
146
|
-
npm test -- --grep "
|
|
147
|
-
npm test -- --grep "is_candidate_stacking_valid"
|
|
148
|
-
npm run coverage
|
|
101
|
+
npm test -- --grep "greedy_reorder"
|
|
102
|
+
npm test -- --grep "strategy_factory"
|
|
149
103
|
```
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type { StabilizerEnv } from '../validation/
|
|
1
|
+
import type { StabilizerEnv } from '../validation/schemas/stabilizer_input_schema.js';
|
|
2
2
|
/**
|
|
3
3
|
* @param final_kg - Loaded weight including tare.
|
|
4
4
|
* @param max_kg - Axle supported max.
|
|
5
|
-
* @param folga_pct -
|
|
5
|
+
* @param folga_pct - Folga percent from profile.
|
|
6
6
|
* @returns True when axle exceeds under folga rule.
|
|
7
7
|
*/
|
|
8
8
|
export declare function exceeds_with_folga(final_kg: number, max_kg: number, folga_pct: number): boolean;
|
|
9
9
|
/**
|
|
10
10
|
* Validates axle loads for an env using axle-load-calculator.
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param folga_pct - Axle load margin percent.
|
|
11
|
+
* @param env - CM env with containers and eixos.
|
|
12
|
+
* @param folga_pct - Folga percent.
|
|
14
13
|
* @returns True when all axles are within limits.
|
|
15
14
|
*/
|
|
16
15
|
export declare function is_axle_load_valid(env: StabilizerEnv, folga_pct: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axle_adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/axle_adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"axle_adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/axle_adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAA;AAErF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAClB,OAAO,CAGT;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAUjF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { calculate_weight_on_axles_physics } from '@jetta/axle-load-calculator';
|
|
2
2
|
/**
|
|
3
3
|
* @param final_kg - Loaded weight including tare.
|
|
4
4
|
* @param max_kg - Axle supported max.
|
|
5
|
-
* @param folga_pct -
|
|
5
|
+
* @param folga_pct - Folga percent from profile.
|
|
6
6
|
* @returns True when axle exceeds under folga rule.
|
|
7
7
|
*/
|
|
8
8
|
export function exceeds_with_folga(final_kg, max_kg, folga_pct) {
|
|
@@ -10,11 +10,28 @@ export function exceeds_with_folga(final_kg, max_kg, folga_pct) {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Validates axle loads for an env using axle-load-calculator.
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param folga_pct - Axle load margin percent.
|
|
13
|
+
* @param env - CM env with containers and eixos.
|
|
14
|
+
* @param folga_pct - Folga percent.
|
|
16
15
|
* @returns True when all axles are within limits.
|
|
17
16
|
*/
|
|
18
17
|
export function is_axle_load_valid(env, folga_pct) {
|
|
19
|
-
|
|
18
|
+
if (!env.eixos || env.eixos.length === 0) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const output_env = parse_axle_calculator_output(env);
|
|
22
|
+
const containers = (output_env.containers ?? []);
|
|
23
|
+
return containers.every(container => container_axles_within_folga(container, folga_pct));
|
|
24
|
+
}
|
|
25
|
+
function parse_axle_calculator_output(env) {
|
|
26
|
+
const request = { envs: [env] };
|
|
27
|
+
const output = JSON.parse(calculate_weight_on_axles_physics(JSON.stringify(request)));
|
|
28
|
+
return output.envs[0];
|
|
29
|
+
}
|
|
30
|
+
function container_axles_within_folga(container, folga_pct) {
|
|
31
|
+
const axles = (container.pesoEixos ?? []);
|
|
32
|
+
return axles.every(axle => {
|
|
33
|
+
const final_kg = Number(axle.pesoCarregadoFinal ?? 0);
|
|
34
|
+
const max_kg = Number(axle.pesoMaxFinal ?? 0);
|
|
35
|
+
return !exceeds_with_folga(final_kg, max_kg, folga_pct);
|
|
36
|
+
});
|
|
20
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerItem } from '../validation/
|
|
1
|
+
import type { StabilizerContainer, StabilizerItem } from '../validation/schemas/stabilizer_input_schema.js';
|
|
2
2
|
import { type AxisAlignedBox } from '../geometry/box_geometry.js';
|
|
3
3
|
export interface StabilityItemPayload {
|
|
4
4
|
x: number;
|
|
@@ -15,14 +15,14 @@ export interface StabilityContainerPayload {
|
|
|
15
15
|
item_list: StabilityItemPayload[];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Maps
|
|
19
|
-
* @param item -
|
|
18
|
+
* Maps CM wire coordinates to cargo-stability payload coordinates.
|
|
19
|
+
* @param item - CM item record.
|
|
20
20
|
* @returns Stability item payload entry.
|
|
21
21
|
*/
|
|
22
22
|
export declare function map_item_to_stability(item: StabilizerItem): StabilityItemPayload;
|
|
23
23
|
/**
|
|
24
|
-
* Builds cargo-stability transport input from
|
|
25
|
-
* @param containers -
|
|
24
|
+
* Builds cargo-stability transport input from CM containers.
|
|
25
|
+
* @param containers - CM container records.
|
|
26
26
|
* @returns Stability containers array.
|
|
27
27
|
*/
|
|
28
28
|
export declare function build_stability_containers(containers: StabilizerContainer[]): StabilityContainerPayload[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinate_mapper.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/coordinate_mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"coordinate_mapper.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/coordinate_mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAA;AAC3G,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE9E,MAAM,WAAW,oBAAoB;IAEjC,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;AAED,MAAM,WAAW,yBAAyB;IAEtC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,SAAS,EAAE,oBAAoB,EAAE,CAAA;CACpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAUhF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACtC,UAAU,EAAE,mBAAmB,EAAE,GAClC,yBAAyB,EAAE,CAQ7B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,mBAAmB,EAC9B,eAAe,CAAC,EAAE,MAAM,GACzB,cAAc,EAAE,CAKlB"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { item_to_box } from '../geometry/box_geometry.js';
|
|
2
2
|
/**
|
|
3
|
-
* Maps
|
|
4
|
-
* @param item -
|
|
3
|
+
* Maps CM wire coordinates to cargo-stability payload coordinates.
|
|
4
|
+
* @param item - CM item record.
|
|
5
5
|
* @returns Stability item payload entry.
|
|
6
6
|
*/
|
|
7
7
|
export function map_item_to_stability(item) {
|
|
8
8
|
return {
|
|
9
9
|
x: item.x,
|
|
10
|
-
y: item.
|
|
11
|
-
z: item.
|
|
12
|
-
w: item.
|
|
13
|
-
h: item.
|
|
14
|
-
l: item.
|
|
10
|
+
y: item.z,
|
|
11
|
+
z: item.y,
|
|
12
|
+
w: item.w,
|
|
13
|
+
h: item.h,
|
|
14
|
+
l: item.d
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Builds cargo-stability transport input from
|
|
19
|
-
* @param containers -
|
|
18
|
+
* Builds cargo-stability transport input from CM containers.
|
|
19
|
+
* @param containers - CM container records.
|
|
20
20
|
* @returns Stability containers array.
|
|
21
21
|
*/
|
|
22
22
|
export function build_stability_containers(containers) {
|
|
23
23
|
return containers.map(container => ({
|
|
24
|
-
w: container.
|
|
25
|
-
h: container.
|
|
26
|
-
l: container.
|
|
24
|
+
w: container.largura,
|
|
25
|
+
h: container.altura,
|
|
26
|
+
l: container.comprimento,
|
|
27
27
|
item_list: container.items.map(map_item_to_stability)
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
@@ -35,6 +35,6 @@ export function build_stability_containers(containers) {
|
|
|
35
35
|
*/
|
|
36
36
|
export function collect_container_boxes(container, exclude_item_id) {
|
|
37
37
|
return container.items
|
|
38
|
-
.filter(item => item.
|
|
38
|
+
.filter(item => item._id !== exclude_item_id)
|
|
39
39
|
.map(item_to_box);
|
|
40
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/
|
|
1
|
+
import type { StabilizerContainer } from '../validation/schemas/stabilizer_input_schema.js';
|
|
2
2
|
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
3
3
|
export interface StabilityEvaluation {
|
|
4
4
|
item_scores: number[][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stability_adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/stability_adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stability_adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/stability_adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAEnE,MAAM,WAAW,mBAAmB;IAEhC,WAAW,EAAE,MAAM,EAAE,EAAE,CAAA;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,UAAU,EAAE,mBAAmB,EAAE,GAClC,mBAAmB,CAiBrB;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC5C,UAAU,EAAE,mBAAmB,EAAE,GAClC,mBAAmB,GAAG,SAAS,CAUjC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,mBAAmB,EAAE,EACjC,WAAW,EAAE,YAAY,EAAE,GAC5B,MAAM,CAgBR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,SAAS,EAAE,mBAAmB,EAC9B,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,GACnB,MAAM,CAGR"}
|
|
@@ -41,7 +41,7 @@ export function sum_loose_item_scores(stability, containers, loose_items) {
|
|
|
41
41
|
let total = 0;
|
|
42
42
|
for (const loose of loose_items) {
|
|
43
43
|
const container = containers[loose.container_index];
|
|
44
|
-
const item_index = container.items.findIndex(item => item.
|
|
44
|
+
const item_index = container.items.findIndex(item => item._id === loose.item_id);
|
|
45
45
|
if (item_index < 0) {
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/
|
|
1
|
+
import type { StabilizerContainer } from '../validation/schemas/stabilizer_input_schema.js';
|
|
2
2
|
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
3
3
|
import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
|
|
4
4
|
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_candidate_context.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/build_candidate_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"build_candidate_context.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/build_candidate_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAExE;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,mBAAmB,EAAE,EACjC,KAAK,EAAE,YAAY,GACpB,0BAA0B,CAQ5B"}
|
|
@@ -10,8 +10,6 @@ export function candidate_context_for_loose(context, containers, loose) {
|
|
|
10
10
|
containers,
|
|
11
11
|
loose,
|
|
12
12
|
mode: context.waypoint_mode,
|
|
13
|
-
zones: context.waypoint_zones
|
|
14
|
-
preserve_tie_block_organization: context.config.preserve_tie_block_organization,
|
|
15
|
-
milkrun_reserved_z_bands: context.milkrun_reserved_z_bands
|
|
13
|
+
zones: context.waypoint_zones
|
|
16
14
|
};
|
|
17
15
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { StabilizerContainer } from '../validation/
|
|
1
|
+
import type { StabilizerContainer } from '../validation/schemas/stabilizer_input_schema.js';
|
|
2
2
|
import type { LooseItemRef } from '../filters/loose_item_filter.js';
|
|
3
3
|
import type { WaypointMode, WaypointZone } from '../waypoint/WaypointMode.js';
|
|
4
|
-
import type { MilkrunReservedBand } from '../waypoint/milkrun_wall_reservation.js';
|
|
5
4
|
export interface CandidateGenerationContext {
|
|
6
5
|
containers: StabilizerContainer[];
|
|
7
6
|
loose: LooseItemRef;
|
|
8
7
|
mode: WaypointMode;
|
|
9
8
|
zones: WaypointZone[];
|
|
10
|
-
preserve_tie_block_organization: boolean;
|
|
11
|
-
milkrun_reserved_z_bands: MilkrunReservedBand[];
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=candidate_context.d.ts.map
|
|
@@ -1 +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,
|
|
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,kDAAkD,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE7E,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;CACxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MoveCandidate } from '../move/apply_move.js';
|
|
2
2
|
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
3
3
|
/**
|
|
4
|
-
* Generates ranked candidate slots
|
|
4
|
+
* Generates ranked floor-first candidate slots for a loose item.
|
|
5
5
|
* @param context - Candidate generation context.
|
|
6
6
|
* @returns Candidate moves sorted floor-first, same container preferred.
|
|
7
7
|
*/
|
|
@@ -1 +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;
|
|
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;AAIxE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,aAAa,EAAE,CAuBxF"}
|
|
@@ -1,42 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { is_candidate_valid } from './candidate_validation.js';
|
|
1
|
+
import { enumerate_floor_slots, is_candidate_valid } from './candidate_validation.js';
|
|
3
2
|
import { rank_candidates } from './rank_candidates.js';
|
|
4
3
|
/**
|
|
5
|
-
* Generates ranked candidate slots
|
|
4
|
+
* Generates ranked floor-first candidate slots for a loose item.
|
|
6
5
|
* @param context - Candidate generation context.
|
|
7
6
|
* @returns Candidate moves sorted floor-first, same container preferred.
|
|
8
7
|
*/
|
|
9
8
|
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
9
|
const candidates = [];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
context.containers.forEach((container, target_index) => {
|
|
11
|
+
const slots = enumerate_floor_slots(container, context.loose.item);
|
|
12
|
+
for (const position of slots) {
|
|
13
|
+
if (!is_candidate_valid(context, target_index, position)) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
candidates.push({
|
|
17
|
+
item_id: context.loose.item_id,
|
|
18
|
+
source_container_index: context.loose.container_index,
|
|
19
|
+
target_container_index: target_index,
|
|
20
|
+
new_position: position
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
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;
|
|
23
|
+
});
|
|
24
|
+
return rank_candidates(candidates, context.loose.container_index);
|
|
42
25
|
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import type { StabilizerContainer, StabilizerItem } from '../validation/schemas/stabilizer_input_schema.js';
|
|
1
2
|
import type { CandidateGenerationContext } from './candidate_context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Enumerates floor-level slot positions for an item in a container.
|
|
5
|
+
* @param container - Target container.
|
|
6
|
+
* @param item - Item dimensions.
|
|
7
|
+
* @returns Floor slot positions.
|
|
8
|
+
*/
|
|
9
|
+
export declare function enumerate_floor_slots(container: StabilizerContainer, item: StabilizerItem): {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
}[];
|
|
2
14
|
/**
|
|
3
15
|
* Validates geometry and waypoint constraints for a candidate position.
|
|
4
16
|
* @param context - Candidate generation context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate_validation.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/candidate_validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"candidate_validation.d.ts","sourceRoot":"","sources":["../../../src/core/candidates/candidate_validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAA;AAK3G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAIxE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,cAAc,GACrB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAevC;AAED;;;;;;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,CAOT"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { collect_container_boxes } from '../adapters/coordinate_mapper.js';
|
|
2
|
-
import { has_overlap,
|
|
2
|
+
import { has_overlap, is_on_floor } from '../geometry/box_geometry.js';
|
|
3
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
4
|
import { resolve_item_waypoint_id } from '../waypoint/validate_waypoint_ids.js';
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const POSITION_STEP = 0.05;
|
|
6
|
+
/**
|
|
7
|
+
* Enumerates floor-level slot positions for an item in a container.
|
|
8
|
+
* @param container - Target container.
|
|
9
|
+
* @param item - Item dimensions.
|
|
10
|
+
* @returns Floor slot positions.
|
|
11
|
+
*/
|
|
12
|
+
export function enumerate_floor_slots(container, item) {
|
|
13
|
+
const slots = [];
|
|
14
|
+
const max_x = container.largura - item.w;
|
|
15
|
+
const max_z = container.comprimento - item.d;
|
|
16
|
+
for (let z = 0; z <= max_z + 1e-6; z += POSITION_STEP) {
|
|
17
|
+
for (let x = 0; x <= max_x + 1e-6; x += POSITION_STEP) {
|
|
18
|
+
slots.push({ x, y: 0, z });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return slots;
|
|
22
|
+
}
|
|
8
23
|
/**
|
|
9
24
|
* Validates geometry and waypoint constraints for a candidate position.
|
|
10
25
|
* @param context - Candidate generation context.
|
|
@@ -16,55 +31,26 @@ export function is_candidate_valid(context, target_index, position) {
|
|
|
16
31
|
if (!is_candidate_geometry_valid(context, target_index, position)) {
|
|
17
32
|
return false;
|
|
18
33
|
}
|
|
19
|
-
if (!is_elevated_on_supporter_origin(context, target_index, position)) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
if (!is_candidate_milkrun_valid(context, target_index, position)) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (!is_candidate_stacking_valid(context, target_index, position)) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
34
|
return is_candidate_waypoint_valid(context, target_index, position);
|
|
29
35
|
}
|
|
30
|
-
function is_candidate_milkrun_valid(context, target_index, position) {
|
|
31
|
-
if (context.milkrun_reserved_z_bands.length === 0) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return !is_position_in_milkrun_reserved_band({
|
|
35
|
-
bands: context.milkrun_reserved_z_bands,
|
|
36
|
-
container_index: target_index,
|
|
37
|
-
item: context.loose.item,
|
|
38
|
-
position
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
36
|
function is_candidate_geometry_valid(context, target_index, position) {
|
|
42
|
-
const candidate_box = build_candidate_box(context, position);
|
|
43
37
|
const target = context.containers[target_index];
|
|
44
|
-
const
|
|
45
|
-
return is_valid_candidate_box(candidate_box, target, boxes);
|
|
46
|
-
}
|
|
47
|
-
function build_candidate_box(context, position) {
|
|
48
|
-
return {
|
|
38
|
+
const candidate_box = {
|
|
49
39
|
x: position.x,
|
|
50
40
|
y: position.y,
|
|
51
41
|
z: position.z,
|
|
52
|
-
w: context.loose.item.
|
|
53
|
-
h: context.loose.item.
|
|
54
|
-
d: context.loose.item.
|
|
42
|
+
w: context.loose.item.w,
|
|
43
|
+
h: context.loose.item.h,
|
|
44
|
+
d: context.loose.item.d
|
|
55
45
|
};
|
|
56
|
-
|
|
57
|
-
function is_valid_candidate_box(candidate_box, target, boxes) {
|
|
58
|
-
if (!is_inside_container(candidate_box, target)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (!is_fully_supported(candidate_box, boxes)) {
|
|
46
|
+
if (!is_on_floor(candidate_box)) {
|
|
62
47
|
return false;
|
|
63
48
|
}
|
|
49
|
+
const boxes = collect_container_boxes(target, context.loose.item_id);
|
|
64
50
|
return !has_overlap(candidate_box, boxes);
|
|
65
51
|
}
|
|
66
52
|
function is_candidate_waypoint_valid(context, target_index, position) {
|
|
67
|
-
if (context.mode.kind === 'SINGLE_WAYPOINT'
|
|
53
|
+
if (context.mode.kind === 'SINGLE_WAYPOINT') {
|
|
68
54
|
return true;
|
|
69
55
|
}
|
|
70
56
|
const waypoint_id = resolve_item_waypoint_id(context.loose.item, context.mode);
|
|
@@ -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,CAgBlG"}
|
|
@@ -6,9 +6,6 @@
|
|
|
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
|
-
}
|
|
12
9
|
const same_left = left.target_container_index === source_index ? 0 : 1;
|
|
13
10
|
const same_right = right.target_container_index === source_index ? 0 : 1;
|
|
14
11
|
if (same_left !== same_right) {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { StabilizerContainer, StabilizerEnv } from '../validation/
|
|
1
|
+
import type { StabilizerContainer, StabilizerEnv } from '../validation/schemas/stabilizer_input_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';
|
|
6
5
|
export interface StateEvaluationContext {
|
|
7
6
|
env: StabilizerEnv;
|
|
8
7
|
loose_items: LooseItemRef[];
|
|
9
8
|
config: StabilizerConfig;
|
|
10
9
|
waypoint_mode: WaypointMode;
|
|
11
10
|
baseline_containers: StabilizerContainer[];
|
|
12
|
-
milkrun_reserved_z_bands: MilkrunReservedBand[];
|
|
13
11
|
}
|
|
14
12
|
//# sourceMappingURL=evaluation_context.d.ts.map
|