我有一个括号列表,我需要找到它们的组合,最多 4 个括号,最适合某个长度。
这些是我的括号,例如,我需要找出最接近的这些组合,而不超过 120 英寸。
<?xml version="1.0" encoding="utf-8" ?>
<brackets>
<bracket>
<PartNumber>F0402583</PartNumber>
<Length>42.09</Length>
</bracket>
<bracket>
<PartNumber>F0402604</PartNumber>
<Length>32.36</Length>
</bracket>
<bracket>
<PartNumber>F0403826</PartNumber>
<Length>46.77</Length>
</bracket>
<bracket>
<PartNumber>F0402566</PartNumber>
<Length>44.17</Length>
</bracket>
<bracket>
<PartNumber>F0402289</PartNumber>
<Length>20.55</Length>
</bracket>
<bracket>
<PartNumber>F0402612</PartNumber>
<Length>18.46</Length>
</bracket>
<bracket>
<PartNumber>F0402606</PartNumber>
<Length>30.28</Length>
</bracket>
<bracket>
<PartNumber>F0403828</PartNumber>
<Length>22.76</Length>
</bracket>
</brackets>
我试图找出 SolverFoundation 库,但我不是数学专业的,对此几乎没有经验......使用 Excel Solver 和 Simplex LP 求解方法,解决方案是 1 30.28" 支架,1 42.09" 支架,和1 46.77" 支架,结果为 119.14"