A method of writing data to physical memory, the method comprising: determining a current state based on the physical memory; and if the current state is in a table comprising a plurality of entries: executing, using one or more processors, an agent (138, 320) to choose a current action from a plurality of actions, wherein each of the plurality of actions is associated with a location within the physical memory to write data; writing the data to the physical memory based on the current action; observing a reward based at least in part on the current state and the current action, wherein the reward is a value that is inversely related to a write amplification factor; updating, using the one or more processors, at least one entry of the plurality of entries of the table, based on the observed reward, to produce an updated table; providing a Flash Translation Layer, FTL, that manages logical to physical mapping of data within the physical memory to optimize data mapping within the physical memory using a reinforcement learning model, wherein the reinforcement learning model includes an environment being a model of the physical memory, the agent, the current action, the reward and the current state. determining a current state based on the physical memory; and if the current state is in a table comprising a plurality of entries: executing, using one or more processors, an agent (138, 320) to choose a current action from a plurality of actions, wherein each of the plurality of actions is associated with a location within the physical memory to write data; writing the data to the physical memory based on the current action; observing a reward based at least in part on the current state and the current action, wherein the reward is a value that is inversely related to a write amplification factor; updating, using the one or more processors, at least one entry of the plurality of entries of the table, based on the observed reward, to produce an updated table; providing a Flash Translation Layer, FTL, that manages logical to physical mapping of data within the physical memory to optimize data mapping within the physical memory using a reinforcement learning model, wherein the reinforcement learning model includes an environment being a model of the physical memory, the agent, the current action, the reward and the current state. executing, using one or more processors, an agent (138, 320) to choose a current action from a plurality of actions, wherein each of the plurality of actions is associated with a location within the physical memory to write data; writing the data to the physical memory based on the current action; observing a reward based at least in part on the current state and the current action, wherein the reward is a value that is inversely related to a write amplification factor; updating, using the one or more processors, at least one entry of the plurality of entries of the table, based on the observed reward, to produce an updated table; providing a Flash Translation Layer, FTL, that manages logical to physical mapping of data within the physical memory to optimize data mapping within the physical memory using a reinforcement learning model, wherein the reinforcement learning model includes an environment being a model of the physical memory, the agent, the current action, the reward and the current state.