# Path: spriteworld/factor_distributions.py
# _MAX_TRIES = int(1e5)
# class AbstractDistribution(object):
# class Continuous(AbstractDistribution):
# class Discrete(AbstractDistribution):
# class Mixture(AbstractDistribution):
# class Intersection(AbstractDistribution):
# class Product(AbstractDistribution):
# class SetMinus(AbstractDistribution):
# class Selection(AbstractDistribution):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def __str__(self):
#   def _get_rng(self, rng=None):
#   def keys(self):
#   def __init__(self, key, minval, maxval, dtype='float32'):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, key, candidates, probs=None):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components, probs=None):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components, index_for_sampling=0):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, base, hold_out):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, base, filtering):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
# 
# Path: spriteworld/sprite_generators.py
# def generate_sprites(factor_dist, num_sprites=1):
#   def _generate():
# def chain_generators(*sprite_generators):
#   def _generate():
# def sample_generator(sprite_generators, p=None):
#   def _generate():
# def shuffle(sprite_generator):
#   def _generate():
# 
# Path: spriteworld/tasks.py
# class AbstractTask(object):
# class NoReward(AbstractTask):
# class FindGoalPosition(AbstractTask):
# class Clustering(AbstractTask):
# class MetaAggregated(AbstractTask):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self):
#   def reward(self, unused_sprites):
#   def success(self, unused_sprites):
#   def __init__(self,
#                filter_distrib=None,
#                goal_position=(0.5, 0.5),
#                terminate_distance=0.05,
#                terminate_bonus=0.0,
#                weights_dimensions=(1, 1),
#                sparse_reward=False,
#                raw_reward_multiplier=50):
#   def _single_sprite_reward(self, sprite):
#   def _filtered_sprites_rewards(self, sprites):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self,
#                cluster_distribs,
#                termination_threshold=2.5,
#                terminate_bonus=0.0,
#                sparse_reward=False,
#                reward_range=10):
#   def _cluster_assignments(self, sprites):
#   def _compute_clustering_metric(self, sprites):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self,
#                subtasks,
#                reward_aggregator='sum',
#                termination_criterion='all',
#                terminate_bonus=0.0):
#   def reward(self, sprites):
#   def success(self, sprites):
#   REWARD_AGGREGATOR = {
#       'sum': np.nansum,
#       'max': np.nanmax,
#       'min': np.nanmin,
#       'mean': np.nanmean
#   }
#   TERMINATION_CRITERION = {'all': np.all, 'any': np.any}
# 
# Path: spriteworld/configs/cobra/common.py
# def action_space():
# def renderers():


import os
from spriteworld import factor_distributions as distribs
from spriteworld import sprite_generators
from spriteworld import tasks
from spriteworld.configs.cobra import common
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
# python2 python3
"""Goal-Finding tasks testing for generalization to new shapes.

In this task there is one sprite per episode. That sprite must be brought to the
goal location, which is always the center of the arena. At training time the
sprite is a square. At test time it is either a circle or a triangle.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


TERMINATE_DISTANCE = 0.075
NUM_TARGETS = 1
MODES_SHAPES = {

# Path: spriteworld/factor_distributions.py
# _MAX_TRIES = int(1e5)
# class AbstractDistribution(object):
# class Continuous(AbstractDistribution):
# class Discrete(AbstractDistribution):
# class Mixture(AbstractDistribution):
# class Intersection(AbstractDistribution):
# class Product(AbstractDistribution):
# class SetMinus(AbstractDistribution):
# class Selection(AbstractDistribution):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def __str__(self):
#   def _get_rng(self, rng=None):
#   def keys(self):
#   def __init__(self, key, minval, maxval, dtype='float32'):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, key, candidates, probs=None):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components, probs=None):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components, index_for_sampling=0):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, components):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, base, hold_out):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
#   def __init__(self, base, filtering):
#   def sample(self, rng=None):
#   def contains(self, spec):
#   def to_str(self, indent):
#   def keys(self):
# 
# Path: spriteworld/sprite_generators.py
# def generate_sprites(factor_dist, num_sprites=1):
#   def _generate():
# def chain_generators(*sprite_generators):
#   def _generate():
# def sample_generator(sprite_generators, p=None):
#   def _generate():
# def shuffle(sprite_generator):
#   def _generate():
# 
# Path: spriteworld/tasks.py
# class AbstractTask(object):
# class NoReward(AbstractTask):
# class FindGoalPosition(AbstractTask):
# class Clustering(AbstractTask):
# class MetaAggregated(AbstractTask):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self):
#   def reward(self, unused_sprites):
#   def success(self, unused_sprites):
#   def __init__(self,
#                filter_distrib=None,
#                goal_position=(0.5, 0.5),
#                terminate_distance=0.05,
#                terminate_bonus=0.0,
#                weights_dimensions=(1, 1),
#                sparse_reward=False,
#                raw_reward_multiplier=50):
#   def _single_sprite_reward(self, sprite):
#   def _filtered_sprites_rewards(self, sprites):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self,
#                cluster_distribs,
#                termination_threshold=2.5,
#                terminate_bonus=0.0,
#                sparse_reward=False,
#                reward_range=10):
#   def _cluster_assignments(self, sprites):
#   def _compute_clustering_metric(self, sprites):
#   def reward(self, sprites):
#   def success(self, sprites):
#   def __init__(self,
#                subtasks,
#                reward_aggregator='sum',
#                termination_criterion='all',
#                terminate_bonus=0.0):
#   def reward(self, sprites):
#   def success(self, sprites):
#   REWARD_AGGREGATOR = {
#       'sum': np.nansum,
#       'max': np.nanmax,
#       'min': np.nanmin,
#       'mean': np.nanmean
#   }
#   TERMINATION_CRITERION = {'all': np.all, 'any': np.any}
# 
# Path: spriteworld/configs/cobra/common.py
# def action_space():
# def renderers():


# Path: spriteworld/configs/cobra/goal_finding_new_shape.py
import os
from spriteworld import factor_distributions as distribs
from spriteworld import sprite_generators
from spriteworld import tasks
from spriteworld.configs.cobra import common

# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
# python2 python3
"""Goal-Finding tasks testing for generalization to new shapes.

In this task there is one sprite per episode. That sprite must be brought to the
goal location, which is always the center of the arena. At training time the
sprite is a square. At test time it is either a circle or a triangle.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


TERMINATE_DISTANCE = 0.075
NUM_TARGETS = 1
MODES_SHAPES = {

    'train': distribs.Discrete('shape', ['square']),