In trailer packing, an orientation is one arrangement of a box’s dimensions for placement in a container. The packing agent chooses among six fixed orientations for each box. section 3.4
For a box with dimensions (l, w, h), the six orientations are:
- (l, w, h) section 3.4
- (l, h, w) section 3.4
- (w, l, h) section 3.4
- (w, h, l) section 3.4
- (h, l, w) section 3.4
- (h, w, l) section 3.4
Listing 3.13 Geometric Helper and Placement Validation Logic
def _get_oriented_dims(self, base_dims, o_idx):
l,w,h=base_dims
if o_idx==0: return(l,w,h) #A
if o_idx==1: return(l,h,w) #A
if o_idx==2: return(w,l,h) #A
if o_idx==3: return(w,h,l) #A
if o_idx==4: return(h,l,w) #A
if o_idx==5: return(h,w,l) #A
raise ValueError(f"Invalid orientation: {o_idx}")
def _get_observation(self): #B
item=self._get_current_item_details() #B
item_info={'id':item['id'],'base_dims':item['dims']} if item else None
return ([s.copy() for s in self.container_spaces], item_info) #B
def _check_placement(self, c_idx, i_dims_o, pos): #C
space=self.container_spaces[c_idx]; c_dims=self.container_dims_list[c_idx]
px,py,pz=np.array(pos,dtype=int); dx,dy,dz=np.array(i_dims_o,dtype=int)
if not (px>=0 and px+dx<=c_dims[0] and py>=0 and py+dy<=c_dims[1] and pz>=0 and pz+dz<=c_dims[2]): return False #D
if np.any(space[px:px+dx, py:py+dy, pz:pz+dz]!=0): return False #E
return True
The placement helper maps orientation indices to these dimension permutations. section 3.4


