FoPra Beluga Challenge - Reinforcement Learning v1.0
Deep Reinforcement Learning solution for the Beluga Challenge shipping container optimization problem using PPO and MCTS
rl.env.state.Rack Class Reference

Storage rack with size constraints. More...

Public Member Functions

 __init__ (self, int size, list[int] current_jigs)
 Initialize a storage rack.
 
 __str__ (self)
 
int get_free_space (self, list[Jig] all_jigs)
 Calculate remaining free space in the rack.
 
 copy (self)
 Create a deep copy of this rack.
 

Public Attributes

 size = size
 
 current_jigs = current_jigs
 

Detailed Description

Storage rack with size constraints.

Represents a storage location that can hold multiple jigs up to its total size capacity.

Constructor & Destructor Documentation

◆ __init__()

rl.env.state.Rack.__init__ ( self,
int size,
list[int] current_jigs )

Initialize a storage rack.

Parameters
sizeMaximum capacity of the rack
current_jigsList of jig IDs currently stored in this rack
125 def __init__(self, size: int, current_jigs: list[int]):
126 """!
127 @brief Initialize a storage rack
128 @param size Maximum capacity of the rack
129 @param current_jigs List of jig IDs currently stored in this rack
130 """
131 self.size = size
132 self.current_jigs = current_jigs
133

Member Function Documentation

◆ __str__()

rl.env.state.Rack.__str__ ( self)
134 def __str__(self):
135 return "size = " + str(self.size) + " | current_jigs = " + str(self.current_jigs)
136

◆ copy()

rl.env.state.Rack.copy ( self)

Create a deep copy of this rack.

Returns
New Rack instance with same properties
152 def copy(self):
153 """!
154 @brief Create a deep copy of this rack
155 @return New Rack instance with same properties
156 """
157 return Rack(self.size, self.current_jigs[:])
158

◆ get_free_space()

int rl.env.state.Rack.get_free_space ( self,
list[Jig] all_jigs )

Calculate remaining free space in the rack.

Parameters
all_jigsList of all jigs in the problem (for size lookup)
Returns
Amount of free space remaining in the rack
137 def get_free_space(self, all_jigs: list[Jig]) -> int:
138 """!
139 @brief Calculate remaining free space in the rack
140 @param all_jigs List of all jigs in the problem (for size lookup)
141 @return Amount of free space remaining in the rack
142 """
143 total_used_space = 0
144 for jig_id in self.current_jigs:
145 jig = all_jigs[jig_id - 1]
146 jig_size = jig.jig_type.size_empty if jig.empty else jig.jig_type.size_loaded
147 total_used_space += jig_size
148
149 remaining_space = self.size - total_used_space
150 return remaining_space
151

Member Data Documentation

◆ current_jigs

rl.env.state.Rack.current_jigs = current_jigs

◆ size

rl.env.state.Rack.size = size

The documentation for this class was generated from the following file: