Skip to content

Commit

Permalink
Merge pull request #2 from StarGazingHomies/optimizer
Browse files Browse the repository at this point in the history
Merge pull request #2: Optimizers and CLI arguments
  • Loading branch information
StarGazingHomies authored Apr 21, 2024
2 parents 157f09f + cb285a2 commit d9057b5
Show file tree
Hide file tree
Showing 15 changed files with 1,526 additions and 747 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ misc/*
*.pyc
*.txt
*.json
*.db

# Spreadsheet wee
3 letter spreadsheet/*
Expand Down
47 changes: 35 additions & 12 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# Changelog
This document details the changes I made,
and how they impact the performance of the program.

TODO:
- Better configuration (CLI arguments)
- Tokenizers & analysis (w/ transformers and a llama-like model, such as minillama)
- Hybrid Step-Generation Preprocessing
- N-Step-Lookahead Generational Algorithm for savefiles?
Maybe even alpha-beta pruning?

All benchmarks are ran on a personal system with the following specs:
i9-13950HX,
128GB RAM

Note that power settings and the like can change between versions, so results
are not comparable between them.
## Version 1.5.1

TODO:
- Saving current progress, and resuming from the last point to avoid heavy precompute
- Better configuration (CLI arguments or config file)
- Added command line arguments for `optimize.py`.
- Added command line arguments for `speedrun.py`.
- Added command line arguments for `main.py`.

Future TODO:
- Speedrun auto-optimization (minimum spanning hypergraph)
## Version 1.5

Added optimizers for speedrunning paths and finding optimal paths in savefiles!

- Separated the `pair_to_int` and `int_to_pair` functions
along with static variables such as `DEFAULT_STARTING_ITEMS`
and `WORD_COMBINE_CHAR_LIMIT`into `util.py`.
- Added a `OptimizerRecipeList` class for a common interface
between all of the optimizers that will be implemented.
- Added an A* algorithm `optimizers/a_star.py` starting from the result
element with a generation-based admissible heuristic. (Source: BRH0208)
- Added a simple generational algorithm `optimizers/simple_generational.py`
starting from the result element with a generation-based heuristic,
made for fast analysis of savefiles. Used on yui's site (Infinite Craft Browser).

## Version 1.4

Expand Down Expand Up @@ -73,6 +84,18 @@ Do note that the parity of depth has some impact on the number of states.
8 6566 19.3702 3844983 3.871 209607
9 17045 163.8879 31438265 21.261 1191681

NEW
DEPTH | SIZE | TIME | STATES |
1 10 0.030 10
2 29 0.031 29
3 81 0.036 113
4 211 0.045 414
5 486 0.095 1642
6 1114 0.229 7822
7 2682 0.812 39284
8 6566 3.871 209607
9 17045 21.261 1191681


## Version 1.2.2

Expand Down
29 changes: 12 additions & 17 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,21 @@ Every time a new depth is completed, I will publish the recipes as a release.

## Usage

TODO: Make this more usable!
Requires python 3.11-3.12.

Requires Python 3.9~3.11 (I'm not that familiar with Python versions, but
there's a few different versions installed on each machine I've run this on)

Run `main.py` to search.

To edit any settings, edit `init_state` for your starting state if you
have an existing recipe, and `recipe.py` for how recipes are handled.

If you want to make sure your speedrun route has missing elements,
repeats, or unused elements, run `speedrun.txt`. It must be in the format
of `x + y -> z` every line, except comment lines that start with `#`.
Install the required packages with:
```commandline
pip install -r requirements.txt
```

There are two types of checks in `speedrun.txt`: static check makes sure
that your speedrun route makes sense (no duplicates, no missing elements, no
unused elements) while dynamic check makes requests to Neal's API to make sure
that your speedrun route has correct crafts.
To run the script, simply run:
```commandline
python main.py
```

Currently, the script does not accept CLI arguments.
`speedrun.py` can help you check your speedrun recipes for errors.
`optimize.py` can help you optimize your speedruns.
Use `-h` for help with any CLI arguments.

## Methodology

Expand Down
Loading

0 comments on commit d9057b5

Please sign in to comment.