Skip to content

Commit

Permalink
Add some agents and adjust the dl page generator
Browse files Browse the repository at this point in the history
See #28.
  • Loading branch information
garfieldnate committed Jun 30, 2024
1 parent eb9d54b commit 83e51cf
Show file tree
Hide file tree
Showing 7 changed files with 299 additions and 7 deletions.
53 changes: 53 additions & 0 deletions docs/downloads/agents/8-puzzle.md
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions docs/downloads/agents/algebra_solver.md
Original file line number Diff line number Diff line change
@@ -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
94 changes: 94 additions & 0 deletions docs/downloads/agents/arithmetic.md
Original file line number Diff line number Diff line change
@@ -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
76 changes: 76 additions & 0 deletions docs/downloads/agents/arithmetic_(with_semantic_memory).md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions docs/downloads/agents/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ include all of the type of information we include on each download page) to
[John Laird](mailto:[email protected]) 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)
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 23 additions & 7 deletions scripts/new_download_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,54 @@
## Environment Properties
* TODO
* TODO (not for agents)
## External Environment
None TODO (agents only)
## Soar Capabilities
TODO
## Download Links
* [TODO: name](TODO: link)
## Associated Agents
TODO (not for agents)
None TODO (not for agents)
## Default Rules
None TODO (agents only)
## Documentation
TODO
## Associated Publications
None
* TODO
## Developers
* TODO
John Laird TODO
## Soar Versions
* TODO
TODO
* Soar 8
* Soar 9
## Language
TODO (not for agents)
## Project Type
TODO (agents only)
VisualSoar TODO (agents only)
"""
)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 83e51cf

Please sign in to comment.