Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: foretmer/Algorithm-Lin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: 18822149379/Algorithm-Lin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jan 7, 2023

  1. 潘柯文&&王蕊首次上传代码

    1.设计思路:
    (1)初始化轴点为(0,0,0),对所有要放入的物体按照体积大小进行排序,在放置过程中,优先放置体积大的物体。
    (2)在第一个物体放置完毕后,之后每放置一个物体之前,首先生成一个新的轴点。这个轴点是按照上一个物体的轴点在依次按照 x 轴,y 轴,z 轴三个方向上生成的三个可放置轴点。
    (3)在放置下一个物体之前,首先将物体的最长边旋转到与容器的最长边平行的位置上,如果一个容器尺寸是 10×9×8,即长度大于宽度,宽度大于高度;此时有一个物品尺寸是 1×2×3,那么就将物品旋转为 3×2×1,再放置物体。也就是保持物体的最长边贴着容器的最长边放置。
    (4)如果物品旋转成 3×2×1 无法放入容器,那就将物体旋转成 2×1×3或者 2×3×1,也就是将第二长边对应箱子的长边来放置;如果还是无法放入的话,就将物体旋转成 1×3×2 或者 1×2×3,也就是将第三长边来对应箱子的长边来放置。
    (5)如果在三个轴点上都尝试了 6 种不同的旋转方式,都无法将物品放入容器中,那么就将物品放入未放置列表中,跳过该物品处理下一个。
    (6)重复 2-4 步,处理完所有的物品之后,所有可放置的物品已经被放入箱子中,同时也有一些物品保存在了未放置列表中,此时再来尝试处理这些未放置的物品。
    
    2.运行描述
    (1)算法主要分为三个文件。utility.py 文件主要设置辅助类的工具函数,loading.py 文件引用了 utility.py,主要就是装箱算法的核心函数,main.py 文件引用了 loading.py,主要就是设置箱子和物品的参数数据。
    (2)在main.py文件中修改测试数据并运行即可得到运行结果。
    18822149379 authored Jan 7, 2023
    Configuration menu
    Copy the full SHA
    5188363 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c605389 View commit details
    Browse the repository at this point in the history
Loading