Observations¶
This class is responsible for the computation of the observation features that will be available to the active agent while it’s interacting with the environment.
There are five types of observations possible:
nodes_static - Nodes/locations intrinsic features (e.g. location, time window width, demands, profits, etc);
nodes_dynamic - Nodes/locations step dependent features. Usually, these observations are computed in relation to the active agent (e.g. fraction of time used by the agent after node visit, time left for location opening, time left for location closing);
agent - Active agent-related features (e.g. fraction of visited nodes, fraction of feasible nodes, fraction of current load, fraction of time available);
other_agents - Features regarding all agents still active in the environment (e.g. location, fraction of time available, fraction of used capacity, distance to the active agent, time difference to the active agent);
global - Environment’s global state features (e.g. fraction of completed services, fraction of used agents, fraction of demands satisfied, fraction of profits collected);
ObservationBuilder¶
- class maenvs4vrp.core.env_observation_builder.ObservationBuilder(feature_list: Dict = None)[source]¶
Observations base class.
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.__init__(self, feature_list: Dict = None)¶
Constructor
- Parameters:
feature_list (Dict) – Dictionary containing observation features list to be available to the agent. Defaults to None.
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.set_env(self, env)¶
Set environment.
- Parameters:
env (AECEnv) – Environment.
- Returns:
None.
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_static_feat_dim(self)¶
Get nodes static features dimensions.
- Parameters:
n/a.
- Returns:
Nodes static features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_dynamic_feat_dim(self)¶
Get nodes dynamic features dimensions.
- Parameters:
n/a.
- Returns:
Nodes dynamic features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_nodes_feat_dim(self)¶
Get nodes features dimensions.
- Parameters:
n/a.
- Returns:
Nodes features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_agent_feat_dim(self)¶
Get agent features dimensions.
- Parameters:
n/a.
- Returns:
Agent features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_other_agents_feat_dim(self)¶
Get other agent features dimensions.
- Parameters:
n/a.
- Returns:
Other agent features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_global_feat_dim(self)¶
Get global features dimensions.
- Parameters:
n/a.
- Returns:
Global features dimensions.
- Return type:
int
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.compute_static_features(self)¶
Get nodes static features.
- Parameters:
n/a.
- Returns:
Nodes static features.
- Return type:
torch.Tensor
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.compute_dynamic_features(self)¶
Get nodes dynamic features.
- Parameters:
n/a.
- Returns:
Nodes dynamic features.
- Return type:
torch.Tensor
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.compute_agent_features(self)¶
Get current agent features.
- Parameters:
n/a.
- Returns:
Current agent features.
- Return type:
torch.Tensor
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.compute_agents_features(self)¶
Get other agent features.
- Parameters:
n/a.
- Returns:
Other agent features.
- Return type:
torch.Tensor
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.compute_global_features(self)¶
Get global features.
- Parameters:
n/a.
- Returns:
Global features.
- Return type:
torch.Tensor
- maenvs4vrp.core.env_observation_builder.ObservationBuilder.get_observations(self)¶
Compute the environment.
- Parameters:
n/a.
- Returns
observations(TensorDict): Current environment observations and masks dictionary.