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

Seed search requirements #228

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add score attribute for all criteria
  • Loading branch information
moulins authored Dec 14, 2016
commit c1049e410e1dddbd72334c28ce918dfbf56ac4f1
17 changes: 10 additions & 7 deletions requirements/seed-search-structure-alt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ THIS IS A DRAFT
**TODO:**
- number of structures feature in criteria (should constraints returns multiple coordinates for reporting multiple structures?)
- score/result propagation for criterion references
- merge AND and OR criteria into Combining (with a combining operation)?

### World
Consists of:
Expand Down Expand Up @@ -47,45 +46,49 @@ Given a world, find among the coordinates which satisfy the predicate the one wi

### Criterion
Given a world, returns whether or not it matches a certain condition.
If it matches, returns the resulting score (a positive number), and a list of matched constraints, along with their result.

If it matches, returns the resulting score (a positive number), and a list of matched constraints, along with their result.
In addition to the score calculation specific to each type, a criterion also has an optional `score` attribute, whose value will be added to the score of the criterion if it matches.

The different type of criteria are:


#### A Constraint
A Constraint can be "lifted" to a criterion.
The criterion matches iff the constraint returns a coordinate, and its score is the valuation of this coordinate.


#### A reference to another criterion
Matches iff the specified criterion matches.
TODO decide how to propagate score/result

#### A Negation of another criterion
Matches iff the specified criterion DOES NOT match.
If it matches, ignore the result returned by the inner criterion, and return and empty match list, with the score of the Negation itself.
If it matches, ignore the result returned by the inner criterion, and return and empty match list, with a score of 0.

**Short-circuiting:** As the matches and the score of the inner criterion are ignored, we can abord as soon as the inner criterion is garanteed to match.


#### An `and` criterion
Consists of:
- a list of children criteria


Matches iff all of its children match, and returns the results of all of its children; the score is the sum of the scores of all children, plus the score of the `and` criterion itself (if present).
Matches iff all of its children match, and returns the results of all of its children; the score is the sum of the scores of all children.

**Short-circuiting:** If one children criterion doesn't match, we can immediately abort and say the `and` criterion doesn't match.


#### An `or` criterion
Consists of:
- a list of children criteria
- two optional attributes `min` and `minScore` (which are positive numbers, 0 by default)

Matches iff at least `min` children matches AND the sum of their scores is at least `minScore`. Only use criteria with a score of 0 if it is required for the criterion to match.

Returns the results of all of the matched children; the score is the sum of the score of all of the matched children, plus the score of the `or` criterion itself (if present).
Returns the results of all of the matched children; the score is the sum of the score of all of the matched children.

**Short-circuiting:** If there is not enough untested criteria for the `or` to match, we can immediately abort. Also, we only test the criteria with a score of 0 only after testing all the others (and the `or` still hasn't matched).


### Search Query
TODO

Expand Down