Constructor
new Search(startopt, spaceopt, queueopt, maxopt)
Create a new Search instance.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
start |
Iterable |
<optional> |
Initial candidates. |
space |
function |
<optional> |
Expansion function. |
queue |
Object |
<optional> |
Queue instance controlling iteration order. |
max |
number |
<optional> |
Maximum queue size. |
Classes
Members
max :number|undefined
Maximum queue size (limits branching).
Type:
- number | undefined
queue :Object
Queue controlling search order (BFS, DFS, priority, etc.).
Must implement .addAll(), .poll(), .clear(), .n(), and optionally .select().
Type:
- Object
space :function|undefined
Expansion function describing the search space.
Should return an iterable of new candidates or undefined to stop expansion.
Type:
- function | undefined
start :Iterable|undefined
Initial candidates to seed the search.
Type:
- Iterable | undefined
Methods
from(…starts) → {Search}
Define the starting candidates for the search.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
starts |
* |
<repeatable> |
One or more initial candidates. |
Returns:
The current search instance (for chaining).
- Type
- Search
through(space) → {Search}
Define the expansion logic (search space).
Parameters:
| Name | Type | Description |
|---|---|---|
space |
function | Function describing the search space. |
Returns:
The current search instance (for chaining).
- Type
- Search
via(queue, maxopt) → {Search}
Define the queue strategy and optionally set a new maximum size.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
queue |
Object | Queue implementation controlling exploration order. |
|
max |
number |
<optional> |
Optional new maximum queue size. |
Returns:
The current search instance (for chaining).
- Type
- Search