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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258 | ------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Cheddar is a GNU GPL real-time scheduling analysis tool.
-- This program provides services to automatically check schedulability and
-- other performance criteria of real-time architecture models.
--
-- Copyright (C) 2002-2023, Frank Singhoff, Alain Plantec, Jerome Legrand,
-- Hai Nam Tran, Stephane Rubini
--
-- The Cheddar project was started in 2002 by
-- Frank Singhoff, Lab-STICC UMR 6285, Université de Bretagne Occidentale
--
-- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008.
-- Since 2008, Ellidiss technologies also contributes to the development of
-- Cheddar and provides industrial support.
--
-- The full list of contributors and sponsors can be found in README.md
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
--
-- Contact : cheddar@listes.univ-brest.fr
--
------------------------------------------------------------------------------
-- Last update :
-- $Rev: 3477 $
-- $Date: 2020-07-13 11:43:48 +0200 (Mon, 13 Jul 2020) $
-- $Author: singhoff $
------------------------------------------------------------------------------
------------------------------------------------------------------------------
with Ada.Containers.Vectors;
use Ada.Containers; use Ada.Containers;
with Ada.Directories; use Ada.Directories;
with Ada.text_IO; use Ada.text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with unbounded_strings; use unbounded_strings;
use unbounded_strings.strings_table_package;
use unbounded_strings.unbounded_string_list_package;
with unbounded_strings; use unbounded_strings;
with Ada.strings; use Ada.strings;
with paes.objective_functions.deadline2energy; use paes.objective_functions.deadline2energy;
with Debug; use Debug;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Paes.deadline2energy ; use Paes.deadline2energy;
with Systems; use Systems;
with sets;
with Dependencies; use Dependencies;
with Task_Dependencies; use Task_Dependencies;
with Task_Dependencies; use Task_Dependencies.Half_Dep_Set;
with MILS_Security; use MILS_Security;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with paes.chromosome_Data_Manipulation_deadline2energy; use paes.chromosome_Data_Manipulation_deadline2energy;
procedure paes.exhaustive_general_form_deadline2energy is
package Solution_Container is new Vectors (Positive, solution_deadline2energy_ptr);
use Solution_Container;
package Integer_Container is new Vectors (Positive, Integer);
use Integer_Container;
search_space_is_exhausted : boolean := false;
search_space_is_exhausted_com : boolean := false;
non : boolean := True;
next_solution : solution_deadline2energy_ptr;
normalized_solution : solution_deadline2energy_ptr;
all_feasible_solutions : Solution_Container.Vector;
N_feasible_solutions : integer := 0;
a_table : Integer_container.Vector;
Cursor1,Cursor2 : Solution_Container.Cursor;
Cursor3 : Integer_container.Cursor;
k, j , i,l : integer;
nb_rejectedSol : Integer;
eidx : natural := 0;
F : Ada.Text_IO.File_Type;
F6 : Ada.Text_IO.File_Type;
begin
next_solution:=new solution_deadline2energy;
normalized_solution:=new solution_deadline2energy;
Append (Data3, "iteration" & " " & "Missed_deadline" &" " &"bell" &" " & "biba" &" "& ASCII.LF);
init_deadline2energy;
-- 2) enumerate and evaluate all feasible solutions
--
i := 1;
j := 1;
k:=1;
l:=1;
---------------------------------------------------------------------------------------
i := 1;
j:= 1;
nb_sol_Exhaus:=0;
while(True) loop
search_space_is_exhausted:= False;
if (i>1) then
if (next_solution.chrom_task(i) >=1) and (next_solution.chrom_task(i)<nb_partitions+1) then
nb(next_solution.chrom_task(i)):= nb(next_solution.chrom_task(i))-1;
if(nb(next_solution.chrom_task(i)) = 0 ) then
next_solution.chrom_task(i) := 0;
i:=i-1;
search_space_is_exhausted:= True;
end if;
end if;
end if;
if (search_space_is_exhausted= False) then
next_solution.chrom_task(i) := next_solution.chrom_task(i) +1;
if ( next_solution.chrom_task(i)>nb_partitions) then
next_solution.chrom_task(i):= 0;
i:=i-1;
else
if (next_solution.chrom_task(i)<=nb_partitions) then
nb(next_solution.chrom_task(i)):= nb(next_solution.chrom_task(i))+1;
end if;
if (next_solution.chrom_task(i)<= i) and (i<genes) then
i:=i+1;
elsif (next_solution.chrom_task(i)<= i) and (i=genes) then
j:= 1;
New_Line;
while(search_space_is_exhausted_com=False) loop
-- eidx := eidx + 1;
if j<=Nb_NonSecure_low then
-- next_solution.chrom_com(NonSecure_list(j)).mode:= emission;
if (next_solution.chrom_com(NonSecure_list(j)).mode= undefined) then
next_solution.chrom_com(NonSecure_list(j)).mode:= nosecure;
elsif (next_solution.chrom_com(NonSecure_list(j)).mode= nosecure) then
next_solution.chrom_com(NonSecure_list(j)).mode:= secure;
elsif(next_solution.chrom_com(NonSecure_list(j)).mode= secure) then
next_solution.chrom_com(NonSecure_list(j)).mode:= undefined;
end if;
end if;
if (next_solution.chrom_com(NonSecure_list(j)).mode/=undefined) and (j<Nb_NonSecure_low) then
j:=j+1;
elsif (next_solution.chrom_com(NonSecure_list(j)).mode/=undefined) and(j=Nb_NonSecure_low) then
if (intra_partition_safe=1) then
nb_sol_Exhaus:= nb_sol_Exhaus+1;
Put_Line("iteration: " & nb_sol_Exhaus'Img);
Put_Line("security config: 1" );
next_solution.security_config:=1;
print_genome(next_solution.all);
normalized_solution := next_solution;
normalize (normalized_solution.all);
if Check_Feasibility (normalized_solution.all,eidx) then
evaluate (normalized_solution.all,eidx);
all_feasible_solutions.Append (normalized_solution);
N_feasible_solutions := N_feasible_solutions + 1;
archive_soln(generic_solution_ptr(normalized_solution));
Append (Data3, N_feasible_solutions'img & " " & normalized_solution.obj(1)'img &" " &normalized_solution.obj(2)'img &" " & normalized_solution.obj(3)'img &" "& ASCII.LF);
end if;
else
for l in 2..4 loop
nb_sol_Exhaus:= nb_sol_Exhaus+1;
Put_Line("iteration: " & nb_sol_Exhaus'Img);
Put_Line("security config" & l'Img);
next_solution.security_config:=l;
print_genome(next_solution.all);
normalized_solution := next_solution;
normalize (normalized_solution.all);
if Check_Feasibility (normalized_solution.all,eidx) then
evaluate (normalized_solution.all,eidx);
all_feasible_solutions.Append (normalized_solution);
N_feasible_solutions := N_feasible_solutions + 1;
archive_soln(generic_solution_ptr(normalized_solution));
Append (Data3, N_feasible_solutions'img & " " & normalized_solution.obj(1)'img &" " &normalized_solution.obj(2)'img &" " & normalized_solution.obj(3)'img &" "& ASCII.LF);
end if;
end loop;
end if;
elsif(next_solution.chrom_com(NonSecure_list(j)).mode=undefined) and (j>1) then
j:=j-1;
elsif (next_solution.chrom_com(NonSecure_list(j)).mode=undefined) and (j=1) then
search_space_is_exhausted_com:=True;
end if;
end loop;
search_space_is_exhausted_com:=False;
elsif (next_solution.chrom_task(i)> i) and (i>1) then
next_solution.chrom_task(i):= 0;
i:=i-1;
else
exit;
end if;
end if;
end if;
end loop;
nb_rejectedSol := nb_InitSol+ N_feasible_solutions - arclength; -- solutions add in the archive during the init process + N_feasible_solutions+iterations+ arclength
Append (Data3," " & ASCII.LF);
Append (Data3," " & ASCII.LF);
Append (Data3,"Number of rejected solution during the archiving process : " & nb_rejectedSol'img & ASCII.LF);
Append (Data3,"Number of solutions generate during the exhaustive research : " & nb_sol_Exhaus'img & ASCII.LF);
Create(F6,Ada.Text_IO.Out_File,"Exhaustive_Execution_iter.dat");
Unbounded_IO.Put_Line(F6, Data3);
Close(F6);
end paes.exhaustive_general_form_deadline2energy;
|