408 Commits

Author SHA1 Message Date
Nic McPhee
9028a8e174 "Simplify" the testing for concat and subvec
This introduces some fancy macro action that allows us to skip the four calls to `(concat-spec …)` with the different generators and types.

@ErikRauer and I wrestled with this for a _long_ time today, and it turned out that it was absolutely necessary to quote the generators in `gen-type-pairs on lines 10-13. I'm not 100% sure why, but it seems that without that something (perhaps a level of macro-ness) got unwrapped too early and then it couldn't find the generator because it had lost the namespace it belonged in.

Whether this actually _simplifies_ things is really up for debate. If this is as far as we get, it's probably not worth it. If we can find a reasonable way to reduce the other sources of duplication, however, it might be worth it?
2020-12-21 16:59:04 -06:00
Nic McPhee
bd59045767 Add tests for vector/_concat
This adds tests for `vector/_concat`.
2020-12-21 16:40:22 -06:00
Nic McPhee
75de8e5be5 Comment out the boilerplate test in core-test
We should remove that, and maybe the whole file, but for now I'll just comment it out.
2020-12-21 16:39:48 -06:00
Nic McPhee
91df21dba5 Fix error in vector/_last
Similar to `vector/_first`, this didn't check for the empty vector case, so I've changed it to return `:ignore-instruction` in that case.

There's a lot of duplication between `_first` and `_last`, which makes me think there's some refactoring opportunities.
2020-12-18 17:03:56 -06:00
Nic McPhee
ab1f6d4396 Add tests for vector/_last
This adds test.check tests for `vector/_last`. This is _really_ similar to `vector/_first` (and the other vector tests), so I think there are definitely ways to extract common logic from these.
2020-12-18 17:02:18 -06:00
Nic McPhee
66ec0a1ebd Address the possibility of vectors being empty in vector/_first
The original version just used the built-in `first`, which returns `nil` if you give it an empty collection, which is almost certainly not a useful behavior.

This changes it to return `:ignore-instruction` if the vector is empty, thereby leaving all the stacks unchanged.
2020-12-17 18:45:06 -06:00
Nic McPhee
f2eecc774f Add tests for vector/_first
These turned up an oversight in the implementation in `vector/_first` that is addressed in the next commit.
2020-12-17 18:42:57 -06:00
Erik Rauer
b3d9d89f4c Allow instructions to indicate they should be ignored
`make-instruction` will ignore any instructions that return `:ignore-instruction`. This allows instructions to be skipped without consuming their arguments.
2020-12-17 18:32:41 -06:00
Nic McPhee
fc26886815 Fix bugs in vector/_subvec
There were two independent bugs in `vector/_subvec` that were turned up by our `test.check` testing.

The first was that the order of the arguments was wrong and `stop-raw` and `start-raw` were flipped.

The second was that `stop` wasn't max'ed with 0, which meant it could sometimes be negative, leading to an `IndexOutOfBoundsException`.
2020-12-17 15:58:11 -06:00
Nic McPhee
d1e863a23a Start test.check tests on vector instructions
This is a start on using `test.check` to write tests for the vector instructions. We currently have tests for:

   * `vector/_emptyvector`
   * `vector/_indexof`
   * `vector/_subvec`

There are _lots_ of other functions still to be tested.

This did reveal errors in `vector/_subvec`, which will be addressed in the next commit.

We used macros to make it easy to generate tests for each of the four vector types; this should be extensible to additional vector types in the future if needed.
2020-12-17 15:56:27 -06:00
Nic McPhee
a6e195eb0e Add data and .calva to .gitignore
We don't want to be committing the data files or the Calva files generated by running Clojure in VS Code. This fixes that.
2020-12-17 08:15:40 -06:00
Lee Spector
8cd1a79da3 Pass argmap to report 2020-12-09 10:50:49 -05:00
Lee Spector
2f4adfde7a Pass argmap to report 2020-12-09 10:49:53 -05:00
Lee Spector
b68cf4ad75 Pass argmap to plushy->post in report 2020-12-09 10:46:02 -05:00
Lee Spector
40ac1c73a4 Add uniform-replacement 2020-12-09 10:44:57 -05:00
Lee Spector
0af6aa095e Add uniform-replacement; pass argmap to plushy->push in report 2020-12-09 10:42:05 -05:00
Lee Spector
0a5a655181 Make genetic operator dispatch more modular and extensible 2020-12-08 22:59:44 -05:00
Lee Spector
180a7fdbe0 Provide more modular and and extensible approach to genetic operator dispatch 2020-12-08 22:53:37 -05:00
Lee Spector
09d5455da3 Remove extraneous argmap argument 2020-12-08 12:21:40 -05:00
Lee Spector
aed8eb8a76 Fix handling of boolean input values 2020-12-08 12:20:26 -05:00
Lee Spector
d49f9e4bf0 Remove extraneous argmap argument; experiment with valiant 2020-12-08 12:12:23 -05:00
Lee Spector
bb916c2ad3 Fix handling of false boolean input values; continue development of valiant problem 2020-12-07 20:19:59 -05:00
Lee Spector
14f63f880b Fix comment and error message in handle-input-instruction; begin developing valiant problem 2020-12-07 13:58:34 -05:00
Lee Spector
7a16770cb9
Merge pull request #9 from NicMcPhee/command-line-problem-specification
Support command-line problem specification
2020-12-04 18:49:20 -05:00
Lee Spector
7ecc32f13e Merge branch 'master' of https://github.com/lspector/propeller 2020-12-04 18:40:34 -05:00
Lee Spector
14e6cfcd08 Reformat 2020-11-29 22:29:31 -05:00
Lee Spector
d309869919 Comment out shutdown-agents since agents not currently used and this messes up REPL sessions 2020-11-29 22:16:29 -05:00
Lee Spector
4783d6695a Fix string-classification problem by adding train-and-test-data and fixing wrong instruction name 2020-11-29 22:09:36 -05:00
Lee Spector
0c6ebde41b Fix :flip that should be :diploid-flip 2020-11-29 21:43:00 -05:00
Lee Spector
81f2c3197f Distinguish flip rate from flip probability 2020-11-29 21:32:42 -05:00
Nic McPhee
e05290d87c Support command-line problem specification
This change uses the first command-line argument as the problem, which is assumed to be a namespace under `propeller.problems`. This will load the `instructions` and `error-function` from that namespace. If no problem is specified, then a (hopefully) helpful error is generated and the programs exits.

This allows us to call Propeller with calls such as:

```
   lein run software.smallest
