Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
perceptualrobots committed Aug 8, 2024
1 parent 8ab163e commit 2a6cfca
Show file tree
Hide file tree
Showing 9 changed files with 363 additions and 64 deletions.
74 changes: 65 additions & 9 deletions nbs/01_putils.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
"# warnings.filterwarnings(\"error\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SingletonObjects"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -83,6 +90,13 @@
" self.objects[key]=value\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# UniqueNamer\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -149,6 +163,13 @@
" print(\"*** \", name, namespace_list[name])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# FunctionsList"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -270,6 +291,13 @@
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Memory"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -310,6 +338,13 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NumberStats"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -502,6 +537,13 @@
"print(var)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Counter"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -877,6 +919,13 @@
" return rtn\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# get_abs_tol"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -886,14 +935,21 @@
"#| export\n",
"def get_abs_tol(key):\n",
" # dic = {'evolve': 0.01, 'ARC-evolve' : 0.01, 'ARC-display': 0.01, 'ARC': 0.01}\n",
" dic = { 'ARC-evolve' : 0.01, 'ARC-display': 0.1, 'ARC-change' : 0.01, 'ARC-zero': 0.01}\n",
" dic = { 'ARC-evolve' : 0.01, 'ARC-display': 0.1, 'ARC-change' : 0.01, 'ARC-zero': 0.01, 'ARC-gradient': 0.005}\n",
"\n",
" # if key in dic:\n",
" return dic[key]\n",
" \n",
" # return 0.001"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# get_rel_tol"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1081,6 +1137,13 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PCTRunProperties "
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1163,7 +1226,7 @@
" drive=filepath[0:index2+index1+1]\n",
"\n",
" return drive, property_dir, file\n",
" \n"
" "
]
},
{
Expand Down Expand Up @@ -1198,13 +1261,6 @@
"#| hide\n",
"import nbdev; nbdev.nbdev_export()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 6 additions & 2 deletions nbs/04_hierarchy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,12 @@
" return output\n",
" \n",
"\n",
" def is_environment_terminated(self):\n",
" return self.get_environment().is_environment_terminated()\n",
" def is_fitness_close_to_zero(self):\n",
" return self.get_environment().is_fitness_close_to_zero()\n",
"\n",
"\n",
" # def is_environment_terminated(self):\n",
" # return self.get_environment().is_environment_terminated()\n",
"\n",
" def set_name(self, name):\n",
" self.name=name \n",
Expand Down
22 changes: 19 additions & 3 deletions nbs/05_environments.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@
" \n",
" return out \n",
" \n",
" def is_environment_terminated(self):\n",
" # def is_environment_terminated(self):\n",
" # return False\n",
" \n",
" def is_fitness_close_to_zero(self):\n",
" return False\n",
" \n",
" def get_parameters_list(self):\n",
Expand Down Expand Up @@ -1642,7 +1645,16 @@
" self.done = self.env_done\n",
" else:\n",
" self.done, details = ListChecker.check_list_unchanged(self.boxcar, rel_tol =get_rel_tol('ARC-change'), abs_tol=get_abs_tol('ARC-change'))\n",
" self.env.fitness_isclose_to_zero = ListChecker.check_float_list_close_to_zero(self.boxcar, rel_tol = 0, abs_tol=get_abs_tol('ARC-zero'))\n",
" # self.env.fitness_isclose_to_zero = ListChecker.check_float_list_close_to_zero(self.boxcar, rel_tol = 0, abs_tol=get_abs_tol('ARC-zero'), gradient_abs_tol=get_abs_tol('ARC-gradient'))\n",
" self.env.fitness_isclose_to_zero = self.is_fitness_close_to_zero()\n",
"\n",
"\n",
" # self.env.fitness_isclose_to_zero, gradient_mean, gradient = ListChecker.check_float_list_close_to_zero(self.boxcar, rel_tol = 0, abs_tol=get_abs_tol('ARC-zero'))\n",
" # if self.boxcar[0]<0.01 and self.boxcar[9]<0.01:\n",
" # print('fitness_isclose_to_zero', self.env.fitness_isclose_to_zero)\n",
" # print(self.boxcar)\n",
" # print('---> ', gradient_mean, gradient)\n",
"\n",
" if self.done:\n",
" if self.env.fitness_isclose_to_zero:\n",
" pass\n",
Expand All @@ -1652,6 +1664,10 @@
" # print('done', self.boxcar)\n",
" pass\n",
"\n",
" def is_fitness_close_to_zero(self):\n",
" return ListChecker.check_float_list_close_to_zero(self.boxcar, rel_tol = 0, abs_tol=get_abs_tol('ARC-zero'), gradient_abs_tol=get_abs_tol('ARC-gradient'))\n",
"\n",
"\n",
" def get_fitness_list(self):\n",
" return self.env.fitness_list\n",
"\n",
Expand Down Expand Up @@ -1715,7 +1731,7 @@
"{'type': 'ARC', 'name': 'ARC', 'value': [9], 'links': {0: 'constant'}, 'env_name': 'ARC'}\n",
"\n",
"1.000 \n",
"9.000 0 False {'num_actions': 1, 'grid_shape': 'equal', 'dims': 1}\n",
"9.000 0 True {'num_actions': 1, 'grid_shape': 'equal', 'dims': 1}\n",
"\n",
"[9]\n"
]
Expand Down
Loading

0 comments on commit 2a6cfca

Please sign in to comment.