Skip to content

JingruiYu/box-planning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Box Planning

中文 | English

Contents

English

A small Python optimization experiment for choosing a combination of storage boxes that best fits a target space.

The project started from a practical home-organization problem: given a cabinet / shelf size and a list of candidate storage-box sizes, find a combination that uses the space efficiently.

Related write-up: 知乎文章

Problem

Given:

  • a target 3D space size, such as a shelf or cabinet;
  • a table of candidate box sizes;
  • a maximum number of boxes to combine;
  • a cost function that penalizes unused space.

Find:

  • the box combination with the lowest cost;
  • several candidate combinations for comparison.

Visual overview

Storage box planning optimization workflow diagram

Repository structure

.
├── main.py                   # Example entry point
├── find_solver.py            # Brute-force combination solver and cost functions
├── candidate_size_1.txt      # Candidate box-size table
├── LICENSE
└── README.md

How it works

The solver enumerates combinations with replacement, computes the occupied size of each combination, filters invalid combinations, and ranks candidates by a handcrafted cost function.

Run

python3 main.py

You can modify these values in main.py:

target_size = np.array([44, 43, 28])
find_solver(target_size, size_table, cost_type.height_one, 3)

Keywords

box planning, storage optimization, combination search, brute force search, Python, home organization, algorithm experiment

Citation

If you use this repository, please cite or acknowledge it using the metadata in CITATION.cff.

License

This repository is released under the MIT License. Please retain the copyright and license notice when redistributing or reusing the code.


中文说明

这是一个源于真实生活问题的 Python 小实验:如何选择一组收纳盒,让它们尽可能合适地放进目标空间里

比如给定一个柜子 / 抽屉 / 置物架的尺寸,以及若干候选收纳盒尺寸,程序会枚举可能的组合,并根据剩余空间和手写 cost function 给出较优方案。

相关文章:知乎:收纳盒组合规划问题

问题定义

输入:

  • 目标空间尺寸;
  • 候选收纳盒尺寸表;
  • 最多允许使用的盒子数量;
  • 对空间浪费的惩罚函数。

输出:

  • cost 最低的组合;
  • 若干候选组合,便于人工比较。

运行方式

python3 main.py

可以在 main.py 中修改目标尺寸和搜索参数。

关键词

收纳盒规划、组合优化、暴力搜索、Python、生活算法、空间利用率、家居收纳。

引用与许可

如果你使用该仓库,请通过 CITATION.cff 引用或致谢该项目。许可协议见 LICENSE

About

Python combination-search experiment for storage-box planning and space-utilization optimization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages