From 83e51cf7585ee863658760d18eb9be01e8c31017 Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Sat, 29 Jun 2024 22:40:14 -0500 Subject: [PATCH] Add some agents and adjust the dl page generator See #28. --- docs/downloads/agents/8-puzzle.md | 53 +++++++++++ docs/downloads/agents/algebra_solver.md | 45 +++++++++ docs/downloads/agents/arithmetic.md | 94 +++++++++++++++++++ .../arithmetic_(with_semantic_memory).md | 76 +++++++++++++++ docs/downloads/agents/index.md | 4 + mkdocs.yml | 4 + scripts/new_download_page.py | 30 ++++-- 7 files changed, 299 insertions(+), 7 deletions(-) create mode 100644 docs/downloads/agents/8-puzzle.md create mode 100644 docs/downloads/agents/algebra_solver.md create mode 100644 docs/downloads/agents/arithmetic.md create mode 100644 docs/downloads/agents/arithmetic_(with_semantic_memory).md diff --git a/docs/downloads/agents/8-puzzle.md b/docs/downloads/agents/8-puzzle.md new file mode 100644 index 00000000..e12ca26b --- /dev/null +++ b/docs/downloads/agents/8-puzzle.md @@ -0,0 +1,53 @@ +--- +Tags: + - chunking + - look-ahead search +--- + +# 8-Puzzle + +This agent is a straightforward implementation of an eight-puzzle. It uses +look-ahead search to solve the puzzle with a simple evaluation function. +This agent also demonstrates chunking. + +The puzzle consists of eight sliding tiles, numbered by digits from 1 to 8 +arranged in a 3 by 3 array of nine cells. One of the cells is always +empty, and any adjacent tile can be moved into the empty cell. The initial +state is some arbitrary arrangement of the tiles. The goal state is the +arrangement of tiles such that they are ordered from lowest to highest +value. The problem is to find a sequence of moves from the initial state +to the goal state. + +## External Environment + +None + +## Soar Capabilities + +* Look-ahead subgoaling +* Chunking + +## Download Links + +* [Eight_Puzzle_Agent.zip](https://github.com/SoarGroup/website-downloads/raw/main/Agents/Eight_Puzzle_Agent.zip) + +## Default Rules + +* selection.soar + +## Associated Publications + +None + +## Developer + +John Laird + +## Soar Versions + +* Soar 8 +* Soar 9 + +## Project Type + +VisualSoar diff --git a/docs/downloads/agents/algebra_solver.md b/docs/downloads/agents/algebra_solver.md new file mode 100644 index 00000000..dbcc10f0 --- /dev/null +++ b/docs/downloads/agents/algebra_solver.md @@ -0,0 +1,45 @@ +--- +Tags: + - chunking + - hierarchical task decomposition +--- + +# Algebra Solver + +This is an agent that can solve simple algebra problems with one variable. +It parses raw text input from Soar Text I/O into a tree structure, solves +the problem in that representation and then prints out the answer. + +## External Environment + +[Soar TextIO](https://web.archive.org/web/20210921225802/https://code.google.com/p/soar/wiki/Domains_SoarTextIO) + +## Soar Capabilities + +* Hierarchical task decomposition +* Chunking + +## Download Links + +* [Algebra_Agent.zip](https://github.com/SoarGroup/website-downloads/raw/main/Agents/Algebra_Agent.zip) + +## Default Rules + +None + +## Associated Publications + +None + +## Developer + +John Laird + +## Soar Versions + +* Soar 8 +* Soar 9 + +## Project Type + +VisualSoar diff --git a/docs/downloads/agents/arithmetic.md b/docs/downloads/agents/arithmetic.md new file mode 100644 index 00000000..62494af9 --- /dev/null +++ b/docs/downloads/agents/arithmetic.md @@ -0,0 +1,94 @@ +--- +Tags: + - chunking + - hierarchical task decomposition +--- + +# Arithmetic + +An agent that performs multi-column addition and subtraction with +borrowing and carrying, all the way down to counting. No math functions +are used. + +This program supports arithmetic ands subtraction between two multi-digit +numbers. It formulates the problem in multiple columns. It does not use +any math functions. As currently formulated, it uses a table of all single +digit addition facts (for addition and one subtraction strategy) and +tables of simple subtraction facts and addition by ten to single digits +(for a second subtraction strategy). These facts can be converted to a +semantic memory access (in the application of compute-result). + +Each primitive operator is relatively simple: without complex proposal +conditions, control rules, lots of control flags or complex conditional +operator applications. The actual execution trace is sometimes a bit +tricky, especially for subtraction. + +The project supports the automatic generation of random 3 column addition +and subtraction problems which are created in generate-problem. The +project will execute N of these (set as the value of `^count` in `initialize-arithmetic`). + +The project checks that all answers are computed correctly by using Soar's +math functions (computed in elaborations/Verify and finish-problem) if an +incorrect answer is computed, it is printed out and Soar halts + +The two subtraction strategies differ in what initial facts they assume. +One of the subtraction strategies assumes the same knowledge as addition +(the sum of two single digit numbers and the resulting carry), but +involves remapping that knowledge so that it is appropriate for +subtraction. For example it knows that if 7 is subtracted from 6 that the +answer is 9 and there must be a borrow from the column to the left. + +The second subtraction strategy assumes that the system knows how to +subtract any single digit (0-9) from the numbers 0-18, and that it has +facts to add ten to any single digit (0-9). + +The actual trace of a strategy arises from the available operator +applications and impasses that arise. For example, in the second strategy, +if a larger number is being subtracted from a smaller number, there is an +operator no-change impasse because no fact is available for that +situation. This is the standard american approach to subtraction. The key +rules for this are in process-column/compute-result.soar + +The only differences between the two strategies are the available facts +and a single rule in process-column that applies the process-column +operator by accessing the facts +(`process-column*apply*compute-result*subtraction`). There are rules that +only are used by the second strategy (in the compute-result substate), but +there is no explicit control to invoke them and they do not have to be +disabled during addition or the other subtraction strategy. + +Works with chunking (`learn --on`). + +## External Environment + +None + +## Soar Capabilities + +* Hierarchical task decomposition +* Chunking +* Doing math with just symbol manipulation + +## Download Links + +* [Arithmetic_Agent.zip](https://github.com/SoarGroup/website-downloads/raw/main/Agents/Arithmetic_Agent.zip) + +## Default Rules + +None + +## Associated Publications + +None + +## Developers + +John Laird + +## Soar Versions + +* Soar 9.2+ + +## Project Type + +VisualSoar diff --git a/docs/downloads/agents/arithmetic_(with_semantic_memory).md b/docs/downloads/agents/arithmetic_(with_semantic_memory).md new file mode 100644 index 00000000..434b9ee4 --- /dev/null +++ b/docs/downloads/agents/arithmetic_(with_semantic_memory).md @@ -0,0 +1,76 @@ +--- +Tags: + - chunking + - hierarchical task decomposition + - semantic memory +--- + +# Arithmetic (with Semantic Memory) + +This agent demonstrates the use of semantic memory by extending the +capabilities of the [Arithmetic Agent](./arithmetic.md). The description +of that agent also applies here. + +This agent supports using semantic memory through in three different ways +controlled by parameters set in initialize-arithmetic. + +1. If the semantic or working memory is pre-loaded with problems, it will +use those problems. If not it will generate problems at random. + + * problems-5000.soar and problems-10000.soar contain the rules to + generate the working memory problems. + * problems-5000-smem.soar contains the structure to initialize semantic memory. + * Controlled by loading one of those files at run time and setting + ^parameters.problems-source [wm smem] + +1. Control whether arithmetic facts are computed/stored in working memory +or semantic memory. If in semantic memory, will dynamically generated +using counting (process-column/compute-result/add-via-counting) + + * Controlled by parameters.fact-source [wm smem] + * To experiment with impact of semantic memory, can control whether + facts are stored in semantic memory (or will always be counted) via + parameters.store [yes no] and whether they are attempted to be retrieved + parameters.retrieve [yes no] + * Number of problems attempted is set by count, which is usually 5000 or 10000. + +*Note*: This agent does not currently work with Soar 9.6.0+ due to changes +in the semantic memory model. + +## External Environment + +None + +## Soar Capabilities + +* Semantic Memory +* Hierarchical task decomposition +* Chunking + +## Download Links + +* [Arithmetic-SMem_Agent.zip](https://github.com/SoarGroup/website-downloads/raw/main/Agents/Arithmetic-SMem_Agent.zip) + +## Associated Agents + +None TODO (not for agents) + +## Default Rules + +None + +## Associated Publications + +None + +## Developers + +John Laird + +## Soar Versions + +* Soar 9.2 - 9.4.0 + +## Project Type + +VisualSoar diff --git a/docs/downloads/agents/index.md b/docs/downloads/agents/index.md index 6aba9fd1..69ce2449 100644 --- a/docs/downloads/agents/index.md +++ b/docs/downloads/agents/index.md @@ -14,3 +14,7 @@ include all of the type of information we include on each download page) to [John Laird](mailto:laird@umich.edu) with the subject "Soar Agent Submission". * [15-Puzzle Agent](./15-puzzle.md) +* [8-Puzzle](./8-puzzle.md) +* [Algebra Solver](./algebra_solver.md) +* [Arithmetic](./arithmetic.md) +* [Arithmetic (with Semantic Memory)](./arithmetic_(with_semantic_memory).md) diff --git a/mkdocs.yml b/mkdocs.yml index c326967c..640bfbf0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -99,6 +99,10 @@ nav: - Agents: - downloads/agents/index.md - 15-Puzzle: downloads/agents/15-puzzle.md + - 8-Puzzle: downloads/agents/8-puzzle.md + - Algebra Solver: downloads/agents/algebra_solver.md + - Arithmetic: downloads/agents/arithmetic.md + - Arithmetic (with Semantic Memory): downloads/agents/arithmetic_(with_semantic_memory).md - Domains: - downloads/domains/index.md - Dice: downloads/domains/dice.md diff --git a/scripts/new_download_page.py b/scripts/new_download_page.py index a0f3fe3f..79b7a08c 100644 --- a/scripts/new_download_page.py +++ b/scripts/new_download_page.py @@ -26,7 +26,15 @@ ## Environment Properties -* TODO +* TODO (not for agents) + +## External Environment + +None TODO (agents only) + +## Soar Capabilities + +TODO ## Download Links @@ -34,7 +42,11 @@ ## Associated Agents -TODO (not for agents) +None TODO (not for agents) + +## Default Rules + +None TODO (agents only) ## Documentation @@ -42,15 +54,18 @@ ## Associated Publications +None * TODO ## Developers -* TODO +John Laird TODO ## Soar Versions -* TODO +TODO +* Soar 8 +* Soar 9 ## Language @@ -58,7 +73,7 @@ ## Project Type -TODO (agents only) +VisualSoar TODO (agents only) """ ) @@ -99,10 +114,11 @@ def main(parent: str, title: str): line_to_insert = f"{' ' * num_leading_spaces}- {title}: downloads/{parent}/{new_file_name}\n" line_inserted = False for i in range(index_line + 1, len(lines)): - if len(lines[i]) - len(lines[i].lstrip()) <= num_leading_spaces: - lines.insert(i + 1, line_to_insert) + if len(lines[i]) - len(lines[i].lstrip()) < num_leading_spaces: + lines.insert(i, line_to_insert) line_inserted = True break + # if we didn't insert the line, then we must have reached the end of the file. Insert there. if not line_inserted: lines.append(line_to_insert)