The following is an example of how to use the run file bfs.txt
to run the breadth-first
search algorithm on a network represented in the format described by
the AMPL model
file mcnfp_model.txt.
This example uses the Unix operating system and the commands that the user
types are in
bold, italic type.
The data file for this example is network1_data.txt.
% ampl < bfs.txt set LIST := 1; i = 1 set CANDIDATES := 2 3; j = 2 set LIST := 1 2; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 1 set CANDIDATES := 3; j = 3 set LIST := 1 2 3; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 1 set CANDIDATES := ; # empty set LIST := 2 3; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 2 set CANDIDATES := 4 5; j = 4 set LIST := 2 3 4; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 2 set CANDIDATES := 5; j = 5 set LIST := 2 3 4 5; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 2 set CANDIDATES := ; # empty set LIST := 3 4 5; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 3 set CANDIDATES := ; # empty set LIST := 4 5; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 4 set CANDIDATES := 6; j = 6 set LIST := 4 5 6; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 4 set CANDIDATES := ; # empty set LIST := 5 6; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 5 set CANDIDATES := ; # empty set LIST := 6; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= i = 6 set CANDIDATES := ; # empty set LIST := ; # empty =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= order [*] := 1 1 2 2 3 3 4 4 5 5 6 6 ; pred [*] := 2 1 3 1 4 2 5 2 6 4 ;