Skip to content

tenderking/box-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Box Stacking Optimization in Rust

Project Overview

Inspired by playing with my kid and stacking boxes, I wanted to find an optimal way to stack ten boxes into three towers of roughly equal height. I measured each box and decided to tackle this problem using Rust.

Box Heights

Here are the heights of the boxes:

let box_values = HashMap::from([
    ("box1", 4.0),
    ("box2", 4.9),
    ("box3", 6.0),
    ("box4", 7.2),
    ("box5", 8.3),
    ("box6", 9.5),
    ("box7", 10.5),
    ("box8", 11.3),
    ("box9", 12.5),
    ("box10", 13.6),
]);

Results

The algorithm identifies valid combinations of box stacks with heights as close as possible. Here's how to run the code and see the results. How to Run

Make sure you have Rust and Cargo installed. If not, follow the instructions at https://www.rust-lang.org/tools/install

Clone the Repository:
Bash

git clone cd

Build and Run: Bash

cargo run

Conclusion

This project demonstrates using Rust to solve a practical box-stacking optimization problem. The algorithm finds combinations of stacks with nearly equal heights, offering a fun and educational way to explore Rust's capabilities.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages