dwave-examples / 3d-bin-packing

Use a hybrid solver to use the minimum number of bins to pack items with different dimensions
Apache License 2.0
62 stars 26 forks source link

removing redundant variables and constraints #47

Closed aivarsoo closed 7 months ago

aivarsoo commented 8 months ago

Minor fixes to the example:

Readme modifications:

  1. Comment added on bins.lowest_num_bin
  2. A width constraint is modified and commented on. Now the text in readme corresponds to the code

Code modifications:

  1. Without loss of generality we can assign the first case to the first bin, therefore the variable bin_loc[0,0] is fixed to be equal to 1.
  2. Since the minimum number of bins is estimated and saved in bins.lowest_num_bin, we can fix the first bins.lowest_num_bin bin_on[j] variables to be equal to one. Thus we can remove bins.lowest_num_bin variables, as well as, 2 * bins.lowest_num_bin constraints.
  3. The width constraints are now added only once
  4. The length constraint for j=0 is not add, since it is redundant.
  5. All the inequality constraints are changed to have be lower or equal than <= for consistency.
  6. The order of adding the constraints is modified so that the add_discrete are added first.