------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2016, Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285 laboratory, 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 AUTHORS.txt and SPONSORS.txt -- -- 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: 1249 $ -- $Date: 2014-08-28 07:02:15 +0200 (Fri, 28 Aug 2014) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This program is the Ada implementation of (1+1)-PAES. -- The original code of (1+1)-PAES is implemented in C -- available from: http://www.cs.man.ac.uk/~jknowles/multi/ -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Paes_Utilities is --------------------- -- Constants -- --------------------- MAX_GENES : constant integer := 1000; -- change as necessary MAX_OBJ : constant integer := 10; -- change as necessary MAX_ARC : constant integer := 1000; -- change as necessary MAX_LOC : constant integer := 1000000;--32768; -- number of locations in grid (set for a three-objective problem using depth 5) MAX_SLAVES : constant integer := 40;--for the parallel algorithm LARGE : constant integer := 2000000000; -- should be about the maximum size of an integer for your compiler --------------------- -- Types -- --------------------- -- This type used to define a chromosome of a solution type chrom_type is array(1..MAX_GENES) of integer; -- This type used to define objectives of a solution type obj_type is array(1..MAX_OBJ) of float; type string_type is new string(1..50); -- This is the main type used to define solutions type solution is record chrom : chrom_type; obj : obj_type; grid_loc : integer; end record; -- This type is used to define the archive of solutions type arc_type is array(1..MAX_ARC) of solution; -- The selection strategy is either : -- *) Local strategy : the PAES original one, rule -- for admitting the matuted solution as current solution -- or to keep current solution for the next iteration -- *) Global strategy : that picks a new current -- individual from the archive at each iteration (NextSelect function). -- type SelectionStrategy is (local, global); ---------------------- -- Global variables -- ---------------------- -- current solution c : solution; -- mutant solution m : solution; -- archive of solutions arc : arc_type; -- the selection strategy --By default is set to the original selection strategy of PAES A_SelectionStrategy : SelectionStrategy := local; -- slaves correspond to the number of process that can be run in parallel -- it depends on the parallel machine capacity -- the number of slaves, By default is set to 0 (i.e. sequantial run) slaves : natural := 0; -- set to 0 (zero) for minimization problems, 1 for maximization problems. -- By default is set to a minimization problem minmax : integer := 0; ------------------------------------------------------------------------------------------------------ -- depth: this is the number of recursive subdivisions of the objective space carried out in order to -- divide the objective space into a grid for the purposes of diversity maintenance. Values of -- between 3 and 6 are useful, depending on number of objectives. -- objectives: the number of objectives to the problem. -- genes: the number of genes in the chromosome. (Only integer genes can be accepted). -- alleles: the number of values that each gene can take. -- archive: the maximum number of solutions to be held in the nondominated solutions archive. -- iterations: the program terminates after this number of iterations. -- minmax: ------------------------------------------------------------------------------------------------------ depth, objectives, genes, archive, iterations : integer; arclength : integer := 0; -- current length of the archive gl_offset : obj_Type; -- the range, offset etc of the grid gl_range : obj_Type; gl_largest : obj_Type; grid_pop : array(1..MAX_LOC) of integer; -- the array holding the population residing in each grid location change : integer := 0; function compare_min(first : obj_type; second : obj_type; n : integer) return integer; function compare_max(first : obj_type; second : obj_type; n : integer) return integer; function equal(first : obj_type; second : obj_type; n : integer) return integer; procedure print_genome(s : solution); procedure print_eval(s : solution); procedure print_debug_genome(s : solution); procedure print_debug_eval(s : solution); procedure add_to_archive(s : solution); function compare_to_archive(s : solution) return integer; procedure update_grid(s : in out solution); procedure archive_soln(s : solution); function find_loc(eval : obj_type) return integer; function selectNext return solution; Procedure Selection_and_Archiving; end Paes_utilities;