with Ada.Containers.Vectors; use Ada.Containers; use Ada.Containers; with Ada.Directories; use Ada.Directories; with Ada.text_IO; use Ada.text_IO; procedure Exhaustive_method_general_form is package Solution_Container is new Vectors (Positive, solution); use Solution_Container; package Integer_Container is new Vectors (Positive, Integer); use Integer_Container; search_space_is_exhausted : boolean := false; m : chrom_type; next_solution : solution; normalized_solution : solution; 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; h,k, j : integer; ok : boolean; eidx : natural := 0; F : Ada.Text_IO.File_Type; begin for i in 1..genes loop next_solution.chrom(i) := 1; m(i) := 1; end loop; -- 2) enumerate and evaluate all feasible solutions -- loop eidx := eidx + 1; generate_next_solution (next_solution, m, search_space_is_exhausted); normalized_solution := next_solution; normalize (normalized_solution); if Check_Feasibility (normalized_solution,eidx) then evaluate (normalized_solution,eidx); all_feasible_solutions.Append (normalized_solution); N_feasible_solutions := N_feasible_solutions + 1; -- else -- -- Deleting the file "Output eidx.txt" if the candidate solution -- -- is simulated with Cheddar -- if Exists ("Output" & eidx'img & ".txt") then -- Open (File => F, -- Mode => Ada.Text_IO.In_File, -- Name => "Output" & eidx'img & ".txt"); -- Ada.text_IO.Delete(File => F); -- end if; end if; exit when search_space_is_exhausted; end loop; -- 2) Compute the Pareto front from all the feasible solutions for i in 1 .. N_feasible_solutions loop Integer_container.Append(a_table, -1); end loop; Cursor1 := Solution_Container.First(all_feasible_solutions); k := 1; while Solution_Container.Has_Element(Cursor1) loop Cursor2 := Solution_Container.First(all_feasible_solutions); j := 1; while Solution_Container.Has_Element(Cursor2) loop if (k /= j) then h := 1; ok := true; while (h <= objectives) and ok loop if (Solution_Container.Element(Cursor1).obj(h) >= Solution_Container.Element(Cursor2).obj(h)) then ok := true; else ok := false; end if; h := h + 1; end loop; if (ok) then h := 1; ok := false; while (h <= objectives) and (Not ok) loop if (Solution_Container.Element(Cursor1).obj(h) > Solution_Container.Element(Cursor2).obj(h)) then ok := true; end if; h := h + 1; end loop; if ok then Integer_container.Replace_Element (Container => a_table, Index => k, New_Item => 1); end if; end if; end if; Solution_Container.Next(Cursor2); j := j + 1; end loop; k := k + 1; Solution_Container.Next(Cursor1); end loop; k := 1; Cursor3 := Integer_container.First(a_table); while Integer_container.Has_Element(Cursor3) loop if (Integer_container.Element(Cursor3) = -1) then add_to_archive (Solution_Container.Element(all_feasible_solutions,k)); end if; k := k + 1; Integer_container.Next(Cursor3); end loop; end Exhaustive_method_general_form;