@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
package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_placement_on_generic_supporter.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const resolve_placement_y_at_slot = require('./resolve_placement_y_at_slot')
|
|
2
|
+
const placement_coords_fit_inside_container = require('./placement_coords_fit_inside_container')
|
|
3
|
+
const { register_pending_footprint } = require('./loose_on_block_slot_state')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object[]} candidates
|
|
7
|
+
* @param {object} supporter
|
|
8
|
+
* @param {object|undefined} slot_state
|
|
9
|
+
* @param {object} placement_options
|
|
10
|
+
* @param {object|undefined} container
|
|
11
|
+
* @returns {{ x: number, y: number, z: number }|undefined}
|
|
12
|
+
*/
|
|
13
|
+
function build_placement_on_generic_supporter(
|
|
14
|
+
candidates,
|
|
15
|
+
supporter,
|
|
16
|
+
slot_state,
|
|
17
|
+
placement_options,
|
|
18
|
+
container
|
|
19
|
+
)
|
|
20
|
+
{
|
|
21
|
+
const slot = {
|
|
22
|
+
x: supporter.get_x(),
|
|
23
|
+
z: supporter.get_z(),
|
|
24
|
+
supporter_item: supporter,
|
|
25
|
+
index: 0
|
|
26
|
+
}
|
|
27
|
+
const placement_y = resolve_placement_y_at_slot(
|
|
28
|
+
candidates,
|
|
29
|
+
slot,
|
|
30
|
+
slot_state
|
|
31
|
+
)
|
|
32
|
+
const placement = {
|
|
33
|
+
x: supporter.get_x(),
|
|
34
|
+
y: placement_y,
|
|
35
|
+
z: supporter.get_z()
|
|
36
|
+
}
|
|
37
|
+
if (!placement_coords_fit_inside_container(
|
|
38
|
+
container,
|
|
39
|
+
placement.x,
|
|
40
|
+
placement.y,
|
|
41
|
+
placement.z,
|
|
42
|
+
placement_options.item_width,
|
|
43
|
+
placement_options.item_height,
|
|
44
|
+
placement_options.item_length
|
|
45
|
+
))
|
|
46
|
+
{
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
if (slot_state !== undefined)
|
|
50
|
+
{
|
|
51
|
+
register_pending_footprint(
|
|
52
|
+
slot_state,
|
|
53
|
+
placement.y,
|
|
54
|
+
placement.x,
|
|
55
|
+
placement.z,
|
|
56
|
+
placement_options.item_width,
|
|
57
|
+
placement_options.item_length,
|
|
58
|
+
placement_options.item_height
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
return placement
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = build_placement_on_generic_supporter
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const block_local_origin = require('./block_local_origin')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} Supporter_Slot
|
|
6
|
+
* @property {number} index
|
|
7
|
+
* @property {number} offset_x
|
|
8
|
+
* @property {number} offset_z
|
|
9
|
+
* @property {number} x
|
|
10
|
+
* @property {number} z
|
|
11
|
+
* @property {object} supporter_item
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Builds a stable slot grid from supporter cluster item positions.
|
|
16
|
+
* @param {object[]} cluster_items
|
|
17
|
+
* @returns {Supporter_Slot[]}
|
|
18
|
+
*/
|
|
19
|
+
function build_slot_grid_from_cluster(cluster_items)
|
|
20
|
+
{
|
|
21
|
+
const origin = block_local_origin(cluster_items)
|
|
22
|
+
const slots = cluster_items.map((supporter_item, index) => ({
|
|
23
|
+
index,
|
|
24
|
+
offset_x: supporter_item.get_x() - origin.min_x,
|
|
25
|
+
offset_z: supporter_item.get_z() - origin.min_z,
|
|
26
|
+
x: supporter_item.get_x(),
|
|
27
|
+
z: supporter_item.get_z(),
|
|
28
|
+
supporter_item
|
|
29
|
+
}))
|
|
30
|
+
slots.sort(compare_slots_by_offset)
|
|
31
|
+
return slots.map((slot, sorted_index) => ({ ...slot, index: sorted_index }))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {object} supporter_item
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
function read_supporter_id(supporter_item)
|
|
39
|
+
{
|
|
40
|
+
if (typeof supporter_item.get_id === 'function')
|
|
41
|
+
{
|
|
42
|
+
return String(supporter_item.get_id() ?? '')
|
|
43
|
+
}
|
|
44
|
+
return String(supporter_item._id ?? '')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {Supporter_Slot} left
|
|
49
|
+
* @param {Supporter_Slot} right
|
|
50
|
+
* @returns {number}
|
|
51
|
+
*/
|
|
52
|
+
function compare_slots_by_offset(left, right)
|
|
53
|
+
{
|
|
54
|
+
if (!math.eq(left.offset_x, right.offset_x))
|
|
55
|
+
{
|
|
56
|
+
return left.offset_x - right.offset_x
|
|
57
|
+
}
|
|
58
|
+
if (!math.eq(left.offset_z, right.offset_z))
|
|
59
|
+
{
|
|
60
|
+
return left.offset_z - right.offset_z
|
|
61
|
+
}
|
|
62
|
+
return read_supporter_id(left.supporter_item)
|
|
63
|
+
.localeCompare(read_supporter_id(right.supporter_item))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = build_slot_grid_from_cluster
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ascending groupId (numeric when both parse as numbers).
|
|
3
|
+
* @param {string|number} left_group_id
|
|
4
|
+
* @param {string|number} right_group_id
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
function compare_group_ids(left_group_id, right_group_id)
|
|
8
|
+
{
|
|
9
|
+
const left_key = String(left_group_id)
|
|
10
|
+
const right_key = String(right_group_id)
|
|
11
|
+
const left_number = Number(left_key)
|
|
12
|
+
const right_number = Number(right_key)
|
|
13
|
+
if (!Number.isNaN(left_number) && !Number.isNaN(right_number))
|
|
14
|
+
{
|
|
15
|
+
return left_number - right_number
|
|
16
|
+
}
|
|
17
|
+
return left_key.localeCompare(right_key)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = compare_group_ids
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/container_with_pending_wall_items.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges in-wall allocated items (not yet on the container) into get_allocated_items().
|
|
3
|
+
* @param {object} container
|
|
4
|
+
* @param {object[]|undefined} pending_wall_allocated_items
|
|
5
|
+
* @returns {object}
|
|
6
|
+
*/
|
|
7
|
+
function container_with_pending_wall_items(container, pending_wall_allocated_items)
|
|
8
|
+
{
|
|
9
|
+
if (!pending_wall_allocated_items || pending_wall_allocated_items.length === 0)
|
|
10
|
+
{
|
|
11
|
+
return container
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const base_get_allocated_items = container.get_allocated_items?.bind(container)
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
...container,
|
|
18
|
+
get_allocated_items()
|
|
19
|
+
{
|
|
20
|
+
const merged = base_get_allocated_items ? base_get_allocated_items() : []
|
|
21
|
+
return [...merged, ...pending_wall_allocated_items]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = container_with_pending_wall_items
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {object|undefined} empty_space
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
*/
|
|
7
|
+
function empty_space_is_on_floor(empty_space)
|
|
8
|
+
{
|
|
9
|
+
if (empty_space === undefined || typeof empty_space.get_y !== 'function')
|
|
10
|
+
{
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
return math.le(empty_space.get_y(), 0)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = empty_space_is_on_floor
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const realigned_loose_passes_geometry_gates = require('./realigned_loose_geometry_gates')
|
|
2
|
+
const container_with_pending_wall_items = require('./container_with_pending_wall_items')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} container
|
|
6
|
+
* @param {object[]|undefined} pending_wall_allocated_items
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
function sync_container_stacking_checker(container, pending_wall_allocated_items)
|
|
10
|
+
{
|
|
11
|
+
if (typeof container.commit_allocated_item_for_stacking !== 'function')
|
|
12
|
+
{
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
for (const committed_item of container.get_allocated_items())
|
|
16
|
+
{
|
|
17
|
+
container.commit_allocated_item_for_stacking(committed_item)
|
|
18
|
+
}
|
|
19
|
+
for (const pending_item of pending_wall_allocated_items ?? [])
|
|
20
|
+
{
|
|
21
|
+
container.commit_allocated_item_for_stacking(pending_item)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Validates stacking and geometric placement for a loose item after realign.
|
|
27
|
+
* @param {object} allocated_item
|
|
28
|
+
* @param {object} wall_data
|
|
29
|
+
* @param {object[]|undefined} pending_wall_allocated_items
|
|
30
|
+
* @returns {object|undefined}
|
|
31
|
+
*/
|
|
32
|
+
function finalize_loose_item_placement(
|
|
33
|
+
allocated_item,
|
|
34
|
+
wall_data,
|
|
35
|
+
pending_wall_allocated_items
|
|
36
|
+
)
|
|
37
|
+
{
|
|
38
|
+
const container = wall_data.container
|
|
39
|
+
sync_container_stacking_checker(container, pending_wall_allocated_items)
|
|
40
|
+
if (!container.is_a_valid_stacking(allocated_item))
|
|
41
|
+
{
|
|
42
|
+
return undefined
|
|
43
|
+
}
|
|
44
|
+
const container_view = container_with_pending_wall_items(
|
|
45
|
+
container,
|
|
46
|
+
pending_wall_allocated_items
|
|
47
|
+
)
|
|
48
|
+
if (!realigned_loose_passes_geometry_gates(container, container_view, allocated_item))
|
|
49
|
+
{
|
|
50
|
+
return undefined
|
|
51
|
+
}
|
|
52
|
+
return allocated_item
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
finalize_loose_item_placement,
|
|
57
|
+
sync_container_stacking_checker
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const footprint_xz_overlap_area = require('./footprint_xz_overlap_area')
|
|
2
|
+
const item_fits_supporter_slot = require('./item_fits_supporter_slot')
|
|
3
|
+
const build_placement_on_generic_supporter = require('./build_placement_on_generic_supporter')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object[]} candidates
|
|
7
|
+
* @param {object} footprint
|
|
8
|
+
* @param {object|undefined} slot_state
|
|
9
|
+
* @param {object} placement_options
|
|
10
|
+
* @param {object|undefined} container
|
|
11
|
+
* @returns {{ x: number, y: number, z: number }|undefined}
|
|
12
|
+
*/
|
|
13
|
+
function find_best_generic_supporter_placement(
|
|
14
|
+
candidates,
|
|
15
|
+
footprint,
|
|
16
|
+
slot_state,
|
|
17
|
+
placement_options,
|
|
18
|
+
container
|
|
19
|
+
)
|
|
20
|
+
{
|
|
21
|
+
let best_placement = undefined
|
|
22
|
+
let best_overlap = -1
|
|
23
|
+
|
|
24
|
+
for (const supporter of candidates)
|
|
25
|
+
{
|
|
26
|
+
const overlap = footprint_xz_overlap_area(footprint, supporter)
|
|
27
|
+
if (overlap <= 0 || overlap <= best_overlap)
|
|
28
|
+
{
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
if (!item_fits_supporter_slot(
|
|
32
|
+
supporter,
|
|
33
|
+
placement_options.item_width,
|
|
34
|
+
placement_options.item_length,
|
|
35
|
+
placement_options.require_same_area === true
|
|
36
|
+
))
|
|
37
|
+
{
|
|
38
|
+
continue
|
|
39
|
+
}
|
|
40
|
+
const placement = build_placement_on_generic_supporter(
|
|
41
|
+
candidates,
|
|
42
|
+
supporter,
|
|
43
|
+
slot_state,
|
|
44
|
+
placement_options,
|
|
45
|
+
container
|
|
46
|
+
)
|
|
47
|
+
if (placement === undefined)
|
|
48
|
+
{
|
|
49
|
+
continue
|
|
50
|
+
}
|
|
51
|
+
best_overlap = overlap
|
|
52
|
+
best_placement = placement
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return best_overlap > 0 ? best_placement : undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = find_best_generic_supporter_placement
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
const item_fits_supporter_slot = require('./item_fits_supporter_slot')
|
|
2
|
+
const {
|
|
3
|
+
allocated_item_blocks_slot,
|
|
4
|
+
allocated_item_occupies_slot,
|
|
5
|
+
pending_footprint_blocks_slot
|
|
6
|
+
} = require('./slot_footprint_collision')
|
|
7
|
+
const { is_slot_marked_occupied } = require('./loose_on_block_slot_state')
|
|
8
|
+
|
|
9
|
+
function slot_blocked_by_allocated_items(
|
|
10
|
+
container,
|
|
11
|
+
slot,
|
|
12
|
+
placement_y,
|
|
13
|
+
placement_options
|
|
14
|
+
)
|
|
15
|
+
{
|
|
16
|
+
const allocated_items = container.get_allocated_items?.() ?? []
|
|
17
|
+
const item_width = placement_options?.item_width
|
|
18
|
+
const item_length = placement_options?.item_length
|
|
19
|
+
return allocated_items.find(item =>
|
|
20
|
+
{
|
|
21
|
+
if (item_width !== undefined && item_length !== undefined)
|
|
22
|
+
{
|
|
23
|
+
return allocated_item_blocks_slot(
|
|
24
|
+
item,
|
|
25
|
+
slot,
|
|
26
|
+
placement_y,
|
|
27
|
+
item_width,
|
|
28
|
+
item_length
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
return allocated_item_occupies_slot(item, slot, placement_y)
|
|
32
|
+
}) !== undefined
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function slot_blocked_by_pending_footprints(
|
|
36
|
+
slot_state,
|
|
37
|
+
slot,
|
|
38
|
+
placement_y,
|
|
39
|
+
item_width,
|
|
40
|
+
item_length
|
|
41
|
+
)
|
|
42
|
+
{
|
|
43
|
+
if (item_width === undefined || item_length === undefined)
|
|
44
|
+
{
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
return pending_footprint_blocks_slot(
|
|
48
|
+
slot_state,
|
|
49
|
+
slot,
|
|
50
|
+
placement_y,
|
|
51
|
+
item_width,
|
|
52
|
+
item_length
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function slot_passes_fit_check(slot, placement_options)
|
|
57
|
+
{
|
|
58
|
+
if (placement_options === undefined)
|
|
59
|
+
{
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
62
|
+
return item_fits_supporter_slot(
|
|
63
|
+
slot.supporter_item,
|
|
64
|
+
placement_options.item_width,
|
|
65
|
+
placement_options.item_length,
|
|
66
|
+
placement_options.require_same_area === true
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {object} container
|
|
72
|
+
* @param {import('./build_slot_grid_from_cluster').Supporter_Slot[]} slot_grid
|
|
73
|
+
* @param {number} placement_y
|
|
74
|
+
* @param {object} slot_state
|
|
75
|
+
* @param {string|number} group_id
|
|
76
|
+
* @param {object|undefined} placement_options
|
|
77
|
+
* @returns {number|undefined}
|
|
78
|
+
*/
|
|
79
|
+
function find_next_free_slot_index(
|
|
80
|
+
container,
|
|
81
|
+
slot_grid,
|
|
82
|
+
placement_y,
|
|
83
|
+
slot_state,
|
|
84
|
+
group_id,
|
|
85
|
+
placement_options
|
|
86
|
+
)
|
|
87
|
+
{
|
|
88
|
+
for (const slot of slot_grid)
|
|
89
|
+
{
|
|
90
|
+
if (!slot_passes_fit_check(slot, placement_options))
|
|
91
|
+
{
|
|
92
|
+
continue
|
|
93
|
+
}
|
|
94
|
+
if (is_slot_marked_occupied(slot_state, group_id, placement_y, slot.index))
|
|
95
|
+
{
|
|
96
|
+
continue
|
|
97
|
+
}
|
|
98
|
+
if (slot_blocked_by_allocated_items(container, slot, placement_y, placement_options))
|
|
99
|
+
{
|
|
100
|
+
continue
|
|
101
|
+
}
|
|
102
|
+
const item_width = placement_options?.item_width
|
|
103
|
+
const item_length = placement_options?.item_length
|
|
104
|
+
if (slot_blocked_by_pending_footprints(
|
|
105
|
+
slot_state,
|
|
106
|
+
slot,
|
|
107
|
+
placement_y,
|
|
108
|
+
item_width,
|
|
109
|
+
item_length
|
|
110
|
+
))
|
|
111
|
+
{
|
|
112
|
+
continue
|
|
113
|
+
}
|
|
114
|
+
return slot.index
|
|
115
|
+
}
|
|
116
|
+
return undefined
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = find_next_free_slot_index
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const footprint_xz_overlap_area = require('./footprint_xz_overlap_area')
|
|
3
|
+
const loose_footprint_region_from_options = require('./loose_footprint_region_from_options')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} loose_item
|
|
7
|
+
* @param {object} supporter
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
function loose_sits_on_supporter_plane(loose_item, supporter)
|
|
11
|
+
{
|
|
12
|
+
const supporter_top = supporter.get_y() + supporter.get_height()
|
|
13
|
+
return math.eq(supporter_top, loose_item.get_y())
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Finds the allocated item directly below the loose item with the largest XZ overlap.
|
|
18
|
+
* @param {object} loose_item
|
|
19
|
+
* @param {object[]} candidate_items
|
|
20
|
+
* @param {{ loose_origin_x?: number, loose_origin_z?: number, item_width?: number, item_length?: number }|undefined} placement_options
|
|
21
|
+
* @returns {object|undefined}
|
|
22
|
+
*/
|
|
23
|
+
function find_supporter_directly_below(loose_item, candidate_items, placement_options)
|
|
24
|
+
{
|
|
25
|
+
const footprint = loose_footprint_region_from_options(loose_item, placement_options)
|
|
26
|
+
let best_supporter = undefined
|
|
27
|
+
let best_overlap = -1
|
|
28
|
+
|
|
29
|
+
for (const supporter of candidate_items)
|
|
30
|
+
{
|
|
31
|
+
if (supporter === loose_item)
|
|
32
|
+
{
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
if (!loose_sits_on_supporter_plane(loose_item, supporter))
|
|
36
|
+
{
|
|
37
|
+
continue
|
|
38
|
+
}
|
|
39
|
+
const overlap = footprint_xz_overlap_area(footprint, supporter)
|
|
40
|
+
if (overlap <= best_overlap)
|
|
41
|
+
{
|
|
42
|
+
continue
|
|
43
|
+
}
|
|
44
|
+
best_overlap = overlap
|
|
45
|
+
best_supporter = supporter
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return best_overlap > 0 ? best_supporter : undefined
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = find_supporter_directly_below
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_tie_ratio_supporter_cluster.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const { build_supporters_by_top_y_index } = require('../supporters_by_top_y_index')
|
|
3
|
+
const { resolve_placement_plane } = require('./tie_ratio_placement_plane')
|
|
4
|
+
const {
|
|
5
|
+
resolve_supporters,
|
|
6
|
+
select_best_cluster
|
|
7
|
+
} = require('./tie_ratio_cluster_selection')
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Finds the tie-ratio compound cluster directly below an empty space.
|
|
11
|
+
* @param {object} container
|
|
12
|
+
* @param {object} empty_space
|
|
13
|
+
* @param {import('../supporters_by_top_y_index').Supporters_By_Top_Y_Index|undefined} supporters_by_top_y_index
|
|
14
|
+
* @param {number|undefined} placement_bottom_y
|
|
15
|
+
* @param {{ item_height?: number }|undefined} placement_options
|
|
16
|
+
* @returns {{ group_id: string|number, orientation: '3_2'|'2_3', items: object[] }|undefined}
|
|
17
|
+
*/
|
|
18
|
+
function find_tie_ratio_supporter_cluster(
|
|
19
|
+
container,
|
|
20
|
+
empty_space,
|
|
21
|
+
supporters_by_top_y_index,
|
|
22
|
+
placement_bottom_y,
|
|
23
|
+
placement_options
|
|
24
|
+
)
|
|
25
|
+
{
|
|
26
|
+
if (!empty_space)
|
|
27
|
+
{
|
|
28
|
+
return undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const space_bottom = resolve_placement_plane(
|
|
32
|
+
container,
|
|
33
|
+
empty_space,
|
|
34
|
+
supporters_by_top_y_index,
|
|
35
|
+
placement_bottom_y,
|
|
36
|
+
placement_options
|
|
37
|
+
)
|
|
38
|
+
if (space_bottom === undefined || math.le(space_bottom, 0))
|
|
39
|
+
{
|
|
40
|
+
return undefined
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return select_best_cluster(
|
|
44
|
+
resolve_supporters(
|
|
45
|
+
container,
|
|
46
|
+
supporters_by_top_y_index,
|
|
47
|
+
space_bottom,
|
|
48
|
+
empty_space,
|
|
49
|
+
placement_options
|
|
50
|
+
),
|
|
51
|
+
empty_space,
|
|
52
|
+
placement_options
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = find_tie_ratio_supporter_cluster
|
|
57
|
+
module.exports.build_supporters_by_top_y_index = build_supporters_by_top_y_index
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const axis_overlap_length = require('./axis_overlap_length')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns XZ footprint overlap area between two axis-aligned boxes.
|
|
5
|
+
* @param {object} left - getters x, z, width, length
|
|
6
|
+
* @param {object} right - getters x, z, width, length
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
function footprint_xz_overlap_area(left, right)
|
|
10
|
+
{
|
|
11
|
+
const x_overlap = axis_overlap_length(
|
|
12
|
+
left.get_x(),
|
|
13
|
+
left.get_x() + left.get_width(),
|
|
14
|
+
right.get_x(),
|
|
15
|
+
right.get_x() + right.get_width()
|
|
16
|
+
)
|
|
17
|
+
const z_overlap = axis_overlap_length(
|
|
18
|
+
left.get_z(),
|
|
19
|
+
left.get_z() + left.get_length(),
|
|
20
|
+
right.get_z(),
|
|
21
|
+
right.get_z() + right.get_length()
|
|
22
|
+
)
|
|
23
|
+
return x_overlap * z_overlap
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = footprint_xz_overlap_area
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether a loose item footprint fits a tie-ratio supporter slot.
|
|
5
|
+
* @param {object} supporter_item
|
|
6
|
+
* @param {number} item_width
|
|
7
|
+
* @param {number} item_length
|
|
8
|
+
* @param {boolean} require_same_area
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
function item_fits_supporter_slot(supporter_item, item_width, item_length, require_same_area)
|
|
12
|
+
{
|
|
13
|
+
const supporter_width = supporter_item.get_width()
|
|
14
|
+
const supporter_length = supporter_item.get_length()
|
|
15
|
+
if (require_same_area)
|
|
16
|
+
{
|
|
17
|
+
return math.eq(item_width, supporter_width) && math.eq(item_length, supporter_length)
|
|
18
|
+
}
|
|
19
|
+
return math.le(item_width, supporter_width) && math.le(item_length, supporter_length)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = item_fits_supporter_slot
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_footprint_region_from_options.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footprint region for overlap scoring before snap (assign origin + dimensions).
|
|
3
|
+
* @param {object} loose_item
|
|
4
|
+
* @param {{ loose_origin_x?: number, loose_origin_z?: number, item_width?: number, item_length?: number }|undefined} placement_options
|
|
5
|
+
* @returns {object}
|
|
6
|
+
*/
|
|
7
|
+
function loose_footprint_region_from_options(loose_item, placement_options)
|
|
8
|
+
{
|
|
9
|
+
if (placement_options?.loose_origin_x !== undefined
|
|
10
|
+
&& placement_options?.loose_origin_z !== undefined
|
|
11
|
+
&& placement_options?.item_width !== undefined
|
|
12
|
+
&& placement_options?.item_length !== undefined)
|
|
13
|
+
{
|
|
14
|
+
return {
|
|
15
|
+
get_x: () => placement_options.loose_origin_x,
|
|
16
|
+
get_z: () => placement_options.loose_origin_z,
|
|
17
|
+
get_width: () => placement_options.item_width,
|
|
18
|
+
get_length: () => placement_options.item_length
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return loose_item
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = loose_footprint_region_from_options
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_fits_inside_container.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const box_fits_inside_container = require('./box_fits_inside_container')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {object} container - Space with width, height, length getters
|
|
5
|
+
* @param {object} allocated_item
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
*/
|
|
8
|
+
function loose_item_fits_inside_container(container, allocated_item)
|
|
9
|
+
{
|
|
10
|
+
return box_fits_inside_container(
|
|
11
|
+
container,
|
|
12
|
+
allocated_item.get_x(),
|
|
13
|
+
allocated_item.get_y(),
|
|
14
|
+
allocated_item.get_z(),
|
|
15
|
+
allocated_item.get_width(),
|
|
16
|
+
allocated_item.get_height(),
|
|
17
|
+
allocated_item.get_length()
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = loose_item_fits_inside_container
|
package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_has_geometric_support.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const math = require('@jetta/number-compare')
|
|
2
|
+
const find_supporter_directly_below = require('./find_supporter_directly_below')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} container_view - object with get_allocated_items()
|
|
6
|
+
* @param {object} loose_item
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
function loose_item_has_geometric_support(container_view, loose_item)
|
|
10
|
+
{
|
|
11
|
+
if (math.le(loose_item.get_y(), 0))
|
|
12
|
+
{
|
|
13
|
+
return true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const candidates = container_view.get_allocated_items?.() ?? []
|
|
17
|
+
const supporter = find_supporter_directly_below(loose_item, candidates)
|
|
18
|
+
return supporter !== undefined
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = loose_item_has_geometric_support
|