Skip to content

Scenario with no meal in gym env #45

Open
@maxime-louis

Description

@maxime-louis

Hey,

Thank you for this awesome library.

I'm trying to run a gym env without any meal (ideally I would like a controller which can also suggest carb but from what I understood it's not supported).

I did the following:

start_time = datetime.now()
no_meal_scenario = CustomScenario(start_time=start_time, scenario=[])


register(
    id='env-v0',
    entry_point='simglucose.envs:T1DSimEnv',
    kwargs={'patient_name': 'adult#001',
           'custom_scenario': no_meal_scenario}
)


env = gym.make('env-v0')



min_insulin = env.action_space.low
max_insulin = env.action_space.high

observation = env.reset()
for t in range(100):
    env.render(mode='human')
    print(observation)
    action = np.random.uniform(min_insulin, max_insulin)
    
    
    print(action)
    observation, reward, done, info = env.step(action)
    if done:
        print("Episode finished after {} timesteps".format(t + 1))
        break

But I still het carbohydrates inputs sometimes:
image

What is the correct way to do that ?
Thank you !

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions