Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options for additional strategies #16

Closed
wants to merge 4 commits into from
Closed

Options for additional strategies #16

wants to merge 4 commits into from

Conversation

aengelberg
Copy link
Owner

My progress as I add the capability to choose "propagation strategy" in Loco. End goal is to provide all options Choco provides. WIP

(fixes #11)

@boxxxie
Copy link

boxxxie commented Dec 25, 2017

i think this is out of date, newest version is 4.0.6 and i'm actually working on updating the codebase to that version so i can use the parallel stuff.

lots and lots of stuff has changed since 3.3.3

@aengelberg
Copy link
Owner Author

You're right, Loco has fallen behind and should probably be updated to the latest Choco version. I'd welcome a pull request if you manage to port everything over.

@boxxxie
Copy link

boxxxie commented Jan 3, 2018

would you be able to explain the code changes in this patch? I'm still pretty new to choco and constraint solving. I have been able to partially update to 4.0.6, but some stuff was really over my head, so I got distracted and focused on other stuff, but now I'm able to work more on making the rest of the tests in the codebase pass, and I may be able to incorporate the changes in this patch, but I have to make tests for them first, which I'm not able to without a better understanding.

@aengelberg
Copy link
Owner Author

@boxxxie sorry for the late response. The changes here are to allow setting different propagation strategies for the Choco engine. There are more details about what this means in the Choco docs. A majority of the code (in strategy.clj) is just boilerplate that creates Clojure functions that wrap Java classes. I believe the only remaining work here is to look through the Choco docs to determine the complete list of supported strategies, and write the equivalent Clojure wrappers for those classes.

Strategies introduce a priority order to the search, which mostly helps performance, so I'm not totally sure how one could test them effectively. The value selectors are predictable enough that you could write test cases that verify that in scenarios with multiple solutions, the right solution is chosen first. e.g.

(is (= {:x 5} (solution [($in :x 1 5)]
                        :strategy (strategy/custom :var-selector (strategy/lexico-var-selector)
                                                   :val-selector (strategy/max-value-selector)))))

For the other less predictable ones (like the random selectors, or dom-over-w-deg) you could at least write some sanity checks for correctness, that verify they still work properly in basic success/failure cases and nothing out of the ordinary happens when you try to use that strategy.

Hopefully that helps.

@boxxxie
Copy link

boxxxie commented Apr 9, 2018

hey, thanks a lot.
i've actually done a lot of work on the code, but in the past 2 months been doing something else (yet related). my code is still a bit of a mess, when i get some time to clean it up i'll post a PR.
any documentation helps a lot.

@marco-m
Copy link

marco-m commented Sep 16, 2018

@boxxxie any news ?

@boxxxie
Copy link

boxxxie commented Sep 17, 2018

I have a fork with 2 branches. one adds some functionality to choco 3 code, the other is a rewrite that adds lots of the choco 4 features, including tasks, sets, tuples. I will have to add the real number stuff soon too, but it takes a long time to do all this.

choco 4 just has a ton of features

@yuhan0
Copy link

yuhan0 commented Dec 14, 2019

@boxxxie Any plans to make a PR? I had a look at your fork and the 4.0.6 branch looks like a complete rewrite with lots of WIP commits, I was wondering if it's in a usable state or what new features were added.

@boxxxie
Copy link

boxxxie commented Dec 14, 2019

@yuhan0 i want to do some cleanup and finish some features
logic that doesn't produce constraints isn't working (if statements). however almost everything else is.

once i find some more time to work on it, i think i'll be able to produce a PR soon.

in it's current state, many things are working. anything using my fancy test macro should be working.

@aengelberg
Copy link
Owner Author

Closing this PR to avoid clutter as I don't anticipate working on this in the near future, but more PRs welcome if someone else wants to take it over the line.

@aengelberg aengelberg closed this Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the specification of different search strategies
4 participants