Variable vs Constraint-based solver #34
perdasilva
started this conversation in
General
Replies: 2 comments 1 reply
-
Is this a OR b (c depends on)? |
Beta Was this translation helpful? Give feedback.
1 reply
-
After an interesting conversation on slack. It seems going the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
I wanted to ask you what you think about the work I've put together in this PR.
Currently, the solver takes as input a slice of variables.
Variable
is an interface that connects an Identifier with a set of Constraints for the purposes of generatinggini
literals when the constraint is applied (e.g. see the dependency constraint).I've refactored the
Solver
to take as input a slice ofConstraint
s, which were themselves refactored to contain thesubject
of the constraint (i.e.). I did this because I think it will make it easier to express arbitrary constraints (inc. conjunctions and disjunctions of arbitrary constraints).For instance, if we have two variables:
A:
B:
It would be hard to express something like
(A OR B)
, especially given that eachVariable
must only appear once in the input .With a constraint based approach, you could simply add a new constraint, e.g.
Or(Mandatory("a"), Mandatory("b"))
.Beta Was this translation helpful? Give feedback.
All reactions