"
24 | exit 1
25 | fi
26 |
27 | DST=$HOME/src/phyre_building_root
28 | module load anaconda3/2020.11
29 |
30 |
31 | for version in 3.6 3.7 3.8 3.9; do
32 | echo "############################"
33 | echo "###### v=${version} ##################"
34 | echo "############################"
35 | vdst=$DST/py$version
36 | env_name="phyre_tmp_$version"
37 | if [ -d "$HOME/.conda/envs/$env_name" ]; then
38 | echo "ENV already exists $env_name"
39 | else
40 | conda create --yes -n $env_name python=$version
41 | fi
42 |
43 | source activate $env_name
44 | if [ $version = "3.6" ] || [ $version = "3.7" ]; then
45 | conda install -c conda-forge sed nodejs=12 thrift-cpp=0.11.0 wget pybind11=2.2.4 cmake boost=1.67.0 setuptools pip --yes
46 | else
47 | conda install -c conda-forge sed nodejs=12 thrift-cpp=0.11.0 wget pybind11=2.6 cmake boost=1.75 setuptools pip --yes
48 | fi
49 |
50 | pip install matplotlib tqdm ipywidgets yapf==0.28.0
51 |
52 | mkdir -p $vdst
53 | cd $vdst
54 | if [ -d "phyre" ]; then
55 | echo "repo exists"
56 | else
57 | git clone https://github.com/facebookresearch/phyre.git
58 | fi
59 | cd phyre
60 | git fetch
61 | git reset --hard origin/$branch
62 | pip install -e src/python
63 | rm -rf src/python/dist
64 | cd src/python/ && python3 setup.py sdist bdist_wheel --plat-name manylinux1_x86_64 --python-tag cp${version//./}
65 |
66 | source deactivate
67 | done
68 |
69 |
70 | echo twine upload -r testpypi $DST/py*/phyre/src/python/dist/*whl
71 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00262.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Template task with a ball that must not roll of a cliff with two holes."""
16 |
17 | import phyre.creator as creator_lib
18 |
19 | __BAR_YS = [0.1 * val for val in range(0, 5)]
20 | __BAR_OFFSET = [0.05 * val for val in range(3, 5)]
21 | __BAR_LENGTH = [0.9, 0.95, 1.]
22 | __LEFT = [True, False]
23 |
24 |
25 | @creator_lib.define_task_template(
26 | bar_y=__BAR_YS,
27 | bar_offset=__BAR_OFFSET,
28 | bar_length=__BAR_LENGTH,
29 | left=__LEFT)
30 | def build_task(C, bar_y, bar_offset, bar_length, left):
31 |
32 | # Add obstacle bars, one of which has a hole on the side.
33 | bar_scale = 0.5 * bar_length
34 | lower_bar = C.add('static bar', scale=bar_scale) \
35 | .set_angle(20. if left else -20.) \
36 | .set_bottom(bar_y * C.scene.height)
37 | if left:
38 | lower_bar.set_right(1.01 * C.scene.width)
39 | else:
40 | lower_bar.set_left(-0.01 * C.scene.width)
41 | upper_bar = C.add('static bar', scale=bar_scale) \
42 | .set_angle(-20. if left else 20.) \
43 | .set_bottom((bar_y + bar_offset) * C.scene.height)
44 | if left:
45 | upper_bar.set_right(lower_bar.left)
46 | else:
47 | upper_bar.set_left(lower_bar.right)
48 |
49 | # Add ball.
50 | ball = C.add('dynamic ball', scale=0.1) \
51 | .set_bottom(0.9 * C.scene.height)
52 | if left:
53 | ball.set_center_x(upper_bar.left)
54 | else:
55 | ball.set_center_x(upper_bar.right)
56 |
57 | # Create assignment.
58 | C.update_task(body1=ball,
59 | body2=lower_bar,
60 | relationships=[C.SpatialRelationship.TOUCHING])
61 | C.set_meta(C.SolutionTier.PRE_TWO_BALLS)
62 |
--------------------------------------------------------------------------------
/agents/train_all_baseline.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright (c) Facebook, Inc. and its affiliates.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | set -e
17 | set -u
18 | set -p
19 |
20 | cd "$(dirname "$0")/.."
21 |
22 | readonly DEV_SEEDS=3
23 | readonly FINAL_SEEDS=10
24 | readonly DQN_BASE_NAME='dqn_10k'
25 | readonly EVAL_SETUPS='ball_cross_template ball_within_template
26 | two_balls_cross_template two_balls_within_template'
27 |
28 | readonly RUN_EXPERIMENT_SCRIPT=${RUN_EXPERIMENT_SCRIPT:-"agents/run_experiment.py"}
29 |
30 |
31 | wait_for_results() {
32 | local base_dir=$1
33 | local num_seeds=$2
34 | for eval_setup in $EVAL_SETUPS; do
35 | for seed in $(seq 0 $(( $num_seeds - 1 )) ); do
36 | local path="$base_dir/$eval_setup/$seed/results.json"
37 | while :; do
38 | if [ -f "$path" ]; then
39 | break
40 | else
41 | echo "Waiting for $path. Will sleep for 5min"
42 | sleep 5m
43 | fi
44 | done
45 | done
46 | done
47 | }
48 |
49 |
50 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 0 --arg-generator base_dqn --num-seeds $DEV_SEEDS
51 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 0 --arg-generator baselines_args_per_rank_size --num-seeds $DEV_SEEDS
52 | wait_for_results "results/dev/$DQN_BASE_NAME" $DEV_SEEDS
53 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 0 --arg-generator dqn_ablation --num-seeds $DEV_SEEDS
54 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 0 --arg-generator rank_and_online_sweep --num-seeds $DEV_SEEDS
55 |
56 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 1 --arg-generator base_dqn --num-seeds $FINAL_SEEDS
57 | wait_for_results "results/final/$DQN_BASE_NAME" $FINAL_SEEDS
58 | python $RUN_EXPERIMENT_SCRIPT --use-test-split 1 --arg-generator finals --num-seeds $FINAL_SEEDS
59 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00009.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Template task in which the agent should knock a bar off an obstacle."""
16 | import numpy as np
17 | import phyre.creator as creator_lib
18 |
19 | __OBSTACLE_XS = np.linspace(0, 1, 64)
20 | __OBSTACLE_WIDTHS = np.linspace(0.4, 0.6, 4)
21 | __BAR_SCALES = np.linspace(0.2, 0.3, 2)
22 | __PLATFORM_Y = np.linspace(0.2, 0.5, 5)
23 |
24 |
25 | @creator_lib.define_task_template(
26 | obstacle_width=__OBSTACLE_WIDTHS,
27 | obstacle_x=__OBSTACLE_XS,
28 | bar_scale=__BAR_SCALES,
29 | platform_y=__PLATFORM_Y,
30 | search_params=dict(
31 | required_flags=['BALL:GOOD_STABLE'],
32 | excluded_flags=['BALL:TRIVIAL'],
33 | diversify_tier='ball',
34 | max_search_tasks=1000,
35 | ),
36 | version='4',
37 | )
38 | def build_task(C, obstacle_width, obstacle_x, bar_scale, platform_y):
39 |
40 | # Add obstacle.
41 | if obstacle_x + obstacle_width > 1.:
42 | raise creator_lib.SkipTemplateParams
43 | obstacle = C.add('static bar', scale=obstacle_width) \
44 | .set_left(obstacle_x * C.scene.width) \
45 | .set_bottom(platform_y * C.scene.height)
46 |
47 | # Add vertical bar.
48 | bar = C.add('dynamic bar', scale=bar_scale) \
49 | .set_angle(90.) \
50 | .set_bottom(obstacle.top)
51 | if obstacle.left > C.scene.width - obstacle.right:
52 | bar.set_left(obstacle.left)
53 | else:
54 | bar.set_right(obstacle.right)
55 |
56 | bottom_wall = C.add('static bar', 1, bottom=0, left=0)
57 | top_wall = C.add('static bar', 1, bottom=bar.top + 0.2 * C.scene.height, left=0)
58 | # Create assignment:
59 | C.update_task(
60 | body1=bar,
61 | body2=bottom_wall,
62 | relationships=[C.SpatialRelationship.TOUCHING])
63 | C.set_meta(C.SolutionTier.BALL)
64 |
--------------------------------------------------------------------------------
/scripts/offline_simulation/compress_partial_simuations.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import joblib
16 |
17 | import phyre.loader
18 | import phyre.settings
19 | import phyre.simulation_cache
20 |
21 |
22 | def main_tier(tier, task_ids, num_actions):
23 | task_ids = sorted(task_ids)
24 |
25 | input_dir = (phyre.simulation_cache.get_partial_cache_folder(num_actions) /
26 | tier)
27 | output_dir = (phyre.simulation_cache.get_cache_folder(num_actions) / tier)
28 | output_dir.mkdir(exist_ok=True, parents=True)
29 | all_simulations = {}
30 | for task_id in task_ids:
31 | tpl = task_id.split(':')[0]
32 | sim_path = input_dir / tpl / f'{task_id}.gz'
33 | assert sim_path.exists(), sim_path
34 | all_simulations[task_id] = joblib.load(sim_path)
35 | actions = joblib.load(input_dir / phyre.simulation_cache.ACTION_FILE_NAME)
36 | cache = dict(statuses_per_task=all_simulations, actions=actions)
37 | joblib.dump(cache, output_dir / phyre.simulation_cache.CACHE_FILE_NAME)
38 |
39 |
40 | def main(num_actions):
41 | task_dict = phyre.loader.load_compiled_task_dict()
42 | task_ids_per_tier = {'ball': [], 'two_balls': []}
43 | for action_tier, task_tiers in phyre.simulation_cache.TIERS.items():
44 | for task_id, task in task_dict.items():
45 | if task.tier in task_tiers:
46 | task_ids_per_tier[action_tier].append(task_id)
47 |
48 | for tier, task_ids in task_ids_per_tier.items():
49 | main_tier(tier, task_ids, num_actions)
50 |
51 |
52 | if __name__ == '__main__':
53 | import argparse
54 | parser = argparse.ArgumentParser()
55 | parser.add_argument('--num-actions',
56 | type=int,
57 | default=phyre.simulation_cache.DEFAULT_NUM_ACTIONS)
58 | main(**vars(parser.parse_args()))
59 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00215.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Template task with a ball that must fall on the other side of a jar."""
16 | import phyre.creator as creator_lib
17 |
18 | __JAR_XS = [val * 0.1 for val in range(3, 7)]
19 | __JAR_SCALES = [val * 0.1 for val in range(2, 6)]
20 | __BALL_XS = [val * 0.1 for val in range(2, 8)]
21 | __BALL_YS = [val * 0.1 for val in range(5, 8)]
22 |
23 |
24 | @creator_lib.define_task_template(
25 | jar_x=__JAR_XS, jar_scale=__JAR_SCALES, ball_x=__BALL_XS, ball_y=__BALL_YS, version='2')
26 | def build_task(C, jar_x, jar_scale, ball_x, ball_y):
27 |
28 | # Add jar.
29 | jar = C.add('dynamic jar', scale=jar_scale) \
30 | .set_left(jar_x * C.scene.width) \
31 | .set_bottom(0.)
32 | if jar.left < 0. or jar.right > C.scene.width:
33 | raise creator_lib.SkipTemplateParams
34 |
35 | # Add ball that is not hovering over jar.
36 | ball = C.add('dynamic ball', scale=0.1) \
37 | .set_center_x(ball_x * C.scene.width) \
38 | .set_bottom(0.9 * C.scene.height)
39 |
40 | # Add a floor bar into two parts: target part and non-target part.
41 | if ball.left > jar.right: # ball is right of jar
42 | bottom_wall = C.add('static bar', 1.0, bottom=0, right=jar.left)
43 | C.add('static bar', 1.0, bottom=0, left=bottom_wall.right)
44 | elif ball.right < jar.left: # ball is left of jar
45 | bottom_wall = C.add('static bar', 1.0, bottom=0, left=jar.right)
46 | C.add('static bar', 1.0, bottom=0, right=bottom_wall.left)
47 | else:
48 | raise creator_lib.SkipTemplateParams
49 |
50 | jar.set_bottom(bottom_wall.top)
51 |
52 | # Create assignment.
53 | C.update_task(body1=ball,
54 | body2=bottom_wall,
55 | relationships=[C.SpatialRelationship.TOUCHING])
56 | C.set_meta(C.SolutionTier.PRE_TWO_BALLS)
57 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00200.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """
16 | Template task with a ball that must hit the left or right wall, and a
17 | horizontal bar that is preventing this from happening.
18 | """
19 | import phyre.creator as creator_lib
20 |
21 | __BALL_SIZE = 0.1
22 | __HOLE_SIZE = 0.2
23 | __HOLE_LEFT = [0.1 * val for val in range(3, 7)]
24 | __BAR_HEIGHT = [0.1 * val for val in range(5, 7)]
25 | __LEFT_WALL = [True, False]
26 |
27 |
28 | @creator_lib.define_task_template(
29 | hole_left=__HOLE_LEFT,
30 | bar_height=__BAR_HEIGHT,
31 | left_wall=__LEFT_WALL)
32 | def build_task(C, hole_left, bar_height, left_wall):
33 |
34 | # Compute right side of hole.
35 | hole_right = hole_left + __HOLE_SIZE
36 | if hole_right >= 1.0:
37 | raise creator_lib.SkipTemplateParams
38 |
39 | # Add ball.
40 | ball = C.add('dynamic ball', scale=__BALL_SIZE) \
41 | .set_center_x((hole_left if left_wall else hole_right) * C.scene.width) \
42 | .set_bottom(0.8 * C.scene.height)
43 |
44 | # Add horizontal bar with hole.
45 | C.add('static bar', scale=hole_left) \
46 | .set_left(0) \
47 | .set_bottom(bar_height * C.scene.height)
48 | C.add('static bar', scale=1.0 - hole_right) \
49 | .set_right(C.scene.width) \
50 | .set_bottom(bar_height * C.scene.height)
51 |
52 | # Add vertical bars that prevent "cheating".
53 | C.add('static bar', scale=1.0 - bar_height) \
54 | .set_angle(90.) \
55 | .set_left(0) \
56 | .set_bottom(bar_height * C.scene.height)
57 | C.add('static bar', scale=1.0 - bar_height) \
58 | .set_angle(90.) \
59 | .set_right(C.scene.width) \
60 | .set_bottom(bar_height * C.scene.height)
61 |
62 | C.update_task(
63 | body1=ball,
64 | body2=C.left_wall if left_wall else C.right_wall,
65 | relationships=[C.SpatialRelationship.TOUCHING])
66 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00328.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """
16 | Template task with a ball that must pass through a hole in the ground, and
17 | a second ball that is trying to prevent this from happening.
18 | """
19 | import numpy as np
20 | import phyre.creator as creator_lib
21 |
22 | __BALL_SIZE = 0.1
23 | __HOLE_SIZE = 0.1
24 |
25 |
26 | @creator_lib.define_task_template(
27 | hole_left=np.linspace(0.2, 0.8, 10),
28 | bar_height=np.linspace(0.2, 0.8, 10),
29 | confounder=[True, False],
30 | version='3',
31 | )
32 | def build_task(C, hole_left, bar_height, confounder):
33 |
34 | # Compute right side of hole.
35 | hole_right = hole_left + __HOLE_SIZE
36 | if hole_right >= 1.0:
37 | raise creator_lib.SkipTemplateParams
38 |
39 | # Add balls.
40 | ball1 = C.add('dynamic ball', scale=__BALL_SIZE) \
41 | .set_center_x(0.5 * C.scene.width) \
42 | .set_bottom(0.8 * C.scene.height)
43 | ball2 = C.add('dynamic ball', scale=__BALL_SIZE) \
44 | .set_center_x((hole_left if confounder else hole_right) * C.scene.width) \
45 | .set_bottom(0.7 * C.scene.height)
46 |
47 | # Add bars with hole.
48 | bar = C.add('static bar', scale=hole_left) \
49 | .set_left(0) \
50 | .set_bottom(bar_height * C.scene.height)
51 | C.add('static bar', scale=1.0 - hole_right) \
52 | .set_right(C.scene.width) \
53 | .set_bottom(bar_height * C.scene.height)
54 |
55 | if ball1.top >= bar.top and ball1.bottom <= bar.bottom:
56 | raise creator_lib.SkipTemplateParams
57 | if ball2.top >= bar.top and ball2.bottom <= bar.bottom:
58 | raise creator_lib.SkipTemplateParams
59 |
60 | # Create task.
61 | C.update_task(
62 | body1=ball1,
63 | body2=ball2,
64 | relationships=[C.SpatialRelationship.TOUCHING])
65 | C.set_meta(C.SolutionTier.PRE_BALL)
66 |
--------------------------------------------------------------------------------
/data/task_scripts/main/task00900.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Unfinished single-ball task."""
16 | import phyre.creator as creator_lib
17 |
18 |
19 | @creator_lib.define_task
20 | def build_task(C):
21 |
22 | # Create catapults with balls.
23 | ball1, line1 = _make_catapult(C, 0.5, 0.1)
24 |
25 | C.add(
26 | 'static bar',
27 | scale=0.4,
28 | angle=90,
29 | bottom=line1.top,
30 | right=line1.center_x + 10)
31 | C.add(
32 | 'dynamic ball', scale=0.1, bottom=line1.top, right=line1.center_x + 40)
33 | C.add('static bar', scale=0.4, angle=90, bottom=line1.top, left=line1.right)
34 | C.add('static bar', scale=0.9, bottom=0, right=C.scene.width)
35 |
36 | C.add('static bar', scale=0.3, angle=90, bottom=0, right=line1.left)
37 |
38 | #ball2 = C.add('static ball', left=b2.right, top=b2.top - 120, scale=0.05)
39 | # Create assignment.
40 | C.update_task(
41 | body1=ball1,
42 | body2=C.bottom_wall,
43 | relationships=[C.SpatialRelationship.TOUCHING])
44 |
45 |
46 | def _make_catapult(C, x, y):
47 | """Builds a catapult."""
48 |
49 | # Base of the catapult.
50 |
51 | base = C.add('static standingsticks ', scale=0.1) \
52 | .set_bottom(y * C.scene.height) \
53 | .set_center_x(x * C.scene.width)
54 |
55 | # Hinge and top line.
56 | bar_center_x = base.left + (base.right - base.left) / 2.
57 | ball = C.add('static ball', scale=0.05) \
58 | .set_bottom(base.top) \
59 | .set_center_x(bar_center_x)
60 | line = C.add_box(height=3, width=120) \
61 | .set_center_x(bar_center_x) \
62 | .set_bottom(ball.top)
63 |
64 | # Ball that needs to move.
65 | top_ball = C.add('dynamic ball', scale=0.04) \
66 | .set_bottom(line.top)
67 | top_ball.set_left(line.left)
68 | return top_ball, line
69 |
--------------------------------------------------------------------------------
/agents/OGRE.md:
--------------------------------------------------------------------------------
1 | # OGRE dataset
2 |
3 | Contains code to reproduce agent baselines from OGRE dataset. See the [paper](https://github.com/orlrworkshop/orlrworkshop.github.io/raw/master/pdf/ORLR_9.pdf) for details.
4 |
5 | ## Abstract
6 |
7 | If an agent understands how to reason about some objects, can it generalize this understanding to new objects that it has never seen before?
8 | We propose the **Object-based Generalization for Reasoning Environment (OGRE)** for testing object generalization in the context of *creative reasoning* and *efficient acting*.
9 |
10 | OGRE emphasizes evaluating agents by how efficiently they solve novel creative reasoning tasks, not just how well they can predict the future.
11 | OGRE provides two levels of generalization: generalization over reasoning strategies with familiar objects, and generalization over new object types that still share similar material properties to those in training.
12 |
13 |
14 | 
15 |
16 |
17 |
18 | A Top: an example of a level within the training set of OGRE. Black and purple objects are static; objects with any other color are dynamic and subject to gravity. Actions are single balls at a position (`x`, `y`) with radius `r`, depicted as a red ball which falls under gravity once placed. Agents can observe the outcomes of these actions for a large set of training levels. Bottom: other example levels that might be included in training.
19 |
20 | B: cross-template testing includes levels that use the same object representations, but require different kinds of strategies to succeed.
21 |
22 | C: cross-dataset testing includes a set of levels from the Virtual Tools environment, which represents both goals and object shapes differently.
23 |
24 |
25 |
26 | ## Explore the tasks
27 |
28 | You can explore all the task in the [PHYRE player](https://player.phyre.ai/)
29 |
30 | ## Agents
31 |
32 | Cross-dataset generalization is implemented as a generaralization tier in PHYRE framework referred to as `ball_phyre_to_tool`. Please see the [API documentaion](https://phyre.ai/docs/evaluator.html) for more details.
33 |
34 | We provide code that runs the baselines from PHYRE dataset and also newly added Object-Oriented Random Agent on cross-template and cross-dataset settings.
35 | To launch all evals download pre-trained checkpoints with `bash download_dqn_ckps.sh` and run `python agents/run_experiments_ogre.py`.
36 | See PHYRE's [README](README.md) for details of DQN training.
37 |
--------------------------------------------------------------------------------