iglu package

Subpackages

Submodules

iglu.const module

iglu.env module

class iglu.env.IGLUEnv(*args, max_steps=500, resolution=(64, 64), start_position=(0.5, 227, 0.5, 0.0, - 90), initial_blocks=None, bound_agent=True, action_space='human-level', **kwargs)

Bases: minerl_patched.env._singleagent._SingleAgentEnv

property action_space
property bound_agent
property current_task
property initial_blocks
real_reset()
reset()

Reset the environment.

Sets-up the Env from its specification (called everytime the env is reset.)

Returns

The first observation of the environment.

property resolution
set_task(task_id)
should_reset(value: bool)
property start_position
step(action)

Run one timestep of the environment’s dynamics. When end of episode is reached, you are responsible for calling reset() to reset this environment’s state.

Accepts an action and returns a tuple (observation, reward, done, info).

Parameters

action (object) – an action provided by the agent

Returns

agent’s observation of the current environment reward (float) : amount of reward returned after previous action done (bool): whether the episode has ended, in which case further step() calls will return undefined results info (dict): contains auxiliary diagnostic information (helpful for debugging, and sometimes learning)

Return type

observation (object)

property tasks
update_taskset(tasks)
class iglu.env.IGLUEnvSpec(*args, iglu_evaluation=False, resolution=(64, 64), start_position=(0.5, 227, 0.5, 0, - 90), initial_blocks=None, bound_agent=True, ation_space='human-level', **kwargs)

Bases: minerl_patched.herobraine.env_specs.simple_embodiment.SimpleEmbodimentEnvSpec

ENTRYPOINT = 'iglu.env:IGLUEnv'
continuous_actions()
create_actionables()

Simple envs have some basic keyboard control functionality, but not all.

create_agent_handlers() List[minerl_patched.herobraine.hero.handler.Handler]

Creates all of the agent handlers for an env specificaiton. These generally are used to specify agent specific behaviours that don’t directly correspond to rewards/actions/observaitons.

For example, one can specify all those behaviours which terminate a mission:

AgentQuitFrom… Handler, etc.

Raises

NotImplementedError – [description]

Returns

[description]

Return type

List[AgentHandler]

create_agent_mode()
create_agent_start()

Specifies all fo the handlers which constitute the agents initial inventory etc at the beginning of a mission. This can be used for domain randomization as these handlers are reinstantiated on every reset!

create_monitors()

Specifies all of the environment monitor handlers for the env specification. These are used to comprise the info dictionary returned by the environment. Note because of the way Gym1 works, these are not accessible at the first tick.

These are also strictly typed (in terms of MineRLSpaces) just like observables and actionables.

Any set of rewards/observables can go here.

TODO (future): Allow monitors to accept state and action previously taken.

create_observables() List[minerl_patched.herobraine.hero.handler.Handler]

Specifies all of the observation handlers for the env specification. These are used to comprise the observation space.

create_rewardables() List[minerl_patched.herobraine.hero.handler.Handler]

Specifies all of the reward handlers for the env specification. These are used to comprise the reward and are summed in the gym environment.

create_server_decorators() List[minerl_patched.herobraine.hero.handler.Handler]
create_server_initial_conditions()
create_server_quit_producers()
create_server_world_generators()
determine_success_from_rewards(rewards: list) bool
discrete_actions()
flatten_continuous_actions(action_space)
flatten_discrete_actions(action_space)
get_docstring()
human_level_actions()
is_from_folder(folder: str) bool

iglu.handlers module

class iglu.handlers.AgentPosObservation

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandlerGroup

from_hero(x)

Applies the constituent from_hero methods on the object X and builds a dictionary with keys corresponding to the constituent handlers applied.

to_string() str

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.CameraAction

Bases: minerl_patched.herobraine.hero.handlers.agent.action.Action

to_string()

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.ChatObservation(monitor)

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandler

from_hero(x)

Converts a “hero” representation of an instance of this handler to a member of the space.

to_string() str

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.ContinuousNavigationActions(position, ground_level, build_zone)

Bases: minerl_patched.herobraine.hero.handlers.agent.action.Action

to_hero(x)

Returns a command string for the multi command action. :param x: :return:

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.DiscreteNavigationActions(movement=True, camera=True, placement=True, custom_name=None)

Bases: minerl_patched.herobraine.hero.handlers.agent.action.Action

to_hero(x: int)

Returns a command string for the multi command action. :param x: :return:

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.FakeResetAction

Bases: minerl_patched.herobraine.hero.handlers.agent.action.Action

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.GridIntersectionMonitor(grid_name, wrong_placement_reward_scale=1, right_placement_reward_scale=2)

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandler

from_hero(x)

Converts a “hero” representation of an instance of this handler to a member of the space.

reset()
set_task(task_id)
to_string()

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

class iglu.handlers.GridObservation(grid_name, min_x, min_y, min_z, max_x, max_y, max_z)

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandler

from_hero(x)

Converts a “hero” representation of an instance of this handler to a member of the space.

to_string() str

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.HotBarChoiceAction(n)

Bases: minerl_patched.herobraine.hero.handlers.agent.action.Action

to_hero(x)

Returns a command string for the multi command action. :param x: :return:

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.HotBarObservation(count)

Bases: minerl_patched.herobraine.hero.handlers.agent.observations.inventory.FlatInventoryObservation

from_hero(info)

Converts the Hero observation into a one-hot of the inventory items for a given inventory container. Ignores variant / color :param obs: :return:

to_string()

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.RayObservation(*args, **other_kwargs)

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandler

from_hero(x)

Converts a “hero” representation of an instance of this handler to a member of the space.

to_string() str

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

xml_template() str

Generates an XML representation of the handler.

This XML representaiton is templated via Jinja2 and has access to all of the member variables of the class.

Note: This is not an abstract method so that handlers without corresponding XML’s can be combined in handler groups with group based XML implementations.

class iglu.handlers.String(shape=None, dtype=None)

Bases: gym.spaces.space.Space

contains(x)

Return boolean specifying if x is a valid member of this space

noop(batch_shape=())
sample(bdim=None)

Randomly sample an element of this space. Can be uniform or non-uniform sampling based on boundedness of space.

class iglu.handlers.TargetGridMonitor(grid_monitor)

Bases: minerl_patched.herobraine.hero.handlers.translation.TranslationHandler

from_hero(x)

Converts a “hero” representation of an instance of this handler to a member of the space.

to_string()

The unique identifier for the agent handler. This is used for constructing aciton/observation spaces and unioning different env specifications.

Module contents