2D bin packing problem
回答済みHi,
|
I am trying to solve a 2D bin packing problem. I have three types of bins where each bin has an associated cost. The problem's objective is to minimize the total cost of using bins. Thus, the number of each bin type is a variable. So I can have 0 number of the first bin, 10 of the second and 5 of the third bin, if that means all balls fit and this is the minimum cost. However, I am having trouble expressing a variable number of bins through the python API. This is my current attempt: machines = [] # this list is meant to contain all the finally used bins However, this gives me the following error at the line 'for x in range (0, variable)': How do I avoid this? |
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Faria, I have a similar problem to model. Did you find an answer for this? - Darren
0 -
Hi,
In your code snippet, \(\texttt{variable}\) is a Var object. The \(\texttt{range}\) function requires two integer objects as arguments thus, you get the \(\texttt{TypeError}\). It should be enough for your problem to replace \(\texttt{range(0, variable)}\) with \(\texttt{range(0, i)}\).
Best regards,
Jaromił0
投稿コメントは受け付けていません。
コメント
3件のコメント