-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A agpl-cr-mutable_assignment-heuristics.adb A agpl-cr-mutable_assignment-heuristics.ads A agpl-cr-containers.ads M agpl-cr-cost_matrix-utils.adb A agpl-cr-cost_cache.adb A agpl-cr-mutable_assignment-auctions.adb A agpl-cr-cost_cache.ads A agpl-cr-mutable_assignment-auctions.ads M agpl-optimization-annealing-solver.adb A agpl-cr-mutable_assignment-or_mutations.adb A agpl-cr-mutable_assignment-or_mutations.ads M agpl-cr-cost_matrix.adb A agpl-cr-assignment-utils.adb M agpl-cr-cost_matrix.ads A agpl-cr-assignment-utils.ads A agpl-cr-mutable_assignment-moves.adb M agpl-cr-mutable_assignment.adb A agpl-cr-mutable_assignment-moves.ads M agpl-cr-mutable_assignment.ads A agpl-cr-cost_cache-handle.ads
- Loading branch information
Showing
21 changed files
with
1,531 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
with Agpl.Cr.Containers; use Agpl.Cr.Containers; | ||
|
||
package body Agpl.Cr.Assignment.Utils is | ||
|
||
----------------- | ||
-- Concatenate -- | ||
----------------- | ||
|
||
procedure Concatenate (Dst : in out Object; Src : Object) is | ||
Agents : constant Agent_Lists.List := Src.Get_Agents; | ||
|
||
procedure Do_It (I : Agent_Lists.Cursor) is | ||
Ag_Src : constant Cr.Agent.Object'Class := Agent_Lists.Element (I); | ||
begin | ||
if Dst.Contains (Ag_Src.Get_Name) then | ||
declare | ||
Ag_Dst : Cr.Agent.Object'Class := Dst.Get_Agent (Ag_Src.Get_Name); | ||
T : Task_Lists.List := Ag_Dst.Get_Tasks; | ||
begin | ||
Task_Utils.Concatenate (T, Ag_Src.Get_Tasks); | ||
Ag_Dst.Set_Tasks (T); | ||
Dst.Set_Agent (Ag_Dst); | ||
end; | ||
else | ||
Dst.Set_Agent (Ag_Src); | ||
end if; | ||
end Do_It; | ||
|
||
begin | ||
Agents.Iterate (Do_It'Access); | ||
end Concatenate; | ||
|
||
end Agpl.Cr.Assignment.Utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
------------------------------------------------------------------------------ | ||
-- AGPL -- | ||
-- -- | ||
-- Copyright (C) 2003 -- | ||
-- A. Mosteo. -- | ||
-- -- | ||
-- Authors: A. Mosteo. (public@mosteo.com) -- | ||
-- -- | ||
-- If you have any questions in regard to this software, please address -- | ||
-- them to the above email. -- | ||
-- -- | ||
-- 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 library; if not, write to the Free Software Foundation, -- | ||
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- | ||
------------------------------------------------------------------------------ | ||
|
||
package Agpl.Cr.Assignment.Utils is | ||
|
||
pragma Preelaborate; | ||
|
||
procedure Concatenate (Dst : in out Object; Src : Object); | ||
|
||
end Agpl.Cr.Assignment.Utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pragma Warnings (Off); | ||
with Agpl.Cr.Agent.Containers; | ||
with Agpl.Cr.Agent.Utils; | ||
with Agpl.Htn.Tasks.Containers; | ||
with Agpl.Htn.Tasks.Utils; | ||
|
||
with Ada.Containers.Indefinite_Ordered_Maps; | ||
|
||
package Agpl.Cr.Containers is | ||
|
||
pragma Preelaborate; | ||
|
||
package Agent_Containers renames Agpl.Cr.Agent.Containers; | ||
package Agent_Lists renames Agent.Containers.Lists; | ||
package Agent_Maps renames Agent.Containers.Maps; | ||
package Agent_Vectors renames Agent.Containers.Vectors; | ||
package Agent_Utils renames Agent.Utils; | ||
|
||
package Task_Containers renames Agpl.Htn.Tasks.Containers; | ||
package Task_Lists renames Agpl.Htn.Tasks.Containers.Lists; | ||
package Task_Maps renames Agpl.Htn.Tasks.Containers.Maps; | ||
package Task_Vectors renames Agpl.Htn.Tasks.Containers.Vectors; | ||
package Task_Utils renames Agpl.Htn.Tasks.Utils; | ||
|
||
package String_Cost_Maps is new | ||
Ada.Containers.Indefinite_Ordered_Maps (String, Costs); | ||
|
||
end Agpl.Cr.Containers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
------------------------------------------------------------------------------ | ||
-- AGPL -- | ||
-- -- | ||
-- Copyright (C) 2003 -- | ||
-- A. Mosteo. -- | ||
-- -- | ||
-- Authors: A. Mosteo. (public@mosteo.com) -- | ||
-- -- | ||
-- If you have any questions in regard to this software, please address -- | ||
-- them to the above email. -- | ||
-- -- | ||
-- 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 library; if not, write to the Free Software Foundation, -- | ||
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- | ||
------------------------------------------------------------------------------ | ||
|
||
-- A generic interface for cost caching strategies. | ||
|
||
with Agpl.Generic_Handle; | ||
|
||
package Agpl.Cr.Cost_Cache.Handle is new | ||
Agpl.Generic_Handle (Object'Class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
with Agpl.Cr.Agent.Dummy; | ||
|
||
package body Agpl.Cr.Cost_Cache is | ||
|
||
------------------- | ||
-- Get_Plan_Cost -- | ||
------------------- | ||
|
||
function Get_Plan_Cost | ||
(This : in Object'Class; | ||
Agent : in Cr.Agent.Object'Class) | ||
return Costs | ||
is | ||
T : constant Htn.Tasks.Containers.Lists.List := Agent.Get_Tasks; | ||
Prev : Htn.Tasks.Task_Id := Htn.Tasks.No_Task; | ||
use Htn.Tasks.Containers.Lists; | ||
|
||
Total, | ||
Partial : Cr.Costs := 0.0; | ||
I : Htn.Tasks.Containers.Lists.Cursor := T.First; | ||
begin | ||
while Has_Element (I) loop | ||
Partial := Get_Cost (This, | ||
Cr.Agent.Get_Name (Agent), | ||
Prev, Htn.Tasks.Get_Id (Element (I))); | ||
if Partial = Cr.Infinite then | ||
Total := Infinite; | ||
else | ||
Total := Total + Partial; | ||
end if; | ||
exit when Partial = Cr.Infinite; | ||
Prev := Htn.Tasks.Get_Id (Element (I)); | ||
Next (I); | ||
end loop; | ||
return Total; | ||
end Get_Plan_Cost; | ||
|
||
------------------- | ||
-- Get_Plan_Cost -- | ||
------------------- | ||
|
||
function Get_Plan_Cost | ||
(This : in Object'Class; | ||
Agent : in String; | ||
Tasks : in Htn.Tasks.Containers.Lists.List) | ||
return Costs | ||
is | ||
Ag : Cr.Agent.Dummy.Object; | ||
begin | ||
Ag.Set_Name (Agent); | ||
Ag.Set_Tasks (Tasks); | ||
return Get_Plan_Cost (This, Ag); | ||
end Get_Plan_Cost; | ||
|
||
end Agpl.Cr.Cost_Cache; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
------------------------------------------------------------------------------ | ||
-- AGPL -- | ||
-- -- | ||
-- Copyright (C) 2003 -- | ||
-- A. Mosteo. -- | ||
-- -- | ||
-- Authors: A. Mosteo. (public@mosteo.com) -- | ||
-- -- | ||
-- If you have any questions in regard to this software, please address -- | ||
-- them to the above email. -- | ||
-- -- | ||
-- 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 library; if not, write to the Free Software Foundation, -- | ||
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- | ||
------------------------------------------------------------------------------ | ||
|
||
-- A generic interface for cost caching strategies. | ||
|
||
with Agpl.Cr.Agent; | ||
with Agpl.Htn.Tasks; | ||
with Agpl.Htn.Tasks.Containers; | ||
|
||
package Agpl.Cr.Cost_Cache is | ||
|
||
pragma Preelaborate; | ||
|
||
-- type Object is interface; | ||
type Object is abstract tagged null record; | ||
|
||
function Get_Cost | ||
(This : in Object; | ||
Agent : in String; | ||
Ini : in Htn.Tasks.Task_Id; | ||
Fin : in Htn.Tasks.Task_Id) return Costs is abstract; | ||
|
||
function Get_Plan_Cost | ||
(This : in Object'Class; | ||
Agent : in Cr.Agent.Object'Class) return Costs; | ||
-- Say the full cost of an agent plan. | ||
|
||
function Get_Plan_Cost | ||
(This : in Object'Class; | ||
Agent : in String; | ||
Tasks : in Htn.Tasks.Containers.Lists.List) return Costs; | ||
-- Evaluate a plan with a given agent | ||
|
||
end Agpl.Cr.Cost_Cache; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.