```
2020-11-24 16:42:22 -06:00
Lee Spector
f2e4cf0e1e
Merge pull request #8 from NicMcPhee/limit-dup-times
Limit stack size when using `_dup_times` and `_dup_items`
2020-11-24 17:24:32 -05:00
Nic McPhee
da84852245 Move max-stack-items to globals
This creates a `push/utils/globals/cljc` similar to that created by @mcgirjau and moved the `max-stack-items` def to that namespace, updating `polymorphic` as necessary.
2020-11-24 16:00:03 -06:00
Nic McPhee
f675f69276 Merge branch 'master' into limit-dup-times 2020-11-24 15:53:36 -06:00
Nic McPhee
0ca5e77d7a Merge remote-tracking branch 'upstream/master' 2020-11-24 15:19:29 -06:00
Lee Spector
35ac379f06 Add more examples to session.clj 2020-11-24 16:09:44 -05:00
Lee Spector
628329e6bf Resolve merge conflict 2020-11-23 21:28:51 -05:00
Lee Spector
a8e9de97ce Fix peek-stack for false on boolean stack 2020-11-23 09:57:04 -05:00
Lee Spector
3ba030ceec Add train/test data support to simple-regression problem 2020-11-23 09:51:19 -05:00
Lee Spector
509c22b79c Fix naming clash in new-individual 2020-11-23 07:49:40 -05:00
Lee Spector
f8bdacc388 Remove debugging printing; update session.clj 2020-11-22 23:35:07 -05:00
Lee Spector
28da548e4c Undo wrong fix for exec_if; fix peek-stack for false on boolean stack 2020-11-22 23:28:02 -05:00
Lee Spector
0482ccccf5 Correct order of clauses for exec_if 2020-11-22 22:05:42 -05:00
Lee Spector
97de757f57 Begin bringing session.clj up to date 2020-11-22 21:57:29 -05:00
Lee Spector
b6a9a410c1 Call diploid-flip when appropriate; make new-individual robust to missing rates 2020-11-22 21:40:57 -05:00
Lee Spector
224d33c19d Add diploid-flip genetic operator 2020-11-22 21:32:49 -05:00
Lee Spector
4df6ea7fdd Use diploid operators when called for; fix bug in diploid-uniform-addition 2020-11-22 21:27:07 -05:00
Lee Spector
67fcdb13b5 Undo deletion rate adjustment (done elsewhere), remove argmap arguments to genetic operators, define diploid genetic operators 2020-11-22 21:18:30 -05:00
Lee Spector
55644a9b6d Make crossover, uniform-addition, and uniform-deletion take argmap arguments 2020-11-22 21:06:39 -05:00
Lee Spector
aadc28d371 Make plushy->push use an empty argmap if none was passed. 2020-11-22 16:35:46 -05:00