@jetta/cargo-stabilizer 0.1.0-9 → 0.1.0
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/README.md +17 -11
- package/build/core/adapters/axle_adapter.d.ts +1 -0
- package/build/core/adapters/axle_adapter.d.ts.map +1 -1
- package/build/core/adapters/axle_adapter.js +3 -18
- package/build/core/adapters/axle_load_evaluation.d.ts +8 -0
- package/build/core/adapters/axle_load_evaluation.d.ts.map +1 -0
- package/build/core/adapters/axle_load_evaluation.js +1 -0
- package/build/core/adapters/build_axle_request.d.ts +2 -9
- package/build/core/adapters/build_axle_request.d.ts.map +1 -1
- package/build/core/adapters/build_axle_request.js +52 -24
- package/build/core/adapters/compute_axle_excess_kg.d.ts +8 -0
- package/build/core/adapters/compute_axle_excess_kg.d.ts.map +1 -0
- package/build/core/adapters/compute_axle_excess_kg.js +19 -0
- package/build/core/adapters/coordinate_mapper.d.ts +1 -1
- package/build/core/adapters/coordinate_mapper.js +3 -3
- package/build/core/adapters/evaluate_axle_load.d.ts +10 -0
- package/build/core/adapters/evaluate_axle_load.d.ts.map +1 -0
- package/build/core/adapters/evaluate_axle_load.js +32 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts +14 -0
- package/build/core/adapters/map_item_to_stacking_item.d.ts.map +1 -0
- package/build/core/adapters/map_item_to_stacking_item.js +40 -0
- package/build/core/adapters/run_axle_calculator.d.ts.map +1 -1
- package/build/core/adapters/run_axle_calculator.js +21 -16
- package/build/core/candidates/candidate_validation.d.ts.map +1 -1
- package/build/core/candidates/candidate_validation.js +4 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts +14 -0
- package/build/core/candidates/is_candidate_stacking_valid.d.ts.map +1 -0
- package/build/core/candidates/is_candidate_stacking_valid.js +43 -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/compare_search_states.d.ts +12 -0
- package/build/core/evaluation/compare_search_states.d.ts.map +1 -0
- package/build/core/evaluation/compare_search_states.js +12 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts +18 -0
- package/build/core/evaluation/evaluate_search_gates.d.ts.map +1 -0
- package/build/core/evaluation/evaluate_search_gates.js +30 -0
- package/build/core/evaluation/evaluation_result.d.ts +15 -0
- package/build/core/evaluation/evaluation_result.d.ts.map +1 -0
- package/build/core/evaluation/evaluation_result.js +1 -0
- package/build/core/evaluation/genetic_fitness.d.ts +9 -0
- package/build/core/evaluation/genetic_fitness.d.ts.map +1 -0
- package/build/core/evaluation/genetic_fitness.js +16 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts +8 -0
- package/build/core/evaluation/is_non_axle_gates_pass.d.ts.map +1 -0
- package/build/core/evaluation/is_non_axle_gates_pass.js +8 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts +10 -0
- package/build/core/evaluation/is_search_trial_admissible.d.ts.map +1 -0
- package/build/core/evaluation/is_search_trial_admissible.js +17 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts +10 -0
- package/build/core/evaluation/is_waypoint_order_valid.d.ts.map +1 -0
- package/build/core/evaluation/is_waypoint_order_valid.js +14 -0
- package/build/core/evaluation/state_evaluator.d.ts +2 -10
- package/build/core/evaluation/state_evaluator.d.ts.map +1 -1
- package/build/core/evaluation/state_evaluator.js +6 -26
- package/build/core/factory/read_stabilizer_config.d.ts +3 -2
- package/build/core/factory/read_stabilizer_config.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config_helpers.d.ts +9 -5
- package/build/core/factory/read_stabilizer_config_helpers.d.ts.map +1 -1
- package/build/core/factory/read_stabilizer_config_helpers.js +12 -1
- 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 +53 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts +8 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.d.ts.map +1 -0
- package/build/core/filters/collect_pinned_floor_tie_ratio_group_ids.js +41 -0
- package/build/core/filters/is_item_on_cm_floor.d.ts +8 -0
- package/build/core/filters/is_item_on_cm_floor.d.ts.map +1 -0
- package/build/core/filters/is_item_on_cm_floor.js +9 -0
- package/build/core/geometry/has_penetrating_overlap.d.ts +9 -0
- package/build/core/geometry/has_penetrating_overlap.d.ts.map +1 -0
- package/build/core/geometry/has_penetrating_overlap.js +27 -0
- 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.map +1 -1
- package/build/core/orchestration/build_reorder_context.js +3 -5
- package/build/core/strategies/reorder/BeamSearchReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/BeamSearchReorder.js +10 -12
- package/build/core/strategies/reorder/GeneticReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/GeneticReorder.js +2 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.d.ts.map +1 -1
- package/build/core/strategies/reorder/SimulatedAnnealingReorder.js +14 -5
- package/build/core/strategies/reorder/append_admitted_trial.d.ts +11 -0
- package/build/core/strategies/reorder/append_admitted_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/append_admitted_trial.js +22 -0
- package/build/core/strategies/reorder/beam_context.d.ts +1 -0
- package/build/core/strategies/reorder/beam_context.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.d.ts.map +1 -1
- package/build/core/strategies/reorder/greedy_improvement.js +3 -2
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts +10 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.d.ts.map +1 -0
- package/build/core/strategies/reorder/is_improving_greedy_trial.js +17 -0
- package/build/core/strategies/reorder/select_surviving_beam.d.ts +11 -0
- package/build/core/strategies/reorder/select_surviving_beam.d.ts.map +1 -0
- package/build/core/strategies/reorder/select_surviving_beam.js +13 -0
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts +37 -3
- package/build/core/validation/contract/cargo_movement_wire_field_map.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_field_map.js +40 -6
- package/build/core/validation/contract/cargo_movement_wire_mapper.d.ts.map +1 -1
- package/build/core/validation/contract/cargo_movement_wire_mapper.js +10 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_contract_to_wire_shape.js +12 -21
- package/build/core/validation/contract/map_input_config.d.ts +9 -0
- package/build/core/validation/contract/map_input_config.d.ts.map +1 -0
- package/build/core/validation/contract/map_input_config.js +40 -0
- package/build/core/validation/contract/map_wire_input_to_contract_shape.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_input_to_contract_shape.js +28 -22
- package/build/core/validation/contract/map_wire_item_stacking.d.ts +7 -0
- package/build/core/validation/contract/map_wire_item_stacking.d.ts.map +1 -0
- package/build/core/validation/contract/map_wire_item_stacking.js +40 -0
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts +1 -5
- package/build/core/validation/contract/map_wire_item_to_contract.d.ts.map +1 -1
- package/build/core/validation/contract/map_wire_item_to_contract.js +16 -14
- package/build/core/validation/contract/parse_stabilizer_input.d.ts +49 -7
- package/build/core/validation/contract/parse_stabilizer_input.d.ts.map +1 -1
- package/build/core/validation/contract/parse_stabilizer_input.js +2 -0
- package/build/core/validation/contract/parse_stabilizer_output.d.ts +34 -5
- package/build/core/validation/contract/parse_stabilizer_output.d.ts.map +1 -1
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts +6 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.d.ts.map +1 -0
- package/build/core/validation/contract/reject_forbidden_input_fields.js +53 -0
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts +36 -65
- package/build/core/validation/contract/stabilizer_domain_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_domain_schema.js +16 -38
- package/build/core/validation/contract/stabilizer_env_schema.d.ts +112 -0
- package/build/core/validation/contract/stabilizer_env_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_env_schema.js +38 -0
- package/build/core/validation/contract/stabilizer_input_schema.d.ts +51 -7
- package/build/core/validation/contract/stabilizer_input_schema.d.ts.map +1 -1
- package/build/core/validation/contract/stabilizer_input_schema.js +2 -2
- package/build/core/validation/contract/stabilizer_item_schema.d.ts +25 -0
- package/build/core/validation/contract/stabilizer_item_schema.d.ts.map +1 -0
- package/build/core/validation/contract/stabilizer_item_schema.js +23 -0
- package/build/core/validation/contract/stabilizer_output_schema.d.ts +68 -10
- package/build/core/validation/contract/stabilizer_output_schema.d.ts.map +1 -1
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts +14 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.d.ts.map +1 -0
- package/build/core/validation/contract/uniquify_contract_item_ids.js +54 -0
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts +2 -1
- package/build/core/validation/schemas/stabilizer_config_schema.d.ts.map +1 -1
- package/build/core/validation/schemas/stabilizer_config_schema.js +2 -1
- package/build/index.d.ts +11 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +29 -21
- package/package.json +28 -13
- package/CHANGELOG.md +0 -38
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ranks search states: lower axle excess first, then higher stability objective.
|
|
3
|
+
* @param left - Left state.
|
|
4
|
+
* @param right - Right state.
|
|
5
|
+
* @returns Negative when left ranks ahead of right.
|
|
6
|
+
*/
|
|
7
|
+
export function compare_search_states(left, right) {
|
|
8
|
+
if (left.axle_excess_kg !== right.axle_excess_kg) {
|
|
9
|
+
return left.axle_excess_kg - right.axle_excess_kg;
|
|
10
|
+
}
|
|
11
|
+
return right.objective - left.objective;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { EvaluationResult } from './evaluation_result.js';
|
|
5
|
+
export interface SearchGateOutcome {
|
|
6
|
+
objective: number;
|
|
7
|
+
pass: boolean;
|
|
8
|
+
flags: Omit<EvaluationResult, 'stability' | 'objective' | 'all_gates_pass'>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Computes reorder objective and legality flags for a layout.
|
|
12
|
+
* @param containers - Container layout.
|
|
13
|
+
* @param context - Evaluation context.
|
|
14
|
+
* @param stability - Transport stability evaluation.
|
|
15
|
+
* @returns Objective, pass flag, and gate fields.
|
|
16
|
+
*/
|
|
17
|
+
export declare function evaluate_search_gates(containers: StabilizerContainer[], context: StateEvaluationContext, stability: StabilityEvaluation): SearchGateOutcome;
|
|
18
|
+
//# sourceMappingURL=evaluate_search_gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate_search_gates.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/evaluate_search_gates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAM9D,MAAM,WAAW,iBAAiB;IAE9B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,GAAG,WAAW,GAAG,gBAAgB,CAAC,CAAA;CAC9E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,sBAAsB,EAC/B,SAAS,EAAE,mBAAmB,GAC/B,iBAAiB,CAanB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { compute_reorder_objective } from './compute_reorder_objective.js';
|
|
2
|
+
import { evaluate_axle_load } from '../adapters/evaluate_axle_load.js';
|
|
3
|
+
import { is_layout_milkrun_valid } from '../waypoint/milkrun_wall_reservation.js';
|
|
4
|
+
import { is_waypoint_order_valid } from './is_waypoint_order_valid.js';
|
|
5
|
+
/**
|
|
6
|
+
* Computes reorder objective and legality flags for a layout.
|
|
7
|
+
* @param containers - Container layout.
|
|
8
|
+
* @param context - Evaluation context.
|
|
9
|
+
* @param stability - Transport stability evaluation.
|
|
10
|
+
* @returns Objective, pass flag, and gate fields.
|
|
11
|
+
*/
|
|
12
|
+
export function evaluate_search_gates(containers, context, stability) {
|
|
13
|
+
const objective = compute_reorder_objective(stability, containers, context.loose_items);
|
|
14
|
+
const axle_load = evaluate_axle_load({ ...context.env, containers }, context.config.axle_load_margin_percent);
|
|
15
|
+
const flags = build_gate_flags({ containers, context, stability, axle_load });
|
|
16
|
+
return {
|
|
17
|
+
objective,
|
|
18
|
+
pass: flags.transport_floor_valid && flags.axle_valid && flags.waypoint_valid && flags.milkrun_valid,
|
|
19
|
+
flags
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function build_gate_flags(input) {
|
|
23
|
+
return {
|
|
24
|
+
transport_floor_valid: input.stability.transport_score >= input.context.config.transport_stability_floor,
|
|
25
|
+
axle_valid: input.axle_load.valid,
|
|
26
|
+
waypoint_valid: is_waypoint_order_valid(input.containers, input.context),
|
|
27
|
+
milkrun_valid: is_layout_milkrun_valid(input.containers, input.context.milkrun_reserved_z_bands),
|
|
28
|
+
axle_excess_kg: input.axle_load.excess_kg
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StabilityEvaluation } from '../adapters/stability_adapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Outcome of evaluating a layout against stabilizer gates.
|
|
4
|
+
*/
|
|
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
|
+
axle_excess_kg: number;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=evaluation_result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation_result.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/evaluation_result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAE3E;;GAEG;AACH,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;IACvB,cAAc,EAAE,MAAM,CAAA;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EvaluationResult } from './evaluation_result.js';
|
|
2
|
+
export declare const LEGAL_FITNESS_OFFSET = 1000000;
|
|
3
|
+
/**
|
|
4
|
+
* Scores a genetic organism: legal layouts outrank every illegal one.
|
|
5
|
+
* @param evaluation - Layout evaluation.
|
|
6
|
+
* @returns Fitness; higher is better.
|
|
7
|
+
*/
|
|
8
|
+
export declare function genetic_fitness(evaluation: EvaluationResult): number;
|
|
9
|
+
//# sourceMappingURL=genetic_fitness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genetic_fitness.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/genetic_fitness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAG9D,eAAO,MAAM,oBAAoB,UAAY,CAAA;AAE7C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,CAWpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { is_non_axle_gates_pass } from './is_non_axle_gates_pass.js';
|
|
2
|
+
export const LEGAL_FITNESS_OFFSET = 1_000_000;
|
|
3
|
+
/**
|
|
4
|
+
* Scores a genetic organism: legal layouts outrank every illegal one.
|
|
5
|
+
* @param evaluation - Layout evaluation.
|
|
6
|
+
* @returns Fitness; higher is better.
|
|
7
|
+
*/
|
|
8
|
+
export function genetic_fitness(evaluation) {
|
|
9
|
+
if (!is_non_axle_gates_pass(evaluation)) {
|
|
10
|
+
return Number.NEGATIVE_INFINITY;
|
|
11
|
+
}
|
|
12
|
+
if (evaluation.axle_valid) {
|
|
13
|
+
return LEGAL_FITNESS_OFFSET + evaluation.objective;
|
|
14
|
+
}
|
|
15
|
+
return -evaluation.axle_excess_kg;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EvaluationResult } from './evaluation_result.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true when waypoint, milkrun, and transport-floor gates pass.
|
|
4
|
+
* @param result - Evaluation result.
|
|
5
|
+
* @returns True when non-axle gates all pass.
|
|
6
|
+
*/
|
|
7
|
+
export declare function is_non_axle_gates_pass(result: EvaluationResult): boolean;
|
|
8
|
+
//# sourceMappingURL=is_non_axle_gates_pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_non_axle_gates_pass.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/is_non_axle_gates_pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAGxE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when waypoint, milkrun, and transport-floor gates pass.
|
|
3
|
+
* @param result - Evaluation result.
|
|
4
|
+
* @returns True when non-axle gates all pass.
|
|
5
|
+
*/
|
|
6
|
+
export function is_non_axle_gates_pass(result) {
|
|
7
|
+
return result.transport_floor_valid && result.waypoint_valid && result.milkrun_valid;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EvaluationResult } from './evaluation_result.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decides whether a one-item trial may enter the search.
|
|
4
|
+
* Over parents may climb with strictly less axle excess; legal parents keep a hard axle gate.
|
|
5
|
+
* @param parent - Parent layout evaluation.
|
|
6
|
+
* @param child - Trial layout evaluation.
|
|
7
|
+
* @returns True when the trial is admissible.
|
|
8
|
+
*/
|
|
9
|
+
export declare function is_search_trial_admissible(parent: EvaluationResult, child: EvaluationResult): boolean;
|
|
10
|
+
//# sourceMappingURL=is_search_trial_admissible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_search_trial_admissible.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/is_search_trial_admissible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAG9D;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,gBAAgB,GACxB,OAAO,CAWT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { is_non_axle_gates_pass } from './is_non_axle_gates_pass.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decides whether a one-item trial may enter the search.
|
|
4
|
+
* Over parents may climb with strictly less axle excess; legal parents keep a hard axle gate.
|
|
5
|
+
* @param parent - Parent layout evaluation.
|
|
6
|
+
* @param child - Trial layout evaluation.
|
|
7
|
+
* @returns True when the trial is admissible.
|
|
8
|
+
*/
|
|
9
|
+
export function is_search_trial_admissible(parent, child) {
|
|
10
|
+
if (!is_non_axle_gates_pass(child)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (parent.axle_valid) {
|
|
14
|
+
return child.axle_valid;
|
|
15
|
+
}
|
|
16
|
+
return child.axle_excess_kg < parent.axle_excess_kg;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { StateEvaluationContext } from './evaluation_context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true when waypoint order is satisfied for the layout.
|
|
5
|
+
* @param containers - Container layout.
|
|
6
|
+
* @param context - Evaluation context.
|
|
7
|
+
* @returns True when waypoint mode is single or order is preserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function is_waypoint_order_valid(containers: StabilizerContainer[], context: StateEvaluationContext): boolean;
|
|
10
|
+
//# sourceMappingURL=is_waypoint_order_valid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_waypoint_order_valid.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/is_waypoint_order_valid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAGrE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,sBAAsB,GAChC,OAAO,CAeT"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { preserves_waypoint_order } from '../waypoint/preserves_waypoint_order.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true when waypoint order is satisfied for the layout.
|
|
4
|
+
* @param containers - Container layout.
|
|
5
|
+
* @param context - Evaluation context.
|
|
6
|
+
* @returns True when waypoint mode is single or order is preserved.
|
|
7
|
+
*/
|
|
8
|
+
export function is_waypoint_order_valid(containers, context) {
|
|
9
|
+
if (context.waypoint_mode.kind === 'SINGLE_WAYPOINT' ||
|
|
10
|
+
!context.config.preserve_tie_block_organization) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return preserves_waypoint_order(context.baseline_containers, containers, context.waypoint_mode);
|
|
14
|
+
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
-
import { type StabilityEvaluation } from '../adapters/stability_adapter.js';
|
|
3
2
|
import type { StateEvaluationContext } from './evaluation_context.js';
|
|
4
3
|
import type { ReorderContext } from '../strategies/reorder/ReorderStrategy.js';
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
}
|
|
4
|
+
import type { EvaluationResult } from './evaluation_result.js';
|
|
5
|
+
export type { EvaluationResult };
|
|
14
6
|
/**
|
|
15
7
|
* Evaluates a container layout against all stabilizer gates.
|
|
16
8
|
* @param containers - Container layout to evaluate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state_evaluator.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/state_evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;
|
|
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;AAG7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAI9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAEhC;;;;;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;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,sBAAsB,GAChC;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAMrD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { try_evaluate_transport_stability } from '../adapters/stability_adapter.js';
|
|
2
|
-
import { compute_reorder_objective } from './compute_reorder_objective.js';
|
|
3
|
-
import { is_axle_load_valid } from '../adapters/axle_adapter.js';
|
|
4
|
-
import { preserves_waypoint_order } from '../waypoint/preserves_waypoint_order.js';
|
|
5
|
-
import { is_layout_milkrun_valid } from '../waypoint/milkrun_wall_reservation.js';
|
|
6
2
|
import { clone_containers } from '../move/apply_move.js';
|
|
3
|
+
import { evaluate_search_gates } from './evaluate_search_gates.js';
|
|
4
|
+
import { is_waypoint_order_valid } from './is_waypoint_order_valid.js';
|
|
5
|
+
import { is_layout_milkrun_valid } from '../waypoint/milkrun_wall_reservation.js';
|
|
7
6
|
/**
|
|
8
7
|
* Evaluates a container layout against all stabilizer gates.
|
|
9
8
|
* @param containers - Container layout to evaluate.
|
|
@@ -15,7 +14,7 @@ export function evaluate_state(containers, context) {
|
|
|
15
14
|
if (!stability) {
|
|
16
15
|
return invalid_evaluation_result();
|
|
17
16
|
}
|
|
18
|
-
const gates =
|
|
17
|
+
const gates = evaluate_search_gates(containers, context, stability);
|
|
19
18
|
return { stability, objective: gates.objective, ...gates.flags, all_gates_pass: gates.pass };
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
@@ -50,19 +49,6 @@ export function evaluation_context_from_reorder(context) {
|
|
|
50
49
|
export function clone_baseline(containers) {
|
|
51
50
|
return clone_containers(containers);
|
|
52
51
|
}
|
|
53
|
-
function evaluate_gates(containers, context, stability) {
|
|
54
|
-
const objective = compute_reorder_objective(stability, containers, context.loose_items);
|
|
55
|
-
const transport_floor_valid = stability.transport_score >= context.config.transport_stability_floor;
|
|
56
|
-
const axle_valid = is_axle_load_valid({ ...context.env, containers }, context.config.axle_load_margin_percent);
|
|
57
|
-
const waypoint_valid = is_waypoint_order_valid(containers, context);
|
|
58
|
-
const milkrun_valid = is_layout_milkrun_valid(containers, context.milkrun_reserved_z_bands);
|
|
59
|
-
const flags = { transport_floor_valid, axle_valid, waypoint_valid, milkrun_valid };
|
|
60
|
-
return {
|
|
61
|
-
objective,
|
|
62
|
-
pass: transport_floor_valid && axle_valid && waypoint_valid && milkrun_valid,
|
|
63
|
-
flags
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
52
|
/**
|
|
67
53
|
* Evaluates organization constraint gates without stability or axle checks.
|
|
68
54
|
* @param containers - Container layout to evaluate.
|
|
@@ -75,13 +61,6 @@ export function evaluate_organization_gates(containers, context) {
|
|
|
75
61
|
milkrun_valid: is_layout_milkrun_valid(containers, context.milkrun_reserved_z_bands)
|
|
76
62
|
};
|
|
77
63
|
}
|
|
78
|
-
function is_waypoint_order_valid(containers, context) {
|
|
79
|
-
if (context.waypoint_mode.kind === 'SINGLE_WAYPOINT' ||
|
|
80
|
-
!context.config.preserve_tie_block_organization) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
return preserves_waypoint_order(context.baseline_containers, containers, context.waypoint_mode);
|
|
84
|
-
}
|
|
85
64
|
function invalid_evaluation_result() {
|
|
86
65
|
return {
|
|
87
66
|
stability: { item_scores: [], container_scores: [], transport_score: 0 },
|
|
@@ -90,6 +69,7 @@ function invalid_evaluation_result() {
|
|
|
90
69
|
axle_valid: false,
|
|
91
70
|
waypoint_valid: false,
|
|
92
71
|
milkrun_valid: false,
|
|
93
|
-
all_gates_pass: false
|
|
72
|
+
all_gates_pass: false,
|
|
73
|
+
axle_excess_kg: Number.POSITIVE_INFINITY
|
|
94
74
|
};
|
|
95
75
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type StabilizerConfig } from '../validation/schemas/stabilizer_config_schema.js';
|
|
2
|
-
import type { StabilizerCargoState } from '../validation/contract/stabilizer_domain_schema.js';
|
|
3
2
|
/**
|
|
4
3
|
* Reads stabilizer config from cargo-movement config and cargo profile algoritmo maps.
|
|
5
4
|
* @param config - Top-level stabilizer input config object.
|
|
6
5
|
* @param cargo_state - Cargo profile (optional) for merged algoritmo keys.
|
|
7
6
|
* @returns Parsed stabilizer configuration.
|
|
8
7
|
*/
|
|
9
|
-
export declare function read_stabilizer_config(config: Record<string, unknown> | undefined, cargo_state?:
|
|
8
|
+
export declare function read_stabilizer_config(config: Record<string, unknown> | undefined, cargo_state?: {
|
|
9
|
+
config?: unknown;
|
|
10
|
+
}): StabilizerConfig;
|
|
10
11
|
//# sourceMappingURL=read_stabilizer_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read_stabilizer_config.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,mDAAmD,CAAA;
|
|
1
|
+
{"version":3,"file":"read_stabilizer_config.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,mDAAmD,CAAA;AAG1D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,WAAW,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACnC,gBAAgB,CAYlB"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
type CargoStateConfigHolder = {
|
|
2
|
+
config?: unknown;
|
|
3
|
+
};
|
|
2
4
|
/**
|
|
3
5
|
* Merges root and cargo profile algoritmo maps (profile overrides root).
|
|
4
6
|
* @param config - Root stabilizer input config.
|
|
5
7
|
* @param cargo_state - Cargo profile state.
|
|
6
8
|
* @returns Merged algoritmo map.
|
|
7
9
|
*/
|
|
8
|
-
export declare function merge_algoritmo_maps(config: Record<string, unknown> | undefined, cargo_state?:
|
|
10
|
+
export declare function merge_algoritmo_maps(config: Record<string, unknown> | undefined, cargo_state?: CargoStateConfigHolder): Record<string, unknown>;
|
|
9
11
|
/**
|
|
10
12
|
* Reads raw stabilizer config fields from merged algoritmo map.
|
|
11
13
|
* @param algoritmo - Merged algoritmo configuration map.
|
|
12
14
|
* @returns Raw config object for schema parsing.
|
|
13
15
|
*/
|
|
14
16
|
export declare function read_raw_stabilizer_config(algoritmo: Record<string, unknown>): {
|
|
17
|
+
preserve_tie_block_organization: boolean;
|
|
18
|
+
pin_tie_ratio_blocks: boolean;
|
|
19
|
+
enforce_milkrun_wall_reservation: boolean;
|
|
20
|
+
number_of_wall_to_allocate_from_last_waypoints: number;
|
|
15
21
|
reorder_strategy: string;
|
|
16
22
|
transport_stability_floor: number;
|
|
17
23
|
max_iteration: number;
|
|
@@ -21,8 +27,6 @@ export declare function read_raw_stabilizer_config(algoritmo: Record<string, unk
|
|
|
21
27
|
beam_width: number;
|
|
22
28
|
beam_top_k: number;
|
|
23
29
|
axle_load_margin_percent: number;
|
|
24
|
-
preserve_tie_block_organization: boolean;
|
|
25
|
-
enforce_milkrun_wall_reservation: boolean;
|
|
26
|
-
number_of_wall_to_allocate_from_last_waypoints: number;
|
|
27
30
|
};
|
|
31
|
+
export {};
|
|
28
32
|
//# sourceMappingURL=read_stabilizer_config_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read_stabilizer_config_helpers.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config_helpers.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"read_stabilizer_config_helpers.d.ts","sourceRoot":"","sources":["../../../src/core/factory/read_stabilizer_config_helpers.ts"],"names":[],"mappings":"AAGA,KAAK,sBAAsB,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAKlD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,WAAW,CAAC,EAAE,sBAAsB,GACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;EAM5E"}
|
|
@@ -19,6 +19,12 @@ export function merge_algoritmo_maps(config, cargo_state) {
|
|
|
19
19
|
* @returns Raw config object for schema parsing.
|
|
20
20
|
*/
|
|
21
21
|
export function read_raw_stabilizer_config(algoritmo) {
|
|
22
|
+
return {
|
|
23
|
+
...read_search_raw(algoritmo),
|
|
24
|
+
...read_organization_raw(algoritmo)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function read_search_raw(algoritmo) {
|
|
22
28
|
return {
|
|
23
29
|
reorder_strategy: read_config_string(algoritmo, 'reorder_strategy', REORDER_STRATEGY.GRAVITY),
|
|
24
30
|
transport_stability_floor: read_config_number(algoritmo, 'transport_stability_floor', 0),
|
|
@@ -28,8 +34,13 @@ export function read_raw_stabilizer_config(algoritmo) {
|
|
|
28
34
|
genetic_mutation_rate: read_config_number(algoritmo, 'genetic_mutation_rate', 0.15),
|
|
29
35
|
beam_width: read_config_number(algoritmo, 'beam_width', 5),
|
|
30
36
|
beam_top_k: read_config_number(algoritmo, 'beam_top_k', 3),
|
|
31
|
-
axle_load_margin_percent: read_config_number(algoritmo, 'folga_de_peso_nos_eixos', 0)
|
|
37
|
+
axle_load_margin_percent: read_config_number(algoritmo, 'folga_de_peso_nos_eixos', 0)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function read_organization_raw(algoritmo) {
|
|
41
|
+
return {
|
|
32
42
|
preserve_tie_block_organization: read_config_boolean(algoritmo, 'preserve_tie_block_organization', true),
|
|
43
|
+
pin_tie_ratio_blocks: read_config_boolean(algoritmo, 'pin_tie_ratio_blocks', false),
|
|
33
44
|
enforce_milkrun_wall_reservation: read_config_boolean(algoritmo, 'enforce_milkrun_wall_reservation', false),
|
|
34
45
|
number_of_wall_to_allocate_from_last_waypoints: read_milkrun_wall_count(algoritmo)
|
|
35
46
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
import type { LooseItemRef } from './loose_item_filter.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collects items the stabilizer may move.
|
|
5
|
+
* @param containers - Container list from env.
|
|
6
|
+
* @param pin_tie_ratio_blocks - When true, skip floor five-slot 3_2/2_3 walls.
|
|
7
|
+
* @returns Movable item references with container index.
|
|
8
|
+
*/
|
|
9
|
+
export declare function collect_movable_items(containers: {
|
|
10
|
+
items: StabilizerItem[];
|
|
11
|
+
}[], pin_tie_ratio_blocks: boolean): LooseItemRef[];
|
|
12
|
+
/**
|
|
13
|
+
* @param item - Item record.
|
|
14
|
+
* @param pinned_group_ids - Floor five-slot 3_2/2_3 group ids.
|
|
15
|
+
* @returns True when the item is a floor member of a pinned wall.
|
|
16
|
+
*/
|
|
17
|
+
export declare function is_tie_ratio_block_item(item: StabilizerItem, pinned_group_ids: Set<string>): boolean;
|
|
18
|
+
//# sourceMappingURL=collect_movable_items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect_movable_items.d.ts","sourceRoot":"","sources":["../../../src/core/filters/collect_movable_items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAI1D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE;IAAE,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,EAAE,EACzC,oBAAoB,EAAE,OAAO,GAC9B,YAAY,EAAE,CAMhB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,cAAc,EACpB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC9B,OAAO,CAOT"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { collect_pinned_floor_tie_ratio_group_ids } from './collect_pinned_floor_tie_ratio_group_ids.js';
|
|
2
|
+
import { is_item_on_cm_floor } from './is_item_on_cm_floor.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collects items the stabilizer may move.
|
|
5
|
+
* @param containers - Container list from env.
|
|
6
|
+
* @param pin_tie_ratio_blocks - When true, skip floor five-slot 3_2/2_3 walls.
|
|
7
|
+
* @returns Movable item references with container index.
|
|
8
|
+
*/
|
|
9
|
+
export function collect_movable_items(containers, pin_tie_ratio_blocks) {
|
|
10
|
+
const pinned_groups = pin_tie_ratio_blocks
|
|
11
|
+
? collect_pinned_floor_tie_ratio_group_ids(flatten_container_items(containers))
|
|
12
|
+
: new Set();
|
|
13
|
+
return collect_items_except_pinned(containers, pinned_groups);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @param item - Item record.
|
|
17
|
+
* @param pinned_group_ids - Floor five-slot 3_2/2_3 group ids.
|
|
18
|
+
* @returns True when the item is a floor member of a pinned wall.
|
|
19
|
+
*/
|
|
20
|
+
export function is_tie_ratio_block_item(item, pinned_group_ids) {
|
|
21
|
+
if (item.group_id == null || !is_item_on_cm_floor(item)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return pinned_group_ids.has(item.group_id);
|
|
25
|
+
}
|
|
26
|
+
function collect_items_except_pinned(containers, pinned_groups) {
|
|
27
|
+
const movable = [];
|
|
28
|
+
for (let container_index = 0; container_index < containers.length; container_index++) {
|
|
29
|
+
movable.push(...collect_container_movable_items(containers[container_index].items, container_index, pinned_groups));
|
|
30
|
+
}
|
|
31
|
+
return movable;
|
|
32
|
+
}
|
|
33
|
+
function collect_container_movable_items(items, container_index, pinned_groups) {
|
|
34
|
+
const movable = [];
|
|
35
|
+
for (const item of items) {
|
|
36
|
+
if (is_tie_ratio_block_item(item, pinned_groups)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
movable.push({
|
|
40
|
+
item_id: item.item_id,
|
|
41
|
+
container_index,
|
|
42
|
+
item
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return movable;
|
|
46
|
+
}
|
|
47
|
+
function flatten_container_items(containers) {
|
|
48
|
+
const items = [];
|
|
49
|
+
for (const container of containers) {
|
|
50
|
+
items.push(...container.items);
|
|
51
|
+
}
|
|
52
|
+
return items;
|
|
53
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Group ids of floor five-slot 3_2/2_3 walls that the stabilizer must pin.
|
|
4
|
+
* @param items - All items in the cargo.
|
|
5
|
+
* @returns Group ids with exactly five floor tie-ratio members.
|
|
6
|
+
*/
|
|
7
|
+
export declare function collect_pinned_floor_tie_ratio_group_ids(items: StabilizerItem[]): Set<string>;
|
|
8
|
+
//# sourceMappingURL=collect_pinned_floor_tie_ratio_group_ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect_pinned_floor_tie_ratio_group_ids.d.ts","sourceRoot":"","sources":["../../../src/core/filters/collect_pinned_floor_tie_ratio_group_ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAMxF;;;;GAIG;AACH,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAQ7F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TIE_RATIO_ORIENTATION } from '../constants/TieRatioOrientation.js';
|
|
2
|
+
import { is_item_on_cm_floor } from './is_item_on_cm_floor.js';
|
|
3
|
+
const FULL_TIE_RATIO_FLOOR_COUNT = 5;
|
|
4
|
+
/**
|
|
5
|
+
* Group ids of floor five-slot 3_2/2_3 walls that the stabilizer must pin.
|
|
6
|
+
* @param items - All items in the cargo.
|
|
7
|
+
* @returns Group ids with exactly five floor tie-ratio members.
|
|
8
|
+
*/
|
|
9
|
+
export function collect_pinned_floor_tie_ratio_group_ids(items) {
|
|
10
|
+
const floor_tie_count_by_group = new Map();
|
|
11
|
+
for (const item of items) {
|
|
12
|
+
add_floor_tie_member(floor_tie_count_by_group, item);
|
|
13
|
+
}
|
|
14
|
+
return groups_with_full_floor_wall(floor_tie_count_by_group);
|
|
15
|
+
}
|
|
16
|
+
function add_floor_tie_member(counts, item) {
|
|
17
|
+
if (item.group_id == null || !is_item_on_cm_floor(item)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!is_tie_ratio_orientation(read_tie_ratio_orientation(item))) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
counts.set(item.group_id, (counts.get(item.group_id) ?? 0) + 1);
|
|
24
|
+
}
|
|
25
|
+
function groups_with_full_floor_wall(counts) {
|
|
26
|
+
const pinned = new Set();
|
|
27
|
+
for (const [group_id, count] of counts) {
|
|
28
|
+
if (count === FULL_TIE_RATIO_FLOOR_COUNT) {
|
|
29
|
+
pinned.add(group_id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return pinned;
|
|
33
|
+
}
|
|
34
|
+
function read_tie_ratio_orientation(item) {
|
|
35
|
+
const orientation = item.tie_ratio_orientation;
|
|
36
|
+
return typeof orientation === 'string' ? orientation : undefined;
|
|
37
|
+
}
|
|
38
|
+
function is_tie_ratio_orientation(orientation) {
|
|
39
|
+
return orientation === TIE_RATIO_ORIENTATION.THREE_TWO
|
|
40
|
+
|| orientation === TIE_RATIO_ORIENTATION.TWO_THREE;
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StabilizerItem } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* True when the item rests on the floor (contract y is height after wire map).
|
|
4
|
+
* @param item - Stabilizer item in contract coordinates.
|
|
5
|
+
* @returns True when height origin is on the floor.
|
|
6
|
+
*/
|
|
7
|
+
export declare function is_item_on_cm_floor(item: StabilizerItem): boolean;
|
|
8
|
+
//# sourceMappingURL=is_item_on_cm_floor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_item_on_cm_floor.d.ts","sourceRoot":"","sources":["../../../src/core/filters/is_item_on_cm_floor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AAIxF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAGjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const CM_FLOOR_HEIGHT_EPSILON = 1e-6;
|
|
2
|
+
/**
|
|
3
|
+
* True when the item rests on the floor (contract y is height after wire map).
|
|
4
|
+
* @param item - Stabilizer item in contract coordinates.
|
|
5
|
+
* @returns True when height origin is on the floor.
|
|
6
|
+
*/
|
|
7
|
+
export function is_item_on_cm_floor(item) {
|
|
8
|
+
return item.y <= CM_FLOOR_HEIGHT_EPSILON;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StabilizerContainer } from '../validation/contract/stabilizer_domain_schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* True when any two items penetrate in the contract frame
|
|
4
|
+
* (x + width, y + height, z + depth). Face-touch uses `@jetta/number-compare`.
|
|
5
|
+
* @param containers - Layout to inspect.
|
|
6
|
+
* @returns True when a pair occupies the same volume beyond float error.
|
|
7
|
+
*/
|
|
8
|
+
export declare function has_penetrating_overlap(containers: StabilizerContainer[]): boolean;
|
|
9
|
+
//# sourceMappingURL=has_penetrating_overlap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has_penetrating_overlap.d.ts","sourceRoot":"","sources":["../../../src/core/geometry/has_penetrating_overlap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,oDAAoD,CAAA;AAE7G;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAGlF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { lt } from '@jetta/number-compare';
|
|
2
|
+
/**
|
|
3
|
+
* True when any two items penetrate in the contract frame
|
|
4
|
+
* (x + width, y + height, z + depth). Face-touch uses `@jetta/number-compare`.
|
|
5
|
+
* @param containers - Layout to inspect.
|
|
6
|
+
* @returns True when a pair occupies the same volume beyond float error.
|
|
7
|
+
*/
|
|
8
|
+
export function has_penetrating_overlap(containers) {
|
|
9
|
+
return containers.some(container => container_has_penetrating_overlap(container));
|
|
10
|
+
}
|
|
11
|
+
function container_has_penetrating_overlap(container) {
|
|
12
|
+
const items = container.items;
|
|
13
|
+
for (let i = 0; i < items.length; i++) {
|
|
14
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
15
|
+
if (items_penetrate(items[i], items[j])) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
function items_penetrate(left, right) {
|
|
23
|
+
return intervals_overlap({ min: left.x, max: left.x + left.width }, { min: right.x, max: right.x + right.width }) && intervals_overlap({ min: left.y, max: left.y + left.height }, { min: right.y, max: right.y + right.height }) && intervals_overlap({ min: left.z, max: left.z + left.depth }, { min: right.z, max: right.z + right.depth });
|
|
24
|
+
}
|
|
25
|
+
function intervals_overlap(left, right) {
|
|
26
|
+
return lt(left.min, right.max) && lt(right.min, left.max);
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAO9F;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"StabilizerFlow.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/StabilizerFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAO9F;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,CAgBhF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,OAAO,GAAG,oBAAoB,CAI1F"}
|
|
@@ -9,7 +9,7 @@ import { stabilizer_logger } from '../logging/stabilizer_logger.js';
|
|
|
9
9
|
* @returns Updated cargo_state.
|
|
10
10
|
*/
|
|
11
11
|
export function run_stabilizer_flow(input) {
|
|
12
|
-
const config = read_stabilizer_config(input.config
|
|
12
|
+
const config = read_stabilizer_config(input.config);
|
|
13
13
|
const context = build_reorder_context(input, config);
|
|
14
14
|
stabilizer_logger.debug('reorder_strategy=' + config.reorder_strategy);
|
|
15
15
|
stabilizer_logger.debug('container_count=' + context.containers.length +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAQ9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"build_reorder_context.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/build_reorder_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAQ9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACzB,cAAc,CAqBhB"}
|