Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- Variable[T] = ref object
- ## Represents a Node in the CSP Graph
- name: string
- ## Unique name of the Variable
- ## TODO: Currently user-enforced
- domain: seq[T]
- ## Domain of the variable as a
- ## finite, ordered set
- value: T
- ## Current value of the variable,
- ## used to represent an assignment
- Constraint*[T] = ref object
- ## A function that subsets valid combinations
- ## of values for its variables. Represents
- ## an Arc or Multi-Arc in the CSP Graph
- variables: seq[Variable[T]]
- ## The list of Variable objects checked
- predicate: proc(x: varargs[T]): bool
- ## The function computing satisfaction
- Problem*[T] = ref object
- ## A CSP Graph with well-defined solving algorithms
- variables: TableRef[string, Variable[T]]
- ## Links the Names of Nodes to their Reference
- constraints: TableRef[string, seq[Constraint[T]]]
- ## Links the Names of Nodes to their Constraints
Advertisement
Add Comment
Please, Sign In to add comment