PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [CPSC 223] Heuristic E Test 11
Date: Monday, 10 Feb 2020, 22:12:48


    > I spoke to you earlier about my program failing test 11 (Heuristic E).
    >
    > This is the error code displayed when I run the test: 16550 Killed...0
    > points

This means that your Binpack was running too slowly.
=====

    > The output for my program is correct, but it just takes longer. I have
    > tried everything, including partially rewriting the function but to no
    > avail.

The general form of backtracking is

  for each bin where the next item can be placed (including one empty bin)
  ...
  return the minimum number of bins found by any of the recursive calls

Note that the outer loop runs #bins + 1 times, not
#items times.

Note also that the inner loop (which looks for a bin
with the same free space as that under consideration)
runs #bins times, not #items times.

Nonetheless in your implementation both loops run #items
(= 37) times, many more than #bins (which is never more
than 10 for this problem).

--Stan-
PREV INDEX NEXT