------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2020, 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 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$ -- $Date$ -- $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 is --------------------- -- Constants -- --------------------- max_genes : constant Integer := 1000; -- change as necessary max_obj : constant Integer := 10; -- change as necessary max_arc : constant Integer := 200; -- 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 -- ---------------------- c : solution; -- current solution m : solution; -- mutant solution arc : arc_type; -- archive of solutions a_selectionstrategy : selectionstrategy := local; -- the selection strategy ------------------------------------------------------------------------------------------------------ -- 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: set to 0 (zero) for minimization problems, 1 for maximization problems. ------------------------------------------------------------------------------------------------------ depth, objectives, genes, archive, iterations, minmax : 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; ----------------------------- -- Non-generic subprograms -- ----------------------------- 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; ------------------------- -- Generic subprograms -- ------------------------- -- User should define mutate, evaluate and init procedures -- according to the MOO problem solved with PAES generic with procedure customize_mutate (s : in out solution; eidx : in Natural); procedure mutate (s : in out solution; eidx : in Natural); generic with procedure customize_evaluate (s : in out solution; eidx : in Natural); procedure evaluate (s : in out solution; eidx : in Natural); generic with procedure customize_init; procedure init; end paes;