Skip to content

BAnSsal/GCMS_Management_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Here's a draft for your README.md file:


Galactic Cargo Management System (GCMS)

This repository contains the implementation of the Galactic Cargo Management System (GCMS), which efficiently manages the allocation of cargo into space cargo bins using a custom AVL Tree-based approach.

Contents

Background

In the vast expanse of the galaxy, interstellar shipping companies face the challenge of efficiently packing cargo into space cargo bins. This system assigns unique integer IDs to bins and objects and allocates cargo based on specific color-coded rules to optimize space usage.

Cargo Color Rules

  1. Blue Cargo (Compact Fit, Least ID): Assign to the bin with the smallest remaining capacity. If multiple bins have the same remaining capacity, the one with the least ID is chosen.
  2. Yellow Cargo (Compact Fit, Greatest ID): Similar to Blue Cargo, but the bin with the greatest ID is chosen.
  3. Red Cargo (Largest Fit, Least ID): Assign to the bin with the largest remaining capacity. If multiple bins have the same remaining capacity, the one with the least ID is chosen.
  4. Green Cargo (Largest Fit, Greatest ID): Similar to Red Cargo, but the bin with the greatest ID is chosen.

Project Structure

  • gcms.py: Main GCMS class to manage bins and objects.
  • bin.py: Implementation of the Bin class that stores bin information.
  • object.py: Implementation of the Object class, storing the object details including color, ID, and size.
  • avl.py: Custom AVL Tree implementation for efficient data handling.
  • node.py: AVL Tree node implementation.
  • exceptions.py: Custom exceptions for error handling.
  • main.py: Script for testing and debugging purposes.

Solution

The solution utilizes custom AVL Trees to manage the cargo and bins efficiently. Here's a detailed breakdown of the approach:

  • AVL Tree Implementation (avl.py): Instead of using inbuilt data structures, the AVL Tree was implemented as a map to maintain efficient data handling. Comparators were created to manage different sorting requirements, and methods such as insert, delete, search, and traversal were implemented. The tree tracks its size and root.

  • Bin Management (bin.py): Each bin object includes attributes like capacity, bin ID, and a nested AVL Tree to store objects. Methods such as add_object and delete_object update the bin's available space accordingly.

  • Object Management (object.py): Objects are represented by their ID, size, and color.

  • Nested AVL Tree for Efficient Sorting: A nested AVL Tree was used to manage bins with the same capacity, sorting them based on their ID. This allows the system to quickly access the most suitable bin for a given object based on the cargo color rules.

  • Main System (gcms.py): The core system manages three AVL Trees:

    • object_by_ID: Tracks which bin an object is stored in.
    • bin_by_id: Stores bins, indexed by their IDs.
    • bin_by_capacity: Uses a nested AVL Tree to group bins with the same available space, ordered by their IDs.

This custom AVL-based approach ensures efficient and organized management of cargo.

Time and Space Complexity Analysis

Let n be the number of objects and m be the number of bins.

  • Space Complexity: The overall space complexity is O(n + m).
  • Time Complexity: Each operation (like insert, delete, or search) operates in O(log n) time, ensuring that the system remains efficient even as the number of objects and bins grows.

This structure should effectively communicate your approach and implementation details. Let me know if you'd like any adjustments!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages