riveSunder / therldaisyworld

Agency in a bio-controlled climate model with existential risk!
0 stars 0 forks source link

Temperature channels don't get updated in `forward` #36

Closed riveSunder closed 8 months ago

riveSunder commented 8 months ago

Looks like a mistake in forward is preventing temperature from being updated in self.grid, and consequently agents receive 0s in those observation channels.

424         new_grid = 0. * grid
425         grid[:,3:4,:,:] = temp
426         grid[:,4:5,:,:] = temp_light
427         grid[:,5:6,:,:] = temp_dark
428         new_grid[:,1:3, :,:] = np.clip(grid[:,1:3, :,:] + self.dt * growth, 0,1)
429         new_grid[:,0, :,:] = self.p - new_grid[:,1, :,:] - new_grid[:,2,:,:] #.sum(dim=1)
430 
431         new_grid = np.round(new_grid, decimals=3)
432 

channels are nominally

0 - bare ground cover 1 - light daisy cover 2 - dark daisy cover 3 - temperature 4 - light temperature 5 - dark temperature 6 - unused (I think)

If you check env.grid[:,3].mean() immediately after env.reset(), the temp channel has a non-zero value, but this is zeroed out after env.step.

The env still works because temp is recalculated at each step, but I believe the intention was not to keep 3 channels of 0s in env.grid and the corresponding observations.

riveSunder commented 8 months ago

Addressed in PR #37