liveBook · Manning

Orientation

As explained in Applied Reinforcement Learning

An orientation is a particular rotational arrangement of a three-dimensional item for placement in a container.

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:

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

How Applied Reinforcement Learning covers it

How deep it goes
Defines six fixed dimension permutations and implements their index mapping, without extending beyond those orientations.
Examples
Shows six permutations of a box’s length, width, and height as the available orientations.
What you can do after
Apply it by choosing one of six dimension permutations when proposing a box placement.
How it connects
Connects orientation to three-dimensional bin packing, box dimensions, container placement, and placement validity.

Also explained in

Compare how 3 books explain orientation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Applied Reinforcement Learning. The section links point to the parts of the book it draws on.