Skip to content

Parth-Nebula/Fedex-InterIIT

Repository files navigation

FedEx ULD Packer

Installation

  1. Install Python and C++

  2. Install Gurobi

    • Download Gurobi Optimizer from Gurobi's official website
    • Install the Gurobi Optimizer following their platform-specific instructions
    • Obtain a Gurobi license:
      • Academic users can get a free license
      • Commercial users need to purchase a license
      • We have the licence but due to inter IIT rules we cant share the key, if any assistance is needed you are free to contact us

    Activate the Gurobi license:

    grbgetkey YOUR_LICENSE_KEY  # Replace with your actual license key
  3. Set up Virtual Environment and Install Requirements

    python3 -m venv packer_env
    source packer_env/bin/activate  # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt

Usage

Running the Packer

  1. Add input data in challenge_input.txt

  2. Run

python fit.py

Default runtime is 35 min, can be modified by passing --timelimit=time_in_minutes while running fit.py or modifying fit.py itself

  1. Get output in challenge_output.txt

Running the Visualizer

  1. Run
python visualizer.py

It plots challenge_output.txt and saves the images in Visuals directory

Directory Breakdown

Main Runner

  • fit.py:
    • Primary script to execute the entire optimization process
    • Coordinates different components of the packing algorithm
    • Handles high-level workflow and integration of various modules
    • Time limit for running the algorithm, can be configured here ( default is 35 mins ).
    • Run commands for python/C++ can be also be configured here ( default is python and g++ ).

Python Scripts

  • fillPriority.py:
    • Focuses on priority-based packing algorithm
    • Ensures high-priority items are packed with specific constraints
  • fillEconomyWithPriority.py:
    • Advanced filling strategy combining economy considerations with priority constraints
    • Fill using Volume cuts and API
  • fillEconomy.py:
    • Implements economy-class packing strategy
    • Fill using metric cuts and API
  • runMIP.py:
    • Executes Linear Programming Problem (MIP)
    • Manages optimization solver configuration and problem setup
  • makeDiscrete.py:
    • Converts continuous variables to discrete values
    • Helps in transforming optimization results to practical, implementable packing solutions

C++ Conversion Utilities

  • input_converter.cpp:
    • Converts input data into a format suitable for optimization
    • Preprocesses and transforms input files
  • output_converter.cpp:
    • Converts optimization results into desired output format
    • Processes and transforms solver output
  • output_checker.cpp:
    • Validates the output of the optimization process
    • Performs checks to ensure solution feasibility and quality
  • gravity.cpp:
    • Implements gravity-based algorithms and settling

I/O Files

  • challenge_input.txt:
    • Contains initial input data for the optimization challenge
    • Provides problem specifications and constraints
  • challenge_output.txt:
    • Contains final output data for the optimization challenge

Utilities

  • visualizer.py:
    • Visualize the output of packaging
    • Output is stored in /Visuals
  • apiCred.txt
    • Contains api username and apikey from 3dbinpacking.com

Visuals/

  • Directory used for storing final visuals

Logs/

  • Directory used for storing intermediate files generated during pipeline execution

Generators/

  • APIinitialise.py:
    • Initializes API connections and configurations
    • Sets up communication with external data sources or services
  • APIresponseConvert.py:
    • Processes and converts API responses
    • Transforms raw API data into usable format for optimization
  • discrete.py:
    • Implements discretization
  • generateConstants.py:
    • Generates constant values used in optimization
    • Provides fixed parameters for the packing algorithm
  • generateInitials.py:
    • Helps in setting up the initial state of the packing problem
  • generateVariables.py:
    • Generates variables for the optimization model
    • Defines decision variables used in the packing algorithm
  • GurobiBatchVariables.py:
    • Manages batch processing of Gurobi variables
    • Handles large-scale variable generation and management
  • GurobiConstraints.py:
    • Defines constraints for Gurobi optimization model
    • Implements packing rules and restrictions
  • GurobiInitialise.py:
    • Initializes Gurobi optimization environment
    • Sets up the Gurobi solver with necessary configurations
  • GurobiStart.py:
    • Creates starting point for Gurobi Variables
  • printState.py:
    • Utility for printing current state of optimization
    • Helps in debugging and monitoring the optimization process
  • readConstants.py:
    • Reads predefined constants from configuration files
    • Loads fixed parameters for the optimization
  • readInitials.py:
    • Reads initial conditions from external sources
    • Loads starting points for the optimization
  • readVariables.py:
    • Reads variables from external sources
    • Loads variable configurations for the optimization model

tried_approaches/

Codes for the tried approaches, MIP with Batching and Metric, and both Greedy Approaches - Randomized Greedy Search with Metric and Maximal Surface Area with Metric. Each Directory has its own README.md for its usage.

  • batch_mip/:
    • Code for MIP with Batching and Metric.
  • maximal_surface_area/
    • Code for Greedy Approach 1 - Maximal Surface Area with Metric
  • randomized_greedy_approach/
    • Code for Greedy Approach 2 - Randomized Greedy Search with Metric

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •