g | x | w | all
Bytes Lang Time Link
688Python3240627T185929ZAjax1234
044Jelly210711T173644ZNick Ken
228Ruby210708T081923ZG B

Python3, 688 bytes

from itertools import*
E=enumerate
R=range
def f(h,w,b):
 q,s,S=[([[0 for _ in R(w)]],b)],[],[]
 while q:
  (p,b),*q=sorted(q,key=lambda x:len(x[1]))
  if not b:s+=[p];continue
  if s and len(p)>=len(min(s,key=len)):continue
  for i,a in E(b):
   for H,W,L in{*permutations(a,3)}:
    for x,r in E(p):
     for y,_ in E(r):
      if y+W<=len(r):
       P=eval(str(p))+[[0 for _ in R(w)]for _ in R(max(x+L-len(p),0))]
       t=[(X,Y)for X in R(x,x+L)for Y in R(y,y+W)]
       if(M:=max(P[X][Y]+H for X,Y in t))<=h:
        for X,Y in t:P[X][Y]=M
        if P not in S:q+=[(P,b[:i]+b[i+1:])];S+=[P]
       elif(U:=p+[[0 for _ in R(w)]])not in S:q+=[(U,b)];S+=[U]
 return len(min(s,key=len))

Try it online!

Jelly, 44 bytes

_⁹żAƑƇŻ€,Œp€+þ@/ʋ/€Ẏ
Œ!€⁹,1W;"çⱮ/pẎ€QƑƇɗ/ʋ1#

Try it online!

A dyadic pair of links taking a list of boxes as the left argument and the truck’s first two dimensions as the right argument. Returns the result as an integer. Very inefficient as the boxes and truck get bigger and do times out on TIO even on the fifth test case.

Explanation

Takes three truck dimensions on the left and a list of permuted boxes on the right. Returns a list of lists of coordinates for all possible translated and rotated versions of that box

_⁹                    | Subtract the permuted boxes from the truck
  ż                   | Zip each with the relevant permuation
   AƑƇ                | Keep only those that are non-negative (by checking whether the numbers are changed when absoluted)
                ʋ/€   | For each of the remaining ones, reduce using the following:
      ݀              | - For each of the (truck-box) dimensions, generate a list from zero to that number
        ,             | - Pair with the box dimensions
         Œp€          | - Cartesian products of each
            +þ@/      | - Reduce using outer addition (generates a list of lists of coordinates for each cell of the translations of that permuation of the box)
                   Ẏ  | Tighten
Œ!€                     | Permutations of each box’s dimensions
   ⁹,                   | Pair truck dimensions with this (call this y)
     1              ʋ1# | Starting with 1, find the first integer x which satisfies the following, using y as the right argument:
      W;"               | - Wrap and concatenate zipped; effectively prepends x to the first member of y (the truck’s two dimensions)
         çⱮ/            | - Call the helper link with the three truck dimensions on the left for each box’s permutations on the right
                  ɗ/    | - Reduce the results of the helper link with the following:
            p           |   - Cartesian product
             Ẏ€         |   - Tighten (concatenate outer lists)
               QƑƇ      |   - Check whether unchanged on uniquifying (i.e. are there any duplicates?)

Ruby, 292... 228 bytes

->t,b{1.step.find{|l|[p].product(*b.map{|c|c.permutation.flat_map{|x,y,z|[*x..t[0]].product([*y..t[1]],[*z..l]).map{|i,j,k|[i-x...i,j-y...j,k-z...k]}}}).any?{|c|c.combination(2).none?{|a,b|a&.zip(b)&.all?{|x,y|[*x]&[*y]!=[]}}}}}

Try it online!

Probably still a lot left to optimize.

Can get the 6th test case on TIO in 17 seconds by adding a uniq after permutation. No way to get more than that.

Explanation:

Brute force approach, pure and simple. Start with length 1, rotate all the boxes, and try all the possible translations. If there is no way to fit them, increase length and try again.