@jetta/blocks-allocator 0.0.0-stage → 0.1.0-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 +103 -2
- package/package.json +67 -5
- package/src/Allocation_Attempt.js +135 -0
- package/src/Allocation_Error_Handler.js +69 -0
- package/src/Allocation_Flow.js +162 -0
- package/src/Allocation_Optimization/Allocation_LP.js +150 -0
- package/src/Allocation_Optimization/Block_Allocator.js +129 -0
- package/src/Allocation_Optimization/Block_Layer_Order.js +50 -0
- package/src/Allocation_Optimization/Block_Potential_Weight.js +54 -0
- package/src/Allocation_Optimization/Chosen_Blocks_Stock_Cap.js +82 -0
- package/src/Allocation_Optimization/block_builder/Allocation_Item_Creator.js +37 -0
- package/src/Allocation_Optimization/block_builder/Block_Item_List_Validator.js +18 -0
- package/src/Allocation_Optimization/block_builder/Block_Wall_Builder.js +303 -0
- package/src/Allocation_Optimization/block_builder/Blocks_Builder.js +40 -0
- package/src/Allocation_Optimization/block_builder/Next_Block_Position.js +33 -0
- package/src/Allocation_Optimization/block_builder/Slot_Item_Assigner.js +45 -0
- package/src/Allocation_Optimization/block_builder/Stacking_Validation.js +30 -0
- package/src/Allocation_Optimization/block_builder/assert_tie_ratio_block_matches_orientation_below.js +44 -0
- package/src/Allocation_Optimization/block_builder/block_shape_stock.js +129 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Empty_Block_Item_List_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Invalid_Stacking_Exception.js +14 -0
- package/src/Allocation_Optimization/block_builder/exceptions/No_Suitable_Item_Exception.js +16 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Restricted_Block_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/should_omit_block_group_id.js +29 -0
- package/src/Allocation_Optimization/block_builder/snap_elevated_block_wall_items.js +34 -0
- package/src/Allocation_Optimization/block_builder/stacking_rules_input.js +52 -0
- package/src/Allocation_Optimization/cap_chosen_blocks_by_shape_stock.js +110 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Preparer.js +21 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Selector.js +55 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Threshold_Resolver.js +28 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Thresholds.js +23 -0
- package/src/Allocation_Optimization/density_groups/Container_Utilization.js +67 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Partitioner.js +74 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Scheduler.js +168 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Stock.js +49 -0
- package/src/Allocation_Optimization/density_groups/Density_Groups_Strategy.js +26 -0
- package/src/Allocation_Optimization/density_groups/Item_Density_Calculator.js +20 -0
- package/src/Allocation_Optimization/density_groups/Lock_Weight_Ahead_Release.js +75 -0
- package/src/Allocation_Optimization/exceptions/Invalid_Item_Amount_Exception.js +17 -0
- package/src/Allocation_Optimization/exceptions/No_Valid_Allocation_Exception.js +14 -0
- package/src/Allocation_Optimization/exceptions/Optimization_Infeasible_Exception.js +14 -0
- package/src/Allocation_Optimization/functions/Measure_Reader.js +20 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Mode.js +25 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Strategies.js +8 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Combination_Mode_Checkers.js +70 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Translation.js +22 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Variable_Weight_Getter.js +85 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/constants.js +16 -0
- package/src/Allocation_Optimization/functions/measure_to_optimize.js +6 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Capacity_Bias_Item_Order.js +76 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Choose_Item_Heuristic_Context.js +63 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_Chooser.js +159 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_For_Slot_Chooser.js +49 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slot_Compatible_Items_Finder.js +88 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slots_Items_Assigner.js +182 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Stack_Slot_Calculator.js +87 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Weight_Slot_Distribution.js +72 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Empty_Slot_Exception.js +17 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Item_Taller_Than_Limit_Exception.js +21 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Available_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Slots_For_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/lp_model/Block_Weight_Calculator.js +31 -0
- package/src/Allocation_Optimization/lp_model/LP_Data_Processor.js +42 -0
- package/src/Allocation_Optimization/lp_model/LP_Item_Slot_Assignment.js +93 -0
- package/src/Allocation_Optimization/lp_model/LP_Result_Mapper.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Dimension_Range_Helper.js +49 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Item_Assignment_Variables.js +133 -0
- package/src/Allocation_Optimization/lp_model/model_builder/LP_Model_Builder.js +132 -0
- package/src/Allocation_Optimization/lp_model/model_builder/exceptions/Missing_Item_Stock_Exception.js +18 -0
- package/src/Allocation_Optimization/lp_model/model_builder/goal_function/Goal_Function_Creator.js +83 -0
- package/src/Allocation_Optimization/lp_model/model_builder/item_dimension_hashes.js +31 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Block_Item_Amount_Restriction.js +53 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Coherence_Restriction.js +65 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Container_Supported_Weight_Restriction.js +42 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Exact_Pass_Amount_Restriction.js +62 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Group_Restriction.js +97 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Single_Item_Type_Restriction.js +79 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Space_Restriction.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Unavailable_Block_Restriction.js +27 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Uniform_Block_Measure_Restriction.js +92 -0
- package/src/Allocation_Optimization/next_group_id_after_preloaded.js +30 -0
- package/src/Allocation_Optimization/preferential_blocks/Preferential_Block_Identifier.js +74 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/Key_Item_Mapper.js +49 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Almost_Unique_Item.js +31 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Cant_Stack_It_Self.js +68 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Rule_Interface.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Intercalation_State.js +49 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Orientation_Filter.js +33 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Vertical_Stack_Filter.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/collect_tie_ratio_orientations_below_footprint.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/filter_blocks_by_orientation.js +17 -0
- package/src/Allocation_Optimization/tie_ratio/find_orientation_below_space.js +77 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/allocated_item_penetrates_any.js +31 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/apply_loose_placement_to_allocated_item.js +94 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/axis_overlap_length.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/block_local_origin.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/box_fits_inside_container.js +39 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_allocated_item_at_placement.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_placement_on_generic_supporter.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_slot_grid_from_cluster.js +66 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/compare_group_ids.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/container_with_pending_wall_items.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/empty_space_is_on_floor.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/finalize_loose_item_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_best_generic_supporter_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_next_free_slot_index.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_supporter_directly_below.js +51 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_tie_ratio_supporter_cluster.js +57 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/footprint_xz_overlap_area.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/item_fits_supporter_slot.js +22 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_footprint_region_from_options.js +24 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_fits_inside_container.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_has_geometric_support.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_on_block_slot_state.js +88 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/placement_coords_fit_inside_container.js +34 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/read_empilhar_area_igual_from_allocation_item.js +12 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/realigned_loose_geometry_gates.js +25 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_on_generic_supporter.js +65 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_placement_position.js +68 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_placement_y_at_slot.js +45 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_without_tie_ratio_cluster.js +79 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/select_tie_ratio_slot_placement.js +84 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/slot_footprint_collision.js +105 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_cluster_selection.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_footprint_overlap.js +56 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_placement_plane.js +109 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_supporter_predicate.js +23 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/try_tie_ratio_slot_placement.js +62 -0
- package/src/Allocation_Optimization/tie_ratio/snap_stacked_items_to_floor_footprints.js +138 -0
- package/src/Allocation_Optimization/tie_ratio/supporters_by_top_y_index.js +78 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_below_empty_space.js +89 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_from_group.js +48 -0
- package/src/Block_Management.js +34 -0
- package/src/Blocks_Preparation/Cube_Map_Function.js +27 -0
- package/src/Blocks_Wall_Allocation.js +3 -0
- package/src/IO/Answer_Status.js +4 -0
- package/src/IO/Output_Builder.js +35 -0
- package/src/IO/count_allocated_items.js +31 -0
- package/src/IO/create_error_response.js +62 -0
- package/src/IO/format_allocation_error_message.js +25 -0
- package/src/Item_Continuation_Lock.js +129 -0
- package/src/Item_Picking_Continuity.js +41 -0
- package/src/allocation_flow/chooser_session_state.js +21 -0
- package/src/allocation_flow/compound_probe_fallback.js +17 -0
- package/src/allocation_flow/container_remaining_capacity.js +23 -0
- package/src/allocation_flow/density_group_item_filter.js +31 -0
- package/src/allocation_flow/effective_item_fingerprint.js +14 -0
- package/src/allocation_flow/item_continuation_lock_gate.js +38 -0
- package/src/allocation_flow/no_space_left_recovery.js +48 -0
- package/src/allocation_flow/run_allocation_iteration.js +155 -0
- package/src/allocation_flow/space_skip_state.js +91 -0
- package/src/allocation_flow/try_no_space_left_recovery.js +50 -0
- package/src/exceptions/Invalid_Parameter_Exception.js +17 -0
- package/src/exceptions/Relational_Allocation_Incomplete_Exception.js +24 -0
- package/src/exceptions/Relational_Colocation_Violation_Exception.js +23 -0
- package/src/exceptions/Relational_Config_Mismatch_Exception.js +17 -0
- package/src/exceptions/There_Is_No_Block_Options_To_Allocate_Exception.js +14 -0
- package/src/index.js +6 -0
- package/src/input_preparation/Block_Formatter.js +179 -0
- package/src/input_preparation/Input_Creator.js +76 -0
- package/src/input_preparation/Input_State_Preparation.js +47 -0
- package/src/input_preparation/State_Builder.js +27 -0
- package/src/input_preparation/block_formatter/align_flush_axis_config.js +36 -0
- package/src/input_preparation/block_formatter/align_flush_axis_single_round.js +112 -0
- package/src/input_preparation/block_formatter/align_flush_stacked_slots.js +67 -0
- package/src/input_preparation/block_formatter/overlapped_slots.js +24 -0
- package/src/input_preparation/block_formatter/parallelepiped_shell.js +38 -0
- package/src/input_preparation/block_formatter/rectangle_coverage.js +112 -0
- package/src/input_preparation/block_formatter/shell_face_coverage.js +64 -0
- package/src/input_preparation/block_formatter/shell_snap_convergence.js +104 -0
- package/src/input_preparation/block_preparation/Block_Data_To_Object_Transformer.js +57 -0
- package/src/input_preparation/block_preparation/Block_Module_Name.js +17 -0
- package/src/input_preparation/block_preparation/Blocks_Creator.js +101 -0
- package/src/input_preparation/block_preparation/Blocksmith.js +19 -0
- package/src/input_preparation/block_preparation/block_modules/create_block_candidates.js +41 -0
- package/src/input_preparation/block_preparation/block_modules/manual_blocks.js +10 -0
- package/src/input_preparation/block_preparation/block_modules/module_registry.js +20 -0
- package/src/input_preparation/block_preparation/block_modules/run_creator.js +34 -0
- package/src/input_preparation/block_preparation/block_modules/single_item_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/spiral_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tie_ratio_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tower_blocks.js +12 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Create_Block_Exception.js +14 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Retrieve_Block_Exception.js +17 -0
- package/src/input_preparation/block_preparation/exceptions/Missing_Object_Store_Exception.js +10 -0
- package/src/input_preparation/block_preparation/exceptions/No_Blocks_Were_Created_Exception.js +14 -0
- package/src/input_preparation/block_preparation/input/Input_Creator.js +96 -0
- package/src/input_preparation/block_preparation/manual_blocks/Manual_Blocks.js +95 -0
- package/src/input_preparation/build_empty_space_finder_options.js +43 -0
- package/src/input_preparation/item_preparation/Items_Reader.js +27 -0
- package/src/input_preparation/min_extents_from_items.js +29 -0
- package/src/input_preparation/stackability_index/Blocks_Stackability_Index_Calculator.js +58 -0
- package/src/input_preparation/stackability_index/Slots_Stackability_index_Calculator.js +28 -0
- package/src/input_preparation/stackability_index/Stackability_Input_Creator.js +27 -0
- package/src/input_preparation/stackability_index/stackability_index_pop_stack.js +81 -0
- package/src/input_preparation/stacking_constraints/Weight_Stacking_Validation.js +15 -0
- package/src/lp_optimizer_result_status.js +20 -0
- package/src/messages/Allocator_Message.js +42 -0
- package/src/messages/resolve_error_message_entry.js +57 -0
- package/src/models/Allocated_Item.js +136 -0
- package/src/models/Allocation_Item.js +219 -0
- package/src/models/Block.js +198 -0
- package/src/models/Cargo_Profile.js +418 -0
- package/src/models/Preloaded_Allocated_Item.js +132 -0
- package/src/models/Slot.js +67 -0
- package/src/models/Stacking_Rules.js +58 -0
- package/src/models/auxiliaryFunctions/Available_Block_Module_List_Creator.js +9 -0
- package/src/models/auxiliaryFunctions/Measure_Translator.js +24 -0
- package/src/models/auxiliaryFunctions/item_json_reader.js +44 -0
- package/src/models/item_json_reader.js +71 -0
- package/src/models/placed_item_record.js +70 -0
- package/src/models/preloaded_rotation_helpers.js +38 -0
- package/src/models/slots_have_same_measure.js +45 -0
- package/src/models/transport/Container.js +162 -0
- package/src/models/transport/Transport.js +62 -0
- package/src/models/transport/build_stacking_feasibility_checker.js +64 -0
- package/src/models/transport/container_stacking_checkpoint.js +42 -0
- package/src/models/transport/factory/Container_Factory.js +46 -0
- package/src/models/transport/factory/Corner_Casting_Factory.js +62 -0
- package/src/models/transport/factory/Previously_Allocated_Item_Factory.js +28 -0
- package/src/models/transport/factory/Transport_Factory.js +13 -0
- package/src/models/transport/items_for_empty_space_finder.js +91 -0
- package/src/models/transport/resolve_container_stacking_inputs.js +23 -0
- package/src/models/transport/stacking_input_from_wire.js +58 -0
- package/src/optimizer_connection_errors.js +50 -0
- package/src/relational/Relational_Error_Codes.js +7 -0
- package/src/relational/finalize_relational_allocation.js +20 -0
- package/src/relational/has_relational_items.js +11 -0
- package/src/relational/is_relational_error_code.js +15 -0
- package/src/relational/resolve_relational_container_sequences.js +29 -0
- package/src/run_core_allocation.js +118 -0
- package/src/space_and_block_chooser/Space_And_Blocks_Chooser.js +115 -0
- package/src/space_and_block_chooser/blocks_filters/Block_Filter_Interface.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/Filter_Runner.js +46 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Block_With_Overlapped_Slots_Filter.js +14 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Initial_Blocks_Filter_List.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Blocks_Bigger_Than_Space_Filter.js +17 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Post_Selection_Filter_List.js +9 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Insuficient_Items_Filter.js +81 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Pre_Selection_Filter_List.js +8 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Blocks_Lower_Than_Max_Tower_Height.js +23 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Max_Tower_Height.js +82 -0
- package/src/space_and_block_chooser/build_allocated_item_snapshots.js +19 -0
- package/src/space_and_block_chooser/compound_first_empty_space_branch.js +61 -0
- package/src/space_and_block_chooser/compound_first_with_leftover_fill.js +142 -0
- package/src/space_and_block_chooser/compound_first_without_leftover_fill.js +56 -0
- package/src/space_and_block_chooser/empty_spaces_where_post_selection_keeps_blocks.js +83 -0
- package/src/space_and_block_chooser/exceptions/Invalid_Space_To_Allocate_Exception.js +14 -0
- package/src/space_and_block_chooser/leftover_space_memory.js +113 -0
- package/src/space_and_block_chooser/leftover_unitary_blocks.js +153 -0
- package/src/space_and_block_chooser/leftover_unitary_empty_spaces.js +135 -0
- package/src/space_and_block_chooser/probe_set_pool.js +35 -0
- package/src/space_and_block_chooser/run_space_and_block_selection_attempt.js +88 -0
- package/src/tools/Array_Validator.js +6 -0
- package/src/tools/Clone.js +27 -0
- package/src/tools/Hash.js +8 -0
- package/src/tools/Rounder.js +5 -0
- package/src/tools/String_To_Boolean.js +12 -0
- package/src/tools/cargo_profile/Cargo_Profile_Field_Value_Resolver.js +44 -0
- package/src/tools/compact_items_with_stock.js +9 -0
- package/src/tools/mm_to_allocation_domain.js +14 -0
- package/src/tracing/Allocation_Tracer.js +52 -0
- package/src/tracing/Trace_Context.js +18 -0
- package/src/tracing/trace_outcome.js +18 -0
- package/src/tracing/traced_step.js +57 -0
- package/src/validation/Item_Continuation_Lock_Flag.js +52 -0
- package/src/validation/Item_Validation.js +29 -0
- package/src/validation/Relational_Colocation_Validator.js +60 -0
- package/src/validation/Relational_Completeness_Validator.js +146 -0
- package/src/validation/Relational_Continuation_Lock_Validation.js +37 -0
- package/src/validation/Relational_Proportional_Normalizer.js +194 -0
- package/src/validation/Validation.js +9 -0
- package/src/validation/Validation_Runner.js +20 -0
- package/src/validation/exceptions/Invalid_Block_Module_Config_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Type_Exception.js +14 -0
- package/src/validation/schemas/allocated_item_schema.js +18 -0
- package/src/validation/schemas/allocation_request_schema.js +178 -0
- package/src/validation/schemas/container_row_schema.js +16 -0
- package/src/validation/schemas/item_schema.js +60 -0
- package/src/validation/schemas/transport_env_schema.js +19 -0
- package/src/validation/validate_block_module_config.js +147 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns {{ occupied_slots: Map<string, Set<number>>, pending_footprints: object[] }}
|
|
3
|
+
*/
|
|
4
|
+
function create_loose_on_block_slot_state()
|
|
5
|
+
{
|
|
6
|
+
return {
|
|
7
|
+
occupied_slots: new Map(),
|
|
8
|
+
pending_footprints: []
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function layer_state_key(group_id, placement_y)
|
|
13
|
+
{
|
|
14
|
+
return `${group_id}:${placement_y}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function get_occupied_slot_set(slot_state, group_id, placement_y)
|
|
18
|
+
{
|
|
19
|
+
const key = layer_state_key(group_id, placement_y)
|
|
20
|
+
if (!slot_state.occupied_slots.has(key))
|
|
21
|
+
{
|
|
22
|
+
slot_state.occupied_slots.set(key, new Set())
|
|
23
|
+
}
|
|
24
|
+
return slot_state.occupied_slots.get(key)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {object} slot_state
|
|
29
|
+
* @param {string|number} group_id
|
|
30
|
+
* @param {number} placement_y
|
|
31
|
+
* @param {number} slot_index
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
function mark_slot_occupied(slot_state, group_id, placement_y, slot_index)
|
|
35
|
+
{
|
|
36
|
+
get_occupied_slot_set(slot_state, group_id, placement_y).add(slot_index)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {object} slot_state
|
|
41
|
+
* @param {string|number} group_id
|
|
42
|
+
* @param {number} placement_y
|
|
43
|
+
* @param {number} slot_index
|
|
44
|
+
* @returns {boolean}
|
|
45
|
+
*/
|
|
46
|
+
function is_slot_marked_occupied(slot_state, group_id, placement_y, slot_index)
|
|
47
|
+
{
|
|
48
|
+
const key = layer_state_key(group_id, placement_y)
|
|
49
|
+
return slot_state.occupied_slots.get(key)?.has(slot_index) === true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {object} slot_state
|
|
54
|
+
* @param {number} placement_y
|
|
55
|
+
* @param {number} origin_x
|
|
56
|
+
* @param {number} origin_z
|
|
57
|
+
* @param {number} item_width
|
|
58
|
+
* @param {number} item_length
|
|
59
|
+
* @param {number} item_height
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
function register_pending_footprint(
|
|
63
|
+
slot_state,
|
|
64
|
+
placement_y,
|
|
65
|
+
origin_x,
|
|
66
|
+
origin_z,
|
|
67
|
+
item_width,
|
|
68
|
+
item_length,
|
|
69
|
+
item_height
|
|
70
|
+
)
|
|
71
|
+
{
|
|
72
|
+
slot_state.pending_footprints.push({
|
|
73
|
+
placement_y,
|
|
74
|
+
origin_x,
|
|
75
|
+
origin_z,
|
|
76
|
+
item_width,
|
|
77
|
+
item_length,
|
|
78
|
+
item_height
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = {
|
|
83
|
+
create_loose_on_block_slot_state,
|
|
84
|
+
mark_slot_occupied,
|
|
85
|
+
is_slot_marked_occupied,
|
|
86
|
+
register_pending_footprint,
|
|
87
|
+
allocated_item_blocks_slot: require('./slot_footprint_collision').allocated_item_blocks_slot
|
|
88
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const box_fits_inside_container = require('./box_fits_inside_container')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {object} container
|
|
5
|
+
* @param {number} origin_x
|
|
6
|
+
* @param {number} origin_y
|
|
7
|
+
* @param {number} origin_z
|
|
8
|
+
* @param {number} item_width
|
|
9
|
+
* @param {number} item_height
|
|
10
|
+
* @param {number} item_length
|
|
11
|
+
* @returns {boolean}
|
|
12
|
+
*/
|
|
13
|
+
function placement_coords_fit_inside_container(
|
|
14
|
+
container,
|
|
15
|
+
origin_x,
|
|
16
|
+
origin_y,
|
|
17
|
+
origin_z,
|
|
18
|
+
item_width,
|
|
19
|
+
item_height,
|
|
20
|
+
item_length
|
|
21
|
+
)
|
|
22
|
+
{
|
|
23
|
+
return box_fits_inside_container(
|
|
24
|
+
container,
|
|
25
|
+
origin_x,
|
|
26
|
+
origin_y,
|
|
27
|
+
origin_z,
|
|
28
|
+
item_width,
|
|
29
|
+
item_height,
|
|
30
|
+
item_length
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = placement_coords_fit_inside_container
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} allocation_item
|
|
3
|
+
* @returns {boolean}
|
|
4
|
+
*/
|
|
5
|
+
function read_empilhar_area_igual_from_allocation_item(allocation_item)
|
|
6
|
+
{
|
|
7
|
+
const json = allocation_item.get_json?.() ?? allocation_item
|
|
8
|
+
const restrictions = json.restricoes ?? json.restrictions ?? {}
|
|
9
|
+
return restrictions.empilharAreaIgual === true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = read_empilhar_area_igual_from_allocation_item
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/realigned_loose_geometry_gates.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const loose_item_fits_inside_container = require('./loose_item_fits_inside_container')
|
|
2
|
+
const loose_item_has_geometric_support = require('./loose_item_has_geometric_support')
|
|
3
|
+
const allocated_item_penetrates_any = require('./allocated_item_penetrates_any')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} container
|
|
7
|
+
* @param {object} container_view
|
|
8
|
+
* @param {object} allocated_item
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
function realigned_loose_passes_geometry_gates(container, container_view, allocated_item)
|
|
12
|
+
{
|
|
13
|
+
if (!loose_item_fits_inside_container(container, allocated_item))
|
|
14
|
+
{
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
const occupants = container_view.get_allocated_items?.() ?? []
|
|
18
|
+
if (allocated_item_penetrates_any(allocated_item, occupants))
|
|
19
|
+
{
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
return loose_item_has_geometric_support(container_view, allocated_item)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = realigned_loose_passes_geometry_gates
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_on_generic_supporter.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const find_supporter_directly_below = require('./find_supporter_directly_below')
|
|
2
|
+
const loose_footprint_region_from_options = require('./loose_footprint_region_from_options')
|
|
3
|
+
const item_fits_supporter_slot = require('./item_fits_supporter_slot')
|
|
4
|
+
const build_placement_on_generic_supporter = require('./build_placement_on_generic_supporter')
|
|
5
|
+
const find_best_generic_supporter_placement = require('./find_best_generic_supporter_placement')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} container_view
|
|
9
|
+
* @param {object} loose_item
|
|
10
|
+
* @param {object|undefined} slot_state
|
|
11
|
+
* @param {object} placement_options
|
|
12
|
+
* @param {object|undefined} container
|
|
13
|
+
* @returns {{ x: number, y: number, z: number }|undefined}
|
|
14
|
+
*/
|
|
15
|
+
function resolve_loose_on_generic_supporter(
|
|
16
|
+
container_view,
|
|
17
|
+
loose_item,
|
|
18
|
+
slot_state,
|
|
19
|
+
placement_options,
|
|
20
|
+
container
|
|
21
|
+
)
|
|
22
|
+
{
|
|
23
|
+
const candidates = container_view.get_allocated_items?.() ?? []
|
|
24
|
+
const footprint = loose_footprint_region_from_options(loose_item, placement_options)
|
|
25
|
+
const direct_supporter = find_supporter_directly_below(
|
|
26
|
+
loose_item,
|
|
27
|
+
candidates,
|
|
28
|
+
placement_options
|
|
29
|
+
)
|
|
30
|
+
if (direct_supporter !== undefined)
|
|
31
|
+
{
|
|
32
|
+
if (!item_fits_supporter_slot(
|
|
33
|
+
direct_supporter,
|
|
34
|
+
placement_options.item_width,
|
|
35
|
+
placement_options.item_length,
|
|
36
|
+
placement_options.require_same_area === true
|
|
37
|
+
))
|
|
38
|
+
{
|
|
39
|
+
return find_best_generic_supporter_placement(
|
|
40
|
+
candidates,
|
|
41
|
+
footprint,
|
|
42
|
+
slot_state,
|
|
43
|
+
placement_options,
|
|
44
|
+
container
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
return build_placement_on_generic_supporter(
|
|
48
|
+
candidates,
|
|
49
|
+
direct_supporter,
|
|
50
|
+
slot_state,
|
|
51
|
+
placement_options,
|
|
52
|
+
container
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return find_best_generic_supporter_placement(
|
|
57
|
+
candidates,
|
|
58
|
+
footprint,
|
|
59
|
+
slot_state,
|
|
60
|
+
placement_options,
|
|
61
|
+
container
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = resolve_loose_on_generic_supporter
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_placement_position.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const Cargo_Profile = require('../../../models/Cargo_Profile')
|
|
2
|
+
const find_tie_ratio_supporter_cluster = require('./find_tie_ratio_supporter_cluster')
|
|
3
|
+
const build_slot_grid_from_cluster = require('./build_slot_grid_from_cluster')
|
|
4
|
+
const resolve_placement_y_at_slot = require('./resolve_placement_y_at_slot')
|
|
5
|
+
const select_tie_ratio_slot_placement = require('./select_tie_ratio_slot_placement')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Resolves aligned placement for a loose item above a tie-ratio compound block.
|
|
9
|
+
* @param {object} container
|
|
10
|
+
* @param {object} empty_space
|
|
11
|
+
* @param {object} slot_state
|
|
12
|
+
* @param {import('../supporters_by_top_y_index').Supporters_By_Top_Y_Index|undefined} supporters_by_top_y_index
|
|
13
|
+
* @param {{ item_width?: number, item_length?: number, require_same_area?: boolean }|undefined} placement_options
|
|
14
|
+
* @param {number|undefined} placement_bottom_y
|
|
15
|
+
* @param {{ group_id: string|number, orientation: '3_2'|'2_3', items: object[] }|undefined} known_cluster
|
|
16
|
+
* @returns {{ x: number, y: number, z: number, slot_index: number, group_id: string|number }|undefined}
|
|
17
|
+
*/
|
|
18
|
+
function resolve_loose_placement_position(
|
|
19
|
+
container,
|
|
20
|
+
empty_space,
|
|
21
|
+
slot_state,
|
|
22
|
+
supporters_by_top_y_index,
|
|
23
|
+
placement_options,
|
|
24
|
+
placement_bottom_y,
|
|
25
|
+
known_cluster
|
|
26
|
+
)
|
|
27
|
+
{
|
|
28
|
+
if (!Cargo_Profile.stack_loose_on_tie_ratio_blocks())
|
|
29
|
+
{
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const cluster = known_cluster ?? find_tie_ratio_supporter_cluster(
|
|
34
|
+
container,
|
|
35
|
+
empty_space,
|
|
36
|
+
supporters_by_top_y_index,
|
|
37
|
+
placement_bottom_y,
|
|
38
|
+
placement_options
|
|
39
|
+
)
|
|
40
|
+
if (cluster === undefined)
|
|
41
|
+
{
|
|
42
|
+
return undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const slot_grid = build_slot_grid_from_cluster(cluster.items)
|
|
46
|
+
const allocated_items = container.get_allocated_items?.() ?? []
|
|
47
|
+
|
|
48
|
+
const slot_placements = slot_grid.map(slot => ({
|
|
49
|
+
slot,
|
|
50
|
+
placement_y: resolve_placement_y_at_slot(
|
|
51
|
+
allocated_items,
|
|
52
|
+
slot,
|
|
53
|
+
slot_state
|
|
54
|
+
)
|
|
55
|
+
}))
|
|
56
|
+
const minimum_resolved_y = Math.min(...slot_placements.map(entry => entry.placement_y))
|
|
57
|
+
|
|
58
|
+
return select_tie_ratio_slot_placement(
|
|
59
|
+
container,
|
|
60
|
+
slot_placements,
|
|
61
|
+
minimum_resolved_y,
|
|
62
|
+
slot_state,
|
|
63
|
+
cluster,
|
|
64
|
+
placement_options
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = resolve_loose_placement_position
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
|
|
3
|
+
function item_matches_slot_origin(item_x, item_z, slot)
|
|
4
|
+
{
|
|
5
|
+
return math.eq(item_x, slot.x) && math.eq(item_z, slot.z)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves vertical placement on top of items that occupy this slot origin.
|
|
10
|
+
* @param {object[]} allocated_items
|
|
11
|
+
* @param {object} slot
|
|
12
|
+
* @param {object|undefined} slot_state
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
function resolve_placement_y_at_slot(allocated_items, slot, slot_state)
|
|
16
|
+
{
|
|
17
|
+
let placement_y = slot.supporter_item.get_y() + slot.supporter_item.get_height()
|
|
18
|
+
for (const item of allocated_items)
|
|
19
|
+
{
|
|
20
|
+
if (typeof item.get_height !== 'function')
|
|
21
|
+
{
|
|
22
|
+
continue
|
|
23
|
+
}
|
|
24
|
+
if (!item_matches_slot_origin(item.get_x(), item.get_z(), slot))
|
|
25
|
+
{
|
|
26
|
+
continue
|
|
27
|
+
}
|
|
28
|
+
placement_y = Math.max(placement_y, item.get_y() + item.get_height())
|
|
29
|
+
}
|
|
30
|
+
if (slot_state === undefined)
|
|
31
|
+
{
|
|
32
|
+
return placement_y
|
|
33
|
+
}
|
|
34
|
+
for (const footprint of slot_state.pending_footprints)
|
|
35
|
+
{
|
|
36
|
+
if (!item_matches_slot_origin(footprint.origin_x, footprint.origin_z, slot))
|
|
37
|
+
{
|
|
38
|
+
continue
|
|
39
|
+
}
|
|
40
|
+
placement_y = Math.max(placement_y, footprint.placement_y + footprint.item_height)
|
|
41
|
+
}
|
|
42
|
+
return placement_y
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = resolve_placement_y_at_slot
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_without_tie_ratio_cluster.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const empty_space_is_on_floor = require('./empty_space_is_on_floor')
|
|
3
|
+
const loose_item_fits_inside_container = require('./loose_item_fits_inside_container')
|
|
4
|
+
const resolve_loose_on_generic_supporter = require('./resolve_loose_on_generic_supporter')
|
|
5
|
+
const read_empilhar_area_igual_from_allocation_item = require('./read_empilhar_area_igual_from_allocation_item')
|
|
6
|
+
const build_allocated_item_at_placement = require('./build_allocated_item_at_placement')
|
|
7
|
+
const realigned_loose_passes_geometry_gates = require('./realigned_loose_geometry_gates')
|
|
8
|
+
|
|
9
|
+
function finalize_placement_coords(
|
|
10
|
+
container,
|
|
11
|
+
container_view,
|
|
12
|
+
allocation_item,
|
|
13
|
+
placement
|
|
14
|
+
)
|
|
15
|
+
{
|
|
16
|
+
const realigned_item = build_allocated_item_at_placement(allocation_item, placement)
|
|
17
|
+
if (!realigned_loose_passes_geometry_gates(container, container_view, realigned_item))
|
|
18
|
+
{
|
|
19
|
+
return undefined
|
|
20
|
+
}
|
|
21
|
+
return realigned_item
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {object} allocated_item
|
|
26
|
+
* @param {object} container
|
|
27
|
+
* @param {object} container_view
|
|
28
|
+
* @param {object} empty_space
|
|
29
|
+
* @param {object|undefined} slot_state
|
|
30
|
+
* @param {object} placement_options
|
|
31
|
+
* @param {object} allocation_item
|
|
32
|
+
* @returns {object|undefined}
|
|
33
|
+
*/
|
|
34
|
+
function resolve_without_tie_ratio_cluster(
|
|
35
|
+
allocated_item,
|
|
36
|
+
container,
|
|
37
|
+
container_view,
|
|
38
|
+
empty_space,
|
|
39
|
+
slot_state,
|
|
40
|
+
placement_options,
|
|
41
|
+
allocation_item
|
|
42
|
+
)
|
|
43
|
+
{
|
|
44
|
+
const on_container_floor = empty_space_is_on_floor(empty_space)
|
|
45
|
+
&& math.le(allocated_item.get_y(), 0)
|
|
46
|
+
if (on_container_floor)
|
|
47
|
+
{
|
|
48
|
+
if (!loose_item_fits_inside_container(container, allocated_item))
|
|
49
|
+
{
|
|
50
|
+
return undefined
|
|
51
|
+
}
|
|
52
|
+
return allocated_item
|
|
53
|
+
}
|
|
54
|
+
const placement = resolve_loose_on_generic_supporter(
|
|
55
|
+
container_view,
|
|
56
|
+
allocated_item,
|
|
57
|
+
slot_state,
|
|
58
|
+
{
|
|
59
|
+
...placement_options,
|
|
60
|
+
require_same_area: read_empilhar_area_igual_from_allocation_item(allocation_item)
|
|
61
|
+
},
|
|
62
|
+
container
|
|
63
|
+
)
|
|
64
|
+
if (placement === undefined)
|
|
65
|
+
{
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
return finalize_placement_coords(
|
|
69
|
+
container,
|
|
70
|
+
container_view,
|
|
71
|
+
allocation_item,
|
|
72
|
+
placement
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = {
|
|
77
|
+
resolve_without_tie_ratio_cluster,
|
|
78
|
+
finalize_placement_coords
|
|
79
|
+
}
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/select_tie_ratio_slot_placement.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const try_tie_ratio_slot_placement = require('./try_tie_ratio_slot_placement')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} container
|
|
6
|
+
* @param {object[]} slot_placements
|
|
7
|
+
* @param {object} slot_state
|
|
8
|
+
* @param {object} cluster
|
|
9
|
+
* @param {object|undefined} placement_options
|
|
10
|
+
* @param {(entry: { slot: object, placement_y: number }) => boolean} layer_filter
|
|
11
|
+
* @returns {object|undefined}
|
|
12
|
+
*/
|
|
13
|
+
function pick_placement_from_slot_layers(
|
|
14
|
+
container,
|
|
15
|
+
slot_placements,
|
|
16
|
+
slot_state,
|
|
17
|
+
cluster,
|
|
18
|
+
placement_options,
|
|
19
|
+
layer_filter
|
|
20
|
+
)
|
|
21
|
+
{
|
|
22
|
+
for (const { slot, placement_y } of slot_placements)
|
|
23
|
+
{
|
|
24
|
+
if (!layer_filter({ slot, placement_y }))
|
|
25
|
+
{
|
|
26
|
+
continue
|
|
27
|
+
}
|
|
28
|
+
const placement = try_tie_ratio_slot_placement(
|
|
29
|
+
container,
|
|
30
|
+
slot,
|
|
31
|
+
placement_y,
|
|
32
|
+
slot_state,
|
|
33
|
+
cluster,
|
|
34
|
+
placement_options
|
|
35
|
+
)
|
|
36
|
+
if (placement !== undefined)
|
|
37
|
+
{
|
|
38
|
+
return placement
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {object} container
|
|
46
|
+
* @param {object[]} slot_placements
|
|
47
|
+
* @param {number} minimum_resolved_y
|
|
48
|
+
* @param {object} slot_state
|
|
49
|
+
* @param {object} cluster
|
|
50
|
+
* @param {object|undefined} placement_options
|
|
51
|
+
* @returns {object|undefined}
|
|
52
|
+
*/
|
|
53
|
+
function select_tie_ratio_slot_placement(
|
|
54
|
+
container,
|
|
55
|
+
slot_placements,
|
|
56
|
+
minimum_resolved_y,
|
|
57
|
+
slot_state,
|
|
58
|
+
cluster,
|
|
59
|
+
placement_options
|
|
60
|
+
)
|
|
61
|
+
{
|
|
62
|
+
const at_minimum = pick_placement_from_slot_layers(
|
|
63
|
+
container,
|
|
64
|
+
slot_placements,
|
|
65
|
+
slot_state,
|
|
66
|
+
cluster,
|
|
67
|
+
placement_options,
|
|
68
|
+
({ placement_y }) => math.eq(placement_y, minimum_resolved_y)
|
|
69
|
+
)
|
|
70
|
+
if (at_minimum !== undefined)
|
|
71
|
+
{
|
|
72
|
+
return at_minimum
|
|
73
|
+
}
|
|
74
|
+
return pick_placement_from_slot_layers(
|
|
75
|
+
container,
|
|
76
|
+
slot_placements,
|
|
77
|
+
slot_state,
|
|
78
|
+
cluster,
|
|
79
|
+
placement_options,
|
|
80
|
+
({ placement_y }) => math.gt(placement_y, minimum_resolved_y)
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = select_tie_ratio_slot_placement
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
|
|
3
|
+
function ranges_overlap(start_a, end_a, start_b, end_b)
|
|
4
|
+
{
|
|
5
|
+
return start_a < end_b && start_b < end_a
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {object} footprint_like
|
|
10
|
+
* @param {object} slot
|
|
11
|
+
* @param {number} placement_y
|
|
12
|
+
* @param {number} item_width
|
|
13
|
+
* @param {number} item_length
|
|
14
|
+
* @returns {boolean}
|
|
15
|
+
*/
|
|
16
|
+
function allocated_item_blocks_slot(
|
|
17
|
+
footprint_like,
|
|
18
|
+
slot,
|
|
19
|
+
placement_y,
|
|
20
|
+
item_width,
|
|
21
|
+
item_length
|
|
22
|
+
)
|
|
23
|
+
{
|
|
24
|
+
const origin_y = typeof footprint_like.get_y === 'function'
|
|
25
|
+
? footprint_like.get_y()
|
|
26
|
+
: footprint_like.placement_y
|
|
27
|
+
if (!math.eq(origin_y, placement_y))
|
|
28
|
+
{
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
const origin_x = typeof footprint_like.get_x === 'function'
|
|
32
|
+
? footprint_like.get_x()
|
|
33
|
+
: footprint_like.origin_x
|
|
34
|
+
const origin_z = typeof footprint_like.get_z === 'function'
|
|
35
|
+
? footprint_like.get_z()
|
|
36
|
+
: footprint_like.origin_z
|
|
37
|
+
const footprint_width = typeof footprint_like.get_width === 'function'
|
|
38
|
+
? footprint_like.get_width()
|
|
39
|
+
: footprint_like.item_width
|
|
40
|
+
const footprint_length = typeof footprint_like.get_length === 'function'
|
|
41
|
+
? footprint_like.get_length()
|
|
42
|
+
: footprint_like.item_length
|
|
43
|
+
return ranges_overlap(
|
|
44
|
+
slot.x,
|
|
45
|
+
slot.x + item_width,
|
|
46
|
+
origin_x,
|
|
47
|
+
origin_x + footprint_width
|
|
48
|
+
) && ranges_overlap(
|
|
49
|
+
slot.z,
|
|
50
|
+
slot.z + item_length,
|
|
51
|
+
origin_z,
|
|
52
|
+
origin_z + footprint_length
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {object} allocated_item
|
|
58
|
+
* @param {object} slot
|
|
59
|
+
* @param {number} placement_y
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
62
|
+
function allocated_item_occupies_slot(allocated_item, slot, placement_y)
|
|
63
|
+
{
|
|
64
|
+
return allocated_item_blocks_slot(
|
|
65
|
+
allocated_item,
|
|
66
|
+
slot,
|
|
67
|
+
placement_y,
|
|
68
|
+
allocated_item.get_width(),
|
|
69
|
+
allocated_item.get_length()
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {object} slot_state
|
|
75
|
+
* @param {object} slot
|
|
76
|
+
* @param {number} placement_y
|
|
77
|
+
* @param {number} item_width
|
|
78
|
+
* @param {number} item_length
|
|
79
|
+
* @returns {boolean}
|
|
80
|
+
*/
|
|
81
|
+
function pending_footprint_blocks_slot(
|
|
82
|
+
slot_state,
|
|
83
|
+
slot,
|
|
84
|
+
placement_y,
|
|
85
|
+
item_width,
|
|
86
|
+
item_length
|
|
87
|
+
)
|
|
88
|
+
{
|
|
89
|
+
return slot_state.pending_footprints.some(footprint =>
|
|
90
|
+
math.eq(footprint.placement_y, placement_y)
|
|
91
|
+
&& allocated_item_blocks_slot(
|
|
92
|
+
footprint,
|
|
93
|
+
slot,
|
|
94
|
+
placement_y,
|
|
95
|
+
item_width,
|
|
96
|
+
item_length
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = {
|
|
102
|
+
allocated_item_blocks_slot,
|
|
103
|
+
allocated_item_occupies_slot,
|
|
104
|
+
pending_footprint_blocks_slot
|
|
105
|
+
}
|