Home>>Control Network

Control Network (CN)

Control Network is one of the most important element of CNP. Others are primitives. Control network consists of one or more subnets. These subnets have states that are connected each other with arrows. These arrows have functions that are called primitives When control of the program moves one state to other, corresponding primitives are executed.

In CNP there are different type of states. Each state is used for different purpose.

STATES

Another features of the control network is static and dynamic options. These options gives extra control over subnets. Here is the list of the options

STATIC OPTIONS

DYNAMIC OPTIONS

Parameters and Variables

Every subnet can has own parameters and variables. Values of variables and parameters can be changed through primitives. They should be given to primitives as parameters.

The code below shows textual definition of subnets above.

[ARROWCOST=0,SOLUTIONS=ALL] Main MainNetwork; var initialState:state body FirstNode: Initialize(initialState), CALL SubNet2(initialState), Print > FINISH ; end; Sub SubNet2(st:state); var newState:state body State1: isFinal > RETURN FillSmall(st, newState) > State2 FillLarge(st, newState ) > State2 PourLargeToSmall(st, newState) > State2 PourSmallToLarge(st, newState) > State2 EmptySmall(st, newState) > State2 EmptyLarge(st, newState) > State2 ; State2: CALL SubNet2(newState) > RETURN ; end;

States

Normal State

Normal state is the basic state in Control Network. It has no additional purpose.

Finish State

Finish state is the last state for search process. When it is reached it means one solution is found. If SOLUTIONS options is equal to 1 program is terminated after one solution is found. Otherwise program use its backtrack mechanism to find different solution paths.

Return State

When a subnet call another subnet, Return state is used to go back to caller subnet. If current subnet is not invoked by another subnet, this state act like Finish state.

Stop State

When this state is reached there could not be a solution path that is extension of current path. Also this state does not allow to control to progress.

Select State

This state is used to select outgoing arrows. For selection, evaluations of outgoing arrows should be equal to “Selector”, but with PROXIMITY option it able to give a tolerance value.

Order State

This state is used to order outgoing arrows. “Selector” variable is used to decide to order. Selection is made according to heuristic values of outgoing arrows. Closest heuristic value to “Selector” decides the order.

Range State

This state is used to select outgoing arrows according to their heuristic values within specific range. Range is determined with “Lo” (low) and “Hi” (high) parameters. There are two versions of this state. First one is without “ELSE” clause. When there is no arrow in the range, backtracking is implemented. Second one is with “ELSE” clause. In this version “ELSE” arrow is applied if no arrows found in the given range.

Static Options

SOLUTIONS

SOLUTIONS option specify maximum number of solutions to be found. Default value of this option is 1. Other values can be ALL, ASK, unsigned integer.

BACKTRACKING

BACKTRACKING option disables or enables backtracking mechanism. Default value of this option is YES (backtracking is allowed). Other value can be NO (backtracking is not allowed).

ONEVISIT

ONEVISIT option specifies if multiple entries into a node (within a recursive level) are allowed. Default value of this option is NO. Other value can be YES.

LOOPS

LOOPS option sets maximum number of repeated visits to a node in the current path. Default value of this option is ANY. Other values can be any unsigned integer.

RECURSION

RECURSION option sets maximum number of repeated invocations of a subnet. Default value of this option is ANY. Other values can be any unsigned integer.

Dynamic Options

ARROWCOST

ARROWCOST option specify all arrows cost in scope. Default value for this option is 1. Other values can be any constant or variable real value.

MAXPATHCOST

MAXPATHCOST option specifies maximum cost of the path. Any arrow that exceeds the cost will fail. Default value for this option is ANY. Other values can be any constant or variable real value.

RANGEORDER

RANGEORDER option is used with state Range to order arrows within the given range.

ORDEROFARROWS

ORDEROFARROWS option specifies order of the arrows that emanating from a state. Default value for this option is NO. This means all arrows examined in predefined order. Other value is RANDOM.

PROXIMITY

PROXIMITY option is used to give a tolerance value to absolute difference between evaluations and “Selector”.

NUMBEROFARROWS

NUMBEROFARROWS option specifies maximum number of attempting arrows from a state. Default value for this option is ANY. Other values can be constant or variable integer value.

Home>>Control Network