@jetta/blocks-allocator 0.0.0-stage → 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 +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,198 @@
|
|
|
1
|
+
const {Cube} = require('@jetta/empty-spaces-manager')
|
|
2
|
+
const Slot = require('./Slot')
|
|
3
|
+
const create_hash = require('../tools/Hash')
|
|
4
|
+
const clone = require('../tools/Clone')
|
|
5
|
+
const Invalid_Parameter_Exception = require('../exceptions/Invalid_Parameter_Exception')
|
|
6
|
+
const slots_have_same_measure = require('./slots_have_same_measure')
|
|
7
|
+
|
|
8
|
+
const default_sorting = (a, b) => Number(a.y) - Number(b.y)
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @class Block
|
|
12
|
+
* @augments Cube
|
|
13
|
+
* @description Represents a block of items, which can be a single item or a combination of multiple items (slots).
|
|
14
|
+
* Inherits from `Cube` for spatial dimensions and provides additional properties and methods
|
|
15
|
+
* related to item allocation, stacking, and preferences.
|
|
16
|
+
*/
|
|
17
|
+
class Block extends Cube
|
|
18
|
+
{
|
|
19
|
+
#data
|
|
20
|
+
#slot_list = []
|
|
21
|
+
#is_block = false
|
|
22
|
+
#stackability_index = -1
|
|
23
|
+
#id
|
|
24
|
+
#volume
|
|
25
|
+
#is_slots_of_same_measure = false
|
|
26
|
+
#allocation_preference = false
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @constructor
|
|
30
|
+
* @param {object} measures - An object containing the block's initial data, including dimensions (width, height, length).
|
|
31
|
+
* @param {Array<Slot>} slot_list - An array of `Slot` objects that compose this block.
|
|
32
|
+
*/
|
|
33
|
+
constructor(measures, slot_list)
|
|
34
|
+
{
|
|
35
|
+
super(measures.width, measures.height, measures.length)
|
|
36
|
+
if (!slot_list || slot_list.length === 0)
|
|
37
|
+
{
|
|
38
|
+
throw new Invalid_Parameter_Exception('slot_list cannot be null or empty')
|
|
39
|
+
}
|
|
40
|
+
this.#data = measures
|
|
41
|
+
this.#slot_list = slot_list
|
|
42
|
+
this.#is_block = slot_list.length > 1
|
|
43
|
+
this.#id = this.#create_id()
|
|
44
|
+
this.#volume = this.#slot_list.reduce((acc, cur) => acc + cur.get_volume(), 0)
|
|
45
|
+
this.#is_slots_of_same_measure = slots_have_same_measure(slot_list)
|
|
46
|
+
this.#data.is_slots_of_same_measure = this.#is_slots_of_same_measure
|
|
47
|
+
this.#sort_slots()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the unique identifier of the block.
|
|
52
|
+
* @returns {string} The block's ID.
|
|
53
|
+
*/
|
|
54
|
+
get_id = () => this.#id
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the calculated stackability index of the block.
|
|
58
|
+
* @returns {number} The stackability index.
|
|
59
|
+
*/
|
|
60
|
+
get_stackability_index = () => this.#stackability_index
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the maximum height occupied by any item within the block.
|
|
64
|
+
* @returns {number} The maximum height.
|
|
65
|
+
*/
|
|
66
|
+
get_height = () => Math.max(...this.#items_end_y())
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns a clone of the block's total volume.
|
|
70
|
+
* @returns {number} The total volume.
|
|
71
|
+
*/
|
|
72
|
+
get_volume = () => clone(this.#volume)
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns tie-ratio orientation when this block was generated by tie_ratio_blocks.
|
|
76
|
+
* @returns {'3_2'|'2_3'|undefined}
|
|
77
|
+
*/
|
|
78
|
+
get_tie_ratio_orientation = () => this.#data.tie_ratio_orientation
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @returns {boolean} True when block carries tie-ratio orientation metadata.
|
|
82
|
+
*/
|
|
83
|
+
is_tie_ratio_block = () => this.#data.tie_ratio_orientation !== undefined
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Returns a shallow copy of the block's raw data.
|
|
87
|
+
* @returns {object} The block's data.
|
|
88
|
+
*/
|
|
89
|
+
get_json = () => Object.assign({}, this.#data)
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns the list of slots (items) that compose this block.
|
|
93
|
+
* @returns {Array<Slot>} The list of slots.
|
|
94
|
+
*/
|
|
95
|
+
get_slot_list = () => this.#slot_list
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Sets the allocation preference flag for this block to true.
|
|
99
|
+
*/
|
|
100
|
+
set_preference = () => this.#allocation_preference = true
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Calculates and sets the stackability index of the block based on its slots.
|
|
104
|
+
* The stackability index is the minimum stackability index among all its slots.
|
|
105
|
+
*/
|
|
106
|
+
calculate_stackability_index = () =>
|
|
107
|
+
{
|
|
108
|
+
const slots_index = this.#get_block_slots_index_list()
|
|
109
|
+
this.#stackability_index = Math.min(...slots_index)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Checks if the block has an allocation preference.
|
|
114
|
+
* @returns {boolean} True if preferred, false otherwise.
|
|
115
|
+
*/
|
|
116
|
+
is_preference = () => this.#allocation_preference
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Checks if the block contains more than one slot, indicating it's a combined block.
|
|
120
|
+
* @returns {boolean} True if it's a multi-slot block, false otherwise.
|
|
121
|
+
*/
|
|
122
|
+
is_block = () => (this.#slot_list.length > 1)
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Checks if all slots within the block have the same measure.
|
|
126
|
+
* @returns {boolean} True if slots have same measure, false otherwise.
|
|
127
|
+
*/
|
|
128
|
+
is_slots_of_same_measure = () => this.#is_slots_of_same_measure
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the block contains more than one slot, indicating it's a combined block.
|
|
132
|
+
* (Duplicate of `is_block` above, consider consolidating).
|
|
133
|
+
* @returns {boolean} True if it's a multi-slot block, false otherwise.
|
|
134
|
+
*/
|
|
135
|
+
is_block = () => this.#is_block
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @private
|
|
139
|
+
* Retrieves the stackability index for each slot in the block.
|
|
140
|
+
* @returns {Array<number>} An array of stackability indices for each slot.
|
|
141
|
+
*/
|
|
142
|
+
#get_block_slots_index_list = () => this.#slot_list.map(slot => slot.get_stackability_index())
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
* Retrieves the end Y-coordinate for each slot in the block.
|
|
147
|
+
* @returns {Array<number>} An array of end Y-coordinates for each slot.
|
|
148
|
+
*/
|
|
149
|
+
#items_end_y = () => this.#slot_list.map(slot => slot.get_end_point().y)
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @private
|
|
153
|
+
* Prepares a string by concatenating the hashes of all slots, used for creating the block's ID.
|
|
154
|
+
* @returns {string} A concatenated string of slot hashes.
|
|
155
|
+
*/
|
|
156
|
+
#prepare_id = () =>this.#slot_list.reduce((acc, cur) => `${acc};${cur.get_hash()}`, '')
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @private
|
|
160
|
+
* Creates a unique hash ID for the block based on the combined hashes of its slots.
|
|
161
|
+
* @returns {string} The unique hash ID.
|
|
162
|
+
*/
|
|
163
|
+
#create_id = () => create_hash(this.#prepare_id())
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @private
|
|
167
|
+
* Sorts the internal list of slots based on a provided sorting function.
|
|
168
|
+
* Defaults to sorting by the Y-coordinate.
|
|
169
|
+
* @param {function(Slot, Slot): number} [sort_function=default_sorting] - The function to use for sorting slots.
|
|
170
|
+
*/
|
|
171
|
+
#sort_slots = (sort_function = default_sorting) => this.#slot_list.sort((a, b) => sort_function(a, b))
|
|
172
|
+
|
|
173
|
+
fits_rotated_item(item)
|
|
174
|
+
{
|
|
175
|
+
for (const slot of this.#slot_list)
|
|
176
|
+
{
|
|
177
|
+
if (slot.rotated_item_fits_perfectly(item))
|
|
178
|
+
{
|
|
179
|
+
return true
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return false
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Creates a `Block` instance from a single item's data.
|
|
188
|
+
* This effectively treats a single item as a block composed of one slot.
|
|
189
|
+
* @param {object} data - The item's data, including dimensions (width, height, length).
|
|
190
|
+
* @returns {Block} A new `Block` instance representing the single item.
|
|
191
|
+
*/
|
|
192
|
+
function create_block_from_item(data)
|
|
193
|
+
{
|
|
194
|
+
const positioned_item = new Slot(0, 0, 0, data.width, data.height, data.length)
|
|
195
|
+
return new Block(data , [positioned_item])
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
module.exports = {create_block_from_item, Block}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
const {
|
|
2
|
+
DENSITY_GROUPS_STRATEGY,
|
|
3
|
+
normalize_density_groups_strategy,
|
|
4
|
+
} = require('../Allocation_Optimization/density_groups/Density_Groups_Strategy')
|
|
5
|
+
const {
|
|
6
|
+
DEFAULT_WEIGHT_AHEAD_THRESHOLD_PP,
|
|
7
|
+
DEFAULT_SPACE_AHEAD_THRESHOLD_PP,
|
|
8
|
+
percentage_points_to_fraction,
|
|
9
|
+
} = require('../Allocation_Optimization/density_groups/Adaptive_Density_Group_Thresholds')
|
|
10
|
+
const str_to_bool = require('../tools/String_To_Boolean')
|
|
11
|
+
const assert = require('assert')
|
|
12
|
+
const create_block_module_lost = require('./auxiliaryFunctions/Available_Block_Module_List_Creator')
|
|
13
|
+
const clone = require('../tools/Clone')
|
|
14
|
+
const {
|
|
15
|
+
finite_float_from_string_or_number,
|
|
16
|
+
finite_int_from_string_or_number,
|
|
17
|
+
optional_finite_float_from_string_or_number,
|
|
18
|
+
} = require('../tools/cargo_profile/Cargo_Profile_Field_Value_Resolver')
|
|
19
|
+
|
|
20
|
+
class Cargo_Profile
|
|
21
|
+
{
|
|
22
|
+
static #instance = null
|
|
23
|
+
static #stacking_constraints_module_list = []
|
|
24
|
+
|
|
25
|
+
constructor(cargo_profile_json)
|
|
26
|
+
{
|
|
27
|
+
assert(Cargo_Profile.#instance === null, 'Cargo_Profile instance already exists')
|
|
28
|
+
Object.assign(this, cargo_profile_json)
|
|
29
|
+
Cargo_Profile.#instance = this
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static set_stacking_constraints_list(stacking_constraints_module_list)
|
|
33
|
+
{
|
|
34
|
+
this.#stacking_constraints_module_list = stacking_constraints_module_list
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static get_stacking_constraint_module_list()
|
|
38
|
+
{
|
|
39
|
+
return Cargo_Profile.#stacking_constraints_module_list
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static measure_to_optimize()
|
|
43
|
+
{
|
|
44
|
+
return this.#instance['allocation.blocks.measure_to_optimize'] ?? ''
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static enable_to_find_empty_space_block()
|
|
48
|
+
{
|
|
49
|
+
const key = 'allocation.empty_space.finder.enable_to_find_empty_space_block'
|
|
50
|
+
return str_to_bool(this.#instance[key], false)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static enable_to_find_empty_space_from_spiral_block_of_same_measure()
|
|
54
|
+
{
|
|
55
|
+
const key = 'allocation.empty_space.finder.enable_to_find_empty_space_from_spiral_block_of_same_measure'
|
|
56
|
+
return str_to_bool(this.#instance[key], false)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static empty_space_score_strategy_criterias()
|
|
60
|
+
{
|
|
61
|
+
const key = 'allocation.empty_space.chooser.score_strategy_criterias'
|
|
62
|
+
return this.#instance[key] ?? [{ criteria: 'MaximumFill', weight: 1 }]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static prefer_block_with_same_item()
|
|
66
|
+
{
|
|
67
|
+
return str_to_bool(this.#instance['allocation.blocks.prefer_block_with_same_item'], true)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether single-slot Item_Continuation_Lock is active.
|
|
72
|
+
* Defaults to true when omitted or when no cargo profile is loaded (legacy behavior).
|
|
73
|
+
* @returns {boolean}
|
|
74
|
+
*/
|
|
75
|
+
static enable_item_continuation_lock()
|
|
76
|
+
{
|
|
77
|
+
if (Cargo_Profile.#instance === null)
|
|
78
|
+
{
|
|
79
|
+
return true
|
|
80
|
+
}
|
|
81
|
+
return str_to_bool(this.#instance['allocation.blocks.enable_item_continuation_lock'], true)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static enable_key_item_mapping()
|
|
85
|
+
{
|
|
86
|
+
return str_to_bool(this.#instance['allocation.blocks.preferential.enable'], true)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static preferential_blocks_bonus()
|
|
90
|
+
{
|
|
91
|
+
const key = 'allocation.blocks.preferential_blocks_bonus'
|
|
92
|
+
return finite_float_from_string_or_number(this.#instance[key], 5)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static enable_block_equalization()
|
|
96
|
+
{
|
|
97
|
+
return str_to_bool(this.#instance['allocation.blocks.enable_block_equalization'], false)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static enable_block_formatter()
|
|
101
|
+
{
|
|
102
|
+
const key = 'allocation.blocks.enable_block_formatter'
|
|
103
|
+
return str_to_bool(this.#instance[key], false)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static enforce_single_item_type()
|
|
107
|
+
{
|
|
108
|
+
return str_to_bool(this.#instance['allocation.blocks.enforce_single_item_type'], false)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static enforce_uniform_block_measure()
|
|
112
|
+
{
|
|
113
|
+
const key = 'allocation.blocks.enforce_uniform_block_measure'
|
|
114
|
+
return str_to_bool(this.#instance[key], true)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static enforce_relational_group_co_location()
|
|
118
|
+
{
|
|
119
|
+
if (Cargo_Profile.#instance === null)
|
|
120
|
+
{
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
const explicit_flag = this.#instance['allocation.blocks.enforce_relational_group_co_location']
|
|
124
|
+
if (explicit_flag !== undefined)
|
|
125
|
+
{
|
|
126
|
+
return str_to_bool(explicit_flag, false)
|
|
127
|
+
}
|
|
128
|
+
return str_to_bool(this.#instance['relational_allocation_enabled'], false)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static relational_lp_require_exact_pass_amount()
|
|
132
|
+
{
|
|
133
|
+
if (Cargo_Profile.#instance === null)
|
|
134
|
+
{
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
const key = 'allocation.blocks.relational_lp_require_exact_pass_amount'
|
|
138
|
+
return str_to_bool(this.#instance[key], false)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static block_equalization_tolerance()
|
|
142
|
+
{
|
|
143
|
+
const key = 'allocation.blocks.block_equalization_tolerance'
|
|
144
|
+
return finite_float_from_string_or_number(this.#instance[key], 0.04)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static block_equalization_penalty_coefficient()
|
|
148
|
+
{
|
|
149
|
+
const key = 'allocation.blocks.block_equalization_penalty_coefficient'
|
|
150
|
+
return finite_int_from_string_or_number(this.#instance[key], -5)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static untie_by_quantity_multiplier()
|
|
154
|
+
{
|
|
155
|
+
const key = 'allocation.blocks.untie_by_quantity_multiplier'
|
|
156
|
+
return finite_float_from_string_or_number(this.#instance[key], 2)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static same_item_measures_bonus()
|
|
160
|
+
{
|
|
161
|
+
const key = 'allocation.blocks.same_item_measures_bonus'
|
|
162
|
+
return finite_float_from_string_or_number(this.#instance[key], 10)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static enable_blocks_extra_score()
|
|
166
|
+
{
|
|
167
|
+
return str_to_bool(this.#instance['allocation.optimization.enable_blocks_extra_score'], false)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static enable_max_tower_cut()
|
|
171
|
+
{
|
|
172
|
+
return str_to_bool(this.#instance['allocation.blocks.enable_max_tower_cut'], false)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static obligate_block_allocation_first()
|
|
176
|
+
{
|
|
177
|
+
if (Cargo_Profile.#instance === null)
|
|
178
|
+
{
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
return str_to_bool(this.#instance['allocation.blocks.obligate_block_allocation_first'], false)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Leftover-SKU unitary fill after compound-first probe fails.
|
|
186
|
+
* Requires obligate_block_allocation_first. Default false (prod compound-first only).
|
|
187
|
+
* @returns {boolean}
|
|
188
|
+
*/
|
|
189
|
+
static leftover_sku_unitary_fill()
|
|
190
|
+
{
|
|
191
|
+
if (Cargo_Profile.#instance === null)
|
|
192
|
+
{
|
|
193
|
+
return false
|
|
194
|
+
}
|
|
195
|
+
return str_to_bool(this.#instance['allocation.blocks.leftover_sku_unitary_fill'], false)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Snaps elevated wall items onto unique floor (x, z) footprints.
|
|
200
|
+
* Default false (prod: no snap, stacking does not require a floor twin).
|
|
201
|
+
* @returns {boolean}
|
|
202
|
+
*/
|
|
203
|
+
static snap_stacked_items_to_floor_footprints()
|
|
204
|
+
{
|
|
205
|
+
if (Cargo_Profile.#instance === null)
|
|
206
|
+
{
|
|
207
|
+
return false
|
|
208
|
+
}
|
|
209
|
+
return str_to_bool(
|
|
210
|
+
this.#instance['allocation.blocks.snap_stacked_items_to_floor_footprints'],
|
|
211
|
+
false
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Rejects blocks whose slots overlap on create. Default false (prod: filter off).
|
|
217
|
+
* @returns {boolean}
|
|
218
|
+
*/
|
|
219
|
+
static reject_blocks_with_overlapped_slots()
|
|
220
|
+
{
|
|
221
|
+
if (Cargo_Profile.#instance === null)
|
|
222
|
+
{
|
|
223
|
+
return false
|
|
224
|
+
}
|
|
225
|
+
return str_to_bool(this.#instance['allocation.blocks.reject_blocks_with_overlapped_slots'], false)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
static enable_density_groups()
|
|
229
|
+
{
|
|
230
|
+
if (Cargo_Profile.#instance === null)
|
|
231
|
+
{
|
|
232
|
+
return false
|
|
233
|
+
}
|
|
234
|
+
const key = 'allocation.items.density_groups.enable'
|
|
235
|
+
return str_to_bool(this.#instance[key], false)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static density_groups_count()
|
|
239
|
+
{
|
|
240
|
+
if (Cargo_Profile.#instance === null)
|
|
241
|
+
{
|
|
242
|
+
return 3
|
|
243
|
+
}
|
|
244
|
+
const key = 'allocation.items.density_groups.count'
|
|
245
|
+
const raw = finite_int_from_string_or_number(this.#instance[key], 3)
|
|
246
|
+
return Math.max(2, raw)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @returns {typeof DENSITY_GROUPS_STRATEGY.ROUND_ROBIN | typeof DENSITY_GROUPS_STRATEGY.ADAPTIVE}
|
|
251
|
+
*/
|
|
252
|
+
static density_groups_strategy()
|
|
253
|
+
{
|
|
254
|
+
if (Cargo_Profile.#instance === null)
|
|
255
|
+
{
|
|
256
|
+
return DENSITY_GROUPS_STRATEGY.ROUND_ROBIN
|
|
257
|
+
}
|
|
258
|
+
const key = 'allocation.items.density_groups.strategy'
|
|
259
|
+
return normalize_density_groups_strategy(this.#instance[key])
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* @returns {number} Weight-ahead gap threshold as a utilization fraction (default 0.10).
|
|
264
|
+
*/
|
|
265
|
+
static density_groups_weight_ahead_threshold()
|
|
266
|
+
{
|
|
267
|
+
return Cargo_Profile.#resolve_density_group_threshold_pp(
|
|
268
|
+
'allocation.items.density_groups.weight_ahead_threshold_pp',
|
|
269
|
+
DEFAULT_WEIGHT_AHEAD_THRESHOLD_PP
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @returns {number} Space-ahead gap threshold as a utilization fraction (default 0.15).
|
|
275
|
+
*/
|
|
276
|
+
static density_groups_space_ahead_threshold()
|
|
277
|
+
{
|
|
278
|
+
return Cargo_Profile.#resolve_density_group_threshold_pp(
|
|
279
|
+
'allocation.items.density_groups.space_ahead_threshold_pp',
|
|
280
|
+
DEFAULT_SPACE_AHEAD_THRESHOLD_PP
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static #resolve_density_group_threshold_pp(key, default_pp)
|
|
285
|
+
{
|
|
286
|
+
if (Cargo_Profile.#instance === null)
|
|
287
|
+
{
|
|
288
|
+
return percentage_points_to_fraction(default_pp)
|
|
289
|
+
}
|
|
290
|
+
const raw = finite_float_from_string_or_number(this.#instance[key], default_pp)
|
|
291
|
+
return percentage_points_to_fraction(raw)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static enable_stacking_constraints_service()
|
|
295
|
+
{
|
|
296
|
+
return str_to_bool(this.#instance['allocation.stacking.enable_stacking_constraints_service'], true)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
static prefer_spiral_blocks_with_slots_of_same_measures()
|
|
300
|
+
{
|
|
301
|
+
const key = 'allocation.blocks.prefer_spiral_blocks_with_slots_of_same_measures'
|
|
302
|
+
return str_to_bool(this.#instance[key], false)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Generic gate for the same-measure slot LP bonus. Default false.
|
|
307
|
+
* @returns {boolean}
|
|
308
|
+
*/
|
|
309
|
+
static prefer_blocks_with_slots_of_same_measures()
|
|
310
|
+
{
|
|
311
|
+
if (Cargo_Profile.#instance === null)
|
|
312
|
+
{
|
|
313
|
+
return false
|
|
314
|
+
}
|
|
315
|
+
const key = 'allocation.blocks.prefer_blocks_with_slots_of_same_measures'
|
|
316
|
+
return str_to_bool(this.#instance[key], false)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* True when the generic or spiral-named same-measure preference flag is on.
|
|
321
|
+
* @returns {boolean}
|
|
322
|
+
*/
|
|
323
|
+
static prefer_same_measure_slot_blocks()
|
|
324
|
+
{
|
|
325
|
+
if (Cargo_Profile.#instance === null)
|
|
326
|
+
{
|
|
327
|
+
return false
|
|
328
|
+
}
|
|
329
|
+
return this.prefer_spiral_blocks_with_slots_of_same_measures()
|
|
330
|
+
|| this.prefer_blocks_with_slots_of_same_measures()
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
static block_variable_weight_config()
|
|
334
|
+
{
|
|
335
|
+
return this.#instance['allocation.blocks.block_variable_weight_config'] ?? []
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
static max_tower_height_superior_gap()
|
|
339
|
+
{
|
|
340
|
+
const key = 'allocation.optimization.max_tower_height_calculation.superior_gap'
|
|
341
|
+
return optional_finite_float_from_string_or_number(this.#instance[key])
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static max_tower_height_inferior_gap()
|
|
345
|
+
{
|
|
346
|
+
const key = 'allocation.optimization.max_tower_height_calculation.inferior_gap'
|
|
347
|
+
return optional_finite_float_from_string_or_number(this.#instance[key])
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
static block_module_list()
|
|
351
|
+
{
|
|
352
|
+
return create_block_module_lost(clone(this.#instance))
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
static allocate_intercalated()
|
|
356
|
+
{
|
|
357
|
+
if (Cargo_Profile.#instance === null)
|
|
358
|
+
{
|
|
359
|
+
return false
|
|
360
|
+
}
|
|
361
|
+
const key = 'allocation.blocks.allocate_intercalated'
|
|
362
|
+
return str_to_bool(this.#instance[key], false)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
static tie_ratio_allocate_remainder_as_partial_blocks()
|
|
366
|
+
{
|
|
367
|
+
if (Cargo_Profile.#instance === null)
|
|
368
|
+
{
|
|
369
|
+
return false
|
|
370
|
+
}
|
|
371
|
+
const key = 'allocation.blocks.tie_ratio.allocate_remainder_as_partial_blocks'
|
|
372
|
+
return str_to_bool(this.#instance[key], false)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
static stack_loose_on_tie_ratio_blocks()
|
|
376
|
+
{
|
|
377
|
+
if (Cargo_Profile.#instance === null)
|
|
378
|
+
{
|
|
379
|
+
return false
|
|
380
|
+
}
|
|
381
|
+
const key = 'allocation.blocks.stack_loose_on_tie_ratio_blocks'
|
|
382
|
+
return str_to_bool(this.#instance[key], false)
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
static reset()
|
|
386
|
+
{
|
|
387
|
+
Cargo_Profile.#instance = null
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
static read_cargo_profile(cargo_profile)
|
|
391
|
+
{
|
|
392
|
+
if (!Cargo_Profile.#instance)
|
|
393
|
+
{
|
|
394
|
+
Cargo_Profile.#instance = new Cargo_Profile(cargo_profile)
|
|
395
|
+
}
|
|
396
|
+
return Cargo_Profile.#instance
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
static set_cargo_profile(cargo_profile)
|
|
400
|
+
{
|
|
401
|
+
Cargo_Profile.#instance = null
|
|
402
|
+
Cargo_Profile.#instance = new Cargo_Profile(cargo_profile)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
static get_cargo_profile()
|
|
406
|
+
{
|
|
407
|
+
assert(Cargo_Profile.#instance !== null, 'No cargo profile has been read.')
|
|
408
|
+
return Cargo_Profile.#instance
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
static get_cargo_profile_as_js_object()
|
|
412
|
+
{
|
|
413
|
+
assert(Cargo_Profile.#instance !== null, 'cargo profile has not been set yet.')
|
|
414
|
+
return { ...Cargo_Profile.#instance }
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
module.exports = Cargo_Profile
|