... | ... | @@ -40,3 +40,16 @@ NDL model is a typed Prolog program consisting of following predicates: |
|
|
* `constraint(+Name:string, ?Index1:variable_index, ?Index2:variable_index) is nondet` - allows to non-deterministically check if two variables indexed `Index1` and `Index2` are constrained with a constraint named `Name`. Also allows to find indexes satisfying those requirements. Used in the NDL query.
|
|
|
* `is_satisfied(+Name:String, +Index1:variable_index, +Index2:variable_index)` - allows to check if the constraint named `Name` is satisfied on variables indexed `Index1` and `Index2`. Used in the NDL query. **FIXME**
|
|
|
dynamic_predicate(constraint/3, public).
|
|
|
|
|
|
## Query
|
|
|
|
|
|
NDL query is a Prolog like program, containing rules, with bodies consisting of goals from a predefined set of clauses:
|
|
|
* NDL model clauses: `constraint/2`, `constraint_range/2`, `variable/2`, `new_value/2`, `constraint/3`, `is_satisfied/3`
|
|
|
* binary arithmetic operations: +, -, /, *, div, mod
|
|
|
* binary arithmetic comparisons: =, >=, >, <, <=
|
|
|
* heads of the rules defined in the query itself (allows recursion)
|
|
|
* operation operating on the current solution:
|
|
|
* `get_value(+Index:variable_index, -Value:integer)` - gets the variable's current value
|
|
|
* `set_value(+Index:variable_index, +Value:integer)` - set the variable's value to `Value`
|
|
|
* `swap_values(+Index1:variable_index, +Index2:variable_index)` - swap values of two variables
|
|
|
|