File size: 2,475 Bytes
888cb3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
register.py
===========
Register the HealthcareRoutingEnv with Gymnasium so it can be created
with gym.make("healthcare-routing-v1").

Also provides the OpenEnv-spec environment_config dict for
submission to the HuggingFace Hub.

Usage:
    python register.py          # verify registration works
    import register             # in any script to auto-register
"""

import gymnasium as gym
from gymnasium.envs.registration import register

# ── Gymnasium registration ───────────────────────────────────────────────────
register(
    id              = "healthcare-routing-v1",
    entry_point     = "openenv_env.healthcare_env:HealthcareRoutingEnv",
    max_episode_steps = 200,
    reward_threshold  = 100.0,
    kwargs          = {},
)

# ── OpenEnv spec dict (for Hub submission) ───────────────────────────────────
ENVIRONMENT_CONFIG = {
    "env_id":           "healthcare-routing-v1",
    "version":          "1.0.0",
    "description":      (
        "AI-Powered Smart Healthcare Routing & Emergency Management. "
        "An RL agent dispatches the optimal ambulance and hospital for each "
        "incoming emergency patient, maximising survival outcomes while "
        "minimising response times and wasted resources."
    ),
    "tags":             ["healthcare", "routing", "multi-objective", "real-world", "emergency"],
    "observation_type": "Box",
    "action_type":      "Discrete",
    "reward_range":     (-200, 220),
    "authors":          ["Healthcare-RL Team"],
    "license":          "MIT",
    "gym_make_kwargs":  {},
    "entry_point":      "openenv_env.healthcare_env:HealthcareRoutingEnv",
}


def make_env(**kwargs):
    """Convenience factory used by OpenEnv infrastructure."""
    from openenv_env.healthcare_env import HealthcareRoutingEnv
    return HealthcareRoutingEnv(**kwargs)


if __name__ == "__main__":
    print("Registering healthcare-routing-v1 with Gymnasium …")
    env = gym.make("healthcare-routing-v1")
    obs, info = env.reset()
    print(f"  βœ… Environment created successfully")
    print(f"  Observation shape : {obs.shape}")
    print(f"  Action space      : {env.action_space}")
    print(f"  Config            : {ENVIRONMENT_CONFIG['env_id']} v{ENVIRONMENT_CONFIG['version']}")
    env.close()
    print("Registration OK πŸŽ‰")