Class Index | File Index

Classes


Class Network


Defined in: Network.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A network of constraints and choices.
Method Summary
Method Attributes Method Name and Description
<static>  
Network.add(choiceDescription)
Adds a choice with any constraints it satisfies to the network.
<static>  
Network.ensureConstraint(constraintName)
<static>  
Network.isSolved()
<static>  
Network.makeOptional(constraintName)
Makes a constraint optional.
<static>  
Network.minConstraint()
<static>  
Network.solve(maxSolutions, maxRunTime)
<static>  
Network.solveOnce(maxRunTime)
<static>  
Network.toString()
Class Detail
Network()
A network of constraints and choices.
Method Detail
<static> Network.add(choiceDescription)
Adds a choice with any constraints it satisfies to the network.
Parameters:
{Object} choiceDescription
something that describes / defines the choice to be taken.
{String} constraintDescription... Optional
potentially many constraint descriptions that would be satisfied by this choice. May not be null or undefined.

<static> Network.ensureConstraint(constraintName)
Parameters:
constraintName
Returns:
the Constraint object that matches the passed constraintName.

<static> Network.isSolved()
Returns:
true if this network currently represents a problem with no outstanding constraints.

<static> Network.makeOptional(constraintName)
Makes a constraint optional. It does this by adding a special choice that only satisfies this one constraint, so there will always be a choice that could satisfy this constraint and won't interfere with other solutions. The special choice is internal and does not appear in solutions unlike users constraints.
Parameters:
{String} constraintName
a string identifying a constraint. May not be null.

<static> {Constraint} Network.minConstraint()
Returns:
{Constraint} the Constraint that has the fewest choices that satisfy it or null if there are no Constraints left in this network.

<static> {Array} Network.solve(maxSolutions, maxRunTime)
Parameters:
{number} maxSolutions
the maximum number of solutions to find, or null/undefined if it should attempt to find them all.
{number} maxRunTime
the maximum time in milliseconds that the solver should run for or null/undefined if it should run until it's finished.
Returns:
{Array} an array of all solutions, where a solution is an array of choice description objects.

<static> {Array} Network.solveOnce(maxRunTime)
Parameters:
{number} maxRunTime
the maximum time in milliseconds that the solver should run for or null/undefined if it should run until it's finished.
Returns:
{Array} the first solution found, where a solution is an array of choice description objects.

<static> Network.toString()

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Apr 28 2017 12:10:01 GMT+0000 (UTC)