text
stringlengths
0
234
--------------------------------
for i in 1..Task_number loop
Mul_Task(i).Compute_Fitness(i);
end loop;
loop
taskComplete:=0;
for i in 1..Task_number loop
if Mul_Task(i)'Terminated then
taskComplete:=taskComplete+1;
end if;
end loop;
if taskComplete = Task_number then
exit;
end if;
end loop;
result:=condition;
final_result := fit;
put(generation,5);
put(" th generation shortest length : ");
put(final_result,3);
put(" Current shortest length : ");
put(best,3);
new_line;
generation:=generation+1;
exit Find_route when result=1;
--arrayAtoArrayB(parent,childarray);
for i in 1..population_size loop
--childgenerate;
crossover(i);
end loop;
arrayAtoArrayB(childarray,parent);
------------------------------------------
Function Definition: function Intel_32 is new Intel_x86_buffer( Unsigned_32, 4 );
Function Body: function Intel_16( n: Unsigned_16 ) return Byte_buffer is
pragma Inline(Intel_16);
begin
return (Unsigned_8(n and 255), Unsigned_8(Shift_Right(n, 8)));
end Intel_16;
-- 2.5.2 Byte Strings, 8-bit string length (BIFF2-BIFF5), p. 187
function To_buf_8_bit_length(s: String) return Byte_buffer is
b: Byte_buffer(s'Range);
begin
if s'Length > 255 then -- length doesn't fit in a byte
raise Constraint_Error;
end if;
for i in b'Range loop
b(i):= Character'Pos(s(i));
end loop;
return Unsigned_8(s'Length) & b;
end To_buf_8_bit_length;
-- 2.5.2 Byte Strings, 16-bit string length (BIFF2-BIFF5), p. 187
function To_buf_16_bit_length(s: String) return Byte_buffer is
b: Byte_buffer(s'Range);
begin
if s'Length > 2**16-1 then -- length doesn't fit in a 16-bit number
raise Constraint_Error;
end if;
for i in b'Range loop
b(i):= Character'Pos(s(i));
end loop;
return Intel_16(s'Length) & b;
end To_buf_16_bit_length;
-- -- 2.5.3 Unicode Strings, 16-bit string length (BIFF2-BIFF5), p. 17
-- function To_buf_16_bit_length(s: Wide_String) return Byte_buffer is
-- b: Byte_buffer(1 .. 2 * s'Length);
-- j: Integer:= 1;
-- begin
-- if s'Length > 2**16-1 then -- length doesn't fit in a 16-bit number
-- raise Constraint_Error;
-- end if;
-- for i in s'Range loop
-- b(j) := Unsigned_8(Unsigned_32'(Wide_Character'Pos(s(i))) and 255);
-- b(j+1):= Unsigned_8(Shift_Right(Unsigned_32'(Wide_Character'Pos(s(i))), 8));
-- j:= j + 2;
-- end loop;
-- return
-- Intel_16(s'Length) &
-- (1 => 1) & -- Character compression (ccompr): 1 = Uncompressed (16-bit characters)
-- b;
-- end To_buf_16_bit_length;
-- Gives a byte sequence of an IEEE 64-bit number as if taken
-- from an Intel machine (i.e. with the same endianess).
--
-- http://en.wikipedia.org/wiki/IEEE_754-1985#Double-precision_64_bit
--
package IEEE_LF is new IEEE_754.Generic_Double_Precision (Long_Float);
function IEEE_Double_Intel_Portable(x: Long_Float) return Byte_buffer is
pragma Inline(IEEE_Double_Intel_Portable);
d : Byte_buffer(1..8);