Code Ada : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Decision model
 
 
Manufacture
L'objectif est d'enrichir le programme existant.
Autopoïèse d'un programme écrit avec Ada par recherche de chemin.
Chacun des états est obtenu par algorithme génétique.
Algorithme Astar
Heuristique
retourne le gain d'un état.
Uniforme
retourne le coût d'un état.
Input/Output
Close File à priorité.
Open Vecteur
Trame
Arbre N-aires éthérogène
 
    -- prototype
    -- declaration
    -- corp
 
Methodes
 
    -- Créer
    -- Ouvrir
    -- Insérer
    -- Ajouter
    -- Réécrire
 
Mouvements
Genes(1..1024) ; 1024 genes (1024 méthodes sur une trame ).
 
    -- Random
    -- Mute
    -- Mutate
    -- Fitness
 
Graph dependencies
[ATTACH=CONFIG]679167[/ATTACH]
 
Program Test
 
with Kernel;
use Kernel;
with Text_Io;
use Text_Io;
procedure Test is
 
   Self : constant String := "astar.adb";
   Empty : constant String := "astar.adb";
   InFile  : File_Type;
   OutFile : File_Type;
   Index : Natural := 0;
   Inopen, Outopen : Boolean := False;
begin
 
   loop
      declare
	 Start : Kernel_Tree := Initialize(Self);
	 Goal  : Kernel_Tree := Initialize(Empty);
      begin
 
	 Open(Infile, In_File, "listing");
	 Inopen := True;
 
         for I in 1..Index-1 loop
	    declare
	       Line : String := Get_Line(InFile);
	    begin
	       null;
	    end;
	 end loop;
	 loop
	    declare
	       Line : String := Get_Line(InFile);
	    begin
	       Index := Index + 1;
	       Close(Infile);
	       Inopen := False;
	       while not Goal.Is_Exhausted loop
		  Put_Line("New goal : " & Line);
		  Put("Program name : ");
		  Goal.Name(Get_Line);
		  Open(Outfile, Append_File, "listing");
		  Outopen := True;
		  Goal.Append(OutFile);
		  Close(Outfile);
		  Outopen := False;
	       end loop;
	       Goal := Initialize(Empty);
	       exit;
	    exception
	       when others =>
		  Put_Line("Standard Errror : ");
		  raise;
	    end;
	 end loop;
      exception
	 when others =>
	    Put_Line("Standard Errror : ");
	    Start.Free;
	    Start := Initialize(Self);
	    if Inopen then
	       Close(Infile);
	    end if;
	    if Outopen then
	       Close(Outfile);
	    end if;
	    Skip_Line;
      end;
   end loop;
end Test;
 
 
 
Differed
 
    -- Goal.Create(Line);
    -- Goal.Add(Random);
    -- Put_Line("Path finding : ");
    -- Astar(Start, Goal);
    -- Put_Line("Goal!");
    -- Goal.Normalize;
    -- Put_Line("Starting manufacture...");
    -- Goal.Initialize;
    -- Put_Line("Running...");
    -- Goal.Run;
    -- Put_Line("End of program.");
    -- Goal.Finalize;
    -- Put_Line("Program saved.");
    -- Goal.Make_ID;
    -- Gaol.Man(1);
 
 
Real time
 
    -- Goal.Create(Line);
    -- Goal.Add(Random);
    -- Put_Line("Path finding : ");
    -- Astar(Start, Goal);
    -- Put_Line("Goal!");
    -- Goal.Normalize;
    -- Put_Line("Starting manufacture...");
    -- Goal.Initialize;
    -- Goal.Make_ID;
    -- Gaol.Man(1);
    -- Put_Line("Running...");
    -- Goal.Run;
    -- Put_Line("End of program.");
    -- Goal.Finalize;
    -- Put_Line("Program saved.");