[Avida-cvs] [Avida2-svn] r332 - in trunk: Avida2.xcodeproj source/bindings/Boost.Python source/cpu source/event source/main source/testsuites/unit_testsuites source/viewers
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Thu Oct 6 16:20:33 PDT 2005
Author: brysonda
Date: 2005-10-06 19:02:07 -0400 (Thu, 06 Oct 2005)
New Revision: 332
Added:
trunk/source/main/avida.h
trunk/source/main/cReaction.cc
trunk/source/main/cReaction.h
trunk/source/main/cReactionLib.cc
trunk/source/main/cReactionLib.h
trunk/source/main/cReactionProcess.cc
trunk/source/main/cReactionProcess.h
trunk/source/main/cReactionRequisite.cc
trunk/source/main/cReactionRequisite.h
trunk/source/main/cReactionResult.cc
trunk/source/main/cReactionResult.h
trunk/source/main/cResource.cc
trunk/source/main/cResource.h
trunk/source/main/cResourceCount.cc
trunk/source/main/cResourceCount.h
trunk/source/main/cResourceLib.cc
trunk/source/main/cResourceLib.h
trunk/source/main/cSpatialCountElem.cc
trunk/source/main/cSpatialCountElem.h
trunk/source/main/cSpatialResCount.cc
trunk/source/main/cSpatialResCount.h
trunk/source/main/cSpecies.cc
trunk/source/main/cSpecies.h
trunk/source/main/cSpeciesControl.cc
trunk/source/main/cSpeciesControl.h
trunk/source/main/cSpeciesQueue.cc
trunk/source/main/cSpeciesQueue.h
trunk/source/main/cStats.cc
trunk/source/main/cStats.h
trunk/source/main/cTaskEntry.cc
trunk/source/main/cTaskEntry.h
trunk/source/main/cTaskLib.cc
trunk/source/main/cTaskLib.h
Removed:
trunk/source/main/avida.hh
trunk/source/main/reaction.cc
trunk/source/main/reaction.hh
trunk/source/main/reaction_lib.cc
trunk/source/main/reaction_lib.hh
trunk/source/main/reaction_process.cc
trunk/source/main/reaction_process.hh
trunk/source/main/reaction_requisite.cc
trunk/source/main/reaction_requisite.hh
trunk/source/main/reaction_result.cc
trunk/source/main/reaction_result.hh
trunk/source/main/resource.cc
trunk/source/main/resource.hh
trunk/source/main/resource_count.cc
trunk/source/main/resource_count.hh
trunk/source/main/resource_lib.cc
trunk/source/main/resource_lib.hh
trunk/source/main/spatial_count_elem.cc
trunk/source/main/spatial_count_elem.hh
trunk/source/main/spatial_res_count.cc
trunk/source/main/spatial_res_count.hh
trunk/source/main/species.cc
trunk/source/main/species.hh
trunk/source/main/species_control.cc
trunk/source/main/species_control.hh
trunk/source/main/species_queue.cc
trunk/source/main/species_queue.hh
trunk/source/main/stats.cc
trunk/source/main/stats.hh
trunk/source/main/task_entry.cc
trunk/source/main/task_entry.hh
trunk/source/main/task_lib.cc
trunk/source/main/task_lib.hh
Modified:
trunk/Avida2.xcodeproj/project.pbxproj
trunk/source/bindings/Boost.Python/avida-fixups.hh
trunk/source/bindings/Boost.Python/environment.pyste
trunk/source/bindings/Boost.Python/genebank.pyste
trunk/source/bindings/Boost.Python/genotype.pyste
trunk/source/bindings/Boost.Python/genotype_birth_data.pyste
trunk/source/bindings/Boost.Python/inject_genebank.pyste
trunk/source/bindings/Boost.Python/lineage_control.pyste
trunk/source/bindings/Boost.Python/reaction.pyste
trunk/source/bindings/Boost.Python/reaction_lib.pyste
trunk/source/bindings/Boost.Python/reaction_process.pyste
trunk/source/bindings/Boost.Python/reaction_requisite.pyste
trunk/source/bindings/Boost.Python/reaction_result.pyste
trunk/source/bindings/Boost.Python/resource.pyste
trunk/source/bindings/Boost.Python/resource_count-fixups.hh
trunk/source/bindings/Boost.Python/resource_lib.pyste
trunk/source/bindings/Boost.Python/spatial_count_elem.pyste
trunk/source/bindings/Boost.Python/spatial_res_count.pyste
trunk/source/bindings/Boost.Python/species.pyste
trunk/source/bindings/Boost.Python/species_control.pyste
trunk/source/bindings/Boost.Python/species_queue.pyste
trunk/source/bindings/Boost.Python/stats.pyste
trunk/source/bindings/Boost.Python/tList_instantiations.hh
trunk/source/bindings/Boost.Python/task_entry.pyste
trunk/source/bindings/Boost.Python/task_lib.pyste
trunk/source/bindings/Boost.Python/test_cpu.pyste
trunk/source/cpu/cTestCPU.cc
trunk/source/cpu/cTestCPU.h
trunk/source/cpu/cTestUtil.cc
trunk/source/event/cPopulationEventFactory.cc
trunk/source/main/CMakeLists.txt
trunk/source/main/avida.cc
trunk/source/main/cAnalyze.cc
trunk/source/main/cAnalyzeUtil.cc
trunk/source/main/cAvidaTriggers.h
trunk/source/main/cCallbackUtil.cc
trunk/source/main/cEnvironment.cc
trunk/source/main/cEnvironment.h
trunk/source/main/cFitnessMatrix.h
trunk/source/main/cGenebank.cc
trunk/source/main/cGenebank.h
trunk/source/main/cInjectGenebank.cc
trunk/source/main/cLandscape.cc
trunk/source/main/cLineageControl.cc
trunk/source/main/cPhenotype.cc
trunk/source/main/cPopulation.cc
trunk/source/main/cPopulation.h
trunk/source/main/main_sub.pri
trunk/source/main/primitive.cc
trunk/source/testsuites/unit_testsuites/avida.t.cc
trunk/source/testsuites/unit_testsuites/reaction.t.cc
trunk/source/testsuites/unit_testsuites/reaction_lib.t.cc
trunk/source/testsuites/unit_testsuites/reaction_process.t.cc
trunk/source/testsuites/unit_testsuites/reaction_result.t.cc
trunk/source/testsuites/unit_testsuites/resource.t.cc
trunk/source/testsuites/unit_testsuites/resource_count.t.cc
trunk/source/testsuites/unit_testsuites/resource_lib.t.cc
trunk/source/testsuites/unit_testsuites/spatial_count_elem.t.cc
trunk/source/testsuites/unit_testsuites/spatial_res_count.t.cc
trunk/source/testsuites/unit_testsuites/species.t.cc
trunk/source/testsuites/unit_testsuites/species_control.t.cc
trunk/source/testsuites/unit_testsuites/species_queue.t.cc
trunk/source/testsuites/unit_testsuites/stats.t.cc
trunk/source/testsuites/unit_testsuites/task_entry.t.cc
trunk/source/testsuites/unit_testsuites/task_lib.t.cc
trunk/source/viewers/bar_screen.cc
trunk/source/viewers/environment_screen.cc
trunk/source/viewers/hist_screen.cc
trunk/source/viewers/stats_screen.cc
trunk/source/viewers/symbol_util.cc
trunk/source/viewers/text_screen.cc
trunk/source/viewers/view.cc
trunk/source/viewers/viewer.hh
trunk/source/viewers/zoom_screen.cc
Log:
Finish renaming class files in main.
Modified: trunk/Avida2.xcodeproj/project.pbxproj
===================================================================
--- trunk/Avida2.xcodeproj/project.pbxproj 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/Avida2.xcodeproj/project.pbxproj 2005-10-06 23:02:07 UTC (rev 332)
@@ -9,22 +9,6 @@
/* Begin PBXBuildFile section */
700E2996085A1F6000CF158A /* primitive in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC3164D07626CF3008F7A48 /* primitive */; };
700E2AF8085DE50C00CF158A /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
- 700E2B1F085DE50C00CF158A /* reaction.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3110B0762539E008F7A48 /* reaction.cc */; };
- 700E2B20085DE50C00CF158A /* reaction_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3110D0762539E008F7A48 /* reaction_lib.cc */; };
- 700E2B21085DE50C00CF158A /* reaction_process.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311100762539E008F7A48 /* reaction_process.cc */; };
- 700E2B22085DE50C00CF158A /* reaction_requisite.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311120762539E008F7A48 /* reaction_requisite.cc */; };
- 700E2B23085DE50C00CF158A /* reaction_result.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311140762539E008F7A48 /* reaction_result.cc */; };
- 700E2B24085DE50C00CF158A /* resource.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311160762539E008F7A48 /* resource.cc */; };
- 700E2B25085DE50C00CF158A /* resource_count.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311180762539E008F7A48 /* resource_count.cc */; };
- 700E2B26085DE50C00CF158A /* resource_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3111B0762539E008F7A48 /* resource_lib.cc */; };
- 700E2B27085DE50C00CF158A /* spatial_count_elem.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3111E0762539E008F7A48 /* spatial_count_elem.cc */; };
- 700E2B28085DE50C00CF158A /* spatial_res_count.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311200762539E008F7A48 /* spatial_res_count.cc */; };
- 700E2B29085DE50C00CF158A /* species.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311220762539E008F7A48 /* species.cc */; };
- 700E2B2A085DE50C00CF158A /* species_control.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311240762539E008F7A48 /* species_control.cc */; };
- 700E2B2B085DE50C00CF158A /* species_queue.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311260762539E008F7A48 /* species_queue.cc */; };
- 700E2B2C085DE50C00CF158A /* stats.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311280762539E008F7A48 /* stats.cc */; };
- 700E2B2D085DE50C00CF158A /* task_entry.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112A0762539E008F7A48 /* task_entry.cc */; };
- 700E2B2E085DE50C00CF158A /* task_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112C0762539E008F7A48 /* task_lib.cc */; };
700E2B43085DE50C00CF158A /* weighted_index.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315B3076253A5008F7A48 /* weighted_index.cc */; };
700E2B44085DE50C00CF158A /* tools.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315AA076253A4008F7A48 /* tools.cc */; };
700E2B45085DE50C00CF158A /* block_struct.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC31545076253A4008F7A48 /* block_struct.cc */; };
@@ -155,6 +139,38 @@
70B0869208F49EA800FC65FE /* cPopulationCell.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868A08F49EA800FC65FE /* cPopulationCell.cc */; };
70B0869D08F49F4800FC65FE /* cPhenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0869C08F49F4800FC65FE /* cPhenotype.cc */; };
70B0869E08F49F4800FC65FE /* cPhenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0869C08F49F4800FC65FE /* cPhenotype.cc */; };
+ 70B0872E08F5E82D00FC65FE /* cReaction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0871E08F5E82D00FC65FE /* cReaction.cc */; };
+ 70B0872F08F5E82D00FC65FE /* cReactionLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0871F08F5E82D00FC65FE /* cReactionLib.cc */; };
+ 70B0873008F5E82D00FC65FE /* cReactionProcess.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872008F5E82D00FC65FE /* cReactionProcess.cc */; };
+ 70B0873108F5E82D00FC65FE /* cReactionRequisite.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872108F5E82D00FC65FE /* cReactionRequisite.cc */; };
+ 70B0873208F5E82D00FC65FE /* cReactionResult.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872208F5E82D00FC65FE /* cReactionResult.cc */; };
+ 70B0873308F5E82D00FC65FE /* cResource.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872308F5E82D00FC65FE /* cResource.cc */; };
+ 70B0873408F5E82D00FC65FE /* cResourceCount.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872408F5E82D00FC65FE /* cResourceCount.cc */; };
+ 70B0873508F5E82D00FC65FE /* cResourceLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872508F5E82D00FC65FE /* cResourceLib.cc */; };
+ 70B0873608F5E82D00FC65FE /* cSpatialCountElem.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872608F5E82D00FC65FE /* cSpatialCountElem.cc */; };
+ 70B0873708F5E82D00FC65FE /* cSpatialResCount.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872708F5E82D00FC65FE /* cSpatialResCount.cc */; };
+ 70B0873808F5E82D00FC65FE /* cSpecies.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872808F5E82D00FC65FE /* cSpecies.cc */; };
+ 70B0873908F5E82D00FC65FE /* cSpeciesControl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872908F5E82D00FC65FE /* cSpeciesControl.cc */; };
+ 70B0873A08F5E82D00FC65FE /* cSpeciesQueue.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872A08F5E82D00FC65FE /* cSpeciesQueue.cc */; };
+ 70B0873B08F5E82D00FC65FE /* cStats.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872B08F5E82D00FC65FE /* cStats.cc */; };
+ 70B0873C08F5E82D00FC65FE /* cTaskEntry.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872C08F5E82D00FC65FE /* cTaskEntry.cc */; };
+ 70B0873D08F5E82D00FC65FE /* cTaskLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872D08F5E82D00FC65FE /* cTaskLib.cc */; };
+ 70B0873E08F5E82D00FC65FE /* cReaction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0871E08F5E82D00FC65FE /* cReaction.cc */; };
+ 70B0873F08F5E82D00FC65FE /* cReactionLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0871F08F5E82D00FC65FE /* cReactionLib.cc */; };
+ 70B0874008F5E82D00FC65FE /* cReactionProcess.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872008F5E82D00FC65FE /* cReactionProcess.cc */; };
+ 70B0874108F5E82D00FC65FE /* cReactionRequisite.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872108F5E82D00FC65FE /* cReactionRequisite.cc */; };
+ 70B0874208F5E82D00FC65FE /* cReactionResult.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872208F5E82D00FC65FE /* cReactionResult.cc */; };
+ 70B0874308F5E82D00FC65FE /* cResource.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872308F5E82D00FC65FE /* cResource.cc */; };
+ 70B0874408F5E82D00FC65FE /* cResourceCount.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872408F5E82D00FC65FE /* cResourceCount.cc */; };
+ 70B0874508F5E82D00FC65FE /* cResourceLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872508F5E82D00FC65FE /* cResourceLib.cc */; };
+ 70B0874608F5E82D00FC65FE /* cSpatialCountElem.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872608F5E82D00FC65FE /* cSpatialCountElem.cc */; };
+ 70B0874708F5E82D00FC65FE /* cSpatialResCount.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872708F5E82D00FC65FE /* cSpatialResCount.cc */; };
+ 70B0874808F5E82D00FC65FE /* cSpecies.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872808F5E82D00FC65FE /* cSpecies.cc */; };
+ 70B0874908F5E82D00FC65FE /* cSpeciesControl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872908F5E82D00FC65FE /* cSpeciesControl.cc */; };
+ 70B0874A08F5E82D00FC65FE /* cSpeciesQueue.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872A08F5E82D00FC65FE /* cSpeciesQueue.cc */; };
+ 70B0874B08F5E82D00FC65FE /* cStats.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872B08F5E82D00FC65FE /* cStats.cc */; };
+ 70B0874C08F5E82D00FC65FE /* cTaskEntry.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872C08F5E82D00FC65FE /* cTaskEntry.cc */; };
+ 70B0874D08F5E82D00FC65FE /* cTaskLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0872D08F5E82D00FC65FE /* cTaskLib.cc */; };
70C1EF4808C393BA00F50912 /* cCodeLabel.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70C1EF4608C393BA00F50912 /* cCodeLabel.cc */; };
70C1EF4A08C393BA00F50912 /* cCodeLabel.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70C1EF4608C393BA00F50912 /* cCodeLabel.cc */; };
70C1EF5908C3948C00F50912 /* cCPUMemory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70C1EF5808C3948C00F50912 /* cCPUMemory.cc */; };
@@ -238,22 +254,6 @@
70D46935085F61DD004C8409 /* trionan.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31471076253A1008F7A48 /* trionan.c */; };
70D46936085F61DF004C8409 /* triostr.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31474076253A1008F7A48 /* triostr.c */; };
DCC3166107628531008F7A48 /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
- DCC3168807628577008F7A48 /* reaction.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3110B0762539E008F7A48 /* reaction.cc */; };
- DCC3168907628578008F7A48 /* reaction_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3110D0762539E008F7A48 /* reaction_lib.cc */; };
- DCC3168A0762857A008F7A48 /* reaction_process.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311100762539E008F7A48 /* reaction_process.cc */; };
- DCC3168B0762857A008F7A48 /* reaction_requisite.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311120762539E008F7A48 /* reaction_requisite.cc */; };
- DCC3168C0762857B008F7A48 /* reaction_result.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311140762539E008F7A48 /* reaction_result.cc */; };
- DCC3168D0762857C008F7A48 /* resource.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311160762539E008F7A48 /* resource.cc */; };
- DCC3168E0762857D008F7A48 /* resource_count.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311180762539E008F7A48 /* resource_count.cc */; };
- DCC3168F0762857F008F7A48 /* resource_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3111B0762539E008F7A48 /* resource_lib.cc */; };
- DCC316900762857F008F7A48 /* spatial_count_elem.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3111E0762539E008F7A48 /* spatial_count_elem.cc */; };
- DCC3169107628580008F7A48 /* spatial_res_count.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311200762539E008F7A48 /* spatial_res_count.cc */; };
- DCC3169207628581008F7A48 /* species.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311220762539E008F7A48 /* species.cc */; };
- DCC3169307628582008F7A48 /* species_control.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311240762539E008F7A48 /* species_control.cc */; };
- DCC3169407628583008F7A48 /* species_queue.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311260762539E008F7A48 /* species_queue.cc */; };
- DCC3169507628584008F7A48 /* stats.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311280762539E008F7A48 /* stats.cc */; };
- DCC3169607628585008F7A48 /* task_entry.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112A0762539E008F7A48 /* task_entry.cc */; };
- DCC3169707628585008F7A48 /* task_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112C0762539E008F7A48 /* task_lib.cc */; };
DCC316B807628742008F7A48 /* weighted_index.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315B3076253A5008F7A48 /* weighted_index.cc */; };
DCC316B907628744008F7A48 /* tools.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315AA076253A4008F7A48 /* tools.cc */; };
DCC316BA07628749008F7A48 /* block_struct.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC31545076253A4008F7A48 /* block_struct.cc */; };
@@ -441,6 +441,39 @@
70B0868A08F49EA800FC65FE /* cPopulationCell.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPopulationCell.cc; sourceTree = "<group>"; };
70B0869B08F49F3900FC65FE /* cPhenotype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPhenotype.h; sourceTree = "<group>"; };
70B0869C08F49F4800FC65FE /* cPhenotype.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPhenotype.cc; sourceTree = "<group>"; };
+ 70B086BE08F5D86100FC65FE /* avida.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = avida.h; sourceTree = "<group>"; };
+ 70B0870E08F5E81000FC65FE /* cReaction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cReaction.h; sourceTree = "<group>"; };
+ 70B0870F08F5E81000FC65FE /* cReactionLib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cReactionLib.h; sourceTree = "<group>"; };
+ 70B0871008F5E81000FC65FE /* cReactionProcess.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cReactionProcess.h; sourceTree = "<group>"; };
+ 70B0871108F5E81000FC65FE /* cReactionRequisite.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cReactionRequisite.h; sourceTree = "<group>"; };
+ 70B0871208F5E81000FC65FE /* cReactionResult.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cReactionResult.h; sourceTree = "<group>"; };
+ 70B0871308F5E81000FC65FE /* cResource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cResource.h; sourceTree = "<group>"; };
+ 70B0871408F5E81000FC65FE /* cResourceCount.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cResourceCount.h; sourceTree = "<group>"; };
+ 70B0871508F5E81000FC65FE /* cResourceLib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cResourceLib.h; sourceTree = "<group>"; };
+ 70B0871608F5E81000FC65FE /* cSpatialCountElem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSpatialCountElem.h; sourceTree = "<group>"; };
+ 70B0871708F5E81000FC65FE /* cSpatialResCount.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSpatialResCount.h; sourceTree = "<group>"; };
+ 70B0871808F5E81000FC65FE /* cSpecies.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSpecies.h; sourceTree = "<group>"; };
+ 70B0871908F5E81000FC65FE /* cSpeciesControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSpeciesControl.h; sourceTree = "<group>"; };
+ 70B0871A08F5E81000FC65FE /* cSpeciesQueue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSpeciesQueue.h; sourceTree = "<group>"; };
+ 70B0871B08F5E81000FC65FE /* cStats.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cStats.h; sourceTree = "<group>"; };
+ 70B0871C08F5E81000FC65FE /* cTaskEntry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTaskEntry.h; sourceTree = "<group>"; };
+ 70B0871D08F5E81000FC65FE /* cTaskLib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTaskLib.h; sourceTree = "<group>"; };
+ 70B0871E08F5E82D00FC65FE /* cReaction.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cReaction.cc; sourceTree = "<group>"; };
+ 70B0871F08F5E82D00FC65FE /* cReactionLib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cReactionLib.cc; sourceTree = "<group>"; };
+ 70B0872008F5E82D00FC65FE /* cReactionProcess.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cReactionProcess.cc; sourceTree = "<group>"; };
+ 70B0872108F5E82D00FC65FE /* cReactionRequisite.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cReactionRequisite.cc; sourceTree = "<group>"; };
+ 70B0872208F5E82D00FC65FE /* cReactionResult.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cReactionResult.cc; sourceTree = "<group>"; };
+ 70B0872308F5E82D00FC65FE /* cResource.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cResource.cc; sourceTree = "<group>"; };
+ 70B0872408F5E82D00FC65FE /* cResourceCount.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cResourceCount.cc; sourceTree = "<group>"; };
+ 70B0872508F5E82D00FC65FE /* cResourceLib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cResourceLib.cc; sourceTree = "<group>"; };
+ 70B0872608F5E82D00FC65FE /* cSpatialCountElem.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSpatialCountElem.cc; sourceTree = "<group>"; };
+ 70B0872708F5E82D00FC65FE /* cSpatialResCount.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSpatialResCount.cc; sourceTree = "<group>"; };
+ 70B0872808F5E82D00FC65FE /* cSpecies.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSpecies.cc; sourceTree = "<group>"; };
+ 70B0872908F5E82D00FC65FE /* cSpeciesControl.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSpeciesControl.cc; sourceTree = "<group>"; };
+ 70B0872A08F5E82D00FC65FE /* cSpeciesQueue.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSpeciesQueue.cc; sourceTree = "<group>"; };
+ 70B0872B08F5E82D00FC65FE /* cStats.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cStats.cc; sourceTree = "<group>"; };
+ 70B0872C08F5E82D00FC65FE /* cTaskEntry.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTaskEntry.cc; sourceTree = "<group>"; };
+ 70B0872D08F5E82D00FC65FE /* cTaskLib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTaskLib.cc; sourceTree = "<group>"; };
70C1EF4608C393BA00F50912 /* cCodeLabel.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cCodeLabel.cc; sourceTree = "<group>"; };
70C1EF4708C393BA00F50912 /* cCodeLabel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cCodeLabel.h; sourceTree = "<group>"; };
70C1EF5808C3948C00F50912 /* cCPUMemory.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cCPUMemory.cc; sourceTree = "<group>"; };
@@ -950,47 +983,14 @@
DCC30FEB0762539D008F7A48 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
DCC30FF00762539D008F7A48 /* event.pri */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = event.pri; sourceTree = "<group>"; };
DCC3109C0762539E008F7A48 /* avida.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = avida.cc; sourceTree = "<group>"; };
- DCC3109D0762539E008F7A48 /* avida.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = avida.hh; sourceTree = "<group>"; };
DCC310A90762539E008F7A48 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
DCC310F00762539E008F7A48 /* main.pro */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = main.pro; sourceTree = "<group>"; };
DCC310F10762539E008F7A48 /* main_sub.pri */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = main_sub.pri; sourceTree = "<group>"; };
DCC311090762539E008F7A48 /* primitive.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = primitive.cc; sourceTree = "<group>"; };
DCC3110A0762539E008F7A48 /* primitive.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = primitive.hh; sourceTree = "<group>"; };
- DCC3110B0762539E008F7A48 /* reaction.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reaction.cc; sourceTree = "<group>"; };
- DCC3110C0762539E008F7A48 /* reaction.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction.hh; sourceTree = "<group>"; };
- DCC3110D0762539E008F7A48 /* reaction_lib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reaction_lib.cc; sourceTree = "<group>"; };
- DCC3110E0762539E008F7A48 /* reaction_lib.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction_lib.hh; sourceTree = "<group>"; };
DCC3110F0762539E008F7A48 /* reaction_macros.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction_macros.hh; sourceTree = "<group>"; };
- DCC311100762539E008F7A48 /* reaction_process.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reaction_process.cc; sourceTree = "<group>"; };
- DCC311110762539E008F7A48 /* reaction_process.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction_process.hh; sourceTree = "<group>"; };
- DCC311120762539E008F7A48 /* reaction_requisite.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reaction_requisite.cc; sourceTree = "<group>"; };
- DCC311130762539E008F7A48 /* reaction_requisite.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction_requisite.hh; sourceTree = "<group>"; };
- DCC311140762539E008F7A48 /* reaction_result.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reaction_result.cc; sourceTree = "<group>"; };
- DCC311150762539E008F7A48 /* reaction_result.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = reaction_result.hh; sourceTree = "<group>"; };
- DCC311160762539E008F7A48 /* resource.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = resource.cc; sourceTree = "<group>"; };
- DCC311170762539E008F7A48 /* resource.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = resource.hh; sourceTree = "<group>"; };
- DCC311180762539E008F7A48 /* resource_count.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = resource_count.cc; sourceTree = "<group>"; };
- DCC311190762539E008F7A48 /* resource_count.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = resource_count.hh; sourceTree = "<group>"; };
DCC3111A0762539E008F7A48 /* resource_count_macros.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = resource_count_macros.hh; sourceTree = "<group>"; };
- DCC3111B0762539E008F7A48 /* resource_lib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = resource_lib.cc; sourceTree = "<group>"; };
- DCC3111C0762539E008F7A48 /* resource_lib.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = resource_lib.hh; sourceTree = "<group>"; };
DCC3111D0762539E008F7A48 /* resource_macros.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = resource_macros.hh; sourceTree = "<group>"; };
- DCC3111E0762539E008F7A48 /* spatial_count_elem.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = spatial_count_elem.cc; sourceTree = "<group>"; };
- DCC3111F0762539E008F7A48 /* spatial_count_elem.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = spatial_count_elem.hh; sourceTree = "<group>"; };
- DCC311200762539E008F7A48 /* spatial_res_count.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = spatial_res_count.cc; sourceTree = "<group>"; };
- DCC311210762539E008F7A48 /* spatial_res_count.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = spatial_res_count.hh; sourceTree = "<group>"; };
- DCC311220762539E008F7A48 /* species.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = species.cc; sourceTree = "<group>"; };
- DCC311230762539E008F7A48 /* species.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = species.hh; sourceTree = "<group>"; };
- DCC311240762539E008F7A48 /* species_control.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = species_control.cc; sourceTree = "<group>"; };
- DCC311250762539E008F7A48 /* species_control.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = species_control.hh; sourceTree = "<group>"; };
- DCC311260762539E008F7A48 /* species_queue.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = species_queue.cc; sourceTree = "<group>"; };
- DCC311270762539E008F7A48 /* species_queue.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = species_queue.hh; sourceTree = "<group>"; };
- DCC311280762539E008F7A48 /* stats.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stats.cc; sourceTree = "<group>"; };
- DCC311290762539E008F7A48 /* stats.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = stats.hh; sourceTree = "<group>"; };
- DCC3112A0762539E008F7A48 /* task_entry.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_entry.cc; sourceTree = "<group>"; };
- DCC3112B0762539E008F7A48 /* task_entry.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = task_entry.hh; sourceTree = "<group>"; };
- DCC3112C0762539E008F7A48 /* task_lib.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_lib.cc; sourceTree = "<group>"; };
- DCC3112D0762539E008F7A48 /* task_lib.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = task_lib.hh; sourceTree = "<group>"; };
DCC311390762539E008F7A48 /* modules.pri */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = modules.pri; sourceTree = "<group>"; };
DCC3114B0762539E008F7A48 /* analyze.cfg */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = analyze.cfg; sourceTree = "<group>"; };
DCC3114C0762539E008F7A48 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
@@ -2038,6 +2038,39 @@
DCC310040762539D008F7A48 /* main */ = {
isa = PBXGroup;
children = (
+ 70B0871E08F5E82D00FC65FE /* cReaction.cc */,
+ 70B0871F08F5E82D00FC65FE /* cReactionLib.cc */,
+ 70B0872008F5E82D00FC65FE /* cReactionProcess.cc */,
+ 70B0872108F5E82D00FC65FE /* cReactionRequisite.cc */,
+ 70B0872208F5E82D00FC65FE /* cReactionResult.cc */,
+ 70B0872308F5E82D00FC65FE /* cResource.cc */,
+ 70B0872408F5E82D00FC65FE /* cResourceCount.cc */,
+ 70B0872508F5E82D00FC65FE /* cResourceLib.cc */,
+ 70B0872608F5E82D00FC65FE /* cSpatialCountElem.cc */,
+ 70B0872708F5E82D00FC65FE /* cSpatialResCount.cc */,
+ 70B0872808F5E82D00FC65FE /* cSpecies.cc */,
+ 70B0872908F5E82D00FC65FE /* cSpeciesControl.cc */,
+ 70B0872A08F5E82D00FC65FE /* cSpeciesQueue.cc */,
+ 70B0872B08F5E82D00FC65FE /* cStats.cc */,
+ 70B0872C08F5E82D00FC65FE /* cTaskEntry.cc */,
+ 70B0872D08F5E82D00FC65FE /* cTaskLib.cc */,
+ 70B0870E08F5E81000FC65FE /* cReaction.h */,
+ 70B0870F08F5E81000FC65FE /* cReactionLib.h */,
+ 70B0871008F5E81000FC65FE /* cReactionProcess.h */,
+ 70B0871108F5E81000FC65FE /* cReactionRequisite.h */,
+ 70B0871208F5E81000FC65FE /* cReactionResult.h */,
+ 70B0871308F5E81000FC65FE /* cResource.h */,
+ 70B0871408F5E81000FC65FE /* cResourceCount.h */,
+ 70B0871508F5E81000FC65FE /* cResourceLib.h */,
+ 70B0871608F5E81000FC65FE /* cSpatialCountElem.h */,
+ 70B0871708F5E81000FC65FE /* cSpatialResCount.h */,
+ 70B0871808F5E81000FC65FE /* cSpecies.h */,
+ 70B0871908F5E81000FC65FE /* cSpeciesControl.h */,
+ 70B0871A08F5E81000FC65FE /* cSpeciesQueue.h */,
+ 70B0871B08F5E81000FC65FE /* cStats.h */,
+ 70B0871C08F5E81000FC65FE /* cTaskEntry.h */,
+ 70B0871D08F5E81000FC65FE /* cTaskLib.h */,
+ 70B086BE08F5D86100FC65FE /* avida.h */,
70B0869C08F49F4800FC65FE /* cPhenotype.cc */,
70B0869B08F49F3900FC65FE /* cPhenotype.h */,
70B0868708F49EA800FC65FE /* cOrganism.cc */,
@@ -2133,48 +2166,15 @@
702D4EF508DA5328007BA469 /* cEnvironment.h */,
702D4EF608DA5328007BA469 /* cPopulationInterface.h */,
DCC3109C0762539E008F7A48 /* avida.cc */,
- DCC3109D0762539E008F7A48 /* avida.hh */,
DCC310A90762539E008F7A48 /* CMakeLists.txt */,
DCC310B00762539E008F7A48 /* functional_testsuites */,
DCC310F00762539E008F7A48 /* main.pro */,
DCC310F10762539E008F7A48 /* main_sub.pri */,
DCC311090762539E008F7A48 /* primitive.cc */,
DCC3110A0762539E008F7A48 /* primitive.hh */,
- DCC3110B0762539E008F7A48 /* reaction.cc */,
- DCC3110C0762539E008F7A48 /* reaction.hh */,
- DCC3110D0762539E008F7A48 /* reaction_lib.cc */,
- DCC3110E0762539E008F7A48 /* reaction_lib.hh */,
DCC3110F0762539E008F7A48 /* reaction_macros.hh */,
- DCC311100762539E008F7A48 /* reaction_process.cc */,
- DCC311110762539E008F7A48 /* reaction_process.hh */,
- DCC311120762539E008F7A48 /* reaction_requisite.cc */,
- DCC311130762539E008F7A48 /* reaction_requisite.hh */,
- DCC311140762539E008F7A48 /* reaction_result.cc */,
- DCC311150762539E008F7A48 /* reaction_result.hh */,
- DCC311160762539E008F7A48 /* resource.cc */,
- DCC311170762539E008F7A48 /* resource.hh */,
- DCC311180762539E008F7A48 /* resource_count.cc */,
- DCC311190762539E008F7A48 /* resource_count.hh */,
DCC3111A0762539E008F7A48 /* resource_count_macros.hh */,
- DCC3111B0762539E008F7A48 /* resource_lib.cc */,
- DCC3111C0762539E008F7A48 /* resource_lib.hh */,
DCC3111D0762539E008F7A48 /* resource_macros.hh */,
- DCC3111E0762539E008F7A48 /* spatial_count_elem.cc */,
- DCC3111F0762539E008F7A48 /* spatial_count_elem.hh */,
- DCC311200762539E008F7A48 /* spatial_res_count.cc */,
- DCC311210762539E008F7A48 /* spatial_res_count.hh */,
- DCC311220762539E008F7A48 /* species.cc */,
- DCC311230762539E008F7A48 /* species.hh */,
- DCC311240762539E008F7A48 /* species_control.cc */,
- DCC311250762539E008F7A48 /* species_control.hh */,
- DCC311260762539E008F7A48 /* species_queue.cc */,
- DCC311270762539E008F7A48 /* species_queue.hh */,
- DCC311280762539E008F7A48 /* stats.cc */,
- DCC311290762539E008F7A48 /* stats.hh */,
- DCC3112A0762539E008F7A48 /* task_entry.cc */,
- DCC3112B0762539E008F7A48 /* task_entry.hh */,
- DCC3112C0762539E008F7A48 /* task_lib.cc */,
- DCC3112D0762539E008F7A48 /* task_lib.hh */,
DCC3112E0762539E008F7A48 /* unit_testsuites */,
70B085D108F48C9400FC65FE /* nSpecies.h */,
);
@@ -3036,22 +3036,6 @@
buildActionMask = 2147483647;
files = (
700E2AF8085DE50C00CF158A /* avida.cc in Sources */,
- 700E2B1F085DE50C00CF158A /* reaction.cc in Sources */,
- 700E2B20085DE50C00CF158A /* reaction_lib.cc in Sources */,
- 700E2B21085DE50C00CF158A /* reaction_process.cc in Sources */,
- 700E2B22085DE50C00CF158A /* reaction_requisite.cc in Sources */,
- 700E2B23085DE50C00CF158A /* reaction_result.cc in Sources */,
- 700E2B24085DE50C00CF158A /* resource.cc in Sources */,
- 700E2B25085DE50C00CF158A /* resource_count.cc in Sources */,
- 700E2B26085DE50C00CF158A /* resource_lib.cc in Sources */,
- 700E2B27085DE50C00CF158A /* spatial_count_elem.cc in Sources */,
- 700E2B28085DE50C00CF158A /* spatial_res_count.cc in Sources */,
- 700E2B29085DE50C00CF158A /* species.cc in Sources */,
- 700E2B2A085DE50C00CF158A /* species_control.cc in Sources */,
- 700E2B2B085DE50C00CF158A /* species_queue.cc in Sources */,
- 700E2B2C085DE50C00CF158A /* stats.cc in Sources */,
- 700E2B2D085DE50C00CF158A /* task_entry.cc in Sources */,
- 700E2B2E085DE50C00CF158A /* task_lib.cc in Sources */,
700E2B43085DE50C00CF158A /* weighted_index.cc in Sources */,
700E2B44085DE50C00CF158A /* tools.cc in Sources */,
700E2B45085DE50C00CF158A /* block_struct.cc in Sources */,
@@ -3166,6 +3150,22 @@
70B0869108F49EA800FC65FE /* cPopulation.cc in Sources */,
70B0869208F49EA800FC65FE /* cPopulationCell.cc in Sources */,
70B0869E08F49F4800FC65FE /* cPhenotype.cc in Sources */,
+ 70B0873E08F5E82D00FC65FE /* cReaction.cc in Sources */,
+ 70B0873F08F5E82D00FC65FE /* cReactionLib.cc in Sources */,
+ 70B0874008F5E82D00FC65FE /* cReactionProcess.cc in Sources */,
+ 70B0874108F5E82D00FC65FE /* cReactionRequisite.cc in Sources */,
+ 70B0874208F5E82D00FC65FE /* cReactionResult.cc in Sources */,
+ 70B0874308F5E82D00FC65FE /* cResource.cc in Sources */,
+ 70B0874408F5E82D00FC65FE /* cResourceCount.cc in Sources */,
+ 70B0874508F5E82D00FC65FE /* cResourceLib.cc in Sources */,
+ 70B0874608F5E82D00FC65FE /* cSpatialCountElem.cc in Sources */,
+ 70B0874708F5E82D00FC65FE /* cSpatialResCount.cc in Sources */,
+ 70B0874808F5E82D00FC65FE /* cSpecies.cc in Sources */,
+ 70B0874908F5E82D00FC65FE /* cSpeciesControl.cc in Sources */,
+ 70B0874A08F5E82D00FC65FE /* cSpeciesQueue.cc in Sources */,
+ 70B0874B08F5E82D00FC65FE /* cStats.cc in Sources */,
+ 70B0874C08F5E82D00FC65FE /* cTaskEntry.cc in Sources */,
+ 70B0874D08F5E82D00FC65FE /* cTaskLib.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3174,22 +3174,6 @@
buildActionMask = 2147483647;
files = (
DCC3166107628531008F7A48 /* avida.cc in Sources */,
- DCC3168807628577008F7A48 /* reaction.cc in Sources */,
- DCC3168907628578008F7A48 /* reaction_lib.cc in Sources */,
- DCC3168A0762857A008F7A48 /* reaction_process.cc in Sources */,
- DCC3168B0762857A008F7A48 /* reaction_requisite.cc in Sources */,
- DCC3168C0762857B008F7A48 /* reaction_result.cc in Sources */,
- DCC3168D0762857C008F7A48 /* resource.cc in Sources */,
- DCC3168E0762857D008F7A48 /* resource_count.cc in Sources */,
- DCC3168F0762857F008F7A48 /* resource_lib.cc in Sources */,
- DCC316900762857F008F7A48 /* spatial_count_elem.cc in Sources */,
- DCC3169107628580008F7A48 /* spatial_res_count.cc in Sources */,
- DCC3169207628581008F7A48 /* species.cc in Sources */,
- DCC3169307628582008F7A48 /* species_control.cc in Sources */,
- DCC3169407628583008F7A48 /* species_queue.cc in Sources */,
- DCC3169507628584008F7A48 /* stats.cc in Sources */,
- DCC3169607628585008F7A48 /* task_entry.cc in Sources */,
- DCC3169707628585008F7A48 /* task_lib.cc in Sources */,
DCC316B807628742008F7A48 /* weighted_index.cc in Sources */,
DCC316B907628744008F7A48 /* tools.cc in Sources */,
DCC316BA07628749008F7A48 /* block_struct.cc in Sources */,
@@ -3294,6 +3278,22 @@
70B0868D08F49EA800FC65FE /* cPopulation.cc in Sources */,
70B0868E08F49EA800FC65FE /* cPopulationCell.cc in Sources */,
70B0869D08F49F4800FC65FE /* cPhenotype.cc in Sources */,
+ 70B0872E08F5E82D00FC65FE /* cReaction.cc in Sources */,
+ 70B0872F08F5E82D00FC65FE /* cReactionLib.cc in Sources */,
+ 70B0873008F5E82D00FC65FE /* cReactionProcess.cc in Sources */,
+ 70B0873108F5E82D00FC65FE /* cReactionRequisite.cc in Sources */,
+ 70B0873208F5E82D00FC65FE /* cReactionResult.cc in Sources */,
+ 70B0873308F5E82D00FC65FE /* cResource.cc in Sources */,
+ 70B0873408F5E82D00FC65FE /* cResourceCount.cc in Sources */,
+ 70B0873508F5E82D00FC65FE /* cResourceLib.cc in Sources */,
+ 70B0873608F5E82D00FC65FE /* cSpatialCountElem.cc in Sources */,
+ 70B0873708F5E82D00FC65FE /* cSpatialResCount.cc in Sources */,
+ 70B0873808F5E82D00FC65FE /* cSpecies.cc in Sources */,
+ 70B0873908F5E82D00FC65FE /* cSpeciesControl.cc in Sources */,
+ 70B0873A08F5E82D00FC65FE /* cSpeciesQueue.cc in Sources */,
+ 70B0873B08F5E82D00FC65FE /* cStats.cc in Sources */,
+ 70B0873C08F5E82D00FC65FE /* cTaskEntry.cc in Sources */,
+ 70B0873D08F5E82D00FC65FE /* cTaskLib.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/source/bindings/Boost.Python/avida-fixups.hh
===================================================================
--- trunk/source/bindings/Boost.Python/avida-fixups.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/avida-fixups.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -2,7 +2,7 @@
#define AVIDA_FIXUPS_HH
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
//inline void SetupAvidaPython(cEnvironment &environment, cPopulationInterface &test_interface){
Modified: trunk/source/bindings/Boost.Python/environment.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/environment.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/environment.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
-Include("reaction_result.hh")
+Include("cReactionResult.h")
cEnvironment = Class("cEnvironment", "cEnvironment.h")
Modified: trunk/source/bindings/Boost.Python/genebank.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/genebank.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/genebank.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,6 +1,6 @@
-Include("stats.hh")
-Include("species.hh")
+Include("cStats.h")
+Include("cSpecies.h")
Include("cGenotype.h")
Include("cGenome.h")
Modified: trunk/source/bindings/Boost.Python/genotype.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/genotype.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/genotype.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,6 +1,6 @@
Include("merit.hh")
-Include("species.hh")
+Include("cSpecies.h")
Include("cGenebank.h")
cGenotype = Class("cGenotype", "cGenotype.h")
Modified: trunk/source/bindings/Boost.Python/genotype_birth_data.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/genotype_birth_data.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/genotype_birth_data.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,6 +1,6 @@
Include("cInstSet.h")
-Include("species.hh")
+Include("cSpecies.h")
Include("cGenotype.h")
cGenotype_BirthData = Class("cGenotype_BirthData", "cGenotype_BirthData.h")
Modified: trunk/source/bindings/Boost.Python/inject_genebank.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/inject_genebank.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/inject_genebank.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
-Include("stats.hh")
+Include("cStats.h")
Include("cInjectGenotype.h")
Include("cGenome.h")
Modified: trunk/source/bindings/Boost.Python/lineage_control.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/lineage_control.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/lineage_control.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,6 +1,6 @@
Include("cGenebank.h")
-Include("stats.hh")
+Include("cStats.h")
Include("string.hh")
Include("cGenotype.h")
Include("cLineage.h")
Modified: trunk/source/bindings/Boost.Python/reaction.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/reaction.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/reaction.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,9 +1,9 @@
-Include("task_entry.hh")
-Include("reaction_requisite.hh")
-Include("reaction_process.hh")
+Include("cTaskEntry.h")
+Include("cReactionRequisite.h")
+Include("cReactionProcess.h")
-cReaction = Class("cReaction", "reaction.hh")
+cReaction = Class("cReaction", "cReaction.h")
set_policy(cReaction.GetTask, return_internal_reference())
set_policy(cReaction.AddProcess, return_internal_reference())
set_policy(cReaction.AddRequisite, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/reaction_lib.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/reaction_lib.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/reaction_lib.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,8 +1,8 @@
Include("string.hh")
-Include("reaction.hh")
+Include("cReaction.h")
-cReactionLib = Class("cReactionLib", "reaction_lib.hh")
+cReactionLib = Class("cReactionLib", "cReactionLib.h")
set_policy(cReactionLib.AddReaction, return_internal_reference())
set_policy(cReactionLib.GetReaction, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/reaction_process.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/reaction_process.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/reaction_process.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,7 +1,7 @@
-Include("resource.hh")
+Include("cResource.h")
-cReactionProcess = Class("cReactionProcess", "reaction_process.hh")
+cReactionProcess = Class("cReactionProcess", "cReactionProcess.h")
set_policy(cReactionProcess.GetResource, return_internal_reference())
set_policy(cReactionProcess.GetProduct, return_internal_reference())
set_policy(cReactionProcess.GetDetect, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/reaction_requisite.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/reaction_requisite.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/reaction_requisite.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
-Include("reaction.hh")
+Include("cReaction.h")
-cReactionRequisite = Class("cReactionRequisite", "reaction_requisite.hh")
+cReactionRequisite = Class("cReactionRequisite", "cReactionRequisite.h")
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/reaction_result.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/reaction_result.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/reaction_result.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,4 +1,4 @@
-cReactionResult = Class("cReactionResult", "reaction_result.hh")
+cReactionResult = Class("cReactionResult", "cReactionResult.h")
set_policy(cReactionResult.GetInstArray, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/resource.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/resource.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/resource.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,4 +1,4 @@
-cResource = Class("cResource", "resource.hh")
+cResource = Class("cResource", "cResource.h")
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/resource_count-fixups.hh
===================================================================
--- trunk/source/bindings/Boost.Python/resource_count-fixups.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/resource_count-fixups.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -2,7 +2,7 @@
#define RESOURCE_COUNT_FIXUPS_HH
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
const cResourceCount &cResourceCount_SetTo(cResourceCount &lhs, cResourceCount &rhs);
Modified: trunk/source/bindings/Boost.Python/resource_lib.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/resource_lib.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/resource_lib.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,8 +1,8 @@
Include("string.hh")
-Include("resource.hh")
+Include("cResource.h")
-cResourceLib = Class("cResourceLib", "resource_lib.hh")
+cResourceLib = Class("cResourceLib", "cResourceLib.h")
set_policy(cResourceLib.AddResource, return_internal_reference())
set_policy(cResourceLib.GetResource, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/spatial_count_elem.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/spatial_count_elem.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/spatial_count_elem.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,4 +1,4 @@
-cSpatialCountElem = Class("cSpatialCountElem", "spatial_count_elem.hh")
+cSpatialCountElem = Class("cSpatialCountElem", "cSpatialCountElem.h")
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/spatial_res_count.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/spatial_res_count.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/spatial_res_count.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,4 +1,4 @@
-cSpatialResCount = Class("cSpatialResCount", "spatial_res_count.hh")
+cSpatialResCount = Class("cSpatialResCount", "cSpatialResCount.h")
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/species.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/species.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/species.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,7 +1,7 @@
Include("cGenotype.h")
-cSpecies = Class("cSpecies", "species.hh")
+cSpecies = Class("cSpecies", "cSpecies.h")
set_policy(cSpecies.GetNext, return_internal_reference())
set_policy(cSpecies.GetPrev, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/species_control.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/species_control.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/species_control.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,10 +1,10 @@
Include("cGenebank.h")
-Include("species.hh")
+Include("cSpecies.h")
Include("cGenotype.h")
-Include("stats.hh")
+Include("cStats.h")
-cSpeciesControl = Class("cSpeciesControl", "species_control.hh")
+cSpeciesControl = Class("cSpeciesControl", "cSpeciesControl.h")
set_policy(cSpeciesControl.Find, return_internal_reference())
set_policy(cSpeciesControl.GetFirst, return_internal_reference())
set_policy(cSpeciesControl.GetFirstInactive, return_internal_reference())
Modified: trunk/source/bindings/Boost.Python/species_queue.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/species_queue.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/species_queue.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,7 +1,7 @@
-Include("species.hh")
+Include("cSpecies.h")
-cSpeciesQueue = Class("cSpeciesQueue", "species_queue.hh")
+cSpeciesQueue = Class("cSpeciesQueue", "cSpeciesQueue.h")
set_policy(cSpeciesQueue.GetFirst, return_internal_reference())
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/stats.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/stats.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/stats.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -3,7 +3,7 @@
Include("cGenotype.h")
Include("cInjectGenotype.h")
-cStats = Class("cStats", "stats.hh")
+cStats = Class("cStats", "cStats.h")
set_policy(cStats.GetDomGenotype, return_value_policy(reference_existing_object))
set_policy(cStats.GetDomInjGenotype, return_value_policy(reference_existing_object))
set_policy(cStats.GetDomInjGenotype, return_value_policy(reference_existing_object))
Modified: trunk/source/bindings/Boost.Python/tList_instantiations.hh
===================================================================
--- trunk/source/bindings/Boost.Python/tList_instantiations.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/tList_instantiations.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -2,9 +2,9 @@
#include "cAnalyzeGenotype.h"
#include "cMutation.h"
#include "cPopulationCell.h"
-#include "reaction_process.hh"
-#include "reaction_requisite.hh"
-#include "reaction.hh"
+#include "cReactionProcess.h"
+#include "cReactionRequisite.h"
+#include "cReaction.h"
#include "string.hh"
#include "tList.hh"
Modified: trunk/source/bindings/Boost.Python/task_entry.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/task_entry.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/task_entry.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
-cTaskEntry = Class("cTaskEntry", "task_entry.hh")
+cTaskEntry = Class("cTaskEntry", "cTaskEntry.h")
# GetTestFun returns a instance method pointer, doesn't play well with
# Python.
exclude(cTaskEntry.GetTestFun)
Modified: trunk/source/bindings/Boost.Python/task_lib.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/task_lib.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/task_lib.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,6 +1,6 @@
-Include("task_entry.hh")
+Include("cTaskEntry.h")
-cTaskLib = Class("cTaskLib", "task_lib.hh")
+cTaskLib = Class("cTaskLib", "cTaskLib.h")
set_policy(cTaskLib.AddTask, return_internal_reference())
# vim: set ft=python:
Modified: trunk/source/bindings/Boost.Python/test_cpu.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/test_cpu.pyste 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/bindings/Boost.Python/test_cpu.pyste 2005-10-06 23:02:07 UTC (rev 332)
@@ -4,7 +4,7 @@
Include("cGenome.h")
Include("cInstSet.h")
Include("cPopulationInterface.h")
-Include("resource_count.hh")
+Include("cResourceCount.h")
cTestCPU = Class("cTestCPU", "test_cpu-fixups.hh")
set_policy(cTestCPU.GetInstSet, return_value_policy(reference_existing_object))
Modified: trunk/source/cpu/cTestCPU.cc
===================================================================
--- trunk/source/cpu/cTestCPU.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/cpu/cTestCPU.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -18,9 +18,9 @@
#include "cOrganism.h"
#include "cPhenotype.h"
#include "cPopulationInterface.h"
-#include "resource_count.hh"
-#include "resource_lib.hh"
-#include "resource.hh"
+#include "cResourceCount.h"
+#include "cResourceLib.h"
+#include "cResource.h"
#include "string_util.hh"
#include "tMatrix.hh"
Modified: trunk/source/cpu/cTestCPU.h
===================================================================
--- trunk/source/cpu/cTestCPU.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/cpu/cTestCPU.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -18,7 +18,7 @@
#endif
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
class cInstSet;
Modified: trunk/source/cpu/cTestUtil.cc
===================================================================
--- trunk/source/cpu/cTestUtil.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/cpu/cTestUtil.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -16,8 +16,8 @@
#include "cInstUtil.h"
#include "cOrganism.h"
#include "cPhenotype.h"
-#include "stats.hh"
-#include "task_entry.hh"
+#include "cStats.h"
+#include "cTaskEntry.h"
#include "cTestCPU.h"
#include <fstream>
Modified: trunk/source/event/cPopulationEventFactory.cc
===================================================================
--- trunk/source/event/cPopulationEventFactory.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/event/cPopulationEventFactory.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -13,7 +13,7 @@
#include "cAnalyzeUtil.h"
#endif
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef AVIDA_DRIVER_BASE_HH
#include "cAvidaDriver_Base.h"
@@ -64,10 +64,10 @@
#include "cPopulationEvent.h"
#endif
#ifndef RESOURCE_HH
-#include "resource.hh"
+#include "cResource.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef STRING_UTIL_HH
#include "string_util.hh"
Modified: trunk/source/main/CMakeLists.txt
===================================================================
--- trunk/source/main/CMakeLists.txt 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/CMakeLists.txt 2005-10-06 23:02:07 UTC (rev 332)
@@ -42,22 +42,22 @@
cPopulation.cc
cPopulationCell.cc
cPopulationInterface.cc
- reaction.cc
- reaction_lib.cc
- reaction_process.cc
- reaction_requisite.cc
- reaction_result.cc
- resource.cc
- resource_count.cc
- resource_lib.cc
- spatial_count_elem.cc
- spatial_res_count.cc
- species.cc
- species_control.cc
- species_queue.cc
- stats.cc
- task_entry.cc
- task_lib.cc
+ cReaction.cc
+ cReactionLib.cc
+ cReactionProcess.cc
+ cReactionRequisite.cc
+ cReactionResult.cc
+ cResource.cc
+ cResourceCount.cc
+ cResourceLib.cc
+ cSpatialCountElem.cc
+ cSpatialResCount.cc
+ cSpecies.cc
+ cSpeciesControl.cc
+ cSpeciesQueue.cc
+ cStats.cc
+ cTaskEntry.cc
+ cTaskLib.cc
)
ADD_LIBRARY(main ${libmain_a_SOURCES})
Modified: trunk/source/main/avida.cc
===================================================================
--- trunk/source/main/avida.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/avida.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -6,7 +6,7 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef AVIDA_DRIVER_BASE_HH
@@ -40,7 +40,7 @@
#include "cPopulationInterface.h"
#endif
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
#ifndef TEST_CPU_HH
#include "cTestCPU.h"
Copied: trunk/source/main/avida.h (from rev 331, trunk/source/main/avida.hh)
Deleted: trunk/source/main/avida.hh
===================================================================
--- trunk/source/main/avida.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/avida.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,32 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef AVIDA_HH
-#define AVIDA_HH
-
-class cEnvironment;
-class cPopulationInterface;
-
-/**
- * This function properly shuts down the Avida program.
- **/
-void ExitAvida(int exit_code);
-
-/**
- * This function does all the command line parsing etc., sets everything
- * up, and returns a reference to the environment that should be used.
- *
- * Besides the command line parameters, this function needs two more
- * variables. One is the environment the Avida run should use (the
- * environment is read in from disk and initialized in SetupAvida), the
- * other is the test population interface (also initialized in SetupAvida).
- **/
-void SetupAvida(
- cEnvironment &environment,
- cPopulationInterface &test_interface );
-
-#endif
Modified: trunk/source/main/cAnalyze.cc
===================================================================
--- trunk/source/main/cAnalyze.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cAnalyze.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -34,16 +34,16 @@
#include "cInstUtil.h"
#include "cLandscape.h"
#include "cPhenotype.h"
-#include "species.hh"
+#include "cSpecies.h"
#include "tArgDataEntry.hh"
-#include "task_entry.hh"
+#include "cTaskEntry.h"
#include "tDataEntry.hh"
#include "tDataEntryCommand.hh"
#include "tMatrix.hh"
#include "cTestCPU.h"
#include "cCPUTestInfo.h"
#include "cTestUtil.h"
-#include "resource.hh"
+#include "cResource.h"
#include "tHashTable.hh"
#ifdef WIN32
# include "win32_mkdir_hack.hh"
Modified: trunk/source/main/cAnalyzeUtil.cc
===================================================================
--- trunk/source/main/cAnalyzeUtil.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cAnalyzeUtil.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -58,10 +58,10 @@
#include "cPopulationCell.h"
#endif
#ifndef SPECIES_HH
-#include "species.hh"
+#include "cSpecies.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef TEST_CPU_HH
#include "cTestCPU.h"
Modified: trunk/source/main/cAvidaTriggers.h
===================================================================
--- trunk/source/main/cAvidaTriggers.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cAvidaTriggers.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -12,7 +12,7 @@
#include "cEventTriggers.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
/**
Modified: trunk/source/main/cCallbackUtil.cc
===================================================================
--- trunk/source/main/cCallbackUtil.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cCallbackUtil.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -10,7 +10,7 @@
#endif
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef AVIDA_DRIVER_BASE_HH
#include "cAvidaDriver_Base.h"
Modified: trunk/source/main/cEnvironment.cc
===================================================================
--- trunk/source/main/cEnvironment.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cEnvironment.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -19,28 +19,28 @@
#include "random.hh"
#endif
#ifndef REACTION_HH
-#include "reaction.hh"
+#include "cReaction.h"
#endif
#ifndef REACTION_MACROS_HH
#include "reaction_macros.hh"
#endif
#ifndef REACTION_PROCESS_HH
-#include "reaction_process.hh"
+#include "cReactionProcess.h"
#endif
#ifndef REACTION_REQUISITE_HH
-#include "reaction_requisite.hh"
+#include "cReactionRequisite.h"
#endif
#ifndef REACTION_RESULT_HH
-#include "reaction_result.hh"
+#include "cReactionResult.h"
#endif
#ifndef RESOURCE_HH
-#include "resource.hh"
+#include "cResource.h"
#endif
#ifndef STRING_UTIL_HH
#include "string_util.hh"
#endif
#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
+#include "cTaskEntry.h"
#endif
#ifndef TOOLS_HH
#include "tools.hh"
Modified: trunk/source/main/cEnvironment.h
===================================================================
--- trunk/source/main/cEnvironment.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cEnvironment.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -18,16 +18,16 @@
#include "cMutationRates.h"
#endif
#ifndef REACTION_LIB_HH
-#include "reaction_lib.hh"
+#include "cReactionLib.h"
#endif
#ifndef RESOURCE_LIB_HH
-#include "resource_lib.hh"
+#include "cResourceLib.h"
#endif
#ifndef STRING_HH
#include "string.hh"
#endif
#ifndef TASK_LIB_HH
-#include "task_lib.hh"
+#include "cTaskLib.h"
#endif
#ifndef TLIST_HH
#include "tList.hh"
Modified: trunk/source/main/cFitnessMatrix.h
===================================================================
--- trunk/source/main/cFitnessMatrix.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cFitnessMatrix.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -30,7 +30,7 @@
#include "cOrganism.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef STRING_UTIL_HH
#include "string_util.hh"
Modified: trunk/source/main/cGenebank.cc
===================================================================
--- trunk/source/main/cGenebank.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cGenebank.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -16,10 +16,10 @@
#include "cGenotype.h"
#endif
#ifndef SPECIES_HH
-#include "species.hh"
+#include "cSpecies.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef TEST_UTIL_HH
#include "cTestUtil.h"
Modified: trunk/source/main/cGenebank.h
===================================================================
--- trunk/source/main/cGenebank.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cGenebank.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -17,7 +17,7 @@
#include "cGenotypeControl.h"
#endif
#ifndef SPECIES_CONTROL_HH
-#include "species_control.hh"
+#include "cSpeciesControl.h"
#endif
#ifndef STRING_HH
#include "string.hh"
Modified: trunk/source/main/cInjectGenebank.cc
===================================================================
--- trunk/source/main/cInjectGenebank.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cInjectGenebank.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -22,7 +22,7 @@
#include "cInjectGenotype.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef TEST_UTIL_HH
#include "cTestUtil.h"
Modified: trunk/source/main/cLandscape.cc
===================================================================
--- trunk/source/main/cLandscape.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cLandscape.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -12,7 +12,7 @@
#include "cInstSet.h"
#include "cOrganism.h"
#include "cPhenotype.h"
-#include "stats.hh" // For GetUpdate in outputs...
+#include "cStats.h" // For GetUpdate in outputs...
#include "cTestCPU.h"
#include "cTestUtil.h"
#include "tools.hh"
Modified: trunk/source/main/cLineageControl.cc
===================================================================
--- trunk/source/main/cLineageControl.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cLineageControl.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -10,7 +10,7 @@
#include "string.hh"
#include "cLineage.h"
-#include "stats.hh"
+#include "cStats.h"
#include "cConfig.h"
#include "cGenebank.h"
#include "cGenotype.h"
Modified: trunk/source/main/cPhenotype.cc
===================================================================
--- trunk/source/main/cPhenotype.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cPhenotype.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -16,7 +16,7 @@
#include "cEnvironment.h"
#endif
#ifndef REACTION_RESULT_HH
-#include "reaction_result.hh"
+#include "cReactionResult.h"
#endif
#ifndef TOOLS_HH
#include "tools.hh"
Modified: trunk/source/main/cPopulation.cc
===================================================================
--- trunk/source/main/cPopulation.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cPopulation.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -31,10 +31,10 @@
#include "cPhenotype.h"
#include "cPopulationCell.h"
#include "prob_schedule.hh"
-#include "resource.hh"
-#include "species.hh"
-#include "stats.hh"
-#include "task_entry.hh"
+#include "cResource.h"
+#include "cSpecies.h"
+#include "cStats.h"
+#include "cTaskEntry.h"
#include <fstream>
#include <vector>
Modified: trunk/source/main/cPopulation.h
===================================================================
--- trunk/source/main/cPopulation.h 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cPopulation.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -17,10 +17,10 @@
#include "cPopulationInterface.h"
#endif
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef STRING_HH
#include "string.hh"
Copied: trunk/source/main/cReaction.cc (from rev 331, trunk/source/main/reaction.cc)
===================================================================
--- trunk/source/main/reaction.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cReaction.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,80 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef REACTION_HH
+#include "cReaction.h"
+#endif
+
+#ifndef REACTION_PROCESS_HH
+#include "cReactionProcess.h"
+#endif
+#ifndef REACTION_REQUISITE_HH
+#include "cReactionRequisite.h"
+#endif
+
+using namespace std;
+
+///////////////
+// cReaction
+///////////////
+
+cReaction::cReaction(const cString & _name, int _id)
+ : name(_name)
+ , id(_id)
+ , task(NULL)
+ , active(true)
+{
+}
+
+cReaction::~cReaction()
+{
+ while (process_list.GetSize() != 0) delete process_list.Pop();
+ while (requisite_list.GetSize() != 0) delete requisite_list.Pop();
+}
+
+cReactionProcess * cReaction::AddProcess()
+{
+ cReactionProcess * new_process = new cReactionProcess();
+ process_list.PushRear(new_process);
+ return new_process;
+}
+
+cReactionRequisite * cReaction::AddRequisite()
+{
+ cReactionRequisite * new_requisite = new cReactionRequisite();
+ requisite_list.PushRear(new_requisite);
+ return new_requisite;
+}
+
+bool cReaction::ModifyValue(double new_value, int process_num)
+{
+ if (process_num >= process_list.GetSize() || process_num < 0) return false;
+ process_list.GetPos(process_num)->SetValue(new_value);
+ return true;
+}
+
+bool cReaction::MultiplyValue(double value_mult, int process_num)
+{
+ if (process_num >= process_list.GetSize() || process_num < 0) return false;
+ double new_value = process_list.GetPos(process_num)->GetValue() * value_mult;
+ process_list.GetPos(process_num)->SetValue(new_value);
+ return true;
+}
+
+bool cReaction::ModifyInst(int inst_id, int process_num)
+{
+ if (process_num >= process_list.GetSize() || process_num < 0) return false;
+ process_list.GetPos(process_num)->SetInstID(inst_id);
+ return true;
+}
+
+
+double cReaction::GetValue(int process_num)
+{
+ if (process_num >= process_list.GetSize() || process_num < 0) return false;
+ return process_list.GetPos(process_num)->GetValue();
+}
Copied: trunk/source/main/cReaction.h (from rev 331, trunk/source/main/reaction.hh)
Copied: trunk/source/main/cReactionLib.cc (from rev 331, trunk/source/main/reaction_lib.cc)
===================================================================
--- trunk/source/main/reaction_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cReactionLib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,54 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef REACTION_LIB_HH
+#include "cReactionLib.h"
+#endif
+
+#ifndef REACTION_HH
+#include "cReaction.h"
+#endif
+
+//////////////////
+// cReactionLib
+//////////////////
+
+cReactionLib::~cReactionLib()
+{
+ for (int i = 0; i < reaction_array.GetSize(); i++) {
+ delete reaction_array[i];
+ }
+}
+
+
+cReaction * cReactionLib::GetReaction(const cString & name) const
+{
+ for (int i = 0; i < reaction_array.GetSize(); i++) {
+ if (reaction_array[i]->GetName() == name) return reaction_array[i];
+ }
+ return NULL;
+}
+
+cReaction * cReactionLib::GetReaction(int id) const
+{
+ return reaction_array[id];
+}
+
+
+cReaction * cReactionLib::AddReaction(const cString & name)
+{
+ // If this reaction already exists, just return it.
+ cReaction * found_reaction = GetReaction(name);
+ if (found_reaction != NULL) return found_reaction;
+
+ // Create a new reaction...
+ const int new_id = reaction_array.GetSize();
+ cReaction * new_reaction = new cReaction(name, new_id);
+ reaction_array.Resize(new_id + 1);
+ reaction_array[new_id] = new_reaction;
+ return new_reaction;
+}
Copied: trunk/source/main/cReactionLib.h (from rev 331, trunk/source/main/reaction_lib.hh)
Copied: trunk/source/main/cReactionProcess.cc (from rev 331, trunk/source/main/reaction_process.cc)
===================================================================
--- trunk/source/main/reaction_process.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cReactionProcess.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,42 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef REACTION_PROCESS_HH
+#include "cReactionProcess.h"
+#endif
+
+#ifndef DEFS_HH
+#include "defs.hh"
+#endif
+#ifndef REACTION_MACROS_HH
+#include "reaction_macros.hh"
+#endif
+
+//////////////////////
+// cReactionProcess
+//////////////////////
+
+cReactionProcess::cReactionProcess()
+ : resource(NULL)
+ , value(1.0)
+ , type(REACTION_PROCTYPE_ADD)
+ , max_number(1.0)
+ , min_number(0.0)
+ , max_fraction(1.0)
+ , product(NULL)
+ , conversion(1.0)
+ , inst_id(-1)
+ , lethal(0)
+ , detect(NULL)
+ , detection_threshold(0.0)
+ , detection_error(0.0)
+{
+}
+
+cReactionProcess::~cReactionProcess()
+{
+}
Copied: trunk/source/main/cReactionProcess.h (from rev 331, trunk/source/main/reaction_process.hh)
Copied: trunk/source/main/cReactionRequisite.cc (from rev 331, trunk/source/main/reaction_requisite.cc)
===================================================================
--- trunk/source/main/reaction_requisite.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cReactionRequisite.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,26 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef REACTION_REQUISITE_HH
+#include "cReactionRequisite.h"
+#endif
+
+#include <limits.h>
+
+////////////////////////
+// cReactionRequisite
+////////////////////////
+
+cReactionRequisite::cReactionRequisite()
+ : min_task_count(0)
+ , max_task_count(INT_MAX)
+{
+}
+
+cReactionRequisite::~cReactionRequisite()
+{
+}
Copied: trunk/source/main/cReactionRequisite.h (from rev 331, trunk/source/main/reaction_requisite.hh)
Copied: trunk/source/main/cReactionResult.cc (from rev 331, trunk/source/main/reaction_result.cc)
===================================================================
--- trunk/source/main/reaction_result.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cReactionResult.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,178 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2004 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "cReactionResult.h"
+
+
+cReactionResult::cReactionResult(const int num_resources,
+ const int num_tasks,
+ const int num_reactions)
+ : resources_consumed(num_resources)
+ , resources_produced(num_resources)
+ , resources_detected(num_resources)
+ , tasks_done(num_tasks)
+ , receive_tasks_done(num_tasks)
+ , send_tasks_done(num_tasks)
+ , reactions_triggered(num_reactions)
+ , bonus_add(0.0)
+ , bonus_mult(1.0)
+ , insts_triggered(0)
+ , lethal(false)
+ , active_reaction(false)
+{
+}
+
+cReactionResult::~cReactionResult()
+{
+}
+
+
+void cReactionResult::ActivateReaction()
+{
+ // If this reaction is already active, don't worry about it.
+ if (active_reaction == true) return;
+
+ // To activate the reaction, we must initialize all counter settings.
+ resources_consumed.SetAll(0.0);
+ resources_produced.SetAll(0.0);
+ resources_detected.SetAll(-1.0);
+ tasks_done.SetAll(false);
+ receive_tasks_done.SetAll(false);
+ send_tasks_done.SetAll(false);
+ reactions_triggered.SetAll(false);
+
+ // And finally note that this is indeed already active.
+ active_reaction = true;
+}
+
+
+void cReactionResult::Consume(int id, double num)
+{
+ ActivateReaction();
+ resources_consumed[id] += num;
+}
+
+
+void cReactionResult::Produce(int id, double num)
+{
+ ActivateReaction();
+ resources_produced[id] += num;
+}
+
+
+void cReactionResult::Detect(int id, double num)
+{
+ ActivateReaction();
+ resources_detected[id] += num;
+}
+
+void cReactionResult::Lethal(bool flag)
+{
+ ActivateReaction();
+ lethal = flag;
+}
+
+void cReactionResult::MarkTask(int id)
+{
+ ActivateReaction();
+ tasks_done[id] = true;
+}
+
+
+void cReactionResult::MarkReceiveTask(int id)
+{
+ ActivateReaction();
+ receive_tasks_done[id] = true;
+}
+
+
+void cReactionResult::MarkSendTask(int id)
+{
+ ActivateReaction();
+ send_tasks_done[id] = true;
+}
+
+
+void cReactionResult::MarkReaction(int id)
+{
+ ActivateReaction();
+ reactions_triggered[id] = true;
+}
+
+
+void cReactionResult::AddBonus(double value)
+{
+ ActivateReaction();
+ bonus_add += value;
+}
+
+
+void cReactionResult::MultBonus(double value)
+{
+ ActivateReaction();
+ bonus_mult *= value;
+}
+
+void cReactionResult::AddInst(int id)
+{
+ insts_triggered.Push(id);
+}
+
+double cReactionResult::GetConsumed(int id)
+{
+ if (GetActive() == false) return 0.0;
+ return resources_consumed[id];
+}
+
+
+double cReactionResult::GetProduced(int id)
+{
+ if (GetActive() == false) return 0.0;
+ return resources_produced[id];
+}
+
+double cReactionResult::GetDetected(int id)
+{
+ if (GetActive() == false) return 0.0;
+ return resources_detected[id];
+}
+
+bool cReactionResult::GetLethal()
+{
+ if (GetActive() == false) return false;
+ return lethal;
+}
+
+bool cReactionResult::ReactionTriggered(int id)
+{
+ if (GetActive() == false) return false;
+ return reactions_triggered[id];
+}
+
+bool cReactionResult::TaskDone(int id)
+{
+ if (GetActive() == false) return false;
+ return tasks_done[id];
+}
+
+double cReactionResult::GetAddBonus()
+{
+ if (GetActive() == false) return 0.0;
+ return bonus_add;
+}
+
+double cReactionResult::GetMultBonus()
+{
+ if (GetActive() == false) return 1.0;
+ return bonus_mult;
+}
+
+tArray<int> & cReactionResult::GetInstArray()
+{
+ return insts_triggered;
+}
+
Copied: trunk/source/main/cReactionResult.h (from rev 331, trunk/source/main/reaction_result.hh)
Copied: trunk/source/main/cResource.cc (from rev 331, trunk/source/main/resource.cc)
===================================================================
--- trunk/source/main/resource.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cResource.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef RESOURCE_HH
+#include "cResource.h"
+#endif
+
+#ifndef CONFIG_HH
+#include "cConfig.h"
+#endif
+
+using namespace std;
+
+cResource::cResource(const cString & _name, int _id)
+ : name(_name)
+ , id(_id)
+ , initial(0.0)
+ , inflow(0.0)
+ , outflow(0.0)
+ , geometry(GEOMETRY_GLOBAL)
+ , inflowX1(-99)
+ , inflowX2(-99)
+ , inflowY1(-99)
+ , inflowY2(-99)
+ , outflowX1(-99)
+ , outflowX2(-99)
+ , outflowY1(-99)
+ , outflowY2(-99)
+ , xdiffuse(1.0)
+ , xgravity(0.0)
+ , ydiffuse(1.0)
+ , ygravity(0.0)
+{
+}
+
+bool cResource::SetGeometry(cString _geometry)
+{
+ _geometry.ToLower();
+ if (_geometry == "global") {
+ geometry = GEOMETRY_GLOBAL;
+ return true;
+ } else if (_geometry == "grid") {
+ geometry = GEOMETRY_GRID;
+ return true;
+ } else if (_geometry == "torus") {
+ geometry = GEOMETRY_TORUS;
+ return true;
+ } else {
+ return false;
+ }
+}
Copied: trunk/source/main/cResource.h (from rev 331, trunk/source/main/resource.hh)
Copied: trunk/source/main/cResourceCount.cc (from rev 331, trunk/source/main/resource_count.cc)
===================================================================
--- trunk/source/main/resource_count.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cResourceCount.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,371 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef RESOURCE_COUNT_HH
+#include "cResourceCount.h"
+#endif
+
+#ifndef CONFIG_HH
+#include "cConfig.h"
+#endif
+
+extern "C" {
+#include <math.h>
+}
+
+using namespace std;
+
+const double cResourceCount::UPDATE_STEP(1.0 / 10000.0);
+const double cResourceCount::EPSILON (1.0e-15);
+const int cResourceCount::PRECALC_DISTANCE(100);
+
+void FlowMatter(cSpatialCountElem &elem1, cSpatialCountElem &elem2, double inxdiffuse,
+ double inydiffuse, double inxgravity, double inygravity,
+ int xdist, int ydist, double dist) {
+
+ /* Routine to calculate the amount of flow from one Element to another.
+ Amount of flow is a function of:
+
+ 1) Amount of material in each cell (will try to equalize)
+ 2) Distance between each cell
+ 3) x and y "gravity"
+
+ This method only effect the delta amount of each element. The State
+ method will need to be called at the end of each time step to complete
+ the movement of material.
+ */
+
+ double diff, flowamt, xgravity, xdiffuse, ygravity, ydiffuse;
+
+ if (((elem1.amount == 0.0) && (elem2.amount == 0.0)) && (dist < 0.0)) return;
+ diff = (elem1.amount - elem2.amount);
+ if (xdist != 0) {
+
+ /* if there is material to be effected by x gravity */
+
+ if (((xdist>0) && (inxgravity>0.0)) || ((xdist<0) && (inxgravity<0.0))) {
+ xgravity = elem1.amount * fabs(inxgravity)/3.0;
+ } else {
+ xgravity = -elem2.amount * fabs(inxgravity)/3.0;
+ }
+
+ /* Diffusion uses the diffusion constant x half the difference (as the
+ elements attempt to equalize) / the number of possible neighbors (8) */
+
+ xdiffuse = inxdiffuse * diff / 16.0;
+ } else {
+ xdiffuse = 0.0;
+ xgravity = 0.0;
+ }
+ if (ydist != 0) {
+
+ /* if there is material to be effected by y gravity */
+
+ if (((ydist>0) && (inygravity>0.0)) || ((ydist<0) && (inygravity<0.0))) {
+ ygravity = elem1.amount * fabs(inygravity)/3.0;
+ } else {
+ ygravity = -elem2.amount * fabs(inygravity)/3.0;
+ }
+ ydiffuse = inydiffuse * diff / 16.0;
+ } else {
+ ydiffuse = 0.0;
+ ygravity = 0.0;
+ }
+
+ flowamt = ((xdiffuse + ydiffuse + xgravity + ygravity)/
+ (fabs(xdist*1.0) + fabs(ydist*1.0)))/dist;
+ elem1.delta -= flowamt;
+ elem2.delta += flowamt;
+}
+
+cResourceCount::cResourceCount(int num_resources)
+ : update_time(0.0)
+ , spatial_update_time(0.0)
+{
+ if(num_resources > 0) {
+ SetSize(num_resources);
+ }
+
+ return;
+}
+
+cResourceCount::cResourceCount(const cResourceCount &rc) {
+ *this = rc;
+
+ return;
+}
+
+const cResourceCount &cResourceCount::operator=(const cResourceCount &rc) {
+ resource_count = rc.resource_count;
+ decay_rate = rc.decay_rate;
+ inflow_rate = rc.inflow_rate;
+ decay_precalc = rc.decay_precalc;
+ inflow_precalc = rc.inflow_precalc;
+ geometry = rc.geometry;
+ spatial_resource_count = rc.spatial_resource_count;
+ curr_grid_res_cnt = rc.curr_grid_res_cnt;
+ curr_spatial_res_cnt = rc.curr_spatial_res_cnt;
+ update_time = rc.update_time;
+ spatial_update_time = rc.spatial_update_time;
+
+ return *this;
+}
+
+void cResourceCount::SetSize(int num_resources)
+{
+ resource_count.ResizeClear(num_resources);
+ decay_rate.ResizeClear(num_resources);
+ inflow_rate.ResizeClear(num_resources);
+ if(num_resources > 0) {
+ decay_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
+ inflow_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
+ }
+ geometry.ResizeClear(num_resources);
+ spatial_resource_count.ResizeClear(num_resources);
+ curr_grid_res_cnt.ResizeClear(num_resources);
+ curr_spatial_res_cnt.ResizeClear(num_resources);
+
+ resource_count.SetAll(0.0);
+ decay_rate.SetAll(0.0);
+ inflow_rate.SetAll(0.0);
+ decay_precalc.SetAll(0.0);
+ inflow_precalc.SetAll(0.0);
+ geometry.SetAll(GEOMETRY_GLOBAL);
+ curr_grid_res_cnt.SetAll(0.0);
+}
+
+cResourceCount::~cResourceCount()
+{
+}
+
+void cResourceCount::Setup(int id, cString name, double initial, double inflow,
+ double decay, int in_geometry, double in_xdiffuse,
+ double in_xgravity, double in_ydiffuse,
+ double in_ygravity, int in_inflowX1,
+ int in_inflowX2, int in_inflowY1,
+ int in_inflowY2, int in_outflowX1,
+ int in_outflowX2, int in_outflowY1,
+ int in_outflowY2)
+{
+ assert(id >= 0 && id < resource_count.GetSize());
+ assert(initial >= 0.0);
+ assert(decay >= 0.0);
+ assert(inflow >= 0.0);
+ assert(spatial_resource_count[id].GetSize() > 0);
+
+ cString geo_name;
+ if (in_geometry == GEOMETRY_GLOBAL) {
+ geo_name = "GLOBAL";
+ } else if (in_geometry == GEOMETRY_GRID) {
+ geo_name = "GRID";
+ } else if (in_geometry == GEOMETRY_TORUS) {
+ geo_name = "TORUS";
+ }
+#if 0
+ cerr << "Setting up resource " << name
+ << "(" << geo_name
+ << ") with initial quatity=" << initial
+ << ", decay=" << decay
+ << ", inflow=" << inflow
+ << endl;
+ if ((in_geometry == GEOMETRY_GRID) || (in_geometry == GEOMETRY_TORUS)) {
+ cerr << " Inflow rectangle (" << in_inflowX1
+ << "," << in_inflowY1
+ << ") to (" << in_inflowX2
+ << "," << in_inflowY2
+ << ")" << endl;
+ cerr << " Outflow rectangle (" << in_outflowX1
+ << "," << in_outflowY1
+ << ") to (" << in_outflowX2
+ << "," << in_outflowY2
+ << ")" << endl;
+ cerr << " xdiffuse=" << in_xdiffuse
+ << ", xgravity=" << in_xgravity
+ << ", ydiffuse=" << in_ydiffuse
+ << ", ygravity=" << in_ygravity
+ << endl;
+ }
+#endif
+
+ resource_count[id] = initial;
+ spatial_resource_count[id].RateAll
+ (initial/spatial_resource_count[id].GetSize());
+ spatial_resource_count[id].StateAll();
+ decay_rate[id] = decay;
+ inflow_rate[id] = inflow;
+ geometry[id] = in_geometry;
+ spatial_resource_count[id].SetGeometry(in_geometry);
+ spatial_resource_count[id].SetPointers();
+
+ double step_decay = pow(decay, UPDATE_STEP);
+ double step_inflow = inflow * UPDATE_STEP;
+
+ decay_precalc(id, 0) = 1.0;
+ inflow_precalc(id, 0) = 0.0;
+ for (int i = 1; i <= PRECALC_DISTANCE; i++) {
+ decay_precalc(id, i) = decay_precalc(id, i-1) * step_decay;
+ inflow_precalc(id, i) = inflow_precalc(id, i-1) * step_decay + step_inflow;
+ }
+ spatial_resource_count[id].SetXdiffuse(in_xdiffuse);
+ spatial_resource_count[id].SetXgravity(in_xgravity);
+ spatial_resource_count[id].SetYdiffuse(in_ydiffuse);
+ spatial_resource_count[id].SetYgravity(in_ygravity);
+ spatial_resource_count[id].SetInflowX1(in_inflowX1);
+ spatial_resource_count[id].SetInflowX2(in_inflowX2);
+ spatial_resource_count[id].SetInflowY1(in_inflowY1);
+ spatial_resource_count[id].SetInflowY2(in_inflowY2);
+ spatial_resource_count[id].SetOutflowX1(in_outflowX1);
+ spatial_resource_count[id].SetOutflowX2(in_outflowX2);
+ spatial_resource_count[id].SetOutflowY1(in_outflowY1);
+ spatial_resource_count[id].SetOutflowY2(in_outflowY2);
+}
+
+void cResourceCount::Update(double in_time)
+{
+ update_time += in_time;
+ spatial_update_time += in_time;
+ }
+
+
+const tArray<double> & cResourceCount::GetResources() const
+{
+ DoUpdates();
+ return resource_count;
+}
+
+const tArray<double> & cResourceCount::GetCellResources(int cell_id) const
+
+ // Get amount of the resource for a given cell in the grid. If it is a
+ // global resource pass out the entire content of that resource.
+
+{
+ int num_resources = resource_count.GetSize();
+ DoUpdates();
+
+ for (int i = 0; i < num_resources; i++) {
+ if (geometry[i] == GEOMETRY_GLOBAL) {
+ curr_grid_res_cnt[i] = resource_count[i];
+ } else {
+ curr_grid_res_cnt[i] = spatial_resource_count[i].GetAmount(cell_id);
+ }
+ }
+ return curr_grid_res_cnt;
+
+}
+
+const tArray<int> & cResourceCount::GetResourcesGeometry() const
+{
+ return geometry;
+}
+
+const tArray< tArray<double> > & cResourceCount::GetSpatialRes()
+{
+ const int num_spatial_resources = spatial_resource_count.GetSize();
+ if (num_spatial_resources > 0) {
+ const int num_cells = spatial_resource_count[0].GetSize();
+ DoUpdates();
+ for (int i = 0; i < num_spatial_resources; i++) {
+ for (int j = 0; j < num_cells; j++) {
+ curr_spatial_res_cnt[i][j] = spatial_resource_count[i].GetAmount(j);
+ }
+ }
+ }
+
+ return curr_spatial_res_cnt;
+}
+
+void cResourceCount::Modify(const tArray<double> & res_change)
+{
+ assert(resource_count.GetSize() == res_change.GetSize());
+
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ resource_count[i] += res_change[i];
+ assert(resource_count[i] >= 0.0);
+ }
+}
+
+
+void cResourceCount::Modify(int id, double change)
+{
+ assert(id < resource_count.GetSize());
+
+ resource_count[id] += change;
+ assert(resource_count[id] >= 0.0);
+}
+
+void cResourceCount::ModifyCell(const tArray<double> & res_change, int cell_id)
+{
+ assert(resource_count.GetSize() == res_change.GetSize());
+
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ if (geometry[i] == GEOMETRY_GLOBAL) {
+ resource_count[i] += res_change[i];
+ assert(resource_count[i] >= 0.0);
+ } else {
+ spatial_resource_count[i].Rate(cell_id, res_change[i]);
+ }
+ }
+}
+
+
+void cResourceCount::Set(int id, double new_level)
+{
+ assert(id < resource_count.GetSize());
+
+ resource_count[id] = new_level;
+}
+
+void cResourceCount::ResizeSpatialGrids(int in_x, int in_y)
+{
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ spatial_resource_count[i].ResizeClear(in_x, in_y, geometry[i]);
+ curr_spatial_res_cnt[i].Resize(in_x * in_y);
+ }
+}
+///// Private Methods /////////
+void cResourceCount::DoUpdates() const
+{
+ assert(update_time >= -EPSILON);
+
+ // Determine how many update steps have progressed
+ int num_steps = (int) (update_time / UPDATE_STEP);
+
+ // Preserve remainder of update_time
+ update_time -= num_steps * UPDATE_STEP;
+
+ while (num_steps > PRECALC_DISTANCE) {
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ if (geometry[i] == GEOMETRY_GLOBAL) {
+ resource_count[i] *= decay_precalc(i, PRECALC_DISTANCE);
+ resource_count[i] += inflow_precalc(i, PRECALC_DISTANCE);
+ }
+ }
+ num_steps -= PRECALC_DISTANCE;
+ }
+
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ if (geometry[i] == GEOMETRY_GLOBAL) {
+ resource_count[i] *= decay_precalc(i, num_steps);
+ resource_count[i] += inflow_precalc(i, num_steps);
+ }
+ }
+
+ // If one (or more) complete update has occured update the spatial resources
+
+ while (spatial_update_time >= 1.0) {
+ spatial_update_time -= 1.0;
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ if (geometry[i] != GEOMETRY_GLOBAL) {
+ spatial_resource_count[i].Source(inflow_rate[i]);
+ spatial_resource_count[i].Sink(decay_rate[i]);
+ spatial_resource_count[i].FlowAll();
+ spatial_resource_count[i].StateAll();
+ resource_count[i] = spatial_resource_count[i].SumAll();
+ }
+ }
+ }
+}
Copied: trunk/source/main/cResourceCount.h (from rev 331, trunk/source/main/resource_count.hh)
===================================================================
--- trunk/source/main/resource_count.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cResourceCount.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,87 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef RESOURCE_COUNT_HH
+#define RESOURCE_COUNT_HH
+
+#ifndef SPATIAL_RES_COUNT_HH
+#include "cSpatialResCount.h"
+#endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
+#ifndef TARRAY_HH
+#include "tArray.hh"
+#endif
+#ifndef TMATRIX_HH
+#include "tMatrix.hh"
+#endif
+
+template <class T> class tArray; // aggregate
+template <class T> class tMatrix; // aggregate
+class cSpatialResCount; // aggregate
+class cString; // aggregate
+
+class cResourceCount {
+private:
+ mutable tArray<double> resource_count; // Current quantity of each resource
+ tArray<double> decay_rate; // Multiplies resource count at each step
+ tArray<double> inflow_rate; // An increment for resource at each step
+ tMatrix<double> decay_precalc; // Precalculation of decay values
+ tMatrix<double> inflow_precalc; // Precalculation of inflow values
+ tArray<int> geometry; // Spatial layout of each resource
+ mutable tArray<cSpatialResCount> spatial_resource_count;
+ mutable tArray<double> curr_grid_res_cnt;
+ mutable tArray< tArray<double> > curr_spatial_res_cnt;
+
+ // Setup the update process to use lazy evaluation...
+ mutable double update_time; // Portion of an update compleated...
+ mutable double spatial_update_time;
+ void DoUpdates() const; // Update resource count based on update time
+
+ // A few constants to describe update process...
+ static const double UPDATE_STEP; // Fraction of an update per step
+ static const double EPSILON; // Tolorance for round off errors
+ static const int PRECALC_DISTANCE; // Number of steps to precalculate
+public:
+ cResourceCount(int num_resources=0);
+ cResourceCount(const cResourceCount &);
+ ~cResourceCount();
+
+ const cResourceCount &operator=(const cResourceCount &);
+
+ void SetSize(int num_resources);
+
+ void Setup(int id, cString name, double initial, double inflow,
+ double decay, int in_geometry, double in_xdiffuse,
+ double in_xgravity, double in_ydiffuse,
+ double in_ygravity, int in_inflowX1,
+ int in_inflowX2, int in_inflowY1,
+ int in_inflowY2, int in_outflowX1,
+ int in_outflowX2, int in_outflowY1,
+ int in_outflowY);
+ void Update(double in_time);
+
+ int GetSize(void) const { return resource_count.GetSize(); }
+ const tArray<double> & ReadResources(void) const { return resource_count; }
+ const tArray<double> & GetResources() const;
+ const tArray<double> & GetCellResources(int cell_id) const;
+ const tArray<int> & GetResourcesGeometry() const;
+ const tArray< tArray<double> > & GetSpatialRes();
+ void Modify(const tArray<double> & res_change);
+ void Modify(int id, double change);
+ void ModifyCell(const tArray<double> & res_change, int cell_id);
+ void Set(int id, double new_level);
+ double Get(int id) const{
+ assert(id < resource_count.GetSize());
+ return resource_count[id]; }
+ void ResizeSpatialGrids(int in_x, int in_y);
+ cSpatialResCount GetSpatialResource(int id)
+ { return spatial_resource_count[id]; }
+};
+
+#endif
Copied: trunk/source/main/cResourceLib.cc (from rev 331, trunk/source/main/resource_lib.cc)
===================================================================
--- trunk/source/main/resource_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cResourceLib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,46 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef RESOURCE_LIB_HH
+#include "cResourceLib.h"
+#endif
+
+#ifndef RESOURCE_HH
+#include "cResource.h"
+#endif
+
+using namespace std;
+
+cResourceLib::~cResourceLib()
+{
+ for (int i = 0; i < resource_array.GetSize(); i++) {
+ delete resource_array[i];
+ }
+}
+
+cResource * cResourceLib::AddResource(const cString & res_name)
+{
+ const int new_id = resource_array.GetSize();
+ cResource * new_resource = new cResource(res_name, new_id);
+ resource_array.Resize(new_id + 1);
+ resource_array[new_id] = new_resource;
+ return new_resource;
+}
+
+cResource * cResourceLib::GetResource(const cString & res_name) const
+{
+ for (int i = 0; i < resource_array.GetSize(); i++) {
+ if (resource_array[i]->GetName() == res_name) return resource_array[i];
+ }
+ cerr << "Error: Unknown resource '" << res_name << "'." << endl;
+ return NULL;
+}
+
+cResource * cResourceLib::GetResource(int id) const
+{
+ return resource_array[id];
+}
Copied: trunk/source/main/cResourceLib.h (from rev 331, trunk/source/main/resource_lib.hh)
Copied: trunk/source/main/cSpatialCountElem.cc (from rev 331, trunk/source/main/spatial_count_elem.cc)
===================================================================
--- trunk/source/main/spatial_count_elem.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpatialCountElem.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPATIAL_COUNT_ELEM_HH
+#include "cSpatialCountElem.h"
+#endif
+
+#ifndef RESOURCE_COUNT_MACROS_HH
+#include "resource_count_macros.hh"
+#endif
+
+cSpatialCountElem::cSpatialCountElem (double initamount) {
+ amount = initamount;
+ delta=0.0;
+ elempt.Resize(MAXFLOWPTS);
+ xdist.Resize(MAXFLOWPTS);
+ ydist.Resize(MAXFLOWPTS);
+ dist.Resize(MAXFLOWPTS);
+}
+cSpatialCountElem::cSpatialCountElem () {
+ amount = 0.0;
+ delta=0.0;
+ elempt.Resize(MAXFLOWPTS);
+ xdist.Resize(MAXFLOWPTS);
+ ydist.Resize(MAXFLOWPTS);
+ dist.Resize(MAXFLOWPTS);
+}
+void cSpatialCountElem::SetPtr (int innum, int inelempt, int inxdist,
+ int inydist, double indist) {
+ elempt[innum] = inelempt;
+ xdist[innum] = inxdist;
+ ydist[innum] = inydist;
+ dist[innum] = indist;
+}
Copied: trunk/source/main/cSpatialCountElem.h (from rev 331, trunk/source/main/spatial_count_elem.hh)
Copied: trunk/source/main/cSpatialResCount.cc (from rev 331, trunk/source/main/spatial_res_count.cc)
===================================================================
--- trunk/source/main/spatial_res_count.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpatialResCount.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,275 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPATIAL_RES_COUNT_HH
+#include "cSpatialResCount.h"
+#endif
+
+#ifndef CONFIG_HH
+#include "cConfig.h"
+#endif
+#ifndef FUNCTIONS_HH
+#include "functions.hh"
+#endif
+
+cSpatialResCount::cSpatialResCount(int inworld_x, int inworld_y,
+ int ingeometry,
+ double inxdiffuse, double inydiffuse, double inxgravity,
+ double inygravity)
+ : grid(inworld_x * inworld_y) {
+
+ int i;
+
+ xdiffuse = inxdiffuse;
+ ydiffuse = inydiffuse;
+ xgravity = inxgravity;
+ ygravity = inygravity;
+ world_x = inworld_x;
+ world_y = inworld_y;
+ geometry = ingeometry;
+ num_cells = world_x * world_y;
+ for (i = 0; i < GetSize(); i++) {
+ cSpatialCountElem tmpelem;
+ grid[i] = tmpelem;
+ }
+ SetPointers();
+}
+
+cSpatialResCount::cSpatialResCount(int inworld_x, int inworld_y, int ingeometry)
+ : grid(inworld_x * inworld_y) {
+ int i;
+
+ xdiffuse = 1.0;
+ ydiffuse = 1.0;
+ xgravity = 0.0;
+ ygravity = 0.0;
+ world_x = inworld_x;
+ world_y = inworld_y;
+ geometry = ingeometry;
+ num_cells = world_x * world_y;
+ for (i = 0; i < GetSize(); i++) {
+ cSpatialCountElem tmpelem;
+ grid[i] = tmpelem;
+ }
+ SetPointers();
+}
+
+cSpatialResCount::cSpatialResCount() {
+
+ xdiffuse = 1.0;
+ ydiffuse = 1.0;
+ xgravity = 0.0;
+ ygravity = 0.0;
+ geometry = GEOMETRY_GLOBAL;
+}
+
+void cSpatialResCount::ResizeClear(int inworld_x, int inworld_y,
+ int ingeometry) {
+ int i;
+
+ grid.ResizeClear(inworld_x * inworld_y);
+ world_x = inworld_x;
+ world_y = inworld_y;
+ geometry = ingeometry;
+ num_cells = world_x * world_y;
+ for (i = 0; i < GetSize(); i++) {
+ cSpatialCountElem tmpelem;
+ grid[i] = tmpelem;
+ }
+ SetPointers();
+}
+
+void cSpatialResCount::SetPointers() {
+
+ /* Pointer 0 will point to the cell above and to the left the current cell
+ and will go clockwise around the cell. */
+
+ int i,ii;
+ double SQRT2 = sqrt(2.0);
+
+ /* First treat all cells like they are in a torus */
+
+ for (i = 0; i < GetSize(); i++) {
+ grid[i].SetPtr(0 ,GridNeighbor(i, world_x, world_y, -1, -1), -1, -1, SQRT2);
+ grid[i].SetPtr(1 ,GridNeighbor(i, world_x, world_y, 0, -1), 0, -1, 1.0);
+ grid[i].SetPtr(2 ,GridNeighbor(i, world_x, world_y, +1, -1), +1, -1, SQRT2);
+ grid[i].SetPtr(3 ,GridNeighbor(i, world_x, world_y, +1, 0), +1, 0, 1.0);
+ grid[i].SetPtr(4 ,GridNeighbor(i, world_x, world_y, +1, +1), +1, +1, SQRT2);
+ grid[i].SetPtr(5 ,GridNeighbor(i, world_x, world_y, 0, +1), 0, +1, 1.0);
+ grid[i].SetPtr(6 ,GridNeighbor(i, world_x, world_y, -1, +1), -1, +1, SQRT2);
+ grid[i].SetPtr(7 ,GridNeighbor(i, world_x, world_y, -1, 0), -1, 0, 1.0);
+ }
+
+ /* Fix links for top, bottom and sides for non-torus */
+
+ if (geometry == GEOMETRY_GRID) {
+ /* Top and bottom */
+
+ for (i = 0; i < world_x; i++) {
+ grid[i].SetPtr(0, -99, -99, -99, -99.0);
+ grid[i].SetPtr(1, -99, -99, -99, -99.0);
+ grid[i].SetPtr(2, -99, -99, -99, -99.0);
+ ii = num_cells-1-i;
+ grid[ii].SetPtr(4, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(5, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(6, -99, -99, -99, -99.0);
+ }
+
+ /* fix links for right and left sides */
+
+ for (i = 0; i < world_y; i++) {
+ ii = i * world_x;
+ grid[ii].SetPtr(0, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(7, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(6, -99, -99, -99, -99.0);
+ ii = ((i + 1) * world_x) - 1;
+ grid[ii].SetPtr(2, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(3, -99, -99, -99, -99.0);
+ grid[ii].SetPtr(4, -99, -99, -99, -99.0);
+ }
+ }
+}
+
+void cSpatialResCount::CheckRanges() {
+
+ // Check that the x, y ranges of the inflow and outflow rectangles
+ // are valid
+ /* check range of inputs */
+ if (inflowX1 < 0) {
+ inflowX1 = 0;
+ } else if (inflowX1 > world_x) {
+ inflowX1 = world_x;
+ }
+ if (inflowX2 < 0) {
+ inflowX2 = 0;
+ } else if (inflowX2 > world_x) {
+ inflowX2 = world_x;
+ }
+ if (inflowY1 < 0) {
+ inflowY1 = 0;
+ } else if (inflowY1 > world_y) {
+ inflowY1 = world_y;
+ }
+ if (inflowY2 < 0) {
+ inflowY2 = 0;
+ } else if (inflowY2 > world_y) {
+ inflowY2 = world_y;
+ }
+
+ /* allow for rectangles that cross over the zero X or zero Y boundry */
+ if (inflowX2 < inflowX1) { inflowX2 += world_x; }
+ if (inflowY2 < inflowY1) { inflowY2 += world_y; }
+ if (outflowX1 < 0) {
+ outflowX1 = 0;
+ } else if (outflowX1 > world_x) {
+ outflowX1 = world_x;
+ }
+ if (outflowX2 < 0) {
+ outflowX2 = 0;
+ } else if (outflowX2 > world_x) {
+ outflowX2 = world_x;
+ }
+ if (outflowY1 < 0) {
+ outflowY1 = 0;
+ } else if (outflowY1 > world_y) {
+ outflowY1 = world_y;
+ }
+ if (outflowY2 < 0) {
+ outflowY2 = 0;
+ } else if (outflowY2 > world_y) {
+ outflowY2 = world_y;
+ }
+
+ /* allow for rectangles that cross over the zero X or zero Y boundry */
+ if (outflowX2 < outflowX1) { outflowX2 += world_x; }
+ if (outflowY2 < outflowY1) { outflowY2 += world_y; }
+
+}
+
+void cSpatialResCount::RateAll(double ratein) {
+
+ int i;
+
+ for (i = 0; i < num_cells; i++) {
+ grid[i].Rate(ratein);
+ }
+}
+
+void cSpatialResCount::StateAll() {
+
+ int i;
+
+ for (i = 0; i < num_cells; i++) {
+ grid[i].State();
+ }
+}
+
+void cSpatialResCount::FlowAll() {
+
+ int i,k,ii,xdist,ydist;
+ double dist;
+
+ for (i = 0; i < num_cells; i++) {
+
+ /* because flow is two way we must check only half the neighbors to
+ prevent double flow calculations */
+
+ for (k = 3; k <= 6; k++) {
+ ii = grid[i].GetElemPtr(k);
+ xdist = grid[i].GetPtrXdist(k);
+ ydist = grid[i].GetPtrYdist(k);
+ dist = grid[i].GetPtrDist(k);
+ if (ii >= 0) {
+ FlowMatter(grid[i],grid[ii],xdiffuse,ydiffuse,xgravity,ygravity,
+ xdist, ydist, dist);
+ }
+ }
+ }
+}
+
+const double cSpatialResCount::SumAll() const{
+
+ int i;
+ double sum = 0.0;
+
+ for (i = 0; i < num_cells; i++) {
+ sum += GetAmount(i);
+ }
+ return sum;
+}
+
+
+void cSpatialResCount::Source(double amount) const {
+ int i, j, elem;
+ double totalcells;
+
+
+ totalcells = (inflowY2 - inflowY1 + 1) * (inflowX2 - inflowX1 + 1) * 1.0;
+ amount /= totalcells;
+
+ for (i = inflowY1; i <= inflowY2; i++) {
+ for (j = inflowX1; j <= inflowX2; j++) {
+ elem = (Mod(i,world_y) * world_x) + Mod(j,world_x);
+ Rate(elem,amount);
+ }
+ }
+}
+
+void cSpatialResCount::Sink(double decay) const {
+
+ int i, j, elem;
+ double deltaamount;
+
+
+ for (i = outflowY1; i <= outflowY2; i++) {
+ for (j = outflowX1; j <= outflowX2; j++) {
+ elem = (Mod(i,world_y) * world_x) + Mod(j,world_x);
+ deltaamount = Max((GetAmount(elem) * (1.0 - decay)), 0.0);
+ Rate(elem,-deltaamount);
+ }
+ }
+}
Copied: trunk/source/main/cSpatialResCount.h (from rev 331, trunk/source/main/spatial_res_count.hh)
===================================================================
--- trunk/source/main/spatial_res_count.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpatialResCount.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,67 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPATIAL_RES_COUNT_HH
+#define SPATIAL_RES_COUNT_HH
+
+#ifndef SPATIAL_COUNT_ELEM_HH
+#include "cSpatialCountElem.h"
+#endif
+#ifndef TARRAY_HH
+#include "tArray.hh"
+#endif
+
+class cSpatialResCount {
+ tArray<cSpatialCountElem> grid;
+ double xdiffuse, xgravity, ydiffuse, ygravity;
+ int inflowX1, inflowX2, inflowY1, inflowY2;
+ int outflowX1, outflowX2, outflowY1, outflowY2;
+ int geometry;
+ int world_x, world_y, num_cells;
+public:
+ cSpatialResCount();
+ cSpatialResCount(int inworld_x, int inworld_y, int ingeometry);
+ cSpatialResCount(int inworld_x, int inworld_y, int ingeometry,
+ double inxdiffuse,
+ double inydiffuse, double inxgravity, double inygravity);
+ void ResizeClear(int inworld_x, int inworld_y, int ingeometry);
+ void SetPointers();
+ void CheckRanges();
+ int GetSize () {return grid.GetSize();}
+ int GetX () {return world_x;}
+ int GetY () {return world_y;}
+ cSpatialCountElem Element(int x) {return grid[x];}
+ void Rate (int x, double ratein) const {grid[x].Rate(ratein);}
+ void Rate (int x, int y, double ratein) const
+ {grid[y * world_x + x].Rate(ratein);}
+ void State (int x) {grid[x].State();}
+ void State (int x, int y) {grid[y*world_x + x].State();}
+ const double GetAmount (int x) const {return grid[x].GetAmount();}
+ const double GetAmount (int x, int y) const
+ {return grid[y*world_x + x].GetAmount();}
+ void RateAll (double ratein);
+ void StateAll ();
+ void FlowAll ();
+ const double SumAll() const;
+ void Source(double amount) const;
+ void Sink(double percent) const;
+ void SetGeometry(int in_geometry) { geometry = in_geometry; }
+ void SetXdiffuse(double in_xdiffuse) { xdiffuse = in_xdiffuse; }
+ void SetXgravity(double in_xgravity) { xgravity = in_xgravity; }
+ void SetYdiffuse(double in_ydiffuse) { ydiffuse = in_ydiffuse; }
+ void SetYgravity(double in_ygravity) { ygravity = in_ygravity; }
+ void SetInflowX1(int in_inflowX1) { inflowX1 = in_inflowX1; }
+ void SetInflowX2(int in_inflowX2) { inflowX2 = in_inflowX2; }
+ void SetInflowY1(int in_inflowY1) { inflowY1 = in_inflowY1; }
+ void SetInflowY2(int in_inflowY2) { inflowY2 = in_inflowY2; }
+ void SetOutflowX1(int in_outflowX1) { outflowX1 = in_outflowX1; }
+ void SetOutflowX2(int in_outflowX2) { outflowX2 = in_outflowX2; }
+ void SetOutflowY1(int in_outflowY1) { outflowY1 = in_outflowY1; }
+ void SetOutflowY2(int in_outflowY2) { outflowY2 = in_outflowY2; }
+};
+
+#endif
Copied: trunk/source/main/cSpecies.cc (from rev 331, trunk/source/main/species.cc)
===================================================================
--- trunk/source/main/species.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpecies.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,189 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPECIES_HH
+#include "cSpecies.h"
+#endif
+
+#ifndef CPU_TEST_INFO_HH
+#include "cCPUTestInfo.h"
+#endif
+#ifndef FUNCTIONS_HH
+#include "functions.hh"
+#endif
+#ifndef GENOTYPE_HH
+#include "cGenotype.h"
+#endif
+#ifndef GENOME_UTIL_HH
+#include "cGenomeUtil.h"
+#endif
+#ifndef TEST_CPU_HH
+#include "cTestCPU.h"
+#endif
+
+using namespace std;
+
+
+/////////////////
+// cSpecies
+/////////////////
+
+cSpecies::cSpecies(const cGenome & in_genome, int update )
+ : genome(in_genome)
+ , update_born(update)
+{
+ static int species_count = 0;
+ id_num = species_count++;
+ parent_id = -1;
+ symbol = '+';
+
+ num_genotypes = 0;
+ num_threshold = 0;
+ total_organisms = 0;
+ total_genotypes = 0;
+
+ queue_type = SPECIES_QUEUE_NONE;
+
+ next = NULL;
+ prev = NULL;
+
+ // Track distance of each genome as it is passed in...
+
+ for (int i = 0; i < SPECIES_MAX_DISTANCE; i++) {
+ genotype_distance[i] = 0;
+ }
+}
+
+cSpecies::~cSpecies()
+{
+ int i, total_count = 0;
+ for (i = 0; i < SPECIES_MAX_DISTANCE; i++) {
+ total_count += genotype_distance[i];
+ }
+
+#ifdef TEST
+ // Only print out the non-trivial species.
+
+ if (total_count > 1) {
+ FILE * fp = stats.GetTestFP();
+
+ fprintf(fp, "Species %3d: ", id_num);
+ for (i = 0; i < SPECIES_MAX_DISTANCE; i++) {
+ fprintf(fp, "%2d ", genotype_distance[i]);
+ }
+ fprintf(fp, "\n");
+ fflush(fp);
+ }
+#endif
+}
+
+// This method compares a second genome to this species and determines
+// how different it is. A -1 indicates a critical failure (like one of
+// the genomes being considered is not viable), otherwise the count
+// Of failed crossovers is returned.
+// @CAO Todo: Check phenotypes, allow failure proportional to size.
+
+int cSpecies::Compare(const cGenome & test_genome, int max_fail_count)
+{
+ cCPUTestInfo test_info;
+
+ // First, make some phenotypic comparisons between organisms.
+ // For now, just check that they both copy-true.
+
+ cTestCPU::TestGenome(test_info, test_genome);
+
+ // If the organisms aren't viable, return a -1...
+ if (test_info.IsViable() == false) {
+ return -1;
+ }
+
+ // Find the optimal offset between organisms, and related variables.
+ // @CAO: For the moment, lets not worry about offsets...
+ // The first line of B is at line 'offset' of A.
+ //int offset = cGenomeUtil::FindBestOffset(genome, test_genome);
+
+
+ // Figure out how much of the organisms overlap, and how much doesn't.
+ int overlap = Min(genome.GetSize(), test_genome.GetSize());
+ int fail_count = Max(genome.GetSize(), test_genome.GetSize()) - overlap;
+
+
+ // Do the crossovers at all posible points.
+ // Start with the first direction crossover...
+
+ bool cross1_viable = true;
+ bool cross2_viable = true;
+ cGenome cross_genome1(genome);
+ cGenome cross_genome2(test_genome);
+
+ for (int i = 0; i < overlap; i++) {
+ // If this position has changed, check if crossovers here are viable.
+ if (test_genome[i] != genome[i]) {
+ // Continue crossing over on each side...
+ cross_genome1[i] = test_genome[i];
+ cross_genome2[i] = genome[i];
+
+ // Run each side, and determine viability...
+ cTestCPU::TestGenome(test_info, cross_genome1);
+ cross1_viable = test_info.IsViable();
+
+ cTestCPU::TestGenome(test_info, cross_genome2);
+ cross2_viable = test_info.IsViable();
+ }
+
+ if (cross1_viable == false) fail_count++;
+ if (cross2_viable == false) fail_count++;
+
+ if (max_fail_count != -1 && fail_count > max_fail_count) break;
+ }
+
+
+ return fail_count;
+}
+
+bool cSpecies::OK()
+{
+ assert(id_num >= 0); // Species has negative ID value!
+ assert(genome.OK()); // Species genome not registering as OK!
+
+ // Assert valid statistics in species.
+ assert(total_organisms >= 0 && total_genotypes >= 0 &&
+ num_threshold >= 0 && num_genotypes >= 0);
+
+ // Finally, make sure the species is registered as being in a queue.
+
+ assert(queue_type >= 0 && queue_type <= 3); // Species not in a proper queue
+
+ return true;
+}
+
+void cSpecies::AddThreshold(cGenotype & in_genotype)
+{
+ const int distance =
+ cGenomeUtil::FindEditDistance(genome, in_genotype.GetGenome());
+
+ if (distance >= 0 && distance < SPECIES_MAX_DISTANCE)
+ genotype_distance[distance]++;
+
+ num_threshold++;
+}
+
+void cSpecies::RemoveThreshold(cGenotype & in_genotype)
+{
+ total_genotypes++;
+ total_organisms += in_genotype.GetTotalOrganisms();
+ num_threshold--;
+}
+
+void cSpecies::AddGenotype()
+{
+ num_genotypes++;
+}
+
+void cSpecies::RemoveGenotype() {
+ num_genotypes--;
+}
Copied: trunk/source/main/cSpecies.h (from rev 331, trunk/source/main/species.hh)
Copied: trunk/source/main/cSpeciesControl.cc (from rev 331, trunk/source/main/species_control.cc)
===================================================================
--- trunk/source/main/species_control.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpeciesControl.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,170 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPECIES_CONTROL_HH
+#include "cSpeciesControl.h"
+#endif
+
+#ifndef CONFIG_HH
+#include "cConfig.h"
+#endif
+#ifndef DEFS_HH
+#include "defs.hh"
+#endif
+#ifndef GENOTYPE_HH
+#include "cGenotype.h"
+#endif
+#ifndef nSpecies_h
+#include "nSpecies.h"
+#endif
+#ifndef SPECIES_HH
+#include "cSpecies.h"
+#endif
+#ifndef STATS_HH
+#include "cStats.h"
+#endif
+
+#include <assert.h>
+
+/////////////////////
+// cSpeciesControl
+/////////////////////
+
+cSpeciesControl::cSpeciesControl(cGenebank & in_gb) : genebank(in_gb)
+{
+}
+
+cSpeciesControl::~cSpeciesControl()
+{
+}
+
+void cSpeciesControl::Remove(cSpecies & in_species)
+{
+ switch (in_species.GetQueueType()) {
+ case SPECIES_QUEUE_ACTIVE:
+ active_queue.Remove(in_species);
+ break;
+ case SPECIES_QUEUE_INACTIVE:
+ inactive_queue.Remove(in_species);
+ break;
+ case SPECIES_QUEUE_GARBAGE:
+ garbage_queue.Remove(in_species);
+ break;
+ default:
+ break;
+ }
+
+ in_species.SetQueueType(SPECIES_QUEUE_NONE);
+}
+
+void cSpeciesControl::Adjust(cSpecies & in_species)
+{
+ // Only adjust if this species is in the active queue.
+
+ if (in_species.GetQueueType() == SPECIES_QUEUE_ACTIVE) {
+ active_queue.Adjust(in_species);
+ }
+}
+
+void cSpeciesControl::SetActive(cSpecies & in_species)
+{
+ Remove(in_species);
+ active_queue.InsertRear(in_species);
+ in_species.SetQueueType(SPECIES_QUEUE_ACTIVE);
+}
+
+void cSpeciesControl::SetInactive(cSpecies & in_species)
+{
+ Remove(in_species);
+ inactive_queue.InsertRear(in_species);
+ in_species.SetQueueType(SPECIES_QUEUE_INACTIVE);
+}
+
+void cSpeciesControl::SetGarbage(cSpecies & in_species)
+{
+ Remove(in_species);
+ garbage_queue.InsertRear(in_species);
+ in_species.SetQueueType(SPECIES_QUEUE_GARBAGE);
+}
+
+bool cSpeciesControl::OK()
+{
+ int ret_value = true;
+
+ // Check the queues.
+
+ assert (active_queue.OK(SPECIES_QUEUE_ACTIVE));
+ assert (inactive_queue.OK(SPECIES_QUEUE_INACTIVE));
+ assert (garbage_queue.OK(SPECIES_QUEUE_GARBAGE));
+
+ return ret_value;
+}
+
+int cSpeciesControl::FindPos(cSpecies & in_species, int max_depth)
+{
+ cSpecies * temp_species = active_queue.GetFirst();
+ if (max_depth < 0 || max_depth > active_queue.GetSize()) {
+ max_depth = active_queue.GetSize();
+ }
+
+ for (int i = 0; i < max_depth; i++) {
+ if (temp_species == &in_species) return i;
+ temp_species = temp_species->GetNext();
+ }
+
+ return -1;
+}
+
+cSpecies * cSpeciesControl::Find(cGenotype & in_genotype, int record_level)
+{
+ cSpecies * found_species = NULL;
+ int cur_count, best_count = MAX_CREATURE_SIZE;
+ cSpecies * cur_species;
+
+ if (record_level == nSpecies::RECORD_FULL) {
+ cur_species = active_queue.GetFirst();
+ int size = active_queue.GetSize();
+ for (int i = 0; i < size; i++) {
+ cur_count = cur_species->Compare(in_genotype.GetGenome(),
+ cConfig::GetSpeciesThreshold());
+ if (cur_count != -1 && cur_count <= cConfig::GetSpeciesThreshold() &&
+ cur_count < best_count) {
+ found_species = cur_species;
+ best_count = cur_count;
+ }
+ cur_species = cur_species->GetNext();
+ }
+ }
+
+ if (record_level == nSpecies::RECORD_LIMITED) {
+ cur_species = in_genotype.GetSpecies();
+
+ if (cur_species) {
+ int num_diff = cur_species->Compare(in_genotype.GetGenome(),
+ cConfig::GetSpeciesThreshold());
+ if (num_diff != -1 && num_diff <= cConfig::GetSpeciesThreshold()) {
+ found_species = cur_species;
+ }
+ }
+ }
+
+ return found_species;
+}
+
+void cSpeciesControl::Purge(cStats & stats)
+{
+ cSpecies * cur_species = garbage_queue.GetFirst();
+ for (int i = 0; i < garbage_queue.GetSize(); i++) {
+ stats.RemoveSpecies(cur_species->GetID(),
+ cur_species->GetParentID(),
+ cur_species->GetTotalGenotypes(),
+ cur_species->GetTotalOrganisms(),
+ stats.GetUpdate() - cur_species->GetUpdateBorn());
+ cur_species = cur_species->GetNext();
+ }
+ garbage_queue.Purge();
+}
Copied: trunk/source/main/cSpeciesControl.h (from rev 331, trunk/source/main/species_control.hh)
===================================================================
--- trunk/source/main/species_control.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpeciesControl.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPECIES_CONTROL_HH
+#define SPECIES_CONTROL_HH
+
+#ifndef SPECIES_QUEUE_HH
+#include "cSpeciesQueue.h"
+#endif
+
+class cGenebank;
+class cGenotype;
+class cSpecies;
+class cStats;
+class cSpeciesControl {
+private:
+ cSpeciesQueue active_queue;
+ cSpeciesQueue inactive_queue;
+ cSpeciesQueue garbage_queue;
+ cGenebank & genebank;
+public:
+ cSpeciesControl(cGenebank & in_gb);
+ ~cSpeciesControl();
+
+ void Remove(cSpecies & in_species);
+ void Adjust(cSpecies & in_species);
+ void SetInactive(cSpecies & in_species);
+ void SetActive(cSpecies & in_species);
+ void SetGarbage(cSpecies & in_species);
+ void Purge(cStats & stats);
+
+ bool OK();
+
+ int FindPos(cSpecies & in_species, int max_depth = -1);
+ cSpecies * Find(cGenotype & in_genotype, int record_level);
+
+ inline cSpecies * GetFirst() const { return active_queue.GetFirst(); }
+ inline cSpecies * GetFirstInactive() const
+ { return inactive_queue.GetFirst(); }
+ inline cSpecies * GetFirstGarbage() const
+ { return garbage_queue.GetFirst(); }
+ inline int GetSize() const { return active_queue.GetSize(); }
+ inline int GetInactiveSize() const { return inactive_queue.GetSize(); }
+};
+
+#endif
Copied: trunk/source/main/cSpeciesQueue.cc (from rev 331, trunk/source/main/species_queue.cc)
===================================================================
--- trunk/source/main/species_queue.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cSpeciesQueue.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,173 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SPECIES_QUEUE_HH
+#include "cSpeciesQueue.h"
+#endif
+
+#ifndef DEFS_HH
+#include "defs.hh"
+#endif
+#ifndef SPECIES_HH
+#include "cSpecies.h"
+#endif
+
+///////////////////
+// cSpeciesQueue
+///////////////////
+
+cSpeciesQueue::cSpeciesQueue()
+{
+ size = 0;
+ first = NULL;
+}
+
+cSpeciesQueue::~cSpeciesQueue()
+{
+}
+
+void cSpeciesQueue::InsertRear(cSpecies & new_species)
+{
+ // If the queue doesn't exist, create it with this species as the only
+ // element.
+
+ if (!first) {
+ first = &new_species;
+ first->SetNext(first);
+ first->SetPrev(first);
+ }
+
+ // Otherwise, put this species at the end of the queue.
+
+ else {
+ new_species.SetNext(first);
+ new_species.SetPrev(first->GetPrev());
+ first->GetPrev()->SetNext(&new_species);
+ first->SetPrev(&new_species);
+ }
+
+ size++;
+}
+
+void cSpeciesQueue::Remove(cSpecies & in_species)
+{
+ size--;
+
+ // If the queue is now empty, delete it properly.
+ if (size == 0) {
+ first = NULL;
+ return;
+ }
+
+ // If we are removing the first element of the queue, slide the queue to
+ // the new first before removing it.
+
+ if (first == &in_species) {
+ first = in_species.GetNext();
+ }
+
+ // Remove the in_species
+
+ in_species.GetPrev()->SetNext(in_species.GetNext());
+ in_species.GetNext()->SetPrev(in_species.GetPrev());
+ in_species.SetNext(NULL);
+ in_species.SetPrev(NULL);
+}
+
+void cSpeciesQueue::Adjust(cSpecies & in_species)
+{
+ // First move it up the list if need be...
+
+ cSpecies * prev_species = in_species.GetPrev();
+ while (&in_species != first &&
+ in_species.GetNumThreshold() > prev_species->GetNumThreshold()) {
+ // Swap the position of this species with the previous one.
+ if (prev_species == first) first = &in_species;
+
+ // Outer connections...
+ prev_species->SetNext(in_species.GetNext());
+ in_species.GetNext()->SetPrev(prev_species);
+ in_species.SetPrev(prev_species->GetPrev());
+ prev_species->GetPrev()->SetNext(&in_species);
+
+ // Inner connections...
+ prev_species->SetPrev(&in_species);
+ in_species.SetNext(prev_species);
+
+ prev_species = in_species.GetPrev();
+ }
+
+ // Then see if it needs to be moved down.
+ cSpecies * next_species = in_species.GetNext();
+ while (next_species != first &&
+ in_species.GetNumThreshold() < next_species->GetNumThreshold()) {
+ // Swap the position of this species with the next one.
+ if (&in_species == first) first = next_species;
+
+ // Outer Connections...
+ in_species.SetNext(next_species->GetNext());
+ next_species->GetNext()->SetPrev(&in_species);
+ next_species->SetPrev(in_species.GetPrev());
+ in_species.GetPrev()->SetNext(next_species);
+
+ // Inner Connections...
+ in_species.SetPrev(next_species);
+ next_species->SetNext(&in_species);
+
+ next_species = in_species.GetNext();
+ }
+}
+
+void cSpeciesQueue::Purge()
+{
+ cSpecies * cur_species = first;
+ cSpecies * next_species = NULL;
+
+ // Loop through the species deleting them until there is only one left.
+ for (int i = 1; i < size; i++) {
+ next_species = cur_species->GetNext();
+ delete cur_species;
+ cur_species = next_species;
+ }
+
+ // And delete that last one.
+ delete cur_species;
+ first = NULL;
+ size = 0;
+}
+
+bool cSpeciesQueue::OK(int queue_type)
+{
+ cSpecies * cur_species = NULL;
+ int count = 0;
+ bool ret_value = true;
+
+ while (first && cur_species != first) {
+ // If we are just starting, set cur_species to the first element.
+ if (!cur_species) cur_species = first;
+
+ // Check that the list is correct in both directions...
+
+ assert (cur_species->GetNext()->GetPrev() == cur_species);
+
+ // Check to make sure the current species is OK() and that it should
+ // indeed be in this list.
+
+ if (!cur_species->OK()) ret_value = false;
+
+ assert (queue_type == cur_species->GetQueueType());
+ count++;
+
+ assert (count <= size);
+
+ cur_species = cur_species->GetNext();
+ }
+
+ assert (count == size);
+
+ return ret_value;
+}
Copied: trunk/source/main/cSpeciesQueue.h (from rev 331, trunk/source/main/species_queue.hh)
Copied: trunk/source/main/cStats.cc (from rev 331, trunk/source/main/stats.cc)
===================================================================
--- trunk/source/main/stats.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cStats.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,888 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "cStats.h"
+
+#include "cConfig.h"
+#include "data_file.hh"
+#include "functions.hh"
+#include "string_util.hh"
+#include "tDataEntry.hh"
+
+#include <math.h>
+
+using namespace std;
+
+////////////
+// cStats
+////////////
+
+cStats::cStats()
+ : current_update(-1)
+ , sub_update(0)
+ , avida_time(0)
+ , data_manager(this, "population_data")
+ , rave_true_replication_rate( 500 )
+ , entropy(0)
+ , species_entropy(0)
+ , energy(0)
+ , dom_fidelity(0)
+ , ave_fidelity(0)
+ , max_viable_fitness(0)
+ , dom_genotype(NULL)
+ , dom_merit(0)
+ , dom_gestation(0)
+ , dom_repro_rate(0)
+ , dom_fitness(0)
+ , dom_size(0)
+ , dom_copied_size(0)
+ , dom_exe_size(0)
+ , max_fitness(0)
+ , max_merit(0)
+ , max_gestation_time(0)
+ , max_genome_length(0)
+ , min_fitness(HUGE_VAL)
+ , min_merit(HUGE_VAL)
+ , min_gestation_time(INT_MAX)
+ , min_genome_length(INT_MAX)
+ , dom_genotype_id(-1)
+ , dom_name("(none)")
+ , dom_births(0)
+ , dom_breed_true(0)
+ , dom_breed_in(0)
+ , dom_breed_out(0)
+ , dom_abundance(0)
+ , dom_gene_depth(-1)
+ , dom_sequence("")
+ , coal_depth(0)
+ , num_births(0)
+ , num_deaths(0)
+ , num_breed_in(0)
+ , num_breed_true(0)
+ , num_breed_true_creatures(0)
+ , num_creatures(0)
+ , num_genotypes(0)
+ , num_threshold(0)
+ , num_species(0)
+ , num_thresh_species(0)
+ , num_lineages(0)
+ , num_executed(0)
+ , num_parasites(0)
+ , num_no_birth_creatures(0)
+ , num_genotypes_last(1)
+ , tot_organisms(0)
+ , tot_genotypes(0)
+ , tot_threshold(0)
+ , tot_species(0)
+ , tot_thresh_species(0)
+ , tot_lineages(0)
+ , tot_executed(0)
+{
+ // Open log files.
+
+ if (cConfig::GetLogCreatures()) fp_creature_log.open("creature.log");
+ else fp_creature_log.close();
+
+ if (cConfig::GetLogGenotypes()) fp_genotype_log.open("genotype.log");
+ else fp_genotype_log.close();
+
+ if (cConfig::GetLogThreshold()) fp_threshold_log.open("threshold.log");
+ else fp_threshold_log.close();
+
+ if (cConfig::GetLogSpecies()) fp_species_log.open("species.log");
+ else fp_species_log.close();
+
+ if (cConfig::GetLogLineages()) fp_lineage_log.open("lineage.log");
+ else fp_lineage_log.close();
+
+ task_cur_count.Resize( cConfig::GetNumTasks() );
+ task_last_count.Resize( cConfig::GetNumTasks() );
+ task_exe_count.Resize( cConfig::GetNumTasks() );
+ task_cur_count.SetAll(0);
+ task_last_count.SetAll(0);
+ task_exe_count.SetAll(0);
+
+#ifdef INSTRUCTION_COUNT
+ sum_exe_inst_array.Resize( cConfig::GetNumInstructions() );
+ ZeroInst();
+#endif
+ inst_names.Resize( cConfig::GetNumInstructions() );
+
+
+
+ reaction_count.Resize( cConfig::GetNumReactions() );
+ reaction_count.SetAll(0);
+
+ resource_count.Resize( cConfig::GetNumResources() );
+ resource_count.SetAll(0);
+
+ task_names.Resize( cConfig::GetNumTasks() );
+ reaction_names.Resize( cConfig::GetNumReactions() );
+ resource_names.Resize( cConfig::GetNumResources() );
+
+ genotype_map.Resize( cConfig::GetWorldX() * cConfig::GetWorldY() );
+ SetupPrintDatabase();
+}
+
+void cStats::SetupPrintDatabase()
+{
+ // Load in all the keywords, descriptions, and associated functions for
+ // data management.
+
+ // Time Stats
+ data_manager.Add("update", "Update", &cStats::GetUpdate);
+ data_manager.Add("sub_update", "Sub-Update", &cStats::GetSubUpdate);
+ data_manager.Add("generation", "Generation", &cStats::GetGeneration);
+
+ // Population Level Stats
+ data_manager.Add("entropy", "Genotype Entropy (Diversity)", &cStats::GetEntropy);
+ data_manager.Add("species_entropy", "Species Entropy (Diversity)", &cStats::GetEntropy);
+ data_manager.Add("energy", "Average Inferiority (Energy)", &cStats::GetEnergy);
+ data_manager.Add("richness", "Number of Different Genotypes (Richness)", &cStats::GetNumGenotypes);
+ data_manager.Add("eveness", "Equitability of Genotype Distribution (Evenness)", &cStats::GetEvenness);
+ data_manager.Add("coal_depth", "Depth of Coalescent Genotype", &cStats::GetCoalescentDepth);
+
+ // Dominant Genotype Stats
+ data_manager.Add("dom_merit", "Ave Merit of Dominant Genotype", &cStats::GetDomMerit);
+ data_manager.Add("dom_gest", "Ave Gestation Time of Dominant Genotype", &cStats::GetDomGestation);
+ data_manager.Add("dom_fitness", "Ave Fitness of Dominant Genotype", &cStats::GetDomFitness);
+ data_manager.Add("dom_repro", "Ave Repro-Rate of Dominant Genotype", &cStats::GetDomReproRate);
+ data_manager.Add("dom_length", "Genome Length of Dominant Genotype", &cStats::GetDomSize);
+ data_manager.Add("dom_copy_length","Copied Length of Dominant Genotype", &cStats::GetDomCopySize);
+ data_manager.Add("dom_exe_length", "Executed Length of Dominant Genotype", &cStats::GetDomExeSize);
+ data_manager.Add("dom_id", "ID of Dominant Genotype", &cStats::GetDomID);
+ data_manager.Add("dom_name", "Name of Dominant Genotype", &cStats::GetDomName);
+ data_manager.Add("dom_births", "Birth Count of Dominant Genotype", &cStats::GetDomBirths);
+ data_manager.Add("dom_breed_true", "Breed-True Count of Dominant Genotype", &cStats::GetDomBreedTrue);
+ data_manager.Add("dom_breed_in", "Breed-In Count of Dominant Genotype", &cStats::GetDomBreedIn);
+ data_manager.Add("dom_breed_out", "Breed-Out Count of Dominant Genotype", &cStats::GetDomBreedOut);
+ data_manager.Add("dom_num_cpus", "Abundance of Dominant Genotype", &cStats::GetDomAbundance);
+ data_manager.Add("dom_depth", "Tree Depth of Dominant Genotype", &cStats::GetDomGeneDepth);
+ data_manager.Add("dom_sequence", "Sequence of Dominant Genotype", &cStats::GetDomSequence);
+
+ // Dominant Inject Genotype Stats
+ data_manager.Add("dom_inj_size", "Genome Length of Dominant Parasite", &cStats::GetDomInjSize);
+ data_manager.Add("dom_inj_ID", "ID of Dominant Parasite", &cStats::GetDomInjID);
+ data_manager.Add("dom_inj_name", "Nameof Dominant Parasite", &cStats::GetDomInjName);
+ data_manager.Add("dom_inj_births", "Birth Count of Dominant Parasite", &cStats::GetDomInjBirths);
+ data_manager.Add("dom_inj_abundance", "Abundance of Dominant Parasite", &cStats::GetDomInjAbundance);
+ data_manager.Add("dom_inj_sequence", "Sequence of Dominant Parasite", &cStats::GetDomInjSequence);
+
+ // Current Counts...
+ data_manager.Add("num_births", "Count of Births in Population", &cStats::GetNumBirths);
+ data_manager.Add("num_deaths", "Count of Deaths in Population", &cStats::GetNumDeaths);
+ data_manager.Add("breed_in", "Count of Non-Breed-True Births", &cStats::GetBreedIn);
+ data_manager.Add("breed_true", "Count of Breed-True Births", &cStats::GetBreedTrue);
+ data_manager.Add("bred_true", "Count of Organisms that have Bred True", &cStats::GetBreedTrueCreatures);
+ data_manager.Add("num_cpus", "Count of Organisms in Population", &cStats::GetNumCreatures);
+ data_manager.Add("num_genotypes", "Count of Genotypes in Population", &cStats::GetNumGenotypes);
+ data_manager.Add("num_threshold", "Count of Threshold Genotypes", &cStats::GetNumThreshold);
+ data_manager.Add("num_species", "Count of Species in Population", &cStats::GetNumSpecies);
+ data_manager.Add("thresh_species", "Count of Threshold Species", &cStats::GetNumThreshSpecies);
+ data_manager.Add("num_lineages", "Count of Lineages in Population", &cStats::GetNumLineages);
+ data_manager.Add("num_parasites", "Count of Parasites in Population", &cStats::GetNumParasites);
+ data_manager.Add("num_no_birth", "Count of Childless Organisms", &cStats::GetNumNoBirthCreatures);
+
+ // Total Counts...
+ data_manager.Add("tot_cpus", "Total Organisms ever in Population", &cStats::GetTotCreatures);
+ data_manager.Add("tot_genotypes", "Total Genotypes ever in Population", &cStats::GetTotGenotypes);
+ data_manager.Add("tot_threshold", "Total Threshold Genotypes Ever", &cStats::GetTotThreshold);
+ data_manager.Add("tot_species", "Total Species ever in Population", &cStats::GetTotSpecies);
+ data_manager.Add("tot_lineages", "Total Lineages ever in Population", &cStats::GetTotLineages);
+
+ // Some Average Data...
+ data_manager.Add("ave_repro_rate", "Average Repro-Rate (1/Gestation)", &cStats::GetAveReproRate);
+ data_manager.Add("ave_merit", "Average Merit", &cStats::GetAveMerit);
+ data_manager.Add("ave_age", "Average Age", &cStats::GetAveCreatureAge);
+ data_manager.Add("ave_memory", "Average Memory Used", &cStats::GetAveMemSize);
+ data_manager.Add("ave_neutral", "Average Neutral Metric", &cStats::GetAveNeutralMetric);
+ data_manager.Add("ave_lineage", "Average Lineage Label", &cStats::GetAveLineageLabel);
+ data_manager.Add("ave_gest", "Average Gestation Time", &cStats::GetAveGestation);
+ data_manager.Add("ave_fitness", "Average Fitness", &cStats::GetAveFitness);
+ data_manager.Add("ave_gen_age", "Average Genotype Age", &cStats::GetAveGenotypeAge);
+ data_manager.Add("ave_length", "Average Genome Length", &cStats::GetAveSize);
+ data_manager.Add("ave_copy_length","Average Copied Length", &cStats::GetAveCopySize);
+ data_manager.Add("ave_exe_length", "Average Executed Length", &cStats::GetAveExeSize);
+ data_manager.Add("ave_thresh_age", "Average Threshold Genotype Age", &cStats::GetAveThresholdAge);
+ data_manager.Add("ave_species_age","Average Species Age", &cStats::GetAveSpeciesAge);
+
+ // And a couple of Maximums
+ data_manager.Add("max_fitness", "Maximum Fitness in Population", &cStats::GetMaxFitness);
+ data_manager.Add("max_merit", "Maximum Merit in Population", &cStats::GetMaxMerit);
+}
+
+cStats::~cStats()
+{
+ cout << "Closing stats object..."<<endl;
+
+ // Close all the statistics files.
+
+ data_file_manager.FlushAll();
+
+ fp_creature_log.close();
+ fp_genotype_log.close();
+ fp_threshold_log.close();
+ fp_species_log.close();
+ fp_lineage_log.close();
+}
+
+void cStats::ZeroTasks()
+{
+ for( int i=0; i < task_cur_count.GetSize(); i++ ){
+ task_cur_count[i] = 0;
+ task_last_count[i] = 0;
+ }
+}
+
+
+#ifdef INSTRUCTION_COUNT
+void cStats::ZeroInst()
+{
+ for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
+ sum_exe_inst_array[i].Clear();
+ }
+}
+#endif
+
+void cStats::CalcEnergy()
+{
+ assert(sum_fitness.Average() >= 0.0);
+ assert(dom_fitness >= 0);
+
+ if (sum_fitness.Average() == 0.0 || dom_fitness == 0.0) {
+ energy = 0.0;
+ } else {
+ energy = Log(dom_fitness / sum_fitness.Average());
+ }
+}
+
+void cStats::CalcFidelity()
+{
+ // There is a (small) probability that when a random instruction is picked
+ // after a mutation occurs, that it will be the original instruction again;
+ // This needs to be adjusted for!
+
+ double adj = ((double) (cConfig::GetNumInstructions() - 1)) /
+ (double) cConfig::GetNumInstructions();
+
+ double base_fidelity = (1.0 - adj * cConfig::GetDivideMutProb()) *
+ (1.0 - cConfig::GetDivideInsProb()) * (1.0 - cConfig::GetDivideDelProb());
+
+ double true_cm_rate = adj * cConfig::GetCopyMutProb();
+ ave_fidelity = base_fidelity * pow(1.0 - true_cm_rate, sum_size.Average());
+ dom_fidelity = base_fidelity * pow(1.0 - true_cm_rate, dom_size);
+}
+
+void cStats::RecordBirth(int cell_id, int genotype_id, bool breed_true)
+{
+ tot_organisms++;
+ num_births++;
+ if (fp_creature_log.good() == true) {
+ fp_creature_log << GetUpdate() << " "
+ << cell_id << " "
+ << genotype_id << endl;
+ }
+
+ if (breed_true == true) num_breed_true++;
+ else num_breed_in++;
+}
+
+
+void cStats::RecordDeath(int cell_id, int genotype_id, int age)
+{
+ num_deaths++;
+}
+
+void cStats::AddGenotype(int id_num)
+{
+ id_num = -1; // @CAO do we still need id_num here?
+ tot_genotypes++;
+}
+
+void cStats::RemoveGenotype(int id_num, int parent_id,
+ int parent_dist, int depth, int max_abundance, int parasite_abundance,
+ int age, int length)
+{
+ if (fp_genotype_log.good() &&
+ (!cConfig::GetLogThresholdOnly() || max_abundance > 2)) {
+ const int update_born = cStats::GetUpdate() - age + 1;
+ fp_genotype_log << id_num << " " // 1
+ << update_born << " " // 2
+ << parent_id << " " // 3
+ << parent_dist << " " // 4
+ << depth << " " // 5
+ << max_abundance << " " // 6
+ << age << " " // 7
+ << length << endl; // 8
+ }
+
+ (void) parasite_abundance; // Not used now, but maybe in future.
+}
+
+void cStats::AddThreshold(int id_num, const char * name, int species_num)
+{
+ num_threshold++;
+ tot_threshold++;
+ if( fp_threshold_log.good() )
+ fp_threshold_log << cStats::GetUpdate() << " " // 1
+ << id_num << " " // 2
+ << species_num << " " // 3
+ << name << endl; // 4
+}
+
+void cStats::RemoveThreshold(int id_num)
+{
+ id_num = -1; // @CAO do we still need id_num here?
+ num_threshold--;
+}
+
+void cStats::AddSpecies(int id_num)
+{
+ id_num = -1; // @CAO do we still need id_num here?
+ tot_species++;
+ num_species++;
+}
+
+void cStats::RemoveSpecies(int id_num, int parent_id,
+ int max_gen_abundance, int max_abundance, int age)
+{
+ num_species--;
+ if( fp_species_log.good() )
+ fp_species_log << cStats::GetUpdate() << " " // 1
+ << id_num << " " // 2
+ << parent_id << " " // 3
+ << max_gen_abundance << " " // 4
+ << max_abundance << " " // 5
+ << age << endl; // 6
+}
+
+void cStats::AddLineage()
+{
+ tot_lineages++;
+ num_lineages++;
+}
+
+void cStats::ProcessUpdate()
+{
+ static int last_update = 0;
+
+ // Increment the "avida_time"
+ if (sum_merit.Count() > 0 && sum_merit.Average() > 0) {
+ double delta = ((double)(current_update-last_update))/sum_merit.Average();
+ avida_time += delta;
+
+ // calculate the true replication rate in this update
+ rave_true_replication_rate.Add( num_births/
+ (delta * cConfig::GetAveTimeslice() * num_creatures) );
+ }
+ last_update = current_update;
+
+ // Zero-out any variables which need to be cleared at end of update.
+
+ num_births = 0;
+ num_deaths = 0;
+ num_breed_true = 0;
+
+ tot_executed += num_executed;
+ num_executed = 0;
+
+ task_cur_count.SetAll(0);
+ task_last_count.SetAll(0);
+ task_exe_count.SetAll(0);
+
+ dom_merit = 0;
+ dom_gestation = 0.0;
+ dom_fitness = 0.0;
+ max_fitness = 0.0;
+}
+
+
+void cStats::FlushFP(){
+ data_file_manager.FlushAll();
+
+ fp_creature_log.flush();
+ fp_genotype_log.flush();
+ fp_threshold_log.flush();
+ fp_species_log.flush();
+ fp_lineage_log.flush();
+}
+
+
+void cStats::RemoveLineage(int id_num, int parent_id, int update_born,
+ double generation_born,
+ int total_CPUs, int total_genotypes, double fitness,
+ double lineage_stat1, double lineage_stat2 )
+{
+ static bool msg_printed = false;
+
+ if ( !msg_printed ){
+ if( fp_lineage_log.good() )
+ fp_lineage_log << "# (1) lineage id "
+ << "(2) parent lineage id "
+ << "(3) initial fitness "
+ << "(4) total number of creatures "
+ << "(5) total number of genotypes "
+ << "(6) update born "
+ << "(7) update extinct "
+ << "(8) generation born "
+ << "(9) generation extinct"
+ << "(10) lineage stat1"
+ << "(11) lineage stat2 [10, 11 depend on lineage creation method chosen]"
+ << endl;
+ msg_printed = true;
+ }
+
+ num_lineages--;
+ if( fp_lineage_log.good() ) {
+ fp_lineage_log << id_num << " " // 1
+ << parent_id << " " // 2
+ << fitness << " " // 3
+ << total_CPUs << " " // 4
+ << total_genotypes << " " // 5
+ << update_born << " " // 6
+ << cStats::GetUpdate() << " " // 7
+ << generation_born << " " // 8
+ << SumGeneration().Average() << " " // 9
+ << lineage_stat1 << " " // 10
+ << lineage_stat2 << " " << endl;
+ }
+}
+
+
+void cStats::PrintDataFile(const cString & filename, const cString & format,
+ char sep)
+{
+ cDataFile & data_file = GetDataFile(filename);
+ data_manager.PrintRow(data_file, format, sep);
+}
+
+
+void cStats::PrintAverageData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida average data" );
+ df.WriteTimeStamp();
+
+ df.Write(GetUpdate(), "update" );
+ df.Write(sum_merit.Average(), "average merit" );
+ df.Write(sum_gestation.Average(), "average gestation time" );
+ df.Write(sum_fitness.Average(), "average fitness" );
+ df.Write(sum_repro_rate.Average(), "repro rate?" );
+ df.Write(sum_size.Average(), "average size" );
+ df.Write(sum_copy_size.Average(), "average copied size" );
+ df.Write(sum_exe_size.Average(), "average executed size" );
+ df.Write(sum_abundance.Average(), "average abundance?" );
+ df.Write((double)num_births/num_creatures,
+ "proportion of organisms that gave birth in this update" );
+ df.Write((double)num_breed_true/num_creatures,
+ "proportion of breed true organisms" );
+ df.Write(sum_genotype_depth.Average(), "average genotype depth" );
+ df.Write(sum_generation.Average(), "average generation" );
+ df.Write(sum_neutral_metric.Average(), "average neutral metric" );
+ df.Write(sum_lineage_label.Average(), "average lineage label" );
+ df.Write(rave_true_replication_rate.Average(),
+ "true replication rate (based on births/update, time-averaged)");
+ df.Endl();
+}
+
+
+void cStats::PrintErrorData(const cString & filename)
+{
+ ofstream & fp = GetDataFileOFStream(filename);
+ assert(fp.good());
+ fp<< GetUpdate() << " " // 1
+ << sum_merit.StdError() << " " // 2
+ << sum_gestation.StdError() << " " // 3
+ << sum_fitness.StdError() << " " // 4
+ << sum_repro_rate.StdError() << " " // 5
+ << sum_size.StdError() << " " // 6
+ << sum_copy_size.StdError() << " " // 7
+ << sum_exe_size.StdError() << " " // 8
+ << sum_abundance.StdError() << " " // 9
+ << -1 << " " // 10
+ << -1 << " " // 11
+ << sum_genotype_depth.StdError() << " " // 12
+ << sum_generation.StdError() << " " // 15
+ << sum_neutral_metric.StdError() << " " // 16
+ << sum_lineage_label.StdError() << endl;// 17
+}
+
+
+void cStats::PrintVarianceData(const cString & filename)
+{
+ ofstream & fp = GetDataFileOFStream(filename);
+ assert(fp.good());
+ fp<<GetUpdate() << " " // 1
+ << sum_merit.Variance() << " " // 2
+ << sum_gestation.Variance() << " " // 3
+ << sum_fitness.Variance() << " " // 4
+ << sum_repro_rate.Variance() << " " // 5
+ << sum_size.Variance() << " " // 6
+ << sum_copy_size.Variance() << " " // 7
+ << sum_exe_size.Variance() << " " // 8
+ << sum_abundance.Variance() << " " // 9
+ << -1 << " " // 10
+ << -1 << " " // 11
+ << sum_genotype_depth.Variance() << " " // 12
+ << sum_generation.Variance() << " " // 15
+ << sum_neutral_metric.Variance() << " " // 16
+ << sum_lineage_label.Variance() << " " // 17
+ << rave_true_replication_rate.Variance()<< endl;// 18
+}
+
+
+void cStats::PrintDominantData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida dominant data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update" );
+ df.Write( dom_merit, "average merit of dominant genotype" );
+ df.Write( dom_gestation, "average gestation time of dominant" );
+ df.Write( dom_fitness, "average fitness of dominant genotype" );
+ df.Write( dom_repro_rate, "repro rate?" );
+ df.Write( dom_size, "size of dominant genotype" );
+ df.Write( dom_copied_size, "copied size of dominant genotype" );
+ df.Write( dom_exe_size, "executed size of dominant genotype" );
+ df.Write( dom_abundance, "abundance of dominant genotype" );
+ df.Write( dom_births, "number of births" );
+ df.Write( dom_breed_true, "number of dominant breed true?" );
+ df.Write( dom_gene_depth, "dominant gene depth" );
+ df.Write( dom_breed_in, "dominant breed in");
+ df.Write( max_fitness, "max fitness?" );
+ df.Write( dom_genotype_id, "genotype ID of dominant genotype" );
+ df.Write( dom_name, "name of dominant genotype" );
+ df.Endl();
+}
+
+void cStats::PrintDominantParaData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida dominant parasite data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update" );
+ df.Write( dom_inj_size, "size of dominant genotype" );
+ df.Write( dom_inj_abundance, "abundance of dominant genotype" );
+ df.Write( dom_inj_genotype_id, "genotype ID of dominant genotype" );
+ df.Write( dom_inj_name, "name of dominant genotype" );
+ df.Endl();
+}
+
+void cStats::PrintStatsData(const cString & filename)
+{
+ const int genotype_change = num_genotypes - num_genotypes_last;
+ const double log_ave_fid = (ave_fidelity > 0) ? -Log(ave_fidelity) : 0.0;
+ const double log_dom_fid = (dom_fidelity > 0) ? -Log(dom_fidelity) : 0.0;
+
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Generic Statistics Data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update" );
+ df.Write( energy, "average inferiority (energy)");
+ df.Write( 1.0 - ave_fidelity, "ave probability of any mutations in genome" );
+ df.Write( 1.0 - dom_fidelity, "probability of any mutations in dom genome" );
+ df.Write( log_ave_fid, "log(average fidelity)");
+ df.Write( log_dom_fid, "log(dominant fidelity)");
+ df.Write( genotype_change, "change in number of genotypes");
+ df.Write( entropy, "genotypic entropy");
+ df.Write( species_entropy, "species entropy");
+ df.Write( coal_depth, "depth of most reacent coalescence");
+ df.Endl();
+}
+
+
+void cStats::PrintCountData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida count data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update");
+ df.Write( num_executed, "number of insts executed this update");
+ df.Write( num_creatures, "number of organisms");
+ df.Write( num_genotypes, "number of different genotypes");
+ df.Write( num_threshold, "number of different threshold genotypes");
+ df.Write( num_species, "number of different species");
+ df.Write( num_thresh_species, "number of different threshold species");
+ df.Write( num_lineages, "number of different lineages");
+ df.Write( num_births, "number of births in this update");
+ df.Write( num_deaths, "number of deaths in this update");
+ df.Write( num_breed_true, "number of breed true");
+ df.Write( num_breed_true_creatures, "number of breed true organisms?");
+ //df.Write( num_parasites, "number of parasites");
+ df.Write( num_no_birth_creatures, "number of no-birth organisms");
+ df.Write( num_single_thread_creatures, "number of single-threaded organisms");
+ df.Write( num_multi_thread_creatures, "number of multi-threaded organisms");
+ df.Write( num_modified, "number of modified organisms");
+ df.Endl();
+}
+
+
+void cStats::PrintTotalsData(const cString & filename)
+{
+ ofstream & fp = GetDataFileOFStream(filename);
+ assert(fp.good());
+ fp << GetUpdate() << " " // 1
+ << (tot_executed+num_executed) << " " // 2
+ << num_executed << " " // 3
+ << tot_organisms << " " // 4
+ << tot_genotypes << " " // 5
+ << tot_threshold << " " // 6
+ << tot_species << " " // 7
+ << tot_lineages << endl; // 8
+}
+
+
+void cStats::PrintTasksData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida tasks data" );
+ df.WriteTimeStamp();
+ df.WriteComment( "First column gives the current update, all further columns give the number" );
+ df.WriteComment( "of organisms that have the particular task as a component of the merit." );
+
+
+ df.Write( GetUpdate(), "Update");
+ for(int i = 0; i < task_last_count.GetSize(); i++) {
+ df.Write( task_last_count[i], task_names[i] );
+ }
+ df.Endl();
+}
+
+
+void cStats::PrintTasksExeData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida tasks data" );
+ df.WriteTimeStamp();
+ df.WriteComment( "First column gives the current update, all further columns give the number" );
+ df.WriteComment( "of times the particular task has been executed this update." );
+
+ df.Write( GetUpdate(), "Update");
+ for (int i = 0; i < task_exe_count.GetSize(); i++) {
+ df.Write( task_exe_count[i], task_names[i] );
+ task_exe_count[i] = 0;
+ }
+ df.Endl();
+}
+
+
+void cStats::PrintReactionData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida tasks data" );
+ df.WriteTimeStamp();
+ df.WriteComment( "First column gives the current update, all further columns give the number" );
+ df.WriteComment( "of currently living organisms each reaction has affected." );
+
+ df.Write( GetUpdate(), "Update");
+ for (int i = 0; i < reaction_count.GetSize(); i++) {
+ df.Write( reaction_count[i], reaction_names[i] );
+ task_exe_count[i] = 0;
+ }
+ df.Endl();
+}
+
+void cStats::PrintResourceData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida resource data" );
+ df.WriteTimeStamp();
+ df.WriteComment( "First column gives the current update, all further columns give the quantity" );
+ df.WriteComment( "of the particular resource at that update." );
+
+ df.Write( GetUpdate(), "Update");
+ for (int i = 0; i < resource_count.GetSize(); i++) {
+ df.Write( resource_count[i], resource_names[i] );
+ if (resource_geometry[i] != GEOMETRY_GLOBAL) {
+ PrintSpatialResData(filename, i);
+ }
+ }
+ df.Endl();
+}
+
+void cStats::PrintSpatialResData(const cString & filename, int i)
+{
+
+ // Write spatial data to a file that can easily be read into Matlab
+
+ cString tmpfilename = "resource_";
+ tmpfilename += resource_names[i] + ".m";
+ cDataFile & df = GetDataFile(tmpfilename);
+ cString UpdateStr = resource_names[i] +
+ cStringUtil::Stringf( "%07i", GetUpdate() ) + " = [ ...";
+
+ df.WriteRaw(UpdateStr);
+
+ int gridsize = spatial_res_count[i].GetSize();
+ int xsize = cConfig::GetWorldX();
+
+ // write grid to file
+
+ for (int j = 0; j < gridsize; j++) {
+ df.WriteBlockElement(spatial_res_count[i][j], j, xsize);
+ }
+ df.WriteRaw("];");
+}
+
+
+void cStats::PrintTimeData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida time data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update" );
+ df.Write( avida_time, "avida time" );
+ df.Write( sum_generation.Average(), "average generation" );
+ df.Write( num_executed, "num_executed?" );
+ df.Endl();
+}
+
+
+void cStats::PrintMutationData(const cString & filename)
+{
+ ofstream & fp = GetDataFileOFStream(filename);
+ assert(fp.good());
+ fp << GetUpdate() << " " // 1
+ << isum_parent_dist.Ave() << " " // 2
+ << isum_parent_size.Ave() << " " // 3
+ << isum_child_size.Ave() << " " // 4
+ << isum_copied_size.Ave() << " " // 5
+ << isum_executed_size.Ave() << " " // 6
+ << isum_copies_exec.Ave() << " " // 7
+ << isum_point_mut.Ave() << " " // 8
+ << isum_copy_mut.Ave() << " " // 9
+ << isum_insert_mut.Ave() << " " // 10
+ << isum_delete_mut.Ave() << " " // 11
+ << isum_point_mut_line.Ave() << " " // 12
+ << isum_copy_mut_line.Ave() << " " // 13
+ << isum_divide_mut.Ave() << " " // 14
+ << isum_divide_insert_mut.Ave() << " " // 15
+ << isum_divide_delete_mut.Ave() << " " // 16
+ << dsum_copy_mut_by_copies_exec.Ave() << " " // 17
+ << dsum_copied_size_by_copies_exec.Ave() << " " // 18
+ << dsum_copy_mut_lines_by_copied_size.Ave() << " " // 19
+ << dsum_copy_mut_lines_by_copy_mut.Ave() << endl; // 20
+
+ isum_parent_dist.Clear();
+ isum_parent_size.Clear();
+ isum_child_size.Clear();
+ isum_point_mut.Clear();
+ isum_copy_mut.Clear();
+ isum_insert_mut.Clear();
+ isum_point_mut_line.Clear();
+ isum_copy_mut_line.Clear();
+ isum_delete_mut.Clear();
+ isum_divide_mut.Clear();
+ isum_divide_insert_mut.Clear();
+ isum_divide_delete_mut.Clear();
+ isum_copied_size.Clear();
+ isum_executed_size.Clear();
+ isum_copies_exec.Clear();
+ dsum_copy_mut_by_copies_exec.Clear();
+ dsum_copied_size_by_copies_exec.Clear();
+ dsum_copy_mut_lines_by_copied_size.Clear();
+ dsum_copy_mut_lines_by_copy_mut.Clear();
+}
+
+void cStats::PrintMutationRateData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida copy mutation rate data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "Update" );
+ df.Write( sum_copy_mut_rate.Ave(), "Average copy mutation rate" );
+ df.Write( sum_copy_mut_rate.Var(), "Variance in copy mutation rate" );
+ df.Write( sum_copy_mut_rate.StdDeviation(), "Standard Deviation in copy mutation rate" );
+ df.Write( sum_copy_mut_rate.Skw(), "Skew in copy mutation rate" );
+ df.Write( sum_copy_mut_rate.Kur(), "Kurtosis in copy mutation rate" );
+
+ df.Write( sum_log_copy_mut_rate.Ave(), "Average log(copy mutation rate)" );
+ df.Write( sum_log_copy_mut_rate.Var(), "Variance in log(copy mutation rate)" );
+ df.Write( sum_log_copy_mut_rate.StdDeviation(), "Standard Deviation in log(copy mutation rate)" );
+ df.Write( sum_log_copy_mut_rate.Skw(), "Skew in log(copy mutation rate)" );
+ df.Write( sum_log_copy_mut_rate.Kur(), "Kurtosis in log(copy mutation rate)" );
+ df.Endl();
+
+}
+
+
+void cStats::PrintDivideMutData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida divide mutation rate data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "Update" );
+ df.Write( sum_div_mut_rate.Ave(), "Average divide mutation rate" );
+ df.Write( sum_div_mut_rate.Var(), "Variance in divide mutation rate" );
+ df.Write( sum_div_mut_rate.StdDeviation(), "Standard Deviation in divide mutation rate" );
+ df.Write( sum_div_mut_rate.Skw(), "Skew in divide mutation rate" );
+ df.Write( sum_div_mut_rate.Kur(), "Kurtosis in divide mutation rate" );
+
+ df.Write( sum_log_div_mut_rate.Ave(), "Average log(divide mutation rate)" );
+ df.Write( sum_log_div_mut_rate.Var(), "Variance in log(divide mutation rate)" );
+ df.Write( sum_log_div_mut_rate.StdDeviation(), "Standard Deviation in log(divide mutation rate)" );
+ df.Write( sum_log_div_mut_rate.Skw(), "Skew in log(divide mutation rate)" );
+ df.Write( sum_log_div_mut_rate.Kur(), "Kurtosis in log(divide mutation rate)" );
+ df.Endl();
+
+}
+
+void cStats::PrintInstructionData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida instruction execution data" );
+ df.WriteTimeStamp();
+
+#ifdef INSTRUCTION_COUNT
+ df.Write( GetUpdate(), "Update" );
+ for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
+ df.Write( (int) sum_exe_inst_array[i].Sum(), inst_names[i] );
+ }
+#else // INSTRUCTION_COUNT undefined
+ cerr<<"Warning: Instruction Counts not compiled in"<<endl;
+#endif // ifdef INSTRUCTION_COUNT
+
+ df.Endl();
+}
+
+void cStats::PrintGenotypeMap(const cString & filename)
+{
+ cDataFile & df = cStats::GetDataFile(filename);
+ cString UpdateStr =
+ cStringUtil::Stringf( "GenoID%07i", GetUpdate() ) + " = [ ...";
+ df.WriteRaw(UpdateStr);
+
+ int gridsize = genotype_map.GetSize();
+ int xsize = cConfig::GetWorldX();
+
+ // write grid to file
+
+ for (int i = 0; i < gridsize; i++) {
+ df.WriteBlockElement(genotype_map[i],i,xsize);
+ }
+ df.WriteRaw("];");
+}
Copied: trunk/source/main/cStats.h (from rev 331, trunk/source/main/stats.hh)
Copied: trunk/source/main/cTaskEntry.cc (from rev 331, trunk/source/main/task_entry.cc)
===================================================================
--- trunk/source/main/task_entry.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cTaskEntry.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef TASK_ENTRY_HH
+#include "cTaskEntry.h"
+#endif
+
+////////////////
+// cTaskEntry
+////////////////
+
+cTaskEntry::cTaskEntry(const cString & _name, const cString & _desc,
+ int _id, tTaskTest _test_fun)
+ : name(_name)
+ , desc(_desc)
+ , id(_id)
+ , test_fun(_test_fun)
+{
+}
+
+cTaskEntry::~cTaskEntry()
+{
+}
Copied: trunk/source/main/cTaskEntry.h (from rev 331, trunk/source/main/task_entry.hh)
===================================================================
--- trunk/source/main/task_entry.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cTaskEntry.h 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,35 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef TASK_ENTRY_HH
+#define TASK_ENTRY_HH
+
+#ifndef STRING_HH
+#include "string.hh"
+#endif
+#ifndef TASK_LIB_HH
+#include "cTaskLib.h"
+#endif
+
+class cTaskEntry {
+private:
+ cString name; // Short keyword for task
+ cString desc; // For more human-understandable output...
+ int id;
+ tTaskTest test_fun;
+public:
+ cTaskEntry(const cString & _name, const cString & _desc, int _id,
+ tTaskTest _test_fun);
+ ~cTaskEntry();
+
+ const cString & GetName() const { return name; }
+ const cString & GetDesc() const { return desc; }
+ const int GetID() const { return id; }
+ const tTaskTest GetTestFun() const { return test_fun; }
+};
+
+#endif
Copied: trunk/source/main/cTaskLib.cc (from rev 331, trunk/source/main/task_lib.cc)
===================================================================
--- trunk/source/main/task_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/cTaskLib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -0,0 +1,1701 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2003 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef TASK_LIB_HH
+#include "cTaskLib.h"
+#endif
+
+#ifndef TASK_ENTRY_HH
+#include "cTaskEntry.h"
+#endif
+
+extern "C" {
+#include <math.h>
+#include <limits.h>
+}
+
+using namespace std;
+
+////////////////////////
+// cTaskLib (public)
+////////////////////////
+
+cTaskLib::cTaskLib()
+ : use_neighbor_input(false)
+ , use_neighbor_output(false)
+ , input_buffer(3)
+ , output_buffer(3)
+{
+}
+
+cTaskLib::~cTaskLib()
+{
+ for (int i = 0; i < task_array.GetSize(); i++) {
+ delete task_array[i];
+ }
+}
+
+cTaskEntry * cTaskLib::AddTask(const cString & name)
+{
+ // Determine if this task is already in the active library.
+ for (int i = 0; i < task_array.GetSize(); i++) {
+ if (task_array[i]->GetName() == name) {
+ assert(task_array[i] != NULL);
+ return task_array[i];
+ }
+ }
+
+ // Match up this name to its corresponding task
+ const int start_size = task_array.GetSize();
+
+ if (name == "echo") NewTask(name, "Echo", &cTaskLib::Task_Echo);
+ else if (name == "add") NewTask(name, "Add", &cTaskLib::Task_Add);
+ else if (name == "sub") NewTask(name, "Sub", &cTaskLib::Task_Sub);
+
+ else if (name == "not") NewTask(name, "Not", &cTaskLib::Task_Not);
+ else if (name == "nand") NewTask(name, "Nand", &cTaskLib::Task_Nand);
+ else if (name == "and") NewTask(name, "And", &cTaskLib::Task_And);
+ else if (name == "orn") NewTask(name, "OrNot", &cTaskLib::Task_OrNot);
+ else if (name == "or") NewTask(name, "Or", &cTaskLib::Task_Or);
+ else if (name == "andn") NewTask(name, "AndNot", &cTaskLib::Task_AndNot);
+ else if (name == "nor") NewTask(name, "Nor", &cTaskLib::Task_Nor);
+ else if (name == "xor") NewTask(name, "Xor", &cTaskLib::Task_Xor);
+ else if (name == "equ") NewTask(name, "Equals", &cTaskLib::Task_Equ);
+
+ else if (name == "logic_3AA")
+ NewTask(name, "Logic 3AA (A+B+C == 0)", &cTaskLib::Task_Logic3in_AA);
+ else if (name == "logic_3AB")
+ NewTask(name, "Logic 3AB (A+B+C == 1)", &cTaskLib::Task_Logic3in_AB);
+ else if (name == "logic_3AC")
+ NewTask(name, "Logic 3AC (A+B+C <= 1)", &cTaskLib::Task_Logic3in_AC);
+ else if (name == "logic_3AD")
+ NewTask(name, "Logic 3AD (A+B+C == 2)", &cTaskLib::Task_Logic3in_AD);
+ else if (name == "logic_3AE")
+ NewTask(name, "Logic 3AE (A+B+C == 0,2)", &cTaskLib::Task_Logic3in_AE);
+ else if (name == "logic_3AF")
+ NewTask(name, "Logic 3AF (A+B+C == 1,2)", &cTaskLib::Task_Logic3in_AF);
+ else if (name == "logic_3AG")
+ NewTask(name, "Logic 3AG (A+B+C <= 2)", &cTaskLib::Task_Logic3in_AG);
+ else if (name == "logic_3AH")
+ NewTask(name, "Logic 3AH (A+B+C == 3)", &cTaskLib::Task_Logic3in_AH);
+ else if (name == "logic_3AI")
+ NewTask(name, "Logic 3AI (A+B+C == 0,3)", &cTaskLib::Task_Logic3in_AI);
+ else if (name == "logic_3AJ")
+ NewTask(name, "Logic 3AJ (A+B+C == 1,3) XOR", &cTaskLib::Task_Logic3in_AJ);
+ else if (name == "logic_3AK")
+ NewTask(name, "Logic 3AK (A+B+C != 2)", &cTaskLib::Task_Logic3in_AK);
+ else if (name == "logic_3AL")
+ NewTask(name, "Logic 3AL (A+B+C >= 2)", &cTaskLib::Task_Logic3in_AL);
+ else if (name == "logic_3AM")
+ NewTask(name, "Logic 3AM (A+B+C != 1)", &cTaskLib::Task_Logic3in_AM);
+ else if (name == "logic_3AN")
+ NewTask(name, "Logic 3AN (A+B+C != 0)", &cTaskLib::Task_Logic3in_AN);
+ else if (name == "logic_3AO")
+ NewTask(name, "Logic 3AO (A & ~B & ~C) [3]", &cTaskLib::Task_Logic3in_AO);
+ else if (name == "logic_3AP")
+ NewTask(name, "Logic 3AP (A^B & ~C) [3]", &cTaskLib::Task_Logic3in_AP);
+ else if (name == "logic_3AQ")
+ NewTask(name, "Logic 3AQ (A==B & ~C) [3]", &cTaskLib::Task_Logic3in_AQ);
+ else if (name == "logic_3AR")
+ NewTask(name, "Logic 3AR (A & B & ~C) [3]", &cTaskLib::Task_Logic3in_AR);
+ else if (name == "logic_3AS")
+ NewTask(name, "Logic 3AS", &cTaskLib::Task_Logic3in_AS);
+ else if (name == "logic_3AT")
+ NewTask(name, "Logic 3AT", &cTaskLib::Task_Logic3in_AT);
+ else if (name == "logic_3AU")
+ NewTask(name, "Logic 3AU", &cTaskLib::Task_Logic3in_AU);
+ else if (name == "logic_3AV")
+ NewTask(name, "Logic 3AV", &cTaskLib::Task_Logic3in_AV);
+ else if (name == "logic_3AW")
+ NewTask(name, "Logic 3AW", &cTaskLib::Task_Logic3in_AW);
+ else if (name == "logic_3AX")
+ NewTask(name, "Logic 3AX", &cTaskLib::Task_Logic3in_AX);
+ else if (name == "logic_3AY")
+ NewTask(name, "Logic 3AY", &cTaskLib::Task_Logic3in_AY);
+ else if (name == "logic_3AZ")
+ NewTask(name, "Logic 3AZ", &cTaskLib::Task_Logic3in_AZ);
+ else if (name == "logic_3BA")
+ NewTask(name, "Logic 3BA", &cTaskLib::Task_Logic3in_BA);
+ else if (name == "logic_3BB")
+ NewTask(name, "Logic 3BB", &cTaskLib::Task_Logic3in_BB);
+ else if (name == "logic_3BC")
+ NewTask(name, "Logic 3BC", &cTaskLib::Task_Logic3in_BC);
+ else if (name == "logic_3BD")
+ NewTask(name, "Logic 3BD", &cTaskLib::Task_Logic3in_BD);
+ else if (name == "logic_3BE")
+ NewTask(name, "Logic 3BE", &cTaskLib::Task_Logic3in_BE);
+ else if (name == "logic_3BF")
+ NewTask(name, "Logic 3BF", &cTaskLib::Task_Logic3in_BF);
+ else if (name == "logic_3BG")
+ NewTask(name, "Logic 3BG", &cTaskLib::Task_Logic3in_BG);
+ else if (name == "logic_3BH")
+ NewTask(name, "Logic 3BH", &cTaskLib::Task_Logic3in_BH);
+ else if (name == "logic_3BI")
+ NewTask(name, "Logic 3BI", &cTaskLib::Task_Logic3in_BI);
+ else if (name == "logic_3BJ")
+ NewTask(name, "Logic 3BJ", &cTaskLib::Task_Logic3in_BJ);
+ else if (name == "logic_3BK")
+ NewTask(name, "Logic 3BK", &cTaskLib::Task_Logic3in_BK);
+ else if (name == "logic_3BL")
+ NewTask(name, "Logic 3BL", &cTaskLib::Task_Logic3in_BL);
+ else if (name == "logic_3BM")
+ NewTask(name, "Logic 3BM", &cTaskLib::Task_Logic3in_BM);
+ else if (name == "logic_3BN")
+ NewTask(name, "Logic 3BN", &cTaskLib::Task_Logic3in_BN);
+ else if (name == "logic_3BO")
+ NewTask(name, "Logic 3BO", &cTaskLib::Task_Logic3in_BO);
+ else if (name == "logic_3BP")
+ NewTask(name, "Logic 3BP", &cTaskLib::Task_Logic3in_BP);
+ else if (name == "logic_3BQ")
+ NewTask(name, "Logic 3BQ", &cTaskLib::Task_Logic3in_BQ);
+ else if (name == "logic_3BR")
+ NewTask(name, "Logic 3BR", &cTaskLib::Task_Logic3in_BR);
+ else if (name == "logic_3BS")
+ NewTask(name, "Logic 3BS", &cTaskLib::Task_Logic3in_BS);
+ else if (name == "logic_3BT")
+ NewTask(name, "Logic 3BT", &cTaskLib::Task_Logic3in_BT);
+ else if (name == "logic_3BU")
+ NewTask(name, "Logic 3BU", &cTaskLib::Task_Logic3in_BU);
+ else if (name == "logic_3BV")
+ NewTask(name, "Logic 3BV", &cTaskLib::Task_Logic3in_BV);
+ else if (name == "logic_3BW")
+ NewTask(name, "Logic 3BW", &cTaskLib::Task_Logic3in_BW);
+ else if (name == "logic_3BX")
+ NewTask(name, "Logic 3BX", &cTaskLib::Task_Logic3in_BX);
+ else if (name == "logic_3BY")
+ NewTask(name, "Logic 3BY", &cTaskLib::Task_Logic3in_BY);
+ else if (name == "logic_3BZ")
+ NewTask(name, "Logic 3BZ", &cTaskLib::Task_Logic3in_BZ);
+ else if (name == "logic_3CA")
+ NewTask(name, "Logic 3CA", &cTaskLib::Task_Logic3in_CA);
+ else if (name == "logic_3CB")
+ NewTask(name, "Logic 3CB", &cTaskLib::Task_Logic3in_CB);
+ else if (name == "logic_3CC")
+ NewTask(name, "Logic 3CC", &cTaskLib::Task_Logic3in_CC);
+ else if (name == "logic_3CD")
+ NewTask(name, "Logic 3CD", &cTaskLib::Task_Logic3in_CD);
+ else if (name == "logic_3CE")
+ NewTask(name, "Logic 3CE", &cTaskLib::Task_Logic3in_CE);
+ else if (name == "logic_3CF")
+ NewTask(name, "Logic 3CF", &cTaskLib::Task_Logic3in_CF);
+ else if (name == "logic_3CG")
+ NewTask(name, "Logic 3CG", &cTaskLib::Task_Logic3in_CG);
+ else if (name == "logic_3CH")
+ NewTask(name, "Logic 3CH", &cTaskLib::Task_Logic3in_CH);
+ else if (name == "logic_3CI")
+ NewTask(name, "Logic 3CI", &cTaskLib::Task_Logic3in_CI);
+ else if (name == "logic_3CJ")
+ NewTask(name, "Logic 3CJ", &cTaskLib::Task_Logic3in_CJ);
+ else if (name == "logic_3CK")
+ NewTask(name, "Logic 3CK", &cTaskLib::Task_Logic3in_CK);
+ else if (name == "logic_3CL")
+ NewTask(name, "Logic 3CL", &cTaskLib::Task_Logic3in_CL);
+ else if (name == "logic_3CM")
+ NewTask(name, "Logic 3CM", &cTaskLib::Task_Logic3in_CM);
+ else if (name == "logic_3CN")
+ NewTask(name, "Logic 3CN", &cTaskLib::Task_Logic3in_CN);
+ else if (name == "logic_3CO")
+ NewTask(name, "Logic 3CO", &cTaskLib::Task_Logic3in_CO);
+ else if (name == "logic_3CP")
+ NewTask(name, "Logic 3CP", &cTaskLib::Task_Logic3in_CP);
+
+ else if (name == "math_1AA")
+ NewTask(name, "Math 1AA (2X)", &cTaskLib::Task_Math1in_AA);
+ else if (name == "math_1AB")
+ NewTask(name, "Math 1AB (2X/3)", &cTaskLib::Task_Math1in_AB);
+ else if (name == "math_1AC")
+ NewTask(name, "Math 1AC (5X/4)", &cTaskLib::Task_Math1in_AC);
+ else if (name == "math_1AD")
+ NewTask(name, "Math 1AD (X^2)", &cTaskLib::Task_Math1in_AD);
+ else if (name == "math_1AE")
+ NewTask(name, "Math 1AE (X^3)", &cTaskLib::Task_Math1in_AE);
+ else if (name == "math_1AF")
+ NewTask(name, "Math 1AF (sqrt(X))", &cTaskLib::Task_Math1in_AF);
+ else if (name == "math_1AG")
+ NewTask(name, "Math 1AG (log(X))", &cTaskLib::Task_Math1in_AG);
+ else if (name == "math_1AH")
+ NewTask(name, "Math 1AH (X^2+X^3)", &cTaskLib::Task_Math1in_AH);
+ else if (name == "math_1AI")
+ NewTask(name, "Math 1AI (X^2+sqrt(X))", &cTaskLib::Task_Math1in_AI);
+ else if (name == "math_1AJ")
+ NewTask(name, "Math 1AJ (abs(X))", &cTaskLib::Task_Math1in_AJ);
+ else if (name == "math_1AK")
+ NewTask(name, "Math 1AK (X-5)", &cTaskLib::Task_Math1in_AK);
+ else if (name == "math_1AL")
+ NewTask(name, "Math 1AL (-X)", &cTaskLib::Task_Math1in_AL);
+ else if (name == "math_1AM")
+ NewTask(name, "Math 1AM (5X)", &cTaskLib::Task_Math1in_AM);
+ else if (name == "math_1AN")
+ NewTask(name, "Math 1AN (X/4)", &cTaskLib::Task_Math1in_AN);
+ else if (name == "math_1AO")
+ NewTask(name, "Math 1AO (X-6)", &cTaskLib::Task_Math1in_AO);
+ else if (name == "math_1AP")
+ NewTask(name, "Math 1AP (X-7)", &cTaskLib::Task_Math1in_AP);
+
+ else if (name == "math_2AA")
+ NewTask(name, "Math 2AA (sqrt(X+Y))", &cTaskLib::Task_Math2in_AA);
+ else if (name == "math_2AB")
+ NewTask(name, "Math 2AB ((X+Y)^2)", &cTaskLib::Task_Math2in_AB);
+ else if (name == "math_2AC")
+ NewTask(name, "Math 2AC (X%Y)", &cTaskLib::Task_Math2in_AC);
+ else if (name == "math_2AD")
+ NewTask(name, "Math 2AD (3X/2+5Y/4)", &cTaskLib::Task_Math2in_AD);
+ else if (name == "math_2AE")
+ NewTask(name, "Math 2AE (abs(X-5)+abs(Y-6))", &cTaskLib::Task_Math2in_AE);
+ else if (name == "math_2AF")
+ NewTask(name, "Math 2AF (XY-X/Y)", &cTaskLib::Task_Math2in_AF);
+ else if (name == "math_2AG")
+ NewTask(name, "Math 2AG ((X-Y)^2)", &cTaskLib::Task_Math2in_AG);
+ else if (name == "math_2AH")
+ NewTask(name, "Math 2AH (X^2+Y^2)", &cTaskLib::Task_Math2in_AH);
+ else if (name == "math_2AI")
+ NewTask(name, "Math 2AI (X^2+Y^3)", &cTaskLib::Task_Math2in_AI);
+ else if (name == "math_2AJ")
+ NewTask(name, "Math 2AJ ((sqrt(X)+Y)/(X-7))", &cTaskLib::Task_Math2in_AJ);
+ else if (name == "math_2AK")
+ NewTask(name, "Math 2AK (log(|X/Y|))", &cTaskLib::Task_Math2in_AK);
+ else if (name == "math_2AL")
+ NewTask(name, "Math 2AL (log(|X|)/Y)", &cTaskLib::Task_Math2in_AL);
+ else if (name == "math_2AM")
+ NewTask(name, "Math 2AM (X/log(|Y|))", &cTaskLib::Task_Math2in_AM);
+ else if (name == "math_2AN")
+ NewTask(name, "Math 2AN (X+Y)", &cTaskLib::Task_Math2in_AN);
+ else if (name == "math_2AO")
+ NewTask(name, "Math 2AO (X-Y)", &cTaskLib::Task_Math2in_AO);
+ else if (name == "math_2AP")
+ NewTask(name, "Math 2AP (X/Y)", &cTaskLib::Task_Math2in_AP);
+ else if (name == "math_2AQ")
+ NewTask(name, "Math 2AQ (XY)", &cTaskLib::Task_Math2in_AQ);
+ else if (name == "math_2AR")
+ NewTask(name, "Math 2AR (sqrt(X)+sqrt(Y))", &cTaskLib::Task_Math2in_AR);
+ else if (name == "math_2AS")
+ NewTask(name, "Math 2AS (X+2Y)", &cTaskLib::Task_Math2in_AS);
+ else if (name == "math_2AT")
+ NewTask(name, "Math 2AT (X+3Y)", &cTaskLib::Task_Math2in_AT);
+ else if (name == "math_2AU")
+ NewTask(name, "Math 2AU (2X+3Y)", &cTaskLib::Task_Math2in_AU);
+ else if (name == "math_2AV")
+ NewTask(name, "Math 2AV (XY^2)", &cTaskLib::Task_Math2in_AV);
+
+ else if (name == "math_3AA")
+ NewTask(name, "Math 3AA (X^2+Y^2+Z^2)", &cTaskLib::Task_Math3in_AA);
+ else if (name == "math_3AB")
+ NewTask(name, "Math 3AB (sqrt(X)+sqrt(Y)+sqrt(Z))", &cTaskLib::Task_Math3in_AB);
+ else if (name == "math_3AC")
+ NewTask(name, "Math 3AC (X+2Y+3Z)", &cTaskLib::Task_Math3in_AC);
+ /*
+ Visual Studio.net 2003 gives compiler error:
+ fatal error C1061: compiler limit : blocks nested too deeply
+ Sherri fixed this by removing the 'else' in the next line.
+ -- K
+ */
+ //else if (name == "math_3AD")
+ // NewTask(name, "Math 3AD (XY^2+Z^3)", &cTaskLib::Task_Math3in_AD);
+ if (name == "math_3AD")
+ NewTask(name, "Math 3AD (XY^2+Z^3)", &cTaskLib::Task_Math3in_AD);
+ else if (name == "math_3AE")
+ NewTask(name, "Math 3AE ((X%Y)*Z)", &cTaskLib::Task_Math3in_AE);
+ else if (name == "math_3AF")
+ NewTask(name, "Math 3AF ((X+Y)^2+sqrt(Y+Z))", &cTaskLib::Task_Math3in_AF);
+ else if (name == "math_3AG")
+ NewTask(name, "Math 3AG ((XY)%(YZ))", &cTaskLib::Task_Math3in_AG);
+ else if (name == "math_3AH")
+ NewTask(name, "Math 3AH (X+Y+Z)", &cTaskLib::Task_Math3in_AH);
+ else if (name == "math_3AI")
+ NewTask(name, "Math 3AI (-X-Y-Z)", &cTaskLib::Task_Math3in_AI);
+ else if (name == "math_3AJ")
+ NewTask(name, "Math 3AJ ((X-Y)^2+(Y-Z)^2+(Z-X)^2)",
+ &cTaskLib::Task_Math3in_AJ);
+ else if (name == "math_3AK")
+ NewTask(name, "Math 3AK ((X+Y)^2+(Y+Z)^2+(Z+X)^2)",
+ &cTaskLib::Task_Math3in_AK);
+ else if (name == "math_3AL")
+ NewTask(name, "Math 3AL ((X-Y)^2+(X-Z)^2)", &cTaskLib::Task_Math3in_AL);
+ else if (name == "math_3AM")
+ NewTask(name, "Math 3AM ((X+Y)^2+(Y+Z)^2)", &cTaskLib::Task_Math3in_AM);
+
+ // communication tasks
+ else if (name == "comm_echo")
+ NewTask(name, "Echo of Neighbor's Input", &cTaskLib::Task_CommEcho,
+ REQ_NEIGHBOR_INPUT);
+ else if (name == "comm_not")
+ NewTask(name, "Not of Neighbor's INput", &cTaskLib::Task_CommNot,
+ REQ_NEIGHBOR_INPUT);
+ // Make sure we have actually found a task.
+
+ if (task_array.GetSize() == start_size) {
+ cerr << "Unknown task entry '" << name << "'." << endl;
+ return NULL;
+ }
+
+ // And return the found task.
+ return task_array[start_size];
+}
+
+const cTaskEntry & cTaskLib::GetTask(int id) const
+{
+ return *(task_array[id]);
+}
+
+void cTaskLib::SetupTests(const tBuffer<int> & inputs,
+ const tBuffer<int> & outputs,
+ const tList<tBuffer<int> > & other_inputs,
+ const tList<tBuffer<int> > & other_outputs) const
+{
+ input_buffer = inputs;
+ output_buffer = outputs;
+ other_input_buffers.Copy(other_inputs);
+ other_output_buffers.Copy(other_outputs);
+
+ SetupLogicTests(inputs, outputs);
+}
+
+void cTaskLib::SetupLogicTests(const tBuffer<int> & inputs,
+ const tBuffer<int> & outputs) const
+{
+ // Collect the inputs in a useful form.
+ const int num_inputs = input_buffer.GetNumStored();
+ int test_inputs[3];
+ for (int i = 0; i < 3; i++) {
+ test_inputs[i] = (num_inputs > i) ? input_buffer[i] : 0;
+ }
+ int test_output = output_buffer[0];
+
+
+ // Setup logic_out to test the output for each logical combination...
+ // Assuming each bit in logic out to be based on the inputs:
+ //
+ // Logic ID Bit: 7 6 5 4 3 2 1 0
+ // Input C: 1 1 1 1 0 0 0 0
+ // Input B: 1 1 0 0 1 1 0 0
+ // Input A: 1 0 1 0 1 0 1 0
+
+ tArray<int> logic_out(8);
+ logic_out.SetAll(-1);
+
+ // Test all input combos!
+ bool func_OK = true; // Have all outputs been consistant?
+ for (int test_pos = 0; test_pos < 32; test_pos++) {
+ int logic_pos = 0;
+ for (int i = 0; i < 3; i++) logic_pos += (test_inputs[i] & 1) << i;
+
+ if ( logic_out[logic_pos] != -1 &&
+ logic_out[logic_pos] != (test_output & 1) ) {
+ func_OK = false;
+ break;
+ }
+ else {
+ logic_out[logic_pos] = test_output & 1;
+ }
+
+ test_output >>= 1;
+ for (int i = 0; i < 3; i++) test_inputs[i] >>= 1;
+ }
+
+ // If there were any inconsistancies, deal with them.
+ if (func_OK == false) {
+ logic_id = -1;
+ return;
+ }
+
+ // Determine the logic ID number of this task.
+ if (num_inputs < 1) { // 000 -> 001
+ logic_out[1] = logic_out[0];
+ }
+ if (num_inputs < 2) { // 000 -> 010; 001 -> 011
+ logic_out[2] = logic_out[0];
+ logic_out[3] = logic_out[1];
+ }
+ if (num_inputs < 3) { // 000->100; 001->101; 010->110; 011->111
+ logic_out[4] = logic_out[0];
+ logic_out[5] = logic_out[1];
+ logic_out[6] = logic_out[2];
+ logic_out[7] = logic_out[3];
+ }
+
+ // Lets just make sure we've gotten this correct...
+ assert(logic_out[0] >= 0 && logic_out[0] <= 1);
+ assert(logic_out[1] >= 0 && logic_out[1] <= 1);
+ assert(logic_out[2] >= 0 && logic_out[2] <= 1);
+ assert(logic_out[3] >= 0 && logic_out[3] <= 1);
+ assert(logic_out[4] >= 0 && logic_out[4] <= 1);
+ assert(logic_out[5] >= 0 && logic_out[5] <= 1);
+ assert(logic_out[6] >= 0 && logic_out[6] <= 1);
+ assert(logic_out[7] >= 0 && logic_out[7] <= 1);
+
+ logic_id = 0;
+ for (int i = 0; i < 8; i++) logic_id += logic_out[i] << i;
+}
+
+
+double cTaskLib::TestOutput(const cTaskEntry & task) const
+{
+ tTaskTest test_fun = task.GetTestFun();
+ return (this->*test_fun)();
+}
+
+
+////////////////////////
+// cTaskLib (private)
+////////////////////////
+
+void cTaskLib::NewTask(const cString & name, const cString & desc,
+ tTaskTest task_fun, int reqs)
+{
+ if (reqs & REQ_NEIGHBOR_INPUT == true) use_neighbor_input = true;
+ if (reqs & REQ_NEIGHBOR_OUTPUT == true) use_neighbor_output = true;
+
+ const int id = task_array.GetSize();
+ task_array.Resize(id+1);
+ task_array[id] = new cTaskEntry(name, desc, id, task_fun);
+}
+
+
+double cTaskLib::Task_Echo() const
+{
+ const int test_output = output_buffer[0];
+ for (int i = 0; i < input_buffer.GetNumStored(); i++) {
+ if (input_buffer[i] == test_output) {
+ assert(logic_id == 170 || logic_id == 204 || logic_id == 240);
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+
+double cTaskLib::Task_Add() const
+{
+ const int test_output = output_buffer[0];
+ for (int i = 0; i < input_buffer.GetNumStored(); i++) {
+ for (int j = 0; j < i; j++) {
+ if (test_output == input_buffer[i] + input_buffer[j]) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+
+double cTaskLib::Task_Sub() const
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] - input_buffer[j]) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Not() const
+{
+ if (logic_id == 15 || logic_id == 51 || logic_id == 85) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Nand() const
+{
+ if (logic_id == 63 || logic_id == 95 || logic_id == 119) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_And() const
+{
+ if (logic_id == 136 || logic_id == 160 || logic_id == 192) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_OrNot() const
+{
+ if (logic_id == 175 || logic_id == 187 || logic_id == 207 ||
+ logic_id == 221 || logic_id == 243 || logic_id == 245) return 1.0;
+
+ return 0.0;
+}
+
+double cTaskLib::Task_Or() const
+{
+ if (logic_id == 238 || logic_id == 250 || logic_id == 252) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_AndNot() const
+{
+ if (logic_id == 10 || logic_id == 12 || logic_id == 34 ||
+ logic_id == 48 || logic_id == 68 || logic_id == 80) return 1.0;
+
+ return 0.0;
+}
+
+double cTaskLib::Task_Nor() const
+{
+ if (logic_id == 3 || logic_id == 5 || logic_id == 17) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Xor() const
+{
+ if (logic_id == 60 || logic_id == 90 || logic_id == 102) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Equ() const
+{
+ if (logic_id == 153 || logic_id == 165 || logic_id == 195) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AA() const
+{
+ if (logic_id == 1) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AB() const
+{
+ if (logic_id == 22) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AC() const
+{
+ if (logic_id == 23) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AD() const
+{
+ if (logic_id == 104) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AE() const
+{
+ if (logic_id == 105) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AF() const
+{
+ if (logic_id == 126) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AG() const
+{
+ if (logic_id == 127) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AH() const
+{
+ if (logic_id == 128) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AI() const
+{
+ if (logic_id == 129) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AJ() const
+{
+ if (logic_id == 150) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AK() const
+{
+ if (logic_id == 151) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AL() const
+{
+ if (logic_id == 232) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AM() const
+{
+ if (logic_id == 233) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AN() const
+{
+ if (logic_id == 254) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AO() const
+{
+ if (logic_id == 2 || logic_id == 4 || logic_id == 16) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AP() const
+{
+ if (logic_id == 6 || logic_id == 18 || logic_id == 20) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AQ() const
+{
+ if (logic_id == 7 || logic_id == 19 || logic_id == 21) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AR() const
+{
+ if (logic_id == 8 || logic_id == 32 || logic_id == 64) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AS() const
+{
+ if (logic_id == 9 || logic_id == 33 || logic_id == 65) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AT() const
+{
+ if (logic_id == 14 || logic_id == 50 || logic_id == 84) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AU() const
+{
+ if (logic_id == 24 || logic_id == 36 || logic_id == 66) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AV() const
+{
+ if (logic_id == 25 || logic_id == 37 || logic_id == 67) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AW() const
+{
+ if (logic_id == 30 || logic_id == 54 || logic_id == 86) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AX() const
+{
+ if (logic_id == 31 || logic_id == 55 || logic_id == 87) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AY() const
+{
+ if (logic_id == 40 || logic_id == 72 || logic_id == 96) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_AZ() const
+{
+ if (logic_id == 41 || logic_id == 73 || logic_id == 97) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BA() const
+{
+ if (logic_id == 42 || logic_id == 76 || logic_id == 112) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BB() const
+{
+ if (logic_id == 43 || logic_id == 77 || logic_id == 113) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BC() const
+{
+ if (logic_id == 61 || logic_id == 91 || logic_id == 103) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BD() const
+{
+ if (logic_id == 62 || logic_id == 94 || logic_id == 118) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BE() const
+{
+ if (logic_id == 106 || logic_id == 108 || logic_id == 120) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BF() const
+{
+ if (logic_id == 107 || logic_id == 109 || logic_id == 121) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BG() const
+{
+ if (logic_id == 110 || logic_id == 122 || logic_id == 124) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BH() const
+{
+ if (logic_id == 111 || logic_id == 123 || logic_id == 125) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BI() const
+{
+ if (logic_id == 130 || logic_id == 132 || logic_id == 144) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BJ() const
+{
+ if (logic_id == 131 || logic_id == 133 || logic_id == 145) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BK() const
+{
+ if (logic_id == 134 || logic_id == 146 || logic_id == 148) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BL() const
+{
+ if (logic_id == 135 || logic_id == 147 || logic_id == 149) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BM() const
+{
+ if (logic_id == 137 || logic_id == 161 || logic_id == 193) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BN() const
+{
+ if (logic_id == 142 || logic_id == 178 || logic_id == 212) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BO() const
+{
+ if (logic_id == 143 || logic_id == 179 || logic_id == 213) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BP() const
+{
+ if (logic_id == 152 || logic_id == 164 || logic_id == 194) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BQ() const
+{
+ if (logic_id == 158 || logic_id == 182 || logic_id == 214) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BR() const
+{
+ if (logic_id == 159 || logic_id == 183 || logic_id == 215) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BS() const
+{
+ if (logic_id == 168 || logic_id == 200 || logic_id == 224) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BT() const
+{
+ if (logic_id == 169 || logic_id == 201 || logic_id == 225) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BU() const
+{
+ if (logic_id == 171 || logic_id == 205 || logic_id == 241) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BV() const
+{
+ if (logic_id == 188 || logic_id == 218 || logic_id == 230) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BW() const
+{
+ if (logic_id == 189 || logic_id == 219 || logic_id == 231) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BX() const
+{
+ if (logic_id == 190 || logic_id == 222 || logic_id == 246) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BY() const
+{
+ if (logic_id == 191 || logic_id == 223 || logic_id == 247) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_BZ() const
+{
+ if (logic_id == 234 || logic_id == 236 || logic_id == 248) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CA() const
+{
+ if (logic_id == 235 || logic_id == 237 || logic_id == 249) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CB() const
+{
+ if (logic_id == 239 || logic_id == 251 || logic_id == 253) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CC() const
+{
+ if (logic_id == 11 || logic_id == 13 || logic_id == 35 ||
+ logic_id == 49 || logic_id == 69 || logic_id == 81) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CD() const
+{
+ if (logic_id == 26 || logic_id == 28 || logic_id == 38 ||
+ logic_id == 52 || logic_id == 70 || logic_id == 82) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CE() const
+{
+ if (logic_id == 27 || logic_id == 29 || logic_id == 39 ||
+ logic_id == 53 || logic_id == 71 || logic_id == 83) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CF() const
+{
+ if (logic_id == 44 || logic_id == 56 || logic_id == 74 ||
+ logic_id == 88 || logic_id == 98 || logic_id == 100) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CG() const
+{
+ if (logic_id == 45 || logic_id == 57 || logic_id == 75 ||
+ logic_id == 89 || logic_id == 99 || logic_id == 101) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CH() const
+{
+ if (logic_id == 46 || logic_id == 58 || logic_id == 78 ||
+ logic_id == 92 || logic_id == 114 || logic_id == 116) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CI() const
+{
+ if (logic_id == 47 || logic_id == 59 || logic_id == 79 ||
+ logic_id == 93 || logic_id == 115 || logic_id == 117) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CJ() const
+{
+ if (logic_id == 138 || logic_id == 140 || logic_id == 162 ||
+ logic_id == 176 || logic_id == 196 || logic_id == 208) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CK() const
+{
+ if (logic_id == 139 || logic_id == 141 || logic_id == 163 ||
+ logic_id == 177 || logic_id == 197 || logic_id == 209) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CL() const
+{
+ if (logic_id == 154 || logic_id == 156 || logic_id == 166 ||
+ logic_id == 180 || logic_id == 198 || logic_id == 210) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CM() const
+{
+ if (logic_id == 155 || logic_id == 157 || logic_id == 167 ||
+ logic_id == 181 || logic_id == 199 || logic_id == 211) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CN() const
+{
+ if (logic_id == 172 || logic_id == 184 || logic_id == 202 ||
+ logic_id == 216 || logic_id == 226 || logic_id == 228) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CO() const
+{
+ if (logic_id == 173 || logic_id == 185 || logic_id == 203 ||
+ logic_id == 217 || logic_id == 227 || logic_id == 229) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Logic3in_CP() const
+{
+ if (logic_id == 174 || logic_id == 186 || logic_id == 206 ||
+ logic_id == 220 || logic_id == 242 || logic_id == 244) return 1.0;
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AA() const //(2X)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ if (test_output == 2 * input_buffer[i]) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AB() const //(2X/3)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == 2 * input_buffer[i] / 3) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AC() const //(5X/4)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == 5 * input_buffer[i] / 4) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AD() const //(X^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] * input_buffer[i]) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AE() const //(X^3)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] * input_buffer[i] * input_buffer[i])
+ return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AF() const //(sqrt(X)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == (int) sqrt((double) abs(input_buffer[i]))) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AG() const //(log(X))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (input_buffer[i] <= 0) continue;
+ if (test_output == (int) log((double) input_buffer[i])) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AH() const //(X^2+X^3)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[i] * input_buffer[i] * input_buffer[i])
+ return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AI() const // (X^2 + sqrt(X))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] * input_buffer[i] + (int) sqrt((double) abs(input_buffer[i])))
+ return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AJ() const // abs(X)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == abs(input_buffer[i])) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AK() const //(X-5)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] - 5) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AL() const //(-X)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == 0 - input_buffer[i]) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AM() const //(5X)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == 5 * input_buffer[i]) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AN() const //(X/4)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] / 4) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AO() const //(X-6)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] - 6) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math1in_AP() const //(X-7)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ if (test_output == input_buffer[i] - 7) return 1.0;
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AA() const //(sqrt(X+Y))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == (int) sqrt((double) abs(input_buffer[i] + input_buffer[j])))
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AB() const //((X+Y)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == (input_buffer[i] + input_buffer[j]) *
+ (input_buffer[i] + input_buffer[j])) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AC() const //(X%Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (input_buffer[j] == 0) continue; // mod by zero
+ if (test_output == input_buffer[i] % input_buffer[j]) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AD() const //(3X/2+5Y/4)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == 3 * input_buffer[i] / 2 + 5 * input_buffer[j] / 4)
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AE() const //(abs(X-5)+abs(Y-6))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == abs(input_buffer[i] - 5) + abs(input_buffer[j] - 6))
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AF() const //(XY-X/Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (input_buffer[j] == 0) continue;
+ if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+ if (test_output == input_buffer[i] * input_buffer[j] -
+ input_buffer[i] / input_buffer[j]) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AG() const //((X-Y)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == (input_buffer[i] - input_buffer[j]) *
+ (input_buffer[i] - input_buffer[j])) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AH() const //(X^2+Y^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] * input_buffer[i] +
+ input_buffer[j] * input_buffer[j]) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AI() const //(X^2+Y^3)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[j] * input_buffer[j] * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AJ() const //((sqrt(X)+Y)/(X-7))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (input_buffer[i] - 7 == 0) continue;
+ if (test_output == ((int) sqrt((double) abs(input_buffer[i])) + input_buffer[j]) / (input_buffer[i] - 7)) return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AK() const //(log(|X/Y|))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j || input_buffer[j] == 0 ) continue;
+ if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+ if (input_buffer[i] / input_buffer[j] == 0) continue;
+ if (test_output == (int) log((double) abs(input_buffer[i] / input_buffer[j])))
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AL() const //(log(|X|)/Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j || input_buffer[j] == 0) continue;
+ if (test_output == (int) log((double) abs(input_buffer[i])) / input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AM() const //(X/log(|Y|))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j || log((double) abs(input_buffer[j])) == 0) continue;
+ if (0-INT_MAX > input_buffer[i] && log((double) abs(input_buffer[j])) == -1) continue;
+ if (test_output == input_buffer[i] / (int) log((double) abs(input_buffer[j])))
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AN() const //(X+Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] + input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AO() const //(X-Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] - input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AP() const //(X/Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j || input_buffer[j] == 0) continue;
+ if (0 - INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+ if (test_output == input_buffer[i] / input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AQ() const //(XY)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AR() const //(sqrt(X)+sqrt(Y))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == (int) sqrt((double) abs(input_buffer[i])) + (int) sqrt((double) abs(input_buffer[j])))
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AS() const //(X+2Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] + 2 * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AT() const //(X+3Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] + 3 * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AU() const //(2X+3Y)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == 2 * input_buffer[i] + 3 * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math2in_AV() const //(XY^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < input_size; j++) {
+ if (i == j) continue;
+ if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j])
+ return 1.0;
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AA() const //(X^2+Y^2+Z^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == input_buffer[i] * input_buffer[i] +
+ input_buffer[j] * input_buffer[j] +
+ input_buffer[k] * input_buffer[k]) return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AB() const //(sqrt(X)+sqrt(Y)+sqrt(Z))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (int) sqrt((double) abs(input_buffer[i])) +
+ (int) sqrt((double) abs(input_buffer[j])) + (int) sqrt((double) abs(input_buffer[k])))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AC() const //(X+2Y+3Z)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == input_buffer[i] + 2 * input_buffer[j] +
+ 3 * input_buffer[k]) return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AD() const //(XY^2+Z^3)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j] + input_buffer[k] * input_buffer[k] * input_buffer[k])
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AE() const //((X%Y)*Z)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (input_buffer[j] == 0) continue; // mod by zero
+ if (test_output == input_buffer[i] % input_buffer[j] * input_buffer[k])
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AF() const //((X+Y)^2+sqrt(Y+Z))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (input_buffer[i] + input_buffer[j]) *
+ (input_buffer[i] + input_buffer[j]) +
+ (int) sqrt((double) abs(input_buffer[j] + input_buffer[k])))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AG() const //((XY)%(YZ))
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ int mod_base = input_buffer[j] * input_buffer[k];
+ if (mod_base == 0) continue;
+ if (test_output == (input_buffer[i] * input_buffer[j]) %
+ mod_base) return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AH() const //(X+Y+Z)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == input_buffer[i] + input_buffer[j] + input_buffer[k])
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AI() const //(-X-Y-Z)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == 0 - input_buffer[i] - input_buffer[j] - input_buffer[k])
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AJ() const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[j] - input_buffer[k]) * (input_buffer[j] - input_buffer[k]) + (input_buffer[k] - input_buffer[i]) * (input_buffer[k] - input_buffer[i]))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AK() const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[j] + input_buffer[k]) * (input_buffer[j] + input_buffer[k]) + (input_buffer[k] + input_buffer[i]) * (input_buffer[k] + input_buffer[i]))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AL() const //((X-Y)^2+(X-Z)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[i] - input_buffer[k]) * (input_buffer[i] - input_buffer[k]))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_Math3in_AM() const //((X+Y)^2+(Y+Z)^2)
+{
+ const int test_output = output_buffer[0];
+ const int input_size = input_buffer.GetNumStored();
+ for (int i = 0; i < input_size; i ++) {
+ for (int j = 0; j < input_size; j ++) {
+ for (int k = 0; k < input_size; k ++) {
+ if (i == j || j == k || i == k) continue;
+ if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[i] + input_buffer[k]) * (input_buffer[i] + input_buffer[k]))
+ return 1.0;
+ }
+ }
+ }
+ return 0.0;
+}
+
+double cTaskLib::Task_CommEcho() const
+{
+ const int test_output = output_buffer[0];
+
+ tListIterator<tBuffer<int> > buff_it(other_input_buffers);
+
+ while (buff_it.Next() != NULL) {
+ tBuffer<int> & cur_buff = *(buff_it.Get());
+ const int buff_size = cur_buff.GetNumStored();
+ for (int i = 0; i < buff_size; i++) {
+ if (test_output == cur_buff[i]) return 1.0;
+ }
+ }
+
+ return 0.0;
+}
+
+double cTaskLib::Task_CommNot() const
+{
+ const int test_output = output_buffer[0];
+
+ tListIterator<tBuffer<int> > buff_it(other_input_buffers);
+
+ while (buff_it.Next() != NULL) {
+ tBuffer<int> & cur_buff = *(buff_it.Get());
+ const int buff_size = cur_buff.GetNumStored();
+ for (int i = 0; i < buff_size; i++) {
+ if (test_output == (0-(cur_buff[i]+1))) return 1.0;
+ }
+ }
+
+ return 0.0;
+}
\ No newline at end of file
Copied: trunk/source/main/cTaskLib.h (from rev 331, trunk/source/main/task_lib.hh)
Modified: trunk/source/main/main_sub.pri
===================================================================
--- trunk/source/main/main_sub.pri 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/main_sub.pri 2005-10-06 23:02:07 UTC (rev 332)
@@ -3,7 +3,7 @@
HEADERS += \
$$MAIN_HH/cAnalyze.h \
$$MAIN_HH/cAnalyzeUtil.h \
- $$MAIN_HH/avida.hh \
+ $$MAIN_HH/avida.h \
$$MAIN_HH/cBirthChamber.h \
$$MAIN_HH/cCallbackUtil.h \
$$MAIN_HH/cConfig.h \
@@ -27,13 +27,13 @@
$$MAIN_HH/cPopulationInterface.h \
$$MAIN_HH/cPopulation.h \
$$MAIN_HH/cPopulationCell.h \
- $$MAIN_HH/reaction.hh \
- $$MAIN_HH/reaction_result.hh \
- $$MAIN_HH/resource.hh \
- $$MAIN_HH/resource_count.hh \
- $$MAIN_HH/resource_lib.hh \
- $$MAIN_HH/species.hh \
- $$MAIN_HH/stats.hh
+ $$MAIN_HH/cReaction.h \
+ $$MAIN_HH/cReactionResult.h \
+ $$MAIN_HH/cResource.h \
+ $$MAIN_HH/cResourceCount.h \
+ $$MAIN_HH/cResourceLib.h \
+ $$MAIN_HH/cSpecies.h \
+ $$MAIN_HH/cStats.h
SOURCES += \
$$MAIN_CC/cAnalyze.cc \
@@ -76,20 +76,20 @@
$$MAIN_CC/cPopulationInterface.cc \
$$MAIN_CC/cPopulation.cc \
$$MAIN_CC/cPopulationCell.cc \
- $$MAIN_CC/reaction.cc \
- $$MAIN_CC/reaction_lib.cc \
- $$MAIN_CC/reaction_process.cc \
- $$MAIN_CC/reaction_requisite.cc \
- $$MAIN_CC/reaction_result.cc \
- $$MAIN_CC/resource.cc \
- $$MAIN_CC/resource_count.cc \
- $$MAIN_CC/resource_lib.cc \
- $$MAIN_CC/spatial_count_elem.cc \
- $$MAIN_CC/spatial_res_count.cc \
- $$MAIN_CC/species.cc \
- $$MAIN_CC/species_control.cc \
- $$MAIN_CC/species_queue.cc \
- $$MAIN_CC/stats.cc \
- $$MAIN_CC/task_entry.cc \
- $$MAIN_CC/task_lib.cc
+ $$MAIN_CC/cReaction.cc \
+ $$MAIN_CC/cReactionLib.cc \
+ $$MAIN_CC/cReactionProcess.cc \
+ $$MAIN_CC/cReactionRequisite.cc \
+ $$MAIN_CC/cReactionResult.cc \
+ $$MAIN_CC/cResource.cc \
+ $$MAIN_CC/cResourceCount.cc \
+ $$MAIN_CC/cResourceLib.cc \
+ $$MAIN_CC/cSpatialCountElem.cc \
+ $$MAIN_CC/cSpatialResCount.cc \
+ $$MAIN_CC/cSpecies.cc \
+ $$MAIN_CC/cSpeciesControl.cc \
+ $$MAIN_CC/cSpeciesQueue.cc \
+ $$MAIN_CC/cStats.cc \
+ $$MAIN_CC/cTaskEntry.cc \
+ $$MAIN_CC/cTaskLib.cc
}
Modified: trunk/source/main/primitive.cc
===================================================================
--- trunk/source/main/primitive.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/primitive.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -10,7 +10,7 @@
#endif
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef AVIDA_DRIVER_ANALYZE_HH
#include "cAvidaDriver_Analyze.h"
@@ -55,7 +55,7 @@
#include "cPopulationInterface.h"
#endif
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
#ifndef TEST_CPU_HH
#include "cTestCPU.h"
Deleted: trunk/source/main/reaction.cc
===================================================================
--- trunk/source/main/reaction.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,80 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_HH
-#include "reaction.hh"
-#endif
-
-#ifndef REACTION_PROCESS_HH
-#include "reaction_process.hh"
-#endif
-#ifndef REACTION_REQUISITE_HH
-#include "reaction_requisite.hh"
-#endif
-
-using namespace std;
-
-///////////////
-// cReaction
-///////////////
-
-cReaction::cReaction(const cString & _name, int _id)
- : name(_name)
- , id(_id)
- , task(NULL)
- , active(true)
-{
-}
-
-cReaction::~cReaction()
-{
- while (process_list.GetSize() != 0) delete process_list.Pop();
- while (requisite_list.GetSize() != 0) delete requisite_list.Pop();
-}
-
-cReactionProcess * cReaction::AddProcess()
-{
- cReactionProcess * new_process = new cReactionProcess();
- process_list.PushRear(new_process);
- return new_process;
-}
-
-cReactionRequisite * cReaction::AddRequisite()
-{
- cReactionRequisite * new_requisite = new cReactionRequisite();
- requisite_list.PushRear(new_requisite);
- return new_requisite;
-}
-
-bool cReaction::ModifyValue(double new_value, int process_num)
-{
- if (process_num >= process_list.GetSize() || process_num < 0) return false;
- process_list.GetPos(process_num)->SetValue(new_value);
- return true;
-}
-
-bool cReaction::MultiplyValue(double value_mult, int process_num)
-{
- if (process_num >= process_list.GetSize() || process_num < 0) return false;
- double new_value = process_list.GetPos(process_num)->GetValue() * value_mult;
- process_list.GetPos(process_num)->SetValue(new_value);
- return true;
-}
-
-bool cReaction::ModifyInst(int inst_id, int process_num)
-{
- if (process_num >= process_list.GetSize() || process_num < 0) return false;
- process_list.GetPos(process_num)->SetInstID(inst_id);
- return true;
-}
-
-
-double cReaction::GetValue(int process_num)
-{
- if (process_num >= process_list.GetSize() || process_num < 0) return false;
- return process_list.GetPos(process_num)->GetValue();
-}
Deleted: trunk/source/main/reaction.hh
===================================================================
--- trunk/source/main/reaction.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,63 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2004 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_HH
-#define REACTION_HH
-
-#ifndef STRING_HH
-#include "string.hh"
-#endif
-#ifndef TLIST_HH
-#include "tList.hh"
-#endif
-
-class cString; // aggregate
-class cTaskEntry;
-template <class T> class tList; // aggregate
-class cReactionProcess;
-class cReactionRequisite;
-
-class cReaction {
-private:
- cString name;
- int id;
- cTaskEntry * task;
- tList<cReactionProcess> process_list;
- tList<cReactionRequisite> requisite_list;
- bool active;
-private:
- // disabled copy constructor.
- cReaction(const cReaction &);
-public:
- cReaction(const cString & _name, int _id);
- ~cReaction();
-
- const cString & GetName() const { return name; }
- int GetID() const { return id; }
- cTaskEntry * GetTask() { return task; }
- const tList<cReactionProcess> & GetProcesses() { return process_list; }
- const tList<cReactionRequisite> & GetRequisites()
- { return requisite_list; }
- bool GetActive() const { return active; }
-
- void SetTask(cTaskEntry * _task) { task = _task; }
- cReactionProcess * AddProcess();
- cReactionRequisite * AddRequisite();
- void SetActive(bool in_active=true) { active = in_active; }
-
- // These methods will modify the value of the process listed.
- bool ModifyValue(double new_value, int process_num=0);
- bool MultiplyValue(double value_mult, int process_num=0);
-
- // This method will modify the instruction triggered by this process
- bool ModifyInst(int inst_id, int process_num=0);
-
- double GetValue(int process_num=0);
-
-};
-
-#endif
Deleted: trunk/source/main/reaction_lib.cc
===================================================================
--- trunk/source/main/reaction_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_lib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,54 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_LIB_HH
-#include "reaction_lib.hh"
-#endif
-
-#ifndef REACTION_HH
-#include "reaction.hh"
-#endif
-
-//////////////////
-// cReactionLib
-//////////////////
-
-cReactionLib::~cReactionLib()
-{
- for (int i = 0; i < reaction_array.GetSize(); i++) {
- delete reaction_array[i];
- }
-}
-
-
-cReaction * cReactionLib::GetReaction(const cString & name) const
-{
- for (int i = 0; i < reaction_array.GetSize(); i++) {
- if (reaction_array[i]->GetName() == name) return reaction_array[i];
- }
- return NULL;
-}
-
-cReaction * cReactionLib::GetReaction(int id) const
-{
- return reaction_array[id];
-}
-
-
-cReaction * cReactionLib::AddReaction(const cString & name)
-{
- // If this reaction already exists, just return it.
- cReaction * found_reaction = GetReaction(name);
- if (found_reaction != NULL) return found_reaction;
-
- // Create a new reaction...
- const int new_id = reaction_array.GetSize();
- cReaction * new_reaction = new cReaction(name, new_id);
- reaction_array.Resize(new_id + 1);
- reaction_array[new_id] = new_reaction;
- return new_reaction;
-}
Deleted: trunk/source/main/reaction_lib.hh
===================================================================
--- trunk/source/main/reaction_lib.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_lib.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,32 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_LIB_HH
-#define REACTION_LIB_HH
-
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-
-class cReaction;
-class cString;
-
-class cReactionLib {
-private:
- tArray<cReaction *> reaction_array;
-public:
- cReactionLib() { ; }
- ~cReactionLib();
-
- int GetSize() const { return reaction_array.GetSize(); }
-
- cReaction * AddReaction(const cString & name);
- cReaction * GetReaction(const cString & name) const;
- cReaction * GetReaction(int id) const;
-};
-
-#endif
Deleted: trunk/source/main/reaction_process.cc
===================================================================
--- trunk/source/main/reaction_process.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_process.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,42 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_PROCESS_HH
-#include "reaction_process.hh"
-#endif
-
-#ifndef DEFS_HH
-#include "defs.hh"
-#endif
-#ifndef REACTION_MACROS_HH
-#include "reaction_macros.hh"
-#endif
-
-//////////////////////
-// cReactionProcess
-//////////////////////
-
-cReactionProcess::cReactionProcess()
- : resource(NULL)
- , value(1.0)
- , type(REACTION_PROCTYPE_ADD)
- , max_number(1.0)
- , min_number(0.0)
- , max_fraction(1.0)
- , product(NULL)
- , conversion(1.0)
- , inst_id(-1)
- , lethal(0)
- , detect(NULL)
- , detection_threshold(0.0)
- , detection_error(0.0)
-{
-}
-
-cReactionProcess::~cReactionProcess()
-{
-}
Deleted: trunk/source/main/reaction_process.hh
===================================================================
--- trunk/source/main/reaction_process.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_process.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,66 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2004 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_PROCESS_HH
-#define REACTION_PROCESS_HH
-
-#include <iostream>
-
-using namespace std;
-
-class cResource;
-class cReactionProcess {
-private:
- cResource * resource; // Resource consumed.
- double value; // Efficiency.
- int type; // Method of applying bonuses.
- double max_number; // Max quantity of resource usable.
- double min_number; // Minimum quantity of resource needed (otherwise 0)
- double max_fraction; // Max fraction of avaiable resources useable.
- cResource * product; // Output resource.
- double conversion; // Conversion factor.
- bool lethal; // Lethality of reaction
- int inst_id; // Instruction to be triggered if reaction successful.
-
- // Resource detection
- cResource * detect; // Resource Measured
- double detection_threshold; // Min quantity of resource to register present
- double detection_error; // Var of Detection Event (as % of resource present)
-public:
- cReactionProcess();
- ~cReactionProcess();
-
- cResource * GetResource() const { return resource; }
- double GetValue() const { return value; }
- int GetType() const { return type; }
- double GetMaxNumber() const { return max_number; }
- double GetMinNumber() const { return min_number; }
- double GetMaxFraction() const { return max_fraction; }
- cResource * GetProduct() const { return product; }
- double GetConversion() const { return conversion; }
- int GetInstID() const { return inst_id; }
- bool GetLethal() const { return lethal; }
- cResource * GetDetect() const { return detect; }
- double GetDetectionThreshold() const { return detection_threshold; }
- double GetDetectionError() const { return detection_error; }
-
- void SetResource(cResource * _in) { resource = _in; }
- void SetValue(double _in) { value = _in; }
- void SetType(int _in) { type = _in; }
- void SetMaxNumber(double _in) { max_number = _in; }
- void SetMinNumber(double _in) { min_number = _in; }
- void SetMaxFraction(double _in) { max_fraction = _in; }
- void SetProduct(cResource * _in) { product = _in; }
- void SetConversion(double _in) { conversion = _in; }
- void SetInstID(int _in) { inst_id = _in; }
- void SetLethal(int _in) { lethal = _in; }
- void SetDetect(cResource * _in) { detect = _in; }
- void SetDetectionThreshold(double _in) { detection_threshold = _in; }
- void SetDetectionError(double _in) { detection_error = _in; }
-};
-
-#endif
Deleted: trunk/source/main/reaction_requisite.cc
===================================================================
--- trunk/source/main/reaction_requisite.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_requisite.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,26 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_REQUISITE_HH
-#include "reaction_requisite.hh"
-#endif
-
-#include <limits.h>
-
-////////////////////////
-// cReactionRequisite
-////////////////////////
-
-cReactionRequisite::cReactionRequisite()
- : min_task_count(0)
- , max_task_count(INT_MAX)
-{
-}
-
-cReactionRequisite::~cReactionRequisite()
-{
-}
Deleted: trunk/source/main/reaction_requisite.hh
===================================================================
--- trunk/source/main/reaction_requisite.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_requisite.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,51 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_REQUISITE_HH
-#define REACTION_REQUISITE_HH
-
-#ifndef TLIST_HH
-#include "tList.hh"
-#endif
-
-class cReaction;
-class cReactionRequisite {
-private:
- tList<cReaction> prior_reaction_list;
- tList<cReaction> prior_noreaction_list;
- int min_task_count;
- int max_task_count;
-private:
- // disabled copy constructor.
- cReactionRequisite(const cReactionRequisite &);
-public:
- cReactionRequisite();
- ~cReactionRequisite();
-
- const tList<cReaction> & GetReactions() const { return prior_reaction_list; }
- const tList<cReaction> & GetNoReactions() const
- { return prior_noreaction_list; }
- int GetMinTaskCount() const { return min_task_count; }
- int GetMaxTaskCount() const { return max_task_count; }
-
- void AddReaction(cReaction * in_reaction) {
- prior_reaction_list.PushRear(in_reaction);
- }
- void AddNoReaction(cReaction * in_reaction) {
- prior_noreaction_list.PushRear(in_reaction);
- }
- void SetMinTaskCount(int min) { min_task_count = min; }
- void SetMaxTaskCount(int max) { max_task_count = max; }
-
- /*
- added to satisfy Boost.Python; the semantics are fairly useless --
- equality of two references means that they refer to the same object.
- */
- bool operator==(const cReactionRequisite &in) const { return &in == this; }
-};
-
-#endif
Deleted: trunk/source/main/reaction_result.cc
===================================================================
--- trunk/source/main/reaction_result.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_result.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,178 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2004 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "reaction_result.hh"
-
-
-cReactionResult::cReactionResult(const int num_resources,
- const int num_tasks,
- const int num_reactions)
- : resources_consumed(num_resources)
- , resources_produced(num_resources)
- , resources_detected(num_resources)
- , tasks_done(num_tasks)
- , receive_tasks_done(num_tasks)
- , send_tasks_done(num_tasks)
- , reactions_triggered(num_reactions)
- , bonus_add(0.0)
- , bonus_mult(1.0)
- , insts_triggered(0)
- , lethal(false)
- , active_reaction(false)
-{
-}
-
-cReactionResult::~cReactionResult()
-{
-}
-
-
-void cReactionResult::ActivateReaction()
-{
- // If this reaction is already active, don't worry about it.
- if (active_reaction == true) return;
-
- // To activate the reaction, we must initialize all counter settings.
- resources_consumed.SetAll(0.0);
- resources_produced.SetAll(0.0);
- resources_detected.SetAll(-1.0);
- tasks_done.SetAll(false);
- receive_tasks_done.SetAll(false);
- send_tasks_done.SetAll(false);
- reactions_triggered.SetAll(false);
-
- // And finally note that this is indeed already active.
- active_reaction = true;
-}
-
-
-void cReactionResult::Consume(int id, double num)
-{
- ActivateReaction();
- resources_consumed[id] += num;
-}
-
-
-void cReactionResult::Produce(int id, double num)
-{
- ActivateReaction();
- resources_produced[id] += num;
-}
-
-
-void cReactionResult::Detect(int id, double num)
-{
- ActivateReaction();
- resources_detected[id] += num;
-}
-
-void cReactionResult::Lethal(bool flag)
-{
- ActivateReaction();
- lethal = flag;
-}
-
-void cReactionResult::MarkTask(int id)
-{
- ActivateReaction();
- tasks_done[id] = true;
-}
-
-
-void cReactionResult::MarkReceiveTask(int id)
-{
- ActivateReaction();
- receive_tasks_done[id] = true;
-}
-
-
-void cReactionResult::MarkSendTask(int id)
-{
- ActivateReaction();
- send_tasks_done[id] = true;
-}
-
-
-void cReactionResult::MarkReaction(int id)
-{
- ActivateReaction();
- reactions_triggered[id] = true;
-}
-
-
-void cReactionResult::AddBonus(double value)
-{
- ActivateReaction();
- bonus_add += value;
-}
-
-
-void cReactionResult::MultBonus(double value)
-{
- ActivateReaction();
- bonus_mult *= value;
-}
-
-void cReactionResult::AddInst(int id)
-{
- insts_triggered.Push(id);
-}
-
-double cReactionResult::GetConsumed(int id)
-{
- if (GetActive() == false) return 0.0;
- return resources_consumed[id];
-}
-
-
-double cReactionResult::GetProduced(int id)
-{
- if (GetActive() == false) return 0.0;
- return resources_produced[id];
-}
-
-double cReactionResult::GetDetected(int id)
-{
- if (GetActive() == false) return 0.0;
- return resources_detected[id];
-}
-
-bool cReactionResult::GetLethal()
-{
- if (GetActive() == false) return false;
- return lethal;
-}
-
-bool cReactionResult::ReactionTriggered(int id)
-{
- if (GetActive() == false) return false;
- return reactions_triggered[id];
-}
-
-bool cReactionResult::TaskDone(int id)
-{
- if (GetActive() == false) return false;
- return tasks_done[id];
-}
-
-double cReactionResult::GetAddBonus()
-{
- if (GetActive() == false) return 0.0;
- return bonus_add;
-}
-
-double cReactionResult::GetMultBonus()
-{
- if (GetActive() == false) return 1.0;
- return bonus_mult;
-}
-
-tArray<int> & cReactionResult::GetInstArray()
-{
- return insts_triggered;
-}
-
Deleted: trunk/source/main/reaction_result.hh
===================================================================
--- trunk/source/main/reaction_result.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/reaction_result.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,63 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2004 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef REACTION_RESULT_HH
-#define REACTION_RESULT_HH
-
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-
-template <class T> class tArray; // aggregate
-
-class cReactionResult {
-private:
- tArray<double> resources_consumed;
- tArray<double> resources_produced;
- tArray<double> resources_detected; //Initialize to -1.0
- tArray<bool> tasks_done;
- tArray<bool> receive_tasks_done;
- tArray<bool> send_tasks_done;
- tArray<bool> reactions_triggered;
- double bonus_add;
- double bonus_mult;
- tArray<int> insts_triggered;
- bool lethal;
- bool active_reaction;
-
- inline void ActivateReaction();
-public:
- cReactionResult(const int num_resources, const int num_tasks,
- const int num_reactions);
- ~cReactionResult();
-
- bool GetActive() { return active_reaction; }
-
- void Consume(int id, double num);
- void Produce(int id, double num);
- void Detect(int id, double num);
- void Lethal(bool flag);
- void MarkTask(int id);
- void MarkReceiveTask(int id);
- void MarkSendTask(int id);
- void MarkReaction(int id);
- void AddBonus(double value);
- void MultBonus(double value);
- void AddInst(int id);
-
- double GetConsumed(int id);
- double GetProduced(int id);
- double GetDetected(int id);
- bool GetLethal();
- bool ReactionTriggered(int id);
- bool TaskDone(int id);
- double GetAddBonus();
- double GetMultBonus();
- tArray<int> & GetInstArray();
-};
-
-#endif
Deleted: trunk/source/main/resource.cc
===================================================================
--- trunk/source/main/resource.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,55 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_HH
-#include "resource.hh"
-#endif
-
-#ifndef CONFIG_HH
-#include "cConfig.h"
-#endif
-
-using namespace std;
-
-cResource::cResource(const cString & _name, int _id)
- : name(_name)
- , id(_id)
- , initial(0.0)
- , inflow(0.0)
- , outflow(0.0)
- , geometry(GEOMETRY_GLOBAL)
- , inflowX1(-99)
- , inflowX2(-99)
- , inflowY1(-99)
- , inflowY2(-99)
- , outflowX1(-99)
- , outflowX2(-99)
- , outflowY1(-99)
- , outflowY2(-99)
- , xdiffuse(1.0)
- , xgravity(0.0)
- , ydiffuse(1.0)
- , ygravity(0.0)
-{
-}
-
-bool cResource::SetGeometry(cString _geometry)
-{
- _geometry.ToLower();
- if (_geometry == "global") {
- geometry = GEOMETRY_GLOBAL;
- return true;
- } else if (_geometry == "grid") {
- geometry = GEOMETRY_GRID;
- return true;
- } else if (_geometry == "torus") {
- geometry = GEOMETRY_TORUS;
- return true;
- } else {
- return false;
- }
-}
Deleted: trunk/source/main/resource.hh
===================================================================
--- trunk/source/main/resource.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,80 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_HH
-#define RESOURCE_HH
-
-#ifndef STRING_HH
-#include "string.hh"
-#endif
-
-class cString; // aggregate
-
-class cResource {
-private:
- cString name;
- int id;
- double initial;
- double inflow;
- double outflow;
- int geometry;
- int inflowX1;
- int inflowX2;
- int inflowY1;
- int inflowY2;
- int outflowX1;
- int outflowX2;
- int outflowY1;
- int outflowY2;
- double xdiffuse;
- double xgravity;
- double ydiffuse;
- double ygravity;
-
-public:
- cResource(const cString & _name, int _id);
- ~cResource() { ; }
-
- const cString & GetName() const { return name; }
- int GetID() const { return id; }
- double GetInitial() const { return initial; }
- double GetInflow() const { return inflow; }
- double GetOutflow() const { return outflow; }
- int GetGeometry() const { return geometry; }
- int GetInflowX1() const { return inflowX1; }
- int GetInflowX2() const { return inflowX2; }
- int GetInflowY1() const { return inflowY1; }
- int GetInflowY2() const { return inflowY2; }
- int GetOutflowX1() const { return outflowX1; }
- int GetOutflowX2() const { return outflowX2; }
- int GetOutflowY1() const { return outflowY1; }
- int GetOutflowY2() const { return outflowY2; }
- double GetXDiffuse() const { return xdiffuse; }
- double GetXGravity() const { return xgravity; }
- double GetYDiffuse() const { return ydiffuse; }
- double GetYGravity() const { return ygravity; }
-
-
- void SetInitial(double _initial) { initial = _initial; }
- void SetInflow (double _inflow ) { inflow = _inflow; }
- void SetOutflow(double _outflow) { outflow = _outflow; }
- bool SetGeometry(cString _geometry);
- void SetInflowX1(int _inflowX1) { inflowX1 = _inflowX1; }
- void SetInflowX2(int _inflowX2) { inflowX2 = _inflowX2; }
- void SetInflowY1(int _inflowY1) { inflowY1 = _inflowY1; }
- void SetInflowY2(int _inflowY2) { inflowY2 = _inflowY2; }
- void SetOutflowX1(int _outflowX1) { outflowX1 = _outflowX1; }
- void SetOutflowX2(int _outflowX2) { outflowX2 = _outflowX2; }
- void SetOutflowY1(int _outflowY1) { outflowY1 = _outflowY1; }
- void SetOutflowY2(int _outflowY2) { outflowY2 = _outflowY2; }
- void SetXDiffuse(double _xdiffuse) { xdiffuse = _xdiffuse; }
- void SetXGravity(double _xgravity) { xgravity = _xgravity; }
- void SetYDiffuse(double _ydiffuse) { ydiffuse = _ydiffuse; }
- void SetYGravity(double _ygravity) { ygravity = _ygravity; }
-};
-
-#endif
Deleted: trunk/source/main/resource_count.cc
===================================================================
--- trunk/source/main/resource_count.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource_count.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,371 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
-#endif
-
-#ifndef CONFIG_HH
-#include "cConfig.h"
-#endif
-
-extern "C" {
-#include <math.h>
-}
-
-using namespace std;
-
-const double cResourceCount::UPDATE_STEP(1.0 / 10000.0);
-const double cResourceCount::EPSILON (1.0e-15);
-const int cResourceCount::PRECALC_DISTANCE(100);
-
-void FlowMatter(cSpatialCountElem &elem1, cSpatialCountElem &elem2, double inxdiffuse,
- double inydiffuse, double inxgravity, double inygravity,
- int xdist, int ydist, double dist) {
-
- /* Routine to calculate the amount of flow from one Element to another.
- Amount of flow is a function of:
-
- 1) Amount of material in each cell (will try to equalize)
- 2) Distance between each cell
- 3) x and y "gravity"
-
- This method only effect the delta amount of each element. The State
- method will need to be called at the end of each time step to complete
- the movement of material.
- */
-
- double diff, flowamt, xgravity, xdiffuse, ygravity, ydiffuse;
-
- if (((elem1.amount == 0.0) && (elem2.amount == 0.0)) && (dist < 0.0)) return;
- diff = (elem1.amount - elem2.amount);
- if (xdist != 0) {
-
- /* if there is material to be effected by x gravity */
-
- if (((xdist>0) && (inxgravity>0.0)) || ((xdist<0) && (inxgravity<0.0))) {
- xgravity = elem1.amount * fabs(inxgravity)/3.0;
- } else {
- xgravity = -elem2.amount * fabs(inxgravity)/3.0;
- }
-
- /* Diffusion uses the diffusion constant x half the difference (as the
- elements attempt to equalize) / the number of possible neighbors (8) */
-
- xdiffuse = inxdiffuse * diff / 16.0;
- } else {
- xdiffuse = 0.0;
- xgravity = 0.0;
- }
- if (ydist != 0) {
-
- /* if there is material to be effected by y gravity */
-
- if (((ydist>0) && (inygravity>0.0)) || ((ydist<0) && (inygravity<0.0))) {
- ygravity = elem1.amount * fabs(inygravity)/3.0;
- } else {
- ygravity = -elem2.amount * fabs(inygravity)/3.0;
- }
- ydiffuse = inydiffuse * diff / 16.0;
- } else {
- ydiffuse = 0.0;
- ygravity = 0.0;
- }
-
- flowamt = ((xdiffuse + ydiffuse + xgravity + ygravity)/
- (fabs(xdist*1.0) + fabs(ydist*1.0)))/dist;
- elem1.delta -= flowamt;
- elem2.delta += flowamt;
-}
-
-cResourceCount::cResourceCount(int num_resources)
- : update_time(0.0)
- , spatial_update_time(0.0)
-{
- if(num_resources > 0) {
- SetSize(num_resources);
- }
-
- return;
-}
-
-cResourceCount::cResourceCount(const cResourceCount &rc) {
- *this = rc;
-
- return;
-}
-
-const cResourceCount &cResourceCount::operator=(const cResourceCount &rc) {
- resource_count = rc.resource_count;
- decay_rate = rc.decay_rate;
- inflow_rate = rc.inflow_rate;
- decay_precalc = rc.decay_precalc;
- inflow_precalc = rc.inflow_precalc;
- geometry = rc.geometry;
- spatial_resource_count = rc.spatial_resource_count;
- curr_grid_res_cnt = rc.curr_grid_res_cnt;
- curr_spatial_res_cnt = rc.curr_spatial_res_cnt;
- update_time = rc.update_time;
- spatial_update_time = rc.spatial_update_time;
-
- return *this;
-}
-
-void cResourceCount::SetSize(int num_resources)
-{
- resource_count.ResizeClear(num_resources);
- decay_rate.ResizeClear(num_resources);
- inflow_rate.ResizeClear(num_resources);
- if(num_resources > 0) {
- decay_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
- inflow_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
- }
- geometry.ResizeClear(num_resources);
- spatial_resource_count.ResizeClear(num_resources);
- curr_grid_res_cnt.ResizeClear(num_resources);
- curr_spatial_res_cnt.ResizeClear(num_resources);
-
- resource_count.SetAll(0.0);
- decay_rate.SetAll(0.0);
- inflow_rate.SetAll(0.0);
- decay_precalc.SetAll(0.0);
- inflow_precalc.SetAll(0.0);
- geometry.SetAll(GEOMETRY_GLOBAL);
- curr_grid_res_cnt.SetAll(0.0);
-}
-
-cResourceCount::~cResourceCount()
-{
-}
-
-void cResourceCount::Setup(int id, cString name, double initial, double inflow,
- double decay, int in_geometry, double in_xdiffuse,
- double in_xgravity, double in_ydiffuse,
- double in_ygravity, int in_inflowX1,
- int in_inflowX2, int in_inflowY1,
- int in_inflowY2, int in_outflowX1,
- int in_outflowX2, int in_outflowY1,
- int in_outflowY2)
-{
- assert(id >= 0 && id < resource_count.GetSize());
- assert(initial >= 0.0);
- assert(decay >= 0.0);
- assert(inflow >= 0.0);
- assert(spatial_resource_count[id].GetSize() > 0);
-
- cString geo_name;
- if (in_geometry == GEOMETRY_GLOBAL) {
- geo_name = "GLOBAL";
- } else if (in_geometry == GEOMETRY_GRID) {
- geo_name = "GRID";
- } else if (in_geometry == GEOMETRY_TORUS) {
- geo_name = "TORUS";
- }
-#if 0
- cerr << "Setting up resource " << name
- << "(" << geo_name
- << ") with initial quatity=" << initial
- << ", decay=" << decay
- << ", inflow=" << inflow
- << endl;
- if ((in_geometry == GEOMETRY_GRID) || (in_geometry == GEOMETRY_TORUS)) {
- cerr << " Inflow rectangle (" << in_inflowX1
- << "," << in_inflowY1
- << ") to (" << in_inflowX2
- << "," << in_inflowY2
- << ")" << endl;
- cerr << " Outflow rectangle (" << in_outflowX1
- << "," << in_outflowY1
- << ") to (" << in_outflowX2
- << "," << in_outflowY2
- << ")" << endl;
- cerr << " xdiffuse=" << in_xdiffuse
- << ", xgravity=" << in_xgravity
- << ", ydiffuse=" << in_ydiffuse
- << ", ygravity=" << in_ygravity
- << endl;
- }
-#endif
-
- resource_count[id] = initial;
- spatial_resource_count[id].RateAll
- (initial/spatial_resource_count[id].GetSize());
- spatial_resource_count[id].StateAll();
- decay_rate[id] = decay;
- inflow_rate[id] = inflow;
- geometry[id] = in_geometry;
- spatial_resource_count[id].SetGeometry(in_geometry);
- spatial_resource_count[id].SetPointers();
-
- double step_decay = pow(decay, UPDATE_STEP);
- double step_inflow = inflow * UPDATE_STEP;
-
- decay_precalc(id, 0) = 1.0;
- inflow_precalc(id, 0) = 0.0;
- for (int i = 1; i <= PRECALC_DISTANCE; i++) {
- decay_precalc(id, i) = decay_precalc(id, i-1) * step_decay;
- inflow_precalc(id, i) = inflow_precalc(id, i-1) * step_decay + step_inflow;
- }
- spatial_resource_count[id].SetXdiffuse(in_xdiffuse);
- spatial_resource_count[id].SetXgravity(in_xgravity);
- spatial_resource_count[id].SetYdiffuse(in_ydiffuse);
- spatial_resource_count[id].SetYgravity(in_ygravity);
- spatial_resource_count[id].SetInflowX1(in_inflowX1);
- spatial_resource_count[id].SetInflowX2(in_inflowX2);
- spatial_resource_count[id].SetInflowY1(in_inflowY1);
- spatial_resource_count[id].SetInflowY2(in_inflowY2);
- spatial_resource_count[id].SetOutflowX1(in_outflowX1);
- spatial_resource_count[id].SetOutflowX2(in_outflowX2);
- spatial_resource_count[id].SetOutflowY1(in_outflowY1);
- spatial_resource_count[id].SetOutflowY2(in_outflowY2);
-}
-
-void cResourceCount::Update(double in_time)
-{
- update_time += in_time;
- spatial_update_time += in_time;
- }
-
-
-const tArray<double> & cResourceCount::GetResources() const
-{
- DoUpdates();
- return resource_count;
-}
-
-const tArray<double> & cResourceCount::GetCellResources(int cell_id) const
-
- // Get amount of the resource for a given cell in the grid. If it is a
- // global resource pass out the entire content of that resource.
-
-{
- int num_resources = resource_count.GetSize();
- DoUpdates();
-
- for (int i = 0; i < num_resources; i++) {
- if (geometry[i] == GEOMETRY_GLOBAL) {
- curr_grid_res_cnt[i] = resource_count[i];
- } else {
- curr_grid_res_cnt[i] = spatial_resource_count[i].GetAmount(cell_id);
- }
- }
- return curr_grid_res_cnt;
-
-}
-
-const tArray<int> & cResourceCount::GetResourcesGeometry() const
-{
- return geometry;
-}
-
-const tArray< tArray<double> > & cResourceCount::GetSpatialRes()
-{
- const int num_spatial_resources = spatial_resource_count.GetSize();
- if (num_spatial_resources > 0) {
- const int num_cells = spatial_resource_count[0].GetSize();
- DoUpdates();
- for (int i = 0; i < num_spatial_resources; i++) {
- for (int j = 0; j < num_cells; j++) {
- curr_spatial_res_cnt[i][j] = spatial_resource_count[i].GetAmount(j);
- }
- }
- }
-
- return curr_spatial_res_cnt;
-}
-
-void cResourceCount::Modify(const tArray<double> & res_change)
-{
- assert(resource_count.GetSize() == res_change.GetSize());
-
- for (int i = 0; i < resource_count.GetSize(); i++) {
- resource_count[i] += res_change[i];
- assert(resource_count[i] >= 0.0);
- }
-}
-
-
-void cResourceCount::Modify(int id, double change)
-{
- assert(id < resource_count.GetSize());
-
- resource_count[id] += change;
- assert(resource_count[id] >= 0.0);
-}
-
-void cResourceCount::ModifyCell(const tArray<double> & res_change, int cell_id)
-{
- assert(resource_count.GetSize() == res_change.GetSize());
-
- for (int i = 0; i < resource_count.GetSize(); i++) {
- if (geometry[i] == GEOMETRY_GLOBAL) {
- resource_count[i] += res_change[i];
- assert(resource_count[i] >= 0.0);
- } else {
- spatial_resource_count[i].Rate(cell_id, res_change[i]);
- }
- }
-}
-
-
-void cResourceCount::Set(int id, double new_level)
-{
- assert(id < resource_count.GetSize());
-
- resource_count[id] = new_level;
-}
-
-void cResourceCount::ResizeSpatialGrids(int in_x, int in_y)
-{
- for (int i = 0; i < resource_count.GetSize(); i++) {
- spatial_resource_count[i].ResizeClear(in_x, in_y, geometry[i]);
- curr_spatial_res_cnt[i].Resize(in_x * in_y);
- }
-}
-///// Private Methods /////////
-void cResourceCount::DoUpdates() const
-{
- assert(update_time >= -EPSILON);
-
- // Determine how many update steps have progressed
- int num_steps = (int) (update_time / UPDATE_STEP);
-
- // Preserve remainder of update_time
- update_time -= num_steps * UPDATE_STEP;
-
- while (num_steps > PRECALC_DISTANCE) {
- for (int i = 0; i < resource_count.GetSize(); i++) {
- if (geometry[i] == GEOMETRY_GLOBAL) {
- resource_count[i] *= decay_precalc(i, PRECALC_DISTANCE);
- resource_count[i] += inflow_precalc(i, PRECALC_DISTANCE);
- }
- }
- num_steps -= PRECALC_DISTANCE;
- }
-
- for (int i = 0; i < resource_count.GetSize(); i++) {
- if (geometry[i] == GEOMETRY_GLOBAL) {
- resource_count[i] *= decay_precalc(i, num_steps);
- resource_count[i] += inflow_precalc(i, num_steps);
- }
- }
-
- // If one (or more) complete update has occured update the spatial resources
-
- while (spatial_update_time >= 1.0) {
- spatial_update_time -= 1.0;
- for (int i = 0; i < resource_count.GetSize(); i++) {
- if (geometry[i] != GEOMETRY_GLOBAL) {
- spatial_resource_count[i].Source(inflow_rate[i]);
- spatial_resource_count[i].Sink(decay_rate[i]);
- spatial_resource_count[i].FlowAll();
- spatial_resource_count[i].StateAll();
- resource_count[i] = spatial_resource_count[i].SumAll();
- }
- }
- }
-}
Deleted: trunk/source/main/resource_count.hh
===================================================================
--- trunk/source/main/resource_count.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource_count.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,87 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_COUNT_HH
-#define RESOURCE_COUNT_HH
-
-#ifndef SPATIAL_RES_COUNT_HH
-#include "spatial_res_count.hh"
-#endif
-#ifndef STRING_HH
-#include "string.hh"
-#endif
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-#ifndef TMATRIX_HH
-#include "tMatrix.hh"
-#endif
-
-template <class T> class tArray; // aggregate
-template <class T> class tMatrix; // aggregate
-class cSpatialResCount; // aggregate
-class cString; // aggregate
-
-class cResourceCount {
-private:
- mutable tArray<double> resource_count; // Current quantity of each resource
- tArray<double> decay_rate; // Multiplies resource count at each step
- tArray<double> inflow_rate; // An increment for resource at each step
- tMatrix<double> decay_precalc; // Precalculation of decay values
- tMatrix<double> inflow_precalc; // Precalculation of inflow values
- tArray<int> geometry; // Spatial layout of each resource
- mutable tArray<cSpatialResCount> spatial_resource_count;
- mutable tArray<double> curr_grid_res_cnt;
- mutable tArray< tArray<double> > curr_spatial_res_cnt;
-
- // Setup the update process to use lazy evaluation...
- mutable double update_time; // Portion of an update compleated...
- mutable double spatial_update_time;
- void DoUpdates() const; // Update resource count based on update time
-
- // A few constants to describe update process...
- static const double UPDATE_STEP; // Fraction of an update per step
- static const double EPSILON; // Tolorance for round off errors
- static const int PRECALC_DISTANCE; // Number of steps to precalculate
-public:
- cResourceCount(int num_resources=0);
- cResourceCount(const cResourceCount &);
- ~cResourceCount();
-
- const cResourceCount &operator=(const cResourceCount &);
-
- void SetSize(int num_resources);
-
- void Setup(int id, cString name, double initial, double inflow,
- double decay, int in_geometry, double in_xdiffuse,
- double in_xgravity, double in_ydiffuse,
- double in_ygravity, int in_inflowX1,
- int in_inflowX2, int in_inflowY1,
- int in_inflowY2, int in_outflowX1,
- int in_outflowX2, int in_outflowY1,
- int in_outflowY);
- void Update(double in_time);
-
- int GetSize(void) const { return resource_count.GetSize(); }
- const tArray<double> & ReadResources(void) const { return resource_count; }
- const tArray<double> & GetResources() const;
- const tArray<double> & GetCellResources(int cell_id) const;
- const tArray<int> & GetResourcesGeometry() const;
- const tArray< tArray<double> > & GetSpatialRes();
- void Modify(const tArray<double> & res_change);
- void Modify(int id, double change);
- void ModifyCell(const tArray<double> & res_change, int cell_id);
- void Set(int id, double new_level);
- double Get(int id) const{
- assert(id < resource_count.GetSize());
- return resource_count[id]; }
- void ResizeSpatialGrids(int in_x, int in_y);
- cSpatialResCount GetSpatialResource(int id)
- { return spatial_resource_count[id]; }
-};
-
-#endif
Deleted: trunk/source/main/resource_lib.cc
===================================================================
--- trunk/source/main/resource_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource_lib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,46 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_LIB_HH
-#include "resource_lib.hh"
-#endif
-
-#ifndef RESOURCE_HH
-#include "resource.hh"
-#endif
-
-using namespace std;
-
-cResourceLib::~cResourceLib()
-{
- for (int i = 0; i < resource_array.GetSize(); i++) {
- delete resource_array[i];
- }
-}
-
-cResource * cResourceLib::AddResource(const cString & res_name)
-{
- const int new_id = resource_array.GetSize();
- cResource * new_resource = new cResource(res_name, new_id);
- resource_array.Resize(new_id + 1);
- resource_array[new_id] = new_resource;
- return new_resource;
-}
-
-cResource * cResourceLib::GetResource(const cString & res_name) const
-{
- for (int i = 0; i < resource_array.GetSize(); i++) {
- if (resource_array[i]->GetName() == res_name) return resource_array[i];
- }
- cerr << "Error: Unknown resource '" << res_name << "'." << endl;
- return NULL;
-}
-
-cResource * cResourceLib::GetResource(int id) const
-{
- return resource_array[id];
-}
Deleted: trunk/source/main/resource_lib.hh
===================================================================
--- trunk/source/main/resource_lib.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/resource_lib.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,31 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef RESOURCE_LIB_HH
-#define RESOURCE_LIB_HH
-
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-
-class cResource;
-class cString;
-class cResourceLib {
-private:
- tArray<cResource *> resource_array;
-public:
- cResourceLib() { ; }
- ~cResourceLib();
-
- int GetSize() const { return resource_array.GetSize(); }
-
- cResource * AddResource(const cString & res_name);
- cResource * GetResource(const cString & res_name) const;
- cResource * GetResource(int id) const;
-};
-
-#endif
Deleted: trunk/source/main/spatial_count_elem.cc
===================================================================
--- trunk/source/main/spatial_count_elem.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/spatial_count_elem.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,38 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPATIAL_COUNT_ELEM_HH
-#include "spatial_count_elem.hh"
-#endif
-
-#ifndef RESOURCE_COUNT_MACROS_HH
-#include "resource_count_macros.hh"
-#endif
-
-cSpatialCountElem::cSpatialCountElem (double initamount) {
- amount = initamount;
- delta=0.0;
- elempt.Resize(MAXFLOWPTS);
- xdist.Resize(MAXFLOWPTS);
- ydist.Resize(MAXFLOWPTS);
- dist.Resize(MAXFLOWPTS);
-}
-cSpatialCountElem::cSpatialCountElem () {
- amount = 0.0;
- delta=0.0;
- elempt.Resize(MAXFLOWPTS);
- xdist.Resize(MAXFLOWPTS);
- ydist.Resize(MAXFLOWPTS);
- dist.Resize(MAXFLOWPTS);
-}
-void cSpatialCountElem::SetPtr (int innum, int inelempt, int inxdist,
- int inydist, double indist) {
- elempt[innum] = inelempt;
- xdist[innum] = inxdist;
- ydist[innum] = inydist;
- dist[innum] = indist;
-}
Deleted: trunk/source/main/spatial_count_elem.hh
===================================================================
--- trunk/source/main/spatial_count_elem.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/spatial_count_elem.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,35 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPATIAL_COUNT_ELEM_HH
-#define SPATIAL_COUNT_ELEM_HH
-
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-
-class cSpatialCountElem {
- mutable double amount, delta;
- tArray<int> elempt, xdist, ydist;
- tArray<double> dist;
-public:
- cSpatialCountElem (double initamount);
- cSpatialCountElem ();
- void Rate (double ratein) const {delta += ratein;}
- void State () {amount += delta; delta = 0.0;}
- const double GetAmount() const {return amount;}
- void SetPtr (int innum, int inelempt, int inxdist, int inydist,
- double indist);
- int GetElemPtr (int innum) {return elempt[innum];}
- int GetPtrXdist (int innum) {return xdist[innum];}
- int GetPtrYdist (int innum) {return ydist[innum];}
- double GetPtrDist (int innum) {return dist[innum];}
- friend void FlowMatter (cSpatialCountElem&, cSpatialCountElem&, double,
- double, double, double, int, int, double);
-};
-
-#endif
Deleted: trunk/source/main/spatial_res_count.cc
===================================================================
--- trunk/source/main/spatial_res_count.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/spatial_res_count.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,275 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPATIAL_RES_COUNT_HH
-#include "spatial_res_count.hh"
-#endif
-
-#ifndef CONFIG_HH
-#include "cConfig.h"
-#endif
-#ifndef FUNCTIONS_HH
-#include "functions.hh"
-#endif
-
-cSpatialResCount::cSpatialResCount(int inworld_x, int inworld_y,
- int ingeometry,
- double inxdiffuse, double inydiffuse, double inxgravity,
- double inygravity)
- : grid(inworld_x * inworld_y) {
-
- int i;
-
- xdiffuse = inxdiffuse;
- ydiffuse = inydiffuse;
- xgravity = inxgravity;
- ygravity = inygravity;
- world_x = inworld_x;
- world_y = inworld_y;
- geometry = ingeometry;
- num_cells = world_x * world_y;
- for (i = 0; i < GetSize(); i++) {
- cSpatialCountElem tmpelem;
- grid[i] = tmpelem;
- }
- SetPointers();
-}
-
-cSpatialResCount::cSpatialResCount(int inworld_x, int inworld_y, int ingeometry)
- : grid(inworld_x * inworld_y) {
- int i;
-
- xdiffuse = 1.0;
- ydiffuse = 1.0;
- xgravity = 0.0;
- ygravity = 0.0;
- world_x = inworld_x;
- world_y = inworld_y;
- geometry = ingeometry;
- num_cells = world_x * world_y;
- for (i = 0; i < GetSize(); i++) {
- cSpatialCountElem tmpelem;
- grid[i] = tmpelem;
- }
- SetPointers();
-}
-
-cSpatialResCount::cSpatialResCount() {
-
- xdiffuse = 1.0;
- ydiffuse = 1.0;
- xgravity = 0.0;
- ygravity = 0.0;
- geometry = GEOMETRY_GLOBAL;
-}
-
-void cSpatialResCount::ResizeClear(int inworld_x, int inworld_y,
- int ingeometry) {
- int i;
-
- grid.ResizeClear(inworld_x * inworld_y);
- world_x = inworld_x;
- world_y = inworld_y;
- geometry = ingeometry;
- num_cells = world_x * world_y;
- for (i = 0; i < GetSize(); i++) {
- cSpatialCountElem tmpelem;
- grid[i] = tmpelem;
- }
- SetPointers();
-}
-
-void cSpatialResCount::SetPointers() {
-
- /* Pointer 0 will point to the cell above and to the left the current cell
- and will go clockwise around the cell. */
-
- int i,ii;
- double SQRT2 = sqrt(2.0);
-
- /* First treat all cells like they are in a torus */
-
- for (i = 0; i < GetSize(); i++) {
- grid[i].SetPtr(0 ,GridNeighbor(i, world_x, world_y, -1, -1), -1, -1, SQRT2);
- grid[i].SetPtr(1 ,GridNeighbor(i, world_x, world_y, 0, -1), 0, -1, 1.0);
- grid[i].SetPtr(2 ,GridNeighbor(i, world_x, world_y, +1, -1), +1, -1, SQRT2);
- grid[i].SetPtr(3 ,GridNeighbor(i, world_x, world_y, +1, 0), +1, 0, 1.0);
- grid[i].SetPtr(4 ,GridNeighbor(i, world_x, world_y, +1, +1), +1, +1, SQRT2);
- grid[i].SetPtr(5 ,GridNeighbor(i, world_x, world_y, 0, +1), 0, +1, 1.0);
- grid[i].SetPtr(6 ,GridNeighbor(i, world_x, world_y, -1, +1), -1, +1, SQRT2);
- grid[i].SetPtr(7 ,GridNeighbor(i, world_x, world_y, -1, 0), -1, 0, 1.0);
- }
-
- /* Fix links for top, bottom and sides for non-torus */
-
- if (geometry == GEOMETRY_GRID) {
- /* Top and bottom */
-
- for (i = 0; i < world_x; i++) {
- grid[i].SetPtr(0, -99, -99, -99, -99.0);
- grid[i].SetPtr(1, -99, -99, -99, -99.0);
- grid[i].SetPtr(2, -99, -99, -99, -99.0);
- ii = num_cells-1-i;
- grid[ii].SetPtr(4, -99, -99, -99, -99.0);
- grid[ii].SetPtr(5, -99, -99, -99, -99.0);
- grid[ii].SetPtr(6, -99, -99, -99, -99.0);
- }
-
- /* fix links for right and left sides */
-
- for (i = 0; i < world_y; i++) {
- ii = i * world_x;
- grid[ii].SetPtr(0, -99, -99, -99, -99.0);
- grid[ii].SetPtr(7, -99, -99, -99, -99.0);
- grid[ii].SetPtr(6, -99, -99, -99, -99.0);
- ii = ((i + 1) * world_x) - 1;
- grid[ii].SetPtr(2, -99, -99, -99, -99.0);
- grid[ii].SetPtr(3, -99, -99, -99, -99.0);
- grid[ii].SetPtr(4, -99, -99, -99, -99.0);
- }
- }
-}
-
-void cSpatialResCount::CheckRanges() {
-
- // Check that the x, y ranges of the inflow and outflow rectangles
- // are valid
- /* check range of inputs */
- if (inflowX1 < 0) {
- inflowX1 = 0;
- } else if (inflowX1 > world_x) {
- inflowX1 = world_x;
- }
- if (inflowX2 < 0) {
- inflowX2 = 0;
- } else if (inflowX2 > world_x) {
- inflowX2 = world_x;
- }
- if (inflowY1 < 0) {
- inflowY1 = 0;
- } else if (inflowY1 > world_y) {
- inflowY1 = world_y;
- }
- if (inflowY2 < 0) {
- inflowY2 = 0;
- } else if (inflowY2 > world_y) {
- inflowY2 = world_y;
- }
-
- /* allow for rectangles that cross over the zero X or zero Y boundry */
- if (inflowX2 < inflowX1) { inflowX2 += world_x; }
- if (inflowY2 < inflowY1) { inflowY2 += world_y; }
- if (outflowX1 < 0) {
- outflowX1 = 0;
- } else if (outflowX1 > world_x) {
- outflowX1 = world_x;
- }
- if (outflowX2 < 0) {
- outflowX2 = 0;
- } else if (outflowX2 > world_x) {
- outflowX2 = world_x;
- }
- if (outflowY1 < 0) {
- outflowY1 = 0;
- } else if (outflowY1 > world_y) {
- outflowY1 = world_y;
- }
- if (outflowY2 < 0) {
- outflowY2 = 0;
- } else if (outflowY2 > world_y) {
- outflowY2 = world_y;
- }
-
- /* allow for rectangles that cross over the zero X or zero Y boundry */
- if (outflowX2 < outflowX1) { outflowX2 += world_x; }
- if (outflowY2 < outflowY1) { outflowY2 += world_y; }
-
-}
-
-void cSpatialResCount::RateAll(double ratein) {
-
- int i;
-
- for (i = 0; i < num_cells; i++) {
- grid[i].Rate(ratein);
- }
-}
-
-void cSpatialResCount::StateAll() {
-
- int i;
-
- for (i = 0; i < num_cells; i++) {
- grid[i].State();
- }
-}
-
-void cSpatialResCount::FlowAll() {
-
- int i,k,ii,xdist,ydist;
- double dist;
-
- for (i = 0; i < num_cells; i++) {
-
- /* because flow is two way we must check only half the neighbors to
- prevent double flow calculations */
-
- for (k = 3; k <= 6; k++) {
- ii = grid[i].GetElemPtr(k);
- xdist = grid[i].GetPtrXdist(k);
- ydist = grid[i].GetPtrYdist(k);
- dist = grid[i].GetPtrDist(k);
- if (ii >= 0) {
- FlowMatter(grid[i],grid[ii],xdiffuse,ydiffuse,xgravity,ygravity,
- xdist, ydist, dist);
- }
- }
- }
-}
-
-const double cSpatialResCount::SumAll() const{
-
- int i;
- double sum = 0.0;
-
- for (i = 0; i < num_cells; i++) {
- sum += GetAmount(i);
- }
- return sum;
-}
-
-
-void cSpatialResCount::Source(double amount) const {
- int i, j, elem;
- double totalcells;
-
-
- totalcells = (inflowY2 - inflowY1 + 1) * (inflowX2 - inflowX1 + 1) * 1.0;
- amount /= totalcells;
-
- for (i = inflowY1; i <= inflowY2; i++) {
- for (j = inflowX1; j <= inflowX2; j++) {
- elem = (Mod(i,world_y) * world_x) + Mod(j,world_x);
- Rate(elem,amount);
- }
- }
-}
-
-void cSpatialResCount::Sink(double decay) const {
-
- int i, j, elem;
- double deltaamount;
-
-
- for (i = outflowY1; i <= outflowY2; i++) {
- for (j = outflowX1; j <= outflowX2; j++) {
- elem = (Mod(i,world_y) * world_x) + Mod(j,world_x);
- deltaamount = Max((GetAmount(elem) * (1.0 - decay)), 0.0);
- Rate(elem,-deltaamount);
- }
- }
-}
Deleted: trunk/source/main/spatial_res_count.hh
===================================================================
--- trunk/source/main/spatial_res_count.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/spatial_res_count.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,67 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPATIAL_RES_COUNT_HH
-#define SPATIAL_RES_COUNT_HH
-
-#ifndef SPATIAL_COUNT_ELEM_HH
-#include "spatial_count_elem.hh"
-#endif
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-
-class cSpatialResCount {
- tArray<cSpatialCountElem> grid;
- double xdiffuse, xgravity, ydiffuse, ygravity;
- int inflowX1, inflowX2, inflowY1, inflowY2;
- int outflowX1, outflowX2, outflowY1, outflowY2;
- int geometry;
- int world_x, world_y, num_cells;
-public:
- cSpatialResCount();
- cSpatialResCount(int inworld_x, int inworld_y, int ingeometry);
- cSpatialResCount(int inworld_x, int inworld_y, int ingeometry,
- double inxdiffuse,
- double inydiffuse, double inxgravity, double inygravity);
- void ResizeClear(int inworld_x, int inworld_y, int ingeometry);
- void SetPointers();
- void CheckRanges();
- int GetSize () {return grid.GetSize();}
- int GetX () {return world_x;}
- int GetY () {return world_y;}
- cSpatialCountElem Element(int x) {return grid[x];}
- void Rate (int x, double ratein) const {grid[x].Rate(ratein);}
- void Rate (int x, int y, double ratein) const
- {grid[y * world_x + x].Rate(ratein);}
- void State (int x) {grid[x].State();}
- void State (int x, int y) {grid[y*world_x + x].State();}
- const double GetAmount (int x) const {return grid[x].GetAmount();}
- const double GetAmount (int x, int y) const
- {return grid[y*world_x + x].GetAmount();}
- void RateAll (double ratein);
- void StateAll ();
- void FlowAll ();
- const double SumAll() const;
- void Source(double amount) const;
- void Sink(double percent) const;
- void SetGeometry(int in_geometry) { geometry = in_geometry; }
- void SetXdiffuse(double in_xdiffuse) { xdiffuse = in_xdiffuse; }
- void SetXgravity(double in_xgravity) { xgravity = in_xgravity; }
- void SetYdiffuse(double in_ydiffuse) { ydiffuse = in_ydiffuse; }
- void SetYgravity(double in_ygravity) { ygravity = in_ygravity; }
- void SetInflowX1(int in_inflowX1) { inflowX1 = in_inflowX1; }
- void SetInflowX2(int in_inflowX2) { inflowX2 = in_inflowX2; }
- void SetInflowY1(int in_inflowY1) { inflowY1 = in_inflowY1; }
- void SetInflowY2(int in_inflowY2) { inflowY2 = in_inflowY2; }
- void SetOutflowX1(int in_outflowX1) { outflowX1 = in_outflowX1; }
- void SetOutflowX2(int in_outflowX2) { outflowX2 = in_outflowX2; }
- void SetOutflowY1(int in_outflowY1) { outflowY1 = in_outflowY1; }
- void SetOutflowY2(int in_outflowY2) { outflowY2 = in_outflowY2; }
-};
-
-#endif
Deleted: trunk/source/main/species.cc
===================================================================
--- trunk/source/main/species.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,189 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_HH
-#include "species.hh"
-#endif
-
-#ifndef CPU_TEST_INFO_HH
-#include "cCPUTestInfo.h"
-#endif
-#ifndef FUNCTIONS_HH
-#include "functions.hh"
-#endif
-#ifndef GENOTYPE_HH
-#include "cGenotype.h"
-#endif
-#ifndef GENOME_UTIL_HH
-#include "cGenomeUtil.h"
-#endif
-#ifndef TEST_CPU_HH
-#include "cTestCPU.h"
-#endif
-
-using namespace std;
-
-
-/////////////////
-// cSpecies
-/////////////////
-
-cSpecies::cSpecies(const cGenome & in_genome, int update )
- : genome(in_genome)
- , update_born(update)
-{
- static int species_count = 0;
- id_num = species_count++;
- parent_id = -1;
- symbol = '+';
-
- num_genotypes = 0;
- num_threshold = 0;
- total_organisms = 0;
- total_genotypes = 0;
-
- queue_type = SPECIES_QUEUE_NONE;
-
- next = NULL;
- prev = NULL;
-
- // Track distance of each genome as it is passed in...
-
- for (int i = 0; i < SPECIES_MAX_DISTANCE; i++) {
- genotype_distance[i] = 0;
- }
-}
-
-cSpecies::~cSpecies()
-{
- int i, total_count = 0;
- for (i = 0; i < SPECIES_MAX_DISTANCE; i++) {
- total_count += genotype_distance[i];
- }
-
-#ifdef TEST
- // Only print out the non-trivial species.
-
- if (total_count > 1) {
- FILE * fp = stats.GetTestFP();
-
- fprintf(fp, "Species %3d: ", id_num);
- for (i = 0; i < SPECIES_MAX_DISTANCE; i++) {
- fprintf(fp, "%2d ", genotype_distance[i]);
- }
- fprintf(fp, "\n");
- fflush(fp);
- }
-#endif
-}
-
-// This method compares a second genome to this species and determines
-// how different it is. A -1 indicates a critical failure (like one of
-// the genomes being considered is not viable), otherwise the count
-// Of failed crossovers is returned.
-// @CAO Todo: Check phenotypes, allow failure proportional to size.
-
-int cSpecies::Compare(const cGenome & test_genome, int max_fail_count)
-{
- cCPUTestInfo test_info;
-
- // First, make some phenotypic comparisons between organisms.
- // For now, just check that they both copy-true.
-
- cTestCPU::TestGenome(test_info, test_genome);
-
- // If the organisms aren't viable, return a -1...
- if (test_info.IsViable() == false) {
- return -1;
- }
-
- // Find the optimal offset between organisms, and related variables.
- // @CAO: For the moment, lets not worry about offsets...
- // The first line of B is at line 'offset' of A.
- //int offset = cGenomeUtil::FindBestOffset(genome, test_genome);
-
-
- // Figure out how much of the organisms overlap, and how much doesn't.
- int overlap = Min(genome.GetSize(), test_genome.GetSize());
- int fail_count = Max(genome.GetSize(), test_genome.GetSize()) - overlap;
-
-
- // Do the crossovers at all posible points.
- // Start with the first direction crossover...
-
- bool cross1_viable = true;
- bool cross2_viable = true;
- cGenome cross_genome1(genome);
- cGenome cross_genome2(test_genome);
-
- for (int i = 0; i < overlap; i++) {
- // If this position has changed, check if crossovers here are viable.
- if (test_genome[i] != genome[i]) {
- // Continue crossing over on each side...
- cross_genome1[i] = test_genome[i];
- cross_genome2[i] = genome[i];
-
- // Run each side, and determine viability...
- cTestCPU::TestGenome(test_info, cross_genome1);
- cross1_viable = test_info.IsViable();
-
- cTestCPU::TestGenome(test_info, cross_genome2);
- cross2_viable = test_info.IsViable();
- }
-
- if (cross1_viable == false) fail_count++;
- if (cross2_viable == false) fail_count++;
-
- if (max_fail_count != -1 && fail_count > max_fail_count) break;
- }
-
-
- return fail_count;
-}
-
-bool cSpecies::OK()
-{
- assert(id_num >= 0); // Species has negative ID value!
- assert(genome.OK()); // Species genome not registering as OK!
-
- // Assert valid statistics in species.
- assert(total_organisms >= 0 && total_genotypes >= 0 &&
- num_threshold >= 0 && num_genotypes >= 0);
-
- // Finally, make sure the species is registered as being in a queue.
-
- assert(queue_type >= 0 && queue_type <= 3); // Species not in a proper queue
-
- return true;
-}
-
-void cSpecies::AddThreshold(cGenotype & in_genotype)
-{
- const int distance =
- cGenomeUtil::FindEditDistance(genome, in_genotype.GetGenome());
-
- if (distance >= 0 && distance < SPECIES_MAX_DISTANCE)
- genotype_distance[distance]++;
-
- num_threshold++;
-}
-
-void cSpecies::RemoveThreshold(cGenotype & in_genotype)
-{
- total_genotypes++;
- total_organisms += in_genotype.GetTotalOrganisms();
- num_threshold--;
-}
-
-void cSpecies::AddGenotype()
-{
- num_genotypes++;
-}
-
-void cSpecies::RemoveGenotype() {
- num_genotypes--;
-}
Deleted: trunk/source/main/species.hh
===================================================================
--- trunk/source/main/species.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,87 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_HH
-#define SPECIES_HH
-
-#include <fstream>
-
-#ifndef GENOME_HH
-#include "cGenome.h"
-#endif
-
-#define SPECIES_QUEUE_NONE 0
-#define SPECIES_QUEUE_ACTIVE 1
-#define SPECIES_QUEUE_INACTIVE 2
-#define SPECIES_QUEUE_GARBAGE 3
-
-#define SPECIES_MAX_DISTANCE 20
-
-class cGenotype;
-
-class cSpecies {
-private:
- int id_num;
- int parent_id;
- cGenome genome;
- int update_born;
-
- int total_organisms;
- int total_genotypes;
- int num_threshold;
- int num_genotypes;
- int num_organisms;
- int queue_type;
- char symbol;
- int genotype_distance[SPECIES_MAX_DISTANCE];
-
- cSpecies * next;
- cSpecies * prev;
-public:
- cSpecies(const cGenome & in_genome, int update);
- ~cSpecies();
-
- int Compare(const cGenome & test_genome, int max_fail_count=-1);
- bool OK();
-
- void AddThreshold(cGenotype & in_genotype);
- void RemoveThreshold(cGenotype & in_genotype);
- void AddGenotype();
- void RemoveGenotype();
-
- void AddOrganisms(int in_num) { num_organisms += in_num; }
- void ResetStats() { num_organisms = 0; }
-
- cSpecies * GetNext() { return next; }
- cSpecies * GetPrev() { return prev; }
-
- int GetID() { return id_num; }
- int GetParentID() { return parent_id; }
- const cGenome & GetGenome() { return genome; }
- int GetUpdateBorn() { return update_born; }
- int GetNumGenotypes() { return num_genotypes; }
- int GetNumThreshold() { return num_threshold; }
- int GetNumOrganisms() { return num_organisms; }
- int GetTotalOrganisms() { return total_organisms; }
- int GetTotalGenotypes() { return total_genotypes; }
- int GetQueueType() { return queue_type; }
- char GetSymbol() { return symbol; }
-
- void SetQueueType(int in_qt) { queue_type = in_qt; }
- void SetNext(cSpecies * in_next) { next = in_next; }
- void SetPrev(cSpecies * in_prev) { prev = in_prev; }
- void SetSymbol(char in_symbol) { symbol = in_symbol; }
- void SetParentID(int in_id) { parent_id = in_id; }
-
-#ifdef DEBUG
- // These are used in cGenebank::OK()
- int debug_num_genotypes;
- int debug_num_threshold;
-#endif
-};
-
-#endif
Deleted: trunk/source/main/species_control.cc
===================================================================
--- trunk/source/main/species_control.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species_control.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,170 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_CONTROL_HH
-#include "species_control.hh"
-#endif
-
-#ifndef CONFIG_HH
-#include "cConfig.h"
-#endif
-#ifndef DEFS_HH
-#include "defs.hh"
-#endif
-#ifndef GENOTYPE_HH
-#include "cGenotype.h"
-#endif
-#ifndef nSpecies_h
-#include "nSpecies.h"
-#endif
-#ifndef SPECIES_HH
-#include "species.hh"
-#endif
-#ifndef STATS_HH
-#include "stats.hh"
-#endif
-
-#include <assert.h>
-
-/////////////////////
-// cSpeciesControl
-/////////////////////
-
-cSpeciesControl::cSpeciesControl(cGenebank & in_gb) : genebank(in_gb)
-{
-}
-
-cSpeciesControl::~cSpeciesControl()
-{
-}
-
-void cSpeciesControl::Remove(cSpecies & in_species)
-{
- switch (in_species.GetQueueType()) {
- case SPECIES_QUEUE_ACTIVE:
- active_queue.Remove(in_species);
- break;
- case SPECIES_QUEUE_INACTIVE:
- inactive_queue.Remove(in_species);
- break;
- case SPECIES_QUEUE_GARBAGE:
- garbage_queue.Remove(in_species);
- break;
- default:
- break;
- }
-
- in_species.SetQueueType(SPECIES_QUEUE_NONE);
-}
-
-void cSpeciesControl::Adjust(cSpecies & in_species)
-{
- // Only adjust if this species is in the active queue.
-
- if (in_species.GetQueueType() == SPECIES_QUEUE_ACTIVE) {
- active_queue.Adjust(in_species);
- }
-}
-
-void cSpeciesControl::SetActive(cSpecies & in_species)
-{
- Remove(in_species);
- active_queue.InsertRear(in_species);
- in_species.SetQueueType(SPECIES_QUEUE_ACTIVE);
-}
-
-void cSpeciesControl::SetInactive(cSpecies & in_species)
-{
- Remove(in_species);
- inactive_queue.InsertRear(in_species);
- in_species.SetQueueType(SPECIES_QUEUE_INACTIVE);
-}
-
-void cSpeciesControl::SetGarbage(cSpecies & in_species)
-{
- Remove(in_species);
- garbage_queue.InsertRear(in_species);
- in_species.SetQueueType(SPECIES_QUEUE_GARBAGE);
-}
-
-bool cSpeciesControl::OK()
-{
- int ret_value = true;
-
- // Check the queues.
-
- assert (active_queue.OK(SPECIES_QUEUE_ACTIVE));
- assert (inactive_queue.OK(SPECIES_QUEUE_INACTIVE));
- assert (garbage_queue.OK(SPECIES_QUEUE_GARBAGE));
-
- return ret_value;
-}
-
-int cSpeciesControl::FindPos(cSpecies & in_species, int max_depth)
-{
- cSpecies * temp_species = active_queue.GetFirst();
- if (max_depth < 0 || max_depth > active_queue.GetSize()) {
- max_depth = active_queue.GetSize();
- }
-
- for (int i = 0; i < max_depth; i++) {
- if (temp_species == &in_species) return i;
- temp_species = temp_species->GetNext();
- }
-
- return -1;
-}
-
-cSpecies * cSpeciesControl::Find(cGenotype & in_genotype, int record_level)
-{
- cSpecies * found_species = NULL;
- int cur_count, best_count = MAX_CREATURE_SIZE;
- cSpecies * cur_species;
-
- if (record_level == nSpecies::RECORD_FULL) {
- cur_species = active_queue.GetFirst();
- int size = active_queue.GetSize();
- for (int i = 0; i < size; i++) {
- cur_count = cur_species->Compare(in_genotype.GetGenome(),
- cConfig::GetSpeciesThreshold());
- if (cur_count != -1 && cur_count <= cConfig::GetSpeciesThreshold() &&
- cur_count < best_count) {
- found_species = cur_species;
- best_count = cur_count;
- }
- cur_species = cur_species->GetNext();
- }
- }
-
- if (record_level == nSpecies::RECORD_LIMITED) {
- cur_species = in_genotype.GetSpecies();
-
- if (cur_species) {
- int num_diff = cur_species->Compare(in_genotype.GetGenome(),
- cConfig::GetSpeciesThreshold());
- if (num_diff != -1 && num_diff <= cConfig::GetSpeciesThreshold()) {
- found_species = cur_species;
- }
- }
- }
-
- return found_species;
-}
-
-void cSpeciesControl::Purge(cStats & stats)
-{
- cSpecies * cur_species = garbage_queue.GetFirst();
- for (int i = 0; i < garbage_queue.GetSize(); i++) {
- stats.RemoveSpecies(cur_species->GetID(),
- cur_species->GetParentID(),
- cur_species->GetTotalGenotypes(),
- cur_species->GetTotalOrganisms(),
- stats.GetUpdate() - cur_species->GetUpdateBorn());
- cur_species = cur_species->GetNext();
- }
- garbage_queue.Purge();
-}
Deleted: trunk/source/main/species_control.hh
===================================================================
--- trunk/source/main/species_control.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species_control.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,50 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_CONTROL_HH
-#define SPECIES_CONTROL_HH
-
-#ifndef SPECIES_QUEUE_HH
-#include "species_queue.hh"
-#endif
-
-class cGenebank;
-class cGenotype;
-class cSpecies;
-class cStats;
-class cSpeciesControl {
-private:
- cSpeciesQueue active_queue;
- cSpeciesQueue inactive_queue;
- cSpeciesQueue garbage_queue;
- cGenebank & genebank;
-public:
- cSpeciesControl(cGenebank & in_gb);
- ~cSpeciesControl();
-
- void Remove(cSpecies & in_species);
- void Adjust(cSpecies & in_species);
- void SetInactive(cSpecies & in_species);
- void SetActive(cSpecies & in_species);
- void SetGarbage(cSpecies & in_species);
- void Purge(cStats & stats);
-
- bool OK();
-
- int FindPos(cSpecies & in_species, int max_depth = -1);
- cSpecies * Find(cGenotype & in_genotype, int record_level);
-
- inline cSpecies * GetFirst() const { return active_queue.GetFirst(); }
- inline cSpecies * GetFirstInactive() const
- { return inactive_queue.GetFirst(); }
- inline cSpecies * GetFirstGarbage() const
- { return garbage_queue.GetFirst(); }
- inline int GetSize() const { return active_queue.GetSize(); }
- inline int GetInactiveSize() const { return inactive_queue.GetSize(); }
-};
-
-#endif
Deleted: trunk/source/main/species_queue.cc
===================================================================
--- trunk/source/main/species_queue.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species_queue.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,173 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_QUEUE_HH
-#include "species_queue.hh"
-#endif
-
-#ifndef DEFS_HH
-#include "defs.hh"
-#endif
-#ifndef SPECIES_HH
-#include "species.hh"
-#endif
-
-///////////////////
-// cSpeciesQueue
-///////////////////
-
-cSpeciesQueue::cSpeciesQueue()
-{
- size = 0;
- first = NULL;
-}
-
-cSpeciesQueue::~cSpeciesQueue()
-{
-}
-
-void cSpeciesQueue::InsertRear(cSpecies & new_species)
-{
- // If the queue doesn't exist, create it with this species as the only
- // element.
-
- if (!first) {
- first = &new_species;
- first->SetNext(first);
- first->SetPrev(first);
- }
-
- // Otherwise, put this species at the end of the queue.
-
- else {
- new_species.SetNext(first);
- new_species.SetPrev(first->GetPrev());
- first->GetPrev()->SetNext(&new_species);
- first->SetPrev(&new_species);
- }
-
- size++;
-}
-
-void cSpeciesQueue::Remove(cSpecies & in_species)
-{
- size--;
-
- // If the queue is now empty, delete it properly.
- if (size == 0) {
- first = NULL;
- return;
- }
-
- // If we are removing the first element of the queue, slide the queue to
- // the new first before removing it.
-
- if (first == &in_species) {
- first = in_species.GetNext();
- }
-
- // Remove the in_species
-
- in_species.GetPrev()->SetNext(in_species.GetNext());
- in_species.GetNext()->SetPrev(in_species.GetPrev());
- in_species.SetNext(NULL);
- in_species.SetPrev(NULL);
-}
-
-void cSpeciesQueue::Adjust(cSpecies & in_species)
-{
- // First move it up the list if need be...
-
- cSpecies * prev_species = in_species.GetPrev();
- while (&in_species != first &&
- in_species.GetNumThreshold() > prev_species->GetNumThreshold()) {
- // Swap the position of this species with the previous one.
- if (prev_species == first) first = &in_species;
-
- // Outer connections...
- prev_species->SetNext(in_species.GetNext());
- in_species.GetNext()->SetPrev(prev_species);
- in_species.SetPrev(prev_species->GetPrev());
- prev_species->GetPrev()->SetNext(&in_species);
-
- // Inner connections...
- prev_species->SetPrev(&in_species);
- in_species.SetNext(prev_species);
-
- prev_species = in_species.GetPrev();
- }
-
- // Then see if it needs to be moved down.
- cSpecies * next_species = in_species.GetNext();
- while (next_species != first &&
- in_species.GetNumThreshold() < next_species->GetNumThreshold()) {
- // Swap the position of this species with the next one.
- if (&in_species == first) first = next_species;
-
- // Outer Connections...
- in_species.SetNext(next_species->GetNext());
- next_species->GetNext()->SetPrev(&in_species);
- next_species->SetPrev(in_species.GetPrev());
- in_species.GetPrev()->SetNext(next_species);
-
- // Inner Connections...
- in_species.SetPrev(next_species);
- next_species->SetNext(&in_species);
-
- next_species = in_species.GetNext();
- }
-}
-
-void cSpeciesQueue::Purge()
-{
- cSpecies * cur_species = first;
- cSpecies * next_species = NULL;
-
- // Loop through the species deleting them until there is only one left.
- for (int i = 1; i < size; i++) {
- next_species = cur_species->GetNext();
- delete cur_species;
- cur_species = next_species;
- }
-
- // And delete that last one.
- delete cur_species;
- first = NULL;
- size = 0;
-}
-
-bool cSpeciesQueue::OK(int queue_type)
-{
- cSpecies * cur_species = NULL;
- int count = 0;
- bool ret_value = true;
-
- while (first && cur_species != first) {
- // If we are just starting, set cur_species to the first element.
- if (!cur_species) cur_species = first;
-
- // Check that the list is correct in both directions...
-
- assert (cur_species->GetNext()->GetPrev() == cur_species);
-
- // Check to make sure the current species is OK() and that it should
- // indeed be in this list.
-
- if (!cur_species->OK()) ret_value = false;
-
- assert (queue_type == cur_species->GetQueueType());
- count++;
-
- assert (count <= size);
-
- cur_species = cur_species->GetNext();
- }
-
- assert (count == size);
-
- return ret_value;
-}
Deleted: trunk/source/main/species_queue.hh
===================================================================
--- trunk/source/main/species_queue.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/species_queue.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,30 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SPECIES_QUEUE_HH
-#define SPECIES_QUEUE_HH
-
-class cSpecies;
-class cSpeciesQueue {
-private:
- int size;
- cSpecies * first;
-public:
- cSpeciesQueue();
- ~cSpeciesQueue();
-
- void InsertRear(cSpecies & new_species);
- void Remove(cSpecies & in_species);
- void Adjust(cSpecies & in_species);
- void Purge();
- bool OK(int queue_type);
-
- inline int GetSize() const { return size; }
- inline cSpecies * GetFirst() const { return first; }
-};
-
-#endif
Deleted: trunk/source/main/stats.cc
===================================================================
--- trunk/source/main/stats.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/stats.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,888 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "stats.hh"
-
-#include "cConfig.h"
-#include "data_file.hh"
-#include "functions.hh"
-#include "string_util.hh"
-#include "tDataEntry.hh"
-
-#include <math.h>
-
-using namespace std;
-
-////////////
-// cStats
-////////////
-
-cStats::cStats()
- : current_update(-1)
- , sub_update(0)
- , avida_time(0)
- , data_manager(this, "population_data")
- , rave_true_replication_rate( 500 )
- , entropy(0)
- , species_entropy(0)
- , energy(0)
- , dom_fidelity(0)
- , ave_fidelity(0)
- , max_viable_fitness(0)
- , dom_genotype(NULL)
- , dom_merit(0)
- , dom_gestation(0)
- , dom_repro_rate(0)
- , dom_fitness(0)
- , dom_size(0)
- , dom_copied_size(0)
- , dom_exe_size(0)
- , max_fitness(0)
- , max_merit(0)
- , max_gestation_time(0)
- , max_genome_length(0)
- , min_fitness(HUGE_VAL)
- , min_merit(HUGE_VAL)
- , min_gestation_time(INT_MAX)
- , min_genome_length(INT_MAX)
- , dom_genotype_id(-1)
- , dom_name("(none)")
- , dom_births(0)
- , dom_breed_true(0)
- , dom_breed_in(0)
- , dom_breed_out(0)
- , dom_abundance(0)
- , dom_gene_depth(-1)
- , dom_sequence("")
- , coal_depth(0)
- , num_births(0)
- , num_deaths(0)
- , num_breed_in(0)
- , num_breed_true(0)
- , num_breed_true_creatures(0)
- , num_creatures(0)
- , num_genotypes(0)
- , num_threshold(0)
- , num_species(0)
- , num_thresh_species(0)
- , num_lineages(0)
- , num_executed(0)
- , num_parasites(0)
- , num_no_birth_creatures(0)
- , num_genotypes_last(1)
- , tot_organisms(0)
- , tot_genotypes(0)
- , tot_threshold(0)
- , tot_species(0)
- , tot_thresh_species(0)
- , tot_lineages(0)
- , tot_executed(0)
-{
- // Open log files.
-
- if (cConfig::GetLogCreatures()) fp_creature_log.open("creature.log");
- else fp_creature_log.close();
-
- if (cConfig::GetLogGenotypes()) fp_genotype_log.open("genotype.log");
- else fp_genotype_log.close();
-
- if (cConfig::GetLogThreshold()) fp_threshold_log.open("threshold.log");
- else fp_threshold_log.close();
-
- if (cConfig::GetLogSpecies()) fp_species_log.open("species.log");
- else fp_species_log.close();
-
- if (cConfig::GetLogLineages()) fp_lineage_log.open("lineage.log");
- else fp_lineage_log.close();
-
- task_cur_count.Resize( cConfig::GetNumTasks() );
- task_last_count.Resize( cConfig::GetNumTasks() );
- task_exe_count.Resize( cConfig::GetNumTasks() );
- task_cur_count.SetAll(0);
- task_last_count.SetAll(0);
- task_exe_count.SetAll(0);
-
-#ifdef INSTRUCTION_COUNT
- sum_exe_inst_array.Resize( cConfig::GetNumInstructions() );
- ZeroInst();
-#endif
- inst_names.Resize( cConfig::GetNumInstructions() );
-
-
-
- reaction_count.Resize( cConfig::GetNumReactions() );
- reaction_count.SetAll(0);
-
- resource_count.Resize( cConfig::GetNumResources() );
- resource_count.SetAll(0);
-
- task_names.Resize( cConfig::GetNumTasks() );
- reaction_names.Resize( cConfig::GetNumReactions() );
- resource_names.Resize( cConfig::GetNumResources() );
-
- genotype_map.Resize( cConfig::GetWorldX() * cConfig::GetWorldY() );
- SetupPrintDatabase();
-}
-
-void cStats::SetupPrintDatabase()
-{
- // Load in all the keywords, descriptions, and associated functions for
- // data management.
-
- // Time Stats
- data_manager.Add("update", "Update", &cStats::GetUpdate);
- data_manager.Add("sub_update", "Sub-Update", &cStats::GetSubUpdate);
- data_manager.Add("generation", "Generation", &cStats::GetGeneration);
-
- // Population Level Stats
- data_manager.Add("entropy", "Genotype Entropy (Diversity)", &cStats::GetEntropy);
- data_manager.Add("species_entropy", "Species Entropy (Diversity)", &cStats::GetEntropy);
- data_manager.Add("energy", "Average Inferiority (Energy)", &cStats::GetEnergy);
- data_manager.Add("richness", "Number of Different Genotypes (Richness)", &cStats::GetNumGenotypes);
- data_manager.Add("eveness", "Equitability of Genotype Distribution (Evenness)", &cStats::GetEvenness);
- data_manager.Add("coal_depth", "Depth of Coalescent Genotype", &cStats::GetCoalescentDepth);
-
- // Dominant Genotype Stats
- data_manager.Add("dom_merit", "Ave Merit of Dominant Genotype", &cStats::GetDomMerit);
- data_manager.Add("dom_gest", "Ave Gestation Time of Dominant Genotype", &cStats::GetDomGestation);
- data_manager.Add("dom_fitness", "Ave Fitness of Dominant Genotype", &cStats::GetDomFitness);
- data_manager.Add("dom_repro", "Ave Repro-Rate of Dominant Genotype", &cStats::GetDomReproRate);
- data_manager.Add("dom_length", "Genome Length of Dominant Genotype", &cStats::GetDomSize);
- data_manager.Add("dom_copy_length","Copied Length of Dominant Genotype", &cStats::GetDomCopySize);
- data_manager.Add("dom_exe_length", "Executed Length of Dominant Genotype", &cStats::GetDomExeSize);
- data_manager.Add("dom_id", "ID of Dominant Genotype", &cStats::GetDomID);
- data_manager.Add("dom_name", "Name of Dominant Genotype", &cStats::GetDomName);
- data_manager.Add("dom_births", "Birth Count of Dominant Genotype", &cStats::GetDomBirths);
- data_manager.Add("dom_breed_true", "Breed-True Count of Dominant Genotype", &cStats::GetDomBreedTrue);
- data_manager.Add("dom_breed_in", "Breed-In Count of Dominant Genotype", &cStats::GetDomBreedIn);
- data_manager.Add("dom_breed_out", "Breed-Out Count of Dominant Genotype", &cStats::GetDomBreedOut);
- data_manager.Add("dom_num_cpus", "Abundance of Dominant Genotype", &cStats::GetDomAbundance);
- data_manager.Add("dom_depth", "Tree Depth of Dominant Genotype", &cStats::GetDomGeneDepth);
- data_manager.Add("dom_sequence", "Sequence of Dominant Genotype", &cStats::GetDomSequence);
-
- // Dominant Inject Genotype Stats
- data_manager.Add("dom_inj_size", "Genome Length of Dominant Parasite", &cStats::GetDomInjSize);
- data_manager.Add("dom_inj_ID", "ID of Dominant Parasite", &cStats::GetDomInjID);
- data_manager.Add("dom_inj_name", "Nameof Dominant Parasite", &cStats::GetDomInjName);
- data_manager.Add("dom_inj_births", "Birth Count of Dominant Parasite", &cStats::GetDomInjBirths);
- data_manager.Add("dom_inj_abundance", "Abundance of Dominant Parasite", &cStats::GetDomInjAbundance);
- data_manager.Add("dom_inj_sequence", "Sequence of Dominant Parasite", &cStats::GetDomInjSequence);
-
- // Current Counts...
- data_manager.Add("num_births", "Count of Births in Population", &cStats::GetNumBirths);
- data_manager.Add("num_deaths", "Count of Deaths in Population", &cStats::GetNumDeaths);
- data_manager.Add("breed_in", "Count of Non-Breed-True Births", &cStats::GetBreedIn);
- data_manager.Add("breed_true", "Count of Breed-True Births", &cStats::GetBreedTrue);
- data_manager.Add("bred_true", "Count of Organisms that have Bred True", &cStats::GetBreedTrueCreatures);
- data_manager.Add("num_cpus", "Count of Organisms in Population", &cStats::GetNumCreatures);
- data_manager.Add("num_genotypes", "Count of Genotypes in Population", &cStats::GetNumGenotypes);
- data_manager.Add("num_threshold", "Count of Threshold Genotypes", &cStats::GetNumThreshold);
- data_manager.Add("num_species", "Count of Species in Population", &cStats::GetNumSpecies);
- data_manager.Add("thresh_species", "Count of Threshold Species", &cStats::GetNumThreshSpecies);
- data_manager.Add("num_lineages", "Count of Lineages in Population", &cStats::GetNumLineages);
- data_manager.Add("num_parasites", "Count of Parasites in Population", &cStats::GetNumParasites);
- data_manager.Add("num_no_birth", "Count of Childless Organisms", &cStats::GetNumNoBirthCreatures);
-
- // Total Counts...
- data_manager.Add("tot_cpus", "Total Organisms ever in Population", &cStats::GetTotCreatures);
- data_manager.Add("tot_genotypes", "Total Genotypes ever in Population", &cStats::GetTotGenotypes);
- data_manager.Add("tot_threshold", "Total Threshold Genotypes Ever", &cStats::GetTotThreshold);
- data_manager.Add("tot_species", "Total Species ever in Population", &cStats::GetTotSpecies);
- data_manager.Add("tot_lineages", "Total Lineages ever in Population", &cStats::GetTotLineages);
-
- // Some Average Data...
- data_manager.Add("ave_repro_rate", "Average Repro-Rate (1/Gestation)", &cStats::GetAveReproRate);
- data_manager.Add("ave_merit", "Average Merit", &cStats::GetAveMerit);
- data_manager.Add("ave_age", "Average Age", &cStats::GetAveCreatureAge);
- data_manager.Add("ave_memory", "Average Memory Used", &cStats::GetAveMemSize);
- data_manager.Add("ave_neutral", "Average Neutral Metric", &cStats::GetAveNeutralMetric);
- data_manager.Add("ave_lineage", "Average Lineage Label", &cStats::GetAveLineageLabel);
- data_manager.Add("ave_gest", "Average Gestation Time", &cStats::GetAveGestation);
- data_manager.Add("ave_fitness", "Average Fitness", &cStats::GetAveFitness);
- data_manager.Add("ave_gen_age", "Average Genotype Age", &cStats::GetAveGenotypeAge);
- data_manager.Add("ave_length", "Average Genome Length", &cStats::GetAveSize);
- data_manager.Add("ave_copy_length","Average Copied Length", &cStats::GetAveCopySize);
- data_manager.Add("ave_exe_length", "Average Executed Length", &cStats::GetAveExeSize);
- data_manager.Add("ave_thresh_age", "Average Threshold Genotype Age", &cStats::GetAveThresholdAge);
- data_manager.Add("ave_species_age","Average Species Age", &cStats::GetAveSpeciesAge);
-
- // And a couple of Maximums
- data_manager.Add("max_fitness", "Maximum Fitness in Population", &cStats::GetMaxFitness);
- data_manager.Add("max_merit", "Maximum Merit in Population", &cStats::GetMaxMerit);
-}
-
-cStats::~cStats()
-{
- cout << "Closing stats object..."<<endl;
-
- // Close all the statistics files.
-
- data_file_manager.FlushAll();
-
- fp_creature_log.close();
- fp_genotype_log.close();
- fp_threshold_log.close();
- fp_species_log.close();
- fp_lineage_log.close();
-}
-
-void cStats::ZeroTasks()
-{
- for( int i=0; i < task_cur_count.GetSize(); i++ ){
- task_cur_count[i] = 0;
- task_last_count[i] = 0;
- }
-}
-
-
-#ifdef INSTRUCTION_COUNT
-void cStats::ZeroInst()
-{
- for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
- sum_exe_inst_array[i].Clear();
- }
-}
-#endif
-
-void cStats::CalcEnergy()
-{
- assert(sum_fitness.Average() >= 0.0);
- assert(dom_fitness >= 0);
-
- if (sum_fitness.Average() == 0.0 || dom_fitness == 0.0) {
- energy = 0.0;
- } else {
- energy = Log(dom_fitness / sum_fitness.Average());
- }
-}
-
-void cStats::CalcFidelity()
-{
- // There is a (small) probability that when a random instruction is picked
- // after a mutation occurs, that it will be the original instruction again;
- // This needs to be adjusted for!
-
- double adj = ((double) (cConfig::GetNumInstructions() - 1)) /
- (double) cConfig::GetNumInstructions();
-
- double base_fidelity = (1.0 - adj * cConfig::GetDivideMutProb()) *
- (1.0 - cConfig::GetDivideInsProb()) * (1.0 - cConfig::GetDivideDelProb());
-
- double true_cm_rate = adj * cConfig::GetCopyMutProb();
- ave_fidelity = base_fidelity * pow(1.0 - true_cm_rate, sum_size.Average());
- dom_fidelity = base_fidelity * pow(1.0 - true_cm_rate, dom_size);
-}
-
-void cStats::RecordBirth(int cell_id, int genotype_id, bool breed_true)
-{
- tot_organisms++;
- num_births++;
- if (fp_creature_log.good() == true) {
- fp_creature_log << GetUpdate() << " "
- << cell_id << " "
- << genotype_id << endl;
- }
-
- if (breed_true == true) num_breed_true++;
- else num_breed_in++;
-}
-
-
-void cStats::RecordDeath(int cell_id, int genotype_id, int age)
-{
- num_deaths++;
-}
-
-void cStats::AddGenotype(int id_num)
-{
- id_num = -1; // @CAO do we still need id_num here?
- tot_genotypes++;
-}
-
-void cStats::RemoveGenotype(int id_num, int parent_id,
- int parent_dist, int depth, int max_abundance, int parasite_abundance,
- int age, int length)
-{
- if (fp_genotype_log.good() &&
- (!cConfig::GetLogThresholdOnly() || max_abundance > 2)) {
- const int update_born = cStats::GetUpdate() - age + 1;
- fp_genotype_log << id_num << " " // 1
- << update_born << " " // 2
- << parent_id << " " // 3
- << parent_dist << " " // 4
- << depth << " " // 5
- << max_abundance << " " // 6
- << age << " " // 7
- << length << endl; // 8
- }
-
- (void) parasite_abundance; // Not used now, but maybe in future.
-}
-
-void cStats::AddThreshold(int id_num, const char * name, int species_num)
-{
- num_threshold++;
- tot_threshold++;
- if( fp_threshold_log.good() )
- fp_threshold_log << cStats::GetUpdate() << " " // 1
- << id_num << " " // 2
- << species_num << " " // 3
- << name << endl; // 4
-}
-
-void cStats::RemoveThreshold(int id_num)
-{
- id_num = -1; // @CAO do we still need id_num here?
- num_threshold--;
-}
-
-void cStats::AddSpecies(int id_num)
-{
- id_num = -1; // @CAO do we still need id_num here?
- tot_species++;
- num_species++;
-}
-
-void cStats::RemoveSpecies(int id_num, int parent_id,
- int max_gen_abundance, int max_abundance, int age)
-{
- num_species--;
- if( fp_species_log.good() )
- fp_species_log << cStats::GetUpdate() << " " // 1
- << id_num << " " // 2
- << parent_id << " " // 3
- << max_gen_abundance << " " // 4
- << max_abundance << " " // 5
- << age << endl; // 6
-}
-
-void cStats::AddLineage()
-{
- tot_lineages++;
- num_lineages++;
-}
-
-void cStats::ProcessUpdate()
-{
- static int last_update = 0;
-
- // Increment the "avida_time"
- if (sum_merit.Count() > 0 && sum_merit.Average() > 0) {
- double delta = ((double)(current_update-last_update))/sum_merit.Average();
- avida_time += delta;
-
- // calculate the true replication rate in this update
- rave_true_replication_rate.Add( num_births/
- (delta * cConfig::GetAveTimeslice() * num_creatures) );
- }
- last_update = current_update;
-
- // Zero-out any variables which need to be cleared at end of update.
-
- num_births = 0;
- num_deaths = 0;
- num_breed_true = 0;
-
- tot_executed += num_executed;
- num_executed = 0;
-
- task_cur_count.SetAll(0);
- task_last_count.SetAll(0);
- task_exe_count.SetAll(0);
-
- dom_merit = 0;
- dom_gestation = 0.0;
- dom_fitness = 0.0;
- max_fitness = 0.0;
-}
-
-
-void cStats::FlushFP(){
- data_file_manager.FlushAll();
-
- fp_creature_log.flush();
- fp_genotype_log.flush();
- fp_threshold_log.flush();
- fp_species_log.flush();
- fp_lineage_log.flush();
-}
-
-
-void cStats::RemoveLineage(int id_num, int parent_id, int update_born,
- double generation_born,
- int total_CPUs, int total_genotypes, double fitness,
- double lineage_stat1, double lineage_stat2 )
-{
- static bool msg_printed = false;
-
- if ( !msg_printed ){
- if( fp_lineage_log.good() )
- fp_lineage_log << "# (1) lineage id "
- << "(2) parent lineage id "
- << "(3) initial fitness "
- << "(4) total number of creatures "
- << "(5) total number of genotypes "
- << "(6) update born "
- << "(7) update extinct "
- << "(8) generation born "
- << "(9) generation extinct"
- << "(10) lineage stat1"
- << "(11) lineage stat2 [10, 11 depend on lineage creation method chosen]"
- << endl;
- msg_printed = true;
- }
-
- num_lineages--;
- if( fp_lineage_log.good() ) {
- fp_lineage_log << id_num << " " // 1
- << parent_id << " " // 2
- << fitness << " " // 3
- << total_CPUs << " " // 4
- << total_genotypes << " " // 5
- << update_born << " " // 6
- << cStats::GetUpdate() << " " // 7
- << generation_born << " " // 8
- << SumGeneration().Average() << " " // 9
- << lineage_stat1 << " " // 10
- << lineage_stat2 << " " << endl;
- }
-}
-
-
-void cStats::PrintDataFile(const cString & filename, const cString & format,
- char sep)
-{
- cDataFile & data_file = GetDataFile(filename);
- data_manager.PrintRow(data_file, format, sep);
-}
-
-
-void cStats::PrintAverageData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida average data" );
- df.WriteTimeStamp();
-
- df.Write(GetUpdate(), "update" );
- df.Write(sum_merit.Average(), "average merit" );
- df.Write(sum_gestation.Average(), "average gestation time" );
- df.Write(sum_fitness.Average(), "average fitness" );
- df.Write(sum_repro_rate.Average(), "repro rate?" );
- df.Write(sum_size.Average(), "average size" );
- df.Write(sum_copy_size.Average(), "average copied size" );
- df.Write(sum_exe_size.Average(), "average executed size" );
- df.Write(sum_abundance.Average(), "average abundance?" );
- df.Write((double)num_births/num_creatures,
- "proportion of organisms that gave birth in this update" );
- df.Write((double)num_breed_true/num_creatures,
- "proportion of breed true organisms" );
- df.Write(sum_genotype_depth.Average(), "average genotype depth" );
- df.Write(sum_generation.Average(), "average generation" );
- df.Write(sum_neutral_metric.Average(), "average neutral metric" );
- df.Write(sum_lineage_label.Average(), "average lineage label" );
- df.Write(rave_true_replication_rate.Average(),
- "true replication rate (based on births/update, time-averaged)");
- df.Endl();
-}
-
-
-void cStats::PrintErrorData(const cString & filename)
-{
- ofstream & fp = GetDataFileOFStream(filename);
- assert(fp.good());
- fp<< GetUpdate() << " " // 1
- << sum_merit.StdError() << " " // 2
- << sum_gestation.StdError() << " " // 3
- << sum_fitness.StdError() << " " // 4
- << sum_repro_rate.StdError() << " " // 5
- << sum_size.StdError() << " " // 6
- << sum_copy_size.StdError() << " " // 7
- << sum_exe_size.StdError() << " " // 8
- << sum_abundance.StdError() << " " // 9
- << -1 << " " // 10
- << -1 << " " // 11
- << sum_genotype_depth.StdError() << " " // 12
- << sum_generation.StdError() << " " // 15
- << sum_neutral_metric.StdError() << " " // 16
- << sum_lineage_label.StdError() << endl;// 17
-}
-
-
-void cStats::PrintVarianceData(const cString & filename)
-{
- ofstream & fp = GetDataFileOFStream(filename);
- assert(fp.good());
- fp<<GetUpdate() << " " // 1
- << sum_merit.Variance() << " " // 2
- << sum_gestation.Variance() << " " // 3
- << sum_fitness.Variance() << " " // 4
- << sum_repro_rate.Variance() << " " // 5
- << sum_size.Variance() << " " // 6
- << sum_copy_size.Variance() << " " // 7
- << sum_exe_size.Variance() << " " // 8
- << sum_abundance.Variance() << " " // 9
- << -1 << " " // 10
- << -1 << " " // 11
- << sum_genotype_depth.Variance() << " " // 12
- << sum_generation.Variance() << " " // 15
- << sum_neutral_metric.Variance() << " " // 16
- << sum_lineage_label.Variance() << " " // 17
- << rave_true_replication_rate.Variance()<< endl;// 18
-}
-
-
-void cStats::PrintDominantData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida dominant data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "update" );
- df.Write( dom_merit, "average merit of dominant genotype" );
- df.Write( dom_gestation, "average gestation time of dominant" );
- df.Write( dom_fitness, "average fitness of dominant genotype" );
- df.Write( dom_repro_rate, "repro rate?" );
- df.Write( dom_size, "size of dominant genotype" );
- df.Write( dom_copied_size, "copied size of dominant genotype" );
- df.Write( dom_exe_size, "executed size of dominant genotype" );
- df.Write( dom_abundance, "abundance of dominant genotype" );
- df.Write( dom_births, "number of births" );
- df.Write( dom_breed_true, "number of dominant breed true?" );
- df.Write( dom_gene_depth, "dominant gene depth" );
- df.Write( dom_breed_in, "dominant breed in");
- df.Write( max_fitness, "max fitness?" );
- df.Write( dom_genotype_id, "genotype ID of dominant genotype" );
- df.Write( dom_name, "name of dominant genotype" );
- df.Endl();
-}
-
-void cStats::PrintDominantParaData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida dominant parasite data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "update" );
- df.Write( dom_inj_size, "size of dominant genotype" );
- df.Write( dom_inj_abundance, "abundance of dominant genotype" );
- df.Write( dom_inj_genotype_id, "genotype ID of dominant genotype" );
- df.Write( dom_inj_name, "name of dominant genotype" );
- df.Endl();
-}
-
-void cStats::PrintStatsData(const cString & filename)
-{
- const int genotype_change = num_genotypes - num_genotypes_last;
- const double log_ave_fid = (ave_fidelity > 0) ? -Log(ave_fidelity) : 0.0;
- const double log_dom_fid = (dom_fidelity > 0) ? -Log(dom_fidelity) : 0.0;
-
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Generic Statistics Data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "update" );
- df.Write( energy, "average inferiority (energy)");
- df.Write( 1.0 - ave_fidelity, "ave probability of any mutations in genome" );
- df.Write( 1.0 - dom_fidelity, "probability of any mutations in dom genome" );
- df.Write( log_ave_fid, "log(average fidelity)");
- df.Write( log_dom_fid, "log(dominant fidelity)");
- df.Write( genotype_change, "change in number of genotypes");
- df.Write( entropy, "genotypic entropy");
- df.Write( species_entropy, "species entropy");
- df.Write( coal_depth, "depth of most reacent coalescence");
- df.Endl();
-}
-
-
-void cStats::PrintCountData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida count data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "update");
- df.Write( num_executed, "number of insts executed this update");
- df.Write( num_creatures, "number of organisms");
- df.Write( num_genotypes, "number of different genotypes");
- df.Write( num_threshold, "number of different threshold genotypes");
- df.Write( num_species, "number of different species");
- df.Write( num_thresh_species, "number of different threshold species");
- df.Write( num_lineages, "number of different lineages");
- df.Write( num_births, "number of births in this update");
- df.Write( num_deaths, "number of deaths in this update");
- df.Write( num_breed_true, "number of breed true");
- df.Write( num_breed_true_creatures, "number of breed true organisms?");
- //df.Write( num_parasites, "number of parasites");
- df.Write( num_no_birth_creatures, "number of no-birth organisms");
- df.Write( num_single_thread_creatures, "number of single-threaded organisms");
- df.Write( num_multi_thread_creatures, "number of multi-threaded organisms");
- df.Write( num_modified, "number of modified organisms");
- df.Endl();
-}
-
-
-void cStats::PrintTotalsData(const cString & filename)
-{
- ofstream & fp = GetDataFileOFStream(filename);
- assert(fp.good());
- fp << GetUpdate() << " " // 1
- << (tot_executed+num_executed) << " " // 2
- << num_executed << " " // 3
- << tot_organisms << " " // 4
- << tot_genotypes << " " // 5
- << tot_threshold << " " // 6
- << tot_species << " " // 7
- << tot_lineages << endl; // 8
-}
-
-
-void cStats::PrintTasksData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida tasks data" );
- df.WriteTimeStamp();
- df.WriteComment( "First column gives the current update, all further columns give the number" );
- df.WriteComment( "of organisms that have the particular task as a component of the merit." );
-
-
- df.Write( GetUpdate(), "Update");
- for(int i = 0; i < task_last_count.GetSize(); i++) {
- df.Write( task_last_count[i], task_names[i] );
- }
- df.Endl();
-}
-
-
-void cStats::PrintTasksExeData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida tasks data" );
- df.WriteTimeStamp();
- df.WriteComment( "First column gives the current update, all further columns give the number" );
- df.WriteComment( "of times the particular task has been executed this update." );
-
- df.Write( GetUpdate(), "Update");
- for (int i = 0; i < task_exe_count.GetSize(); i++) {
- df.Write( task_exe_count[i], task_names[i] );
- task_exe_count[i] = 0;
- }
- df.Endl();
-}
-
-
-void cStats::PrintReactionData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida tasks data" );
- df.WriteTimeStamp();
- df.WriteComment( "First column gives the current update, all further columns give the number" );
- df.WriteComment( "of currently living organisms each reaction has affected." );
-
- df.Write( GetUpdate(), "Update");
- for (int i = 0; i < reaction_count.GetSize(); i++) {
- df.Write( reaction_count[i], reaction_names[i] );
- task_exe_count[i] = 0;
- }
- df.Endl();
-}
-
-void cStats::PrintResourceData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida resource data" );
- df.WriteTimeStamp();
- df.WriteComment( "First column gives the current update, all further columns give the quantity" );
- df.WriteComment( "of the particular resource at that update." );
-
- df.Write( GetUpdate(), "Update");
- for (int i = 0; i < resource_count.GetSize(); i++) {
- df.Write( resource_count[i], resource_names[i] );
- if (resource_geometry[i] != GEOMETRY_GLOBAL) {
- PrintSpatialResData(filename, i);
- }
- }
- df.Endl();
-}
-
-void cStats::PrintSpatialResData(const cString & filename, int i)
-{
-
- // Write spatial data to a file that can easily be read into Matlab
-
- cString tmpfilename = "resource_";
- tmpfilename += resource_names[i] + ".m";
- cDataFile & df = GetDataFile(tmpfilename);
- cString UpdateStr = resource_names[i] +
- cStringUtil::Stringf( "%07i", GetUpdate() ) + " = [ ...";
-
- df.WriteRaw(UpdateStr);
-
- int gridsize = spatial_res_count[i].GetSize();
- int xsize = cConfig::GetWorldX();
-
- // write grid to file
-
- for (int j = 0; j < gridsize; j++) {
- df.WriteBlockElement(spatial_res_count[i][j], j, xsize);
- }
- df.WriteRaw("];");
-}
-
-
-void cStats::PrintTimeData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida time data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "update" );
- df.Write( avida_time, "avida time" );
- df.Write( sum_generation.Average(), "average generation" );
- df.Write( num_executed, "num_executed?" );
- df.Endl();
-}
-
-
-void cStats::PrintMutationData(const cString & filename)
-{
- ofstream & fp = GetDataFileOFStream(filename);
- assert(fp.good());
- fp << GetUpdate() << " " // 1
- << isum_parent_dist.Ave() << " " // 2
- << isum_parent_size.Ave() << " " // 3
- << isum_child_size.Ave() << " " // 4
- << isum_copied_size.Ave() << " " // 5
- << isum_executed_size.Ave() << " " // 6
- << isum_copies_exec.Ave() << " " // 7
- << isum_point_mut.Ave() << " " // 8
- << isum_copy_mut.Ave() << " " // 9
- << isum_insert_mut.Ave() << " " // 10
- << isum_delete_mut.Ave() << " " // 11
- << isum_point_mut_line.Ave() << " " // 12
- << isum_copy_mut_line.Ave() << " " // 13
- << isum_divide_mut.Ave() << " " // 14
- << isum_divide_insert_mut.Ave() << " " // 15
- << isum_divide_delete_mut.Ave() << " " // 16
- << dsum_copy_mut_by_copies_exec.Ave() << " " // 17
- << dsum_copied_size_by_copies_exec.Ave() << " " // 18
- << dsum_copy_mut_lines_by_copied_size.Ave() << " " // 19
- << dsum_copy_mut_lines_by_copy_mut.Ave() << endl; // 20
-
- isum_parent_dist.Clear();
- isum_parent_size.Clear();
- isum_child_size.Clear();
- isum_point_mut.Clear();
- isum_copy_mut.Clear();
- isum_insert_mut.Clear();
- isum_point_mut_line.Clear();
- isum_copy_mut_line.Clear();
- isum_delete_mut.Clear();
- isum_divide_mut.Clear();
- isum_divide_insert_mut.Clear();
- isum_divide_delete_mut.Clear();
- isum_copied_size.Clear();
- isum_executed_size.Clear();
- isum_copies_exec.Clear();
- dsum_copy_mut_by_copies_exec.Clear();
- dsum_copied_size_by_copies_exec.Clear();
- dsum_copy_mut_lines_by_copied_size.Clear();
- dsum_copy_mut_lines_by_copy_mut.Clear();
-}
-
-void cStats::PrintMutationRateData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida copy mutation rate data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "Update" );
- df.Write( sum_copy_mut_rate.Ave(), "Average copy mutation rate" );
- df.Write( sum_copy_mut_rate.Var(), "Variance in copy mutation rate" );
- df.Write( sum_copy_mut_rate.StdDeviation(), "Standard Deviation in copy mutation rate" );
- df.Write( sum_copy_mut_rate.Skw(), "Skew in copy mutation rate" );
- df.Write( sum_copy_mut_rate.Kur(), "Kurtosis in copy mutation rate" );
-
- df.Write( sum_log_copy_mut_rate.Ave(), "Average log(copy mutation rate)" );
- df.Write( sum_log_copy_mut_rate.Var(), "Variance in log(copy mutation rate)" );
- df.Write( sum_log_copy_mut_rate.StdDeviation(), "Standard Deviation in log(copy mutation rate)" );
- df.Write( sum_log_copy_mut_rate.Skw(), "Skew in log(copy mutation rate)" );
- df.Write( sum_log_copy_mut_rate.Kur(), "Kurtosis in log(copy mutation rate)" );
- df.Endl();
-
-}
-
-
-void cStats::PrintDivideMutData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida divide mutation rate data" );
- df.WriteTimeStamp();
-
- df.Write( GetUpdate(), "Update" );
- df.Write( sum_div_mut_rate.Ave(), "Average divide mutation rate" );
- df.Write( sum_div_mut_rate.Var(), "Variance in divide mutation rate" );
- df.Write( sum_div_mut_rate.StdDeviation(), "Standard Deviation in divide mutation rate" );
- df.Write( sum_div_mut_rate.Skw(), "Skew in divide mutation rate" );
- df.Write( sum_div_mut_rate.Kur(), "Kurtosis in divide mutation rate" );
-
- df.Write( sum_log_div_mut_rate.Ave(), "Average log(divide mutation rate)" );
- df.Write( sum_log_div_mut_rate.Var(), "Variance in log(divide mutation rate)" );
- df.Write( sum_log_div_mut_rate.StdDeviation(), "Standard Deviation in log(divide mutation rate)" );
- df.Write( sum_log_div_mut_rate.Skw(), "Skew in log(divide mutation rate)" );
- df.Write( sum_log_div_mut_rate.Kur(), "Kurtosis in log(divide mutation rate)" );
- df.Endl();
-
-}
-
-void cStats::PrintInstructionData(const cString & filename)
-{
- cDataFile & df = GetDataFile(filename);
-
- df.WriteComment( "Avida instruction execution data" );
- df.WriteTimeStamp();
-
-#ifdef INSTRUCTION_COUNT
- df.Write( GetUpdate(), "Update" );
- for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
- df.Write( (int) sum_exe_inst_array[i].Sum(), inst_names[i] );
- }
-#else // INSTRUCTION_COUNT undefined
- cerr<<"Warning: Instruction Counts not compiled in"<<endl;
-#endif // ifdef INSTRUCTION_COUNT
-
- df.Endl();
-}
-
-void cStats::PrintGenotypeMap(const cString & filename)
-{
- cDataFile & df = cStats::GetDataFile(filename);
- cString UpdateStr =
- cStringUtil::Stringf( "GenoID%07i", GetUpdate() ) + " = [ ...";
- df.WriteRaw(UpdateStr);
-
- int gridsize = genotype_map.GetSize();
- int xsize = cConfig::GetWorldX();
-
- // write grid to file
-
- for (int i = 0; i < gridsize; i++) {
- df.WriteBlockElement(genotype_map[i],i,xsize);
- }
- df.WriteRaw("];");
-}
Deleted: trunk/source/main/stats.hh
===================================================================
--- trunk/source/main/stats.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/stats.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,631 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2002 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef STATS_HH
-#define STATS_HH
-
-#include <assert.h>
-#include <fstream>
-#include <iostream>
-
-#ifndef DEFS_HH
-#include "defs.hh"
-#endif
-#ifndef DATA_FILE_MANAGER_HH
-#include "data_file_manager.hh"
-#endif
-#ifndef DOUBLE_SUM_HH
-#include "double_sum.hh"
-#endif
-#ifndef FUNCTIONS_HH
-#include "functions.hh"
-#endif
-#ifndef INT_SUM_HH
-#include "int_sum.hh"
-#endif
-#ifndef RUNNING_AVERAGE_HH
-#include "running_average.hh"
-#endif
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-#ifndef TDATAMANAGER_HH
-#include "tDataManager.hh"
-#endif
-
-#define GEOMETRY_GLOBAL 0
-#define GEOMETRY_GRID 1
-#define GEOMETRY_TORUS 2
-
-template <class T> class tDataManager; // aggregate
-class cDataFileManager; // aggregate
-class cDoubleSum; // aggregate
-class cRunningAverage; // aggregate
-class cIntSum; // aggregate
-template <class T> class tArray; // aggregate
-class cGenotype;
-class cString; // aggregate
-class cInjectGenotype;
-class cDataFile;
-
-class cStats {
-private:
- cStats(const cStats &); // not implemented.
-private:
- // Time scales...
- int current_update;
- int sub_update;
- double avida_time;
-
- // The data manager handles printing user-formated output files.
- tDataManager<cStats> data_manager;
-
- // Log files are recorded every time a specified event occurs.
- cDataFileManager data_file_manager;
-
- std::ofstream fp_creature_log;
- std::ofstream fp_genotype_log;
- std::ofstream fp_threshold_log;
- std::ofstream fp_species_log;
- std::ofstream fp_lineage_log;
-
-
- //// By Creature Sums //// (Cleared and resummed by population each update)
- cDoubleSum sum_merit;
- cDoubleSum sum_mem_size;
- cDoubleSum sum_creature_age;
- cDoubleSum sum_generation;
-
- cDoubleSum sum_neutral_metric;
- cDoubleSum sum_lineage_label;
-
- cDoubleSum sum_copy_mut_rate;
- cDoubleSum sum_log_copy_mut_rate;
-
- cDoubleSum sum_div_mut_rate;
- cDoubleSum sum_log_div_mut_rate;
-
- //// By Genotype Sums //// (Cleared and resummed by population each update)
-
- cDoubleSum sum_gestation;
- cDoubleSum sum_fitness;
- cDoubleSum sum_repro_rate;
-
- // calculates a running average over the actual replication rate
- // given by the number of births per update
- cRunningAverage rave_true_replication_rate;
-
- cDoubleSum sum_size;
- cDoubleSum sum_copy_size;
- cDoubleSum sum_exe_size;
-
- cDoubleSum sum_genotype_age;
-
- // breed/geneological stats
- cDoubleSum sum_abundance;
- cDoubleSum sum_genotype_depth;
-
-
- //// By Threshold Sums //// (Cleared and resummed by population each update)
-
- cDoubleSum sum_threshold_age;
-
-
- //// By Species Sums //// (Cleared and resummed by population each update)
-
- cDoubleSum sum_species_age;
-
-
- //// Sums cleard on output only ////
- cIntSum isum_parent_dist;
- cIntSum isum_parent_size;
- cIntSum isum_child_size;
- cIntSum isum_point_mut;
- cIntSum isum_copy_mut;
- cIntSum isum_insert_mut;
- cIntSum isum_point_mut_line;
- cIntSum isum_copy_mut_line;
- cIntSum isum_delete_mut;
- cIntSum isum_divide_mut;
- cIntSum isum_divide_insert_mut;
- cIntSum isum_divide_delete_mut;
- cIntSum isum_copied_size;
- cIntSum isum_executed_size;
- cIntSum isum_copies_exec;
- cDoubleSum dsum_copy_mut_by_copies_exec;
- cDoubleSum dsum_copied_size_by_copies_exec;
- cDoubleSum dsum_copy_mut_lines_by_copied_size;
- cDoubleSum dsum_copy_mut_lines_by_copy_mut;
-
- // Instruction Counts (DM)
- tArray<cIntSum> sum_exe_inst_array;
-
-
- // Calculated stats
- double entropy;
- double species_entropy;
- double energy;
- double dom_fidelity;
- double ave_fidelity;
-
- // For tracking of advantageous mutations
- double max_viable_fitness;
-
- // Dominant Genotype
- cGenotype * dom_genotype;
- double dom_merit;
- double dom_gestation;
- double dom_repro_rate;
- double dom_fitness;
- int dom_size;
- double dom_copied_size;
- double dom_exe_size;
- double max_fitness;
- double max_merit;
- int max_gestation_time;
- int max_genome_length;
- double min_fitness;
- double min_merit;
- int min_gestation_time;
- int min_genome_length;
- int dom_genotype_id;
- cString dom_name;
- int dom_births;
- int dom_breed_true;
- int dom_breed_in;
- int dom_breed_out;
- int dom_abundance;
- int dom_gene_depth;
- cString dom_sequence;
- int coal_depth;
-
- // Dominant Parasite
- cInjectGenotype * dom_inj_genotype;
- int dom_inj_size;
- int dom_inj_genotype_id;
- cString dom_inj_name;
- int dom_inj_births;
- int dom_inj_abundance;
- cString dom_inj_sequence;
-
- int num_births;
- int num_deaths;
- int num_breed_in;
- int num_breed_true;
- int num_breed_true_creatures;
- int num_creatures;
- int num_genotypes;
- int num_threshold;
- int num_species;
- int num_thresh_species;
- int num_lineages;
- int num_executed;
- int num_parasites;
- int num_no_birth_creatures;
- int num_single_thread_creatures;
- int num_multi_thread_creatures;
- int num_modified;
-
- int num_genotypes_last;
-
- int tot_organisms;
- int tot_genotypes;
- int tot_threshold;
- int tot_species;
- int tot_thresh_species;
- int tot_lineages;
- int tot_executed;
-
- tArray<int> genotype_map;
-
- tArray<int> task_cur_count;
- tArray<int> task_last_count;
- tArray<int> task_exe_count;
-
- tArray<double> reaction_count;
- tArray<double> resource_count;
- tArray<int> resource_geometry;
- tArray< tArray<double> > spatial_res_count;
-
- tArray<cString> task_names;
- tArray<cString> inst_names;
- tArray<cString> reaction_names;
- tArray<cString> resource_names;
-
-public:
- cStats();
- ~cStats();
-
- void SetupPrintDatabase();
-
- void ProcessUpdate();
-
-
- // GLOBAL STATS
-
- inline void SetCurrentUpdate(int new_update) {
- current_update = new_update;
- sub_update = 0;
- }
-
- inline void IncCurrentUpdate() {
- current_update++;
- sub_update = 0;
- }
-
- void IncSubUpdate() { sub_update++; }
-
- bool OK() { return true; } // @CAO FIX!!!!
-
- void FlushFP(); // Flush all the files
-
- // Accessors...
- int GetUpdate() const { return current_update; }
- int GetSubUpdate() const { return sub_update; }
- double GetGeneration() const { return SumGeneration().Average(); }
-
- cGenotype * GetDomGenotype() const { return dom_genotype; }
- double GetDomMerit() const { return dom_merit; }
- double GetDomGestation() const { return dom_gestation; }
- double GetDomReproRate() const { return dom_repro_rate; }
- double GetDomFitness() const { return dom_fitness; }
- double GetDomCopySize() const { return dom_copied_size; }
- double GetDomExeSize() const { return dom_exe_size; }
-
- int GetDomSize() const { return dom_size; }
- int GetDomID() const { return dom_genotype_id; }
- const cString & GetDomName() const { return dom_name; }
- int GetDomBirths() const { return dom_births; }
- int GetDomBreedTrue() const { return dom_breed_true; }
- int GetDomBreedIn() const { return dom_breed_in; }
- int GetDomBreedOut() const { return dom_breed_out; }
- int GetDomAbundance() const { return dom_abundance; }
- int GetDomGeneDepth() const { return dom_gene_depth; }
- const cString & GetDomSequence() const { return dom_sequence; }
-
- cInjectGenotype * GetDomInjGenotype() const { return dom_inj_genotype; }
- int GetDomInjSize() const { return dom_inj_size; }
- int GetDomInjID() const { return dom_inj_genotype_id; }
- const cString & GetDomInjName() const { return dom_inj_name; }
- int GetDomInjBirths() const { return dom_inj_births; }
- int GetDomInjAbundance() const { return dom_inj_abundance; }
- const cString & GetDomInjSequence() const { return dom_inj_sequence; }
-
- // Settings...
- void SetDomGenotype(cGenotype * in_gen) { dom_genotype = in_gen; }
- void SetDomMerit(double in_merit) { dom_merit = in_merit; }
- void SetDomGestation(double in_gest) { dom_gestation = in_gest; }
- void SetDomReproRate(double in_rate) { dom_repro_rate = in_rate; }
- void SetDomFitness(double in_fit) { dom_fitness = in_fit; }
- void SetDomCopiedSize(double in_size) { dom_copied_size = in_size; }
- void SetDomExeSize(double in_size) { dom_exe_size = in_size; }
-
- void SetDomSize(int in_size) { dom_size = in_size; }
- void SetDomID(int in_id) { dom_genotype_id = in_id; }
- void SetDomName(const cString & in_name) { dom_name = in_name; }
- void SetDomBirths(int in_births) { dom_births = in_births; }
- void SetDomBreedTrue(int in_bt) { dom_breed_true = in_bt; }
- void SetDomBreedIn(int in_bi) { dom_breed_in = in_bi; }
- void SetDomBreedOut(int in_bo) { dom_breed_out = in_bo; }
- void SetDomAbundance(int in_abund) { dom_abundance = in_abund; }
- void SetDomGeneDepth(int in_depth) { dom_gene_depth = in_depth; }
- void SetDomSequence(const cString & in_seq) { dom_sequence = in_seq; }
-
- void SetDomInjGenotype(cInjectGenotype * in_inj_genotype)
- {dom_inj_genotype = in_inj_genotype;}
- void SetDomInjSize(int in_inj_size)
- {dom_inj_size = in_inj_size;}
- void SetDomInjID(int in_inj_ID)
- {dom_inj_genotype_id = in_inj_ID;}
- void SetDomInjName(const cString & in_name)
- {dom_inj_name = in_name;}
- void SetDomInjBirths(int in_births)
- {dom_inj_births=in_births;}
- void SetDomInjAbundance(int in_inj_abundance)
- {dom_inj_abundance=in_inj_abundance;}
- void SetDomInjSequence(const cString & in_inj_sequence)
- {dom_inj_sequence = in_inj_sequence;}
-
- void SetGenoMapElement(int i, int in_geno) { genotype_map[i] = in_geno; }
- // Generic data
- void SetCoalescentGenotypeDepth(int in_depth) {coal_depth = in_depth;}
-
- inline void SetNumGenotypes(int new_genotypes);
- inline void SetNumCreatures(int new_creatures);
- inline void SetNumThreshSpecies(int new_thresh_species);
- inline void SetBreedTrueCreatures(int in_num_breed_true_creatures);
- inline void SetNumParasites(int in_num_parasites);
- inline void SetNumNoBirthCreatures(int in_num_no_birth_creatures);
- inline void SetNumSingleThreadCreatures(int in_num_single_thread_creatures);
- inline void SetNumMultiThreadCreatures(int in_num_multi_thread_creatures);
- inline void SetNumModified(int in_num_modified);
-
- inline void SetMaxFitness(double in_max_fitness)
- { max_fitness = in_max_fitness; }
- inline void SetMaxMerit(double in_max_merit)
- { max_merit = in_max_merit; }
- inline void SetMaxGestationTime(int in_max_gestation_time)
- { max_gestation_time = in_max_gestation_time; }
- inline void SetMaxGenomeLength(int in_max_genome_length)
- { max_genome_length = in_max_genome_length; }
-
- inline void SetMinFitness(double in_min_fitness)
- { min_fitness = in_min_fitness; }
- inline void SetMinMerit(double in_min_merit)
- { min_merit = in_min_merit; }
- inline void SetMinGestationTime(int in_min_gestation_time)
- { min_gestation_time = in_min_gestation_time; }
- inline void SetMinGenomeLength(int in_min_genome_length)
- { min_genome_length = in_min_genome_length; }
-
- inline void SetEntropy(double in_entropy)
- { entropy = in_entropy; }
- inline void SetSpeciesEntropy(double in_ent)
- { species_entropy = in_ent; }
-
- cDoubleSum & SumFitness() { return sum_fitness; }
- cDoubleSum & SumGestation() { return sum_gestation; }
- cDoubleSum & SumMerit() { return sum_merit; }
- cDoubleSum & SumReproRate() { return sum_repro_rate; }
-
- cDoubleSum & SumCreatureAge() { return sum_creature_age; }
- cDoubleSum & SumGenotypeAge() { return sum_genotype_age; }
- cDoubleSum & SumGeneration() { return sum_generation; }
- cDoubleSum & SumAbundance() { return sum_abundance; }
- cDoubleSum & SumGenotypeDepth() { return sum_genotype_depth; }
- cDoubleSum & SumThresholdAge() { return sum_threshold_age; }
- cDoubleSum & SumSpeciesAge() { return sum_species_age; }
-
- cDoubleSum & SumNeutralMetric() { return sum_neutral_metric; }
- cDoubleSum & SumLineageLabel() { return sum_lineage_label; }
- cDoubleSum & SumCopyMutRate() { return sum_copy_mut_rate; }
- cDoubleSum & SumLogCopyMutRate() { return sum_log_copy_mut_rate; }
- cDoubleSum & SumDivMutRate() { return sum_div_mut_rate; }
- cDoubleSum & SumLogDivMutRate() { return sum_log_div_mut_rate; }
-
- cDoubleSum & SumSize() { return sum_size; }
- cDoubleSum & SumCopySize() { return sum_copy_size; }
- cDoubleSum & SumExeSize() { return sum_exe_size; }
- cDoubleSum & SumMemSize() { return sum_mem_size; }
-
-#ifdef INSTRUCTION_COUNT
- void ZeroInst();
-#endif
- tArray<cIntSum> & SumExeInst() { return sum_exe_inst_array; }
-
- // And constant versions of the above...
- const cDoubleSum & SumFitness() const { return sum_fitness; }
- const cDoubleSum & SumGestation() const { return sum_gestation; }
- const cDoubleSum & SumMerit() const { return sum_merit; }
- const cDoubleSum & SumReproRate() const { return sum_repro_rate; }
-
- const cDoubleSum & SumCreatureAge() const { return sum_creature_age; }
- const cDoubleSum & SumGenotypeAge() const { return sum_genotype_age; }
- const cDoubleSum & SumGeneration() const { return sum_generation; }
- const cDoubleSum & SumAbundance() const { return sum_abundance; }
- const cDoubleSum & SumGenotypeDepth() const { return sum_genotype_depth; }
- const cDoubleSum & SumThresholdAge() const { return sum_threshold_age; }
- const cDoubleSum & SumSpeciesAge() const { return sum_species_age; }
-
- const cDoubleSum & SumNeutralMetric() const { return sum_neutral_metric; }
- const cDoubleSum & SumLineageLabel() const { return sum_lineage_label; }
- const cDoubleSum & SumCopyMutRate() const { return sum_copy_mut_rate; }
- const cDoubleSum & SumLogCopyMutRate() const{ return sum_log_copy_mut_rate; }
- const cDoubleSum & SumDivMutRate() const { return sum_div_mut_rate; }
- const cDoubleSum & SumLogDivMutRate() const{ return sum_log_div_mut_rate; }
-
- const cDoubleSum & SumSize() const { return sum_size; }
- const cDoubleSum & SumCopySize() const { return sum_copy_size; }
- const cDoubleSum & SumExeSize() const { return sum_exe_size; }
- const cDoubleSum & SumMemSize() const { return sum_mem_size; }
-
- void CalcEnergy();
- void CalcFidelity();
-
- void RecordBirth(int cell_id, int genotype_id, bool breed_true);
- void RecordDeath(int genotype_id, int num_divides, int age);
- void AddGenotype(int id_num);
- void RemoveGenotype(int id_num, int parent_id,
- int parent_distance, int depth, int max_abundance,
- int parasite_abundance, int age, int length);
- void AddThreshold(int id_num, const char * name,
- int species_num=-1);
- void RemoveThreshold(int id_num);
- void AddSpecies(int id_num);
- void RemoveSpecies(int id_num, int parent_id,
- int max_gen_abundance, int max_abundance, int age);
- void AddLineage();
- void RemoveLineage(int id_num, int parent_id, int update_born,
- double generation_born, int total_CPUs,
- int total_genotypes, double fitness,
- double lineage_stat1, double lineage_stat2 );
-
- void IncExecuted() { num_executed++; }
-
- void AddCurTask(int task_num) { task_cur_count[task_num]++; }
- void AddLastTask(int task_num) { task_last_count[task_num]++; }
- void IncTaskExeCount(int task_num, int task_count)
- { task_exe_count[task_num] += task_count; }
- void ZeroTasks();
-
- void SetReactions(const tArray<double> &_in) { reaction_count = _in; }
- void SetResources(const tArray<double> &_in) { resource_count = _in; }
- void SetResourcesGeometry(const tArray<int> &_in) { resource_geometry = _in;}
- void SetSpatialRes(const tArray< tArray<double> > &_in) {
- spatial_res_count = _in;
- }
-
- void SetTaskName(int id, const cString & name) { task_names[id] = name; }
- void SetInstName(int id, const cString & name) {
- assert(id < inst_names.GetSize());
- inst_names[id] = name;
- }
- void SetReactionName(int id, const cString & name) { reaction_names[id] = name; }
- void SetResourceName(int id, const cString & name) { resource_names[id] = name; }
-
- // Information retrieval section...
-
- int GetNumBirths() const { return num_births; }
- int GetNumDeaths() const { return num_deaths; }
- int GetBreedIn() const { return num_breed_in; }
- int GetBreedTrue() const { return num_breed_true; }
- int GetBreedTrueCreatures() const { return num_breed_true_creatures; }
- int GetNumCreatures() const { return num_creatures; }
- int GetNumGenotypes() const { return num_genotypes; }
- int GetNumThreshold() const { return num_threshold; }
- int GetNumSpecies() const { return num_species; }
- int GetNumThreshSpecies() const { return num_thresh_species; }
- int GetNumLineages() const { return num_lineages; }
- int GetNumParasites() const { return num_parasites; }
- int GetNumNoBirthCreatures() const{ return num_no_birth_creatures; }
- int GetNumSingleThreadCreatures() const { return num_single_thread_creatures; }
- int GetNumMultiThreadCreatures() const { return num_multi_thread_creatures; }
- int GetNumModified() const { return num_modified;}
-
- int GetTotCreatures() const { return tot_organisms; }
- int GetTotGenotypes() const { return tot_genotypes; }
- int GetTotThreshold() const { return tot_threshold; }
- int GetTotSpecies() const { return tot_species; }
- int GetTotThreshSpecies() const { return tot_thresh_species; }
- int GetTotLineages() const { return tot_lineages; }
-
- int GetTaskCurCount(int task_num) const { return task_cur_count[task_num]; }
- int GetTaskLastCount(int task_num) const {return task_last_count[task_num];}
- int GetTaskExeCount(int task_num) const { return task_exe_count[task_num]; }
-
- const tArray<double> & GetReactions() const { return reaction_count; }
- const tArray<double> & GetResources() const { return resource_count; }
-
- double GetAveReproRate() const { return sum_repro_rate.Average(); }
-
- double GetAveMerit() const { return sum_merit.Average(); }
- double GetAveCreatureAge() const{ return sum_creature_age.Average(); }
- double GetAveMemSize() const { return sum_mem_size.Average(); }
-
- double GetAveNeutralMetric() const { return sum_neutral_metric.Average(); }
- double GetAveLineageLabel() const { return sum_lineage_label.Average(); }
- double GetAveCopyMutRate() const { return sum_copy_mut_rate.Average(); }
- double GetAveLogCopyMutRate() const{ return sum_log_copy_mut_rate.Average();}
- double GetAveDivMutRate() const { return sum_div_mut_rate.Average(); }
- double GetAveLogDivMutRate() const{ return sum_log_div_mut_rate.Average();}
-
- double GetAveGestation() const { return sum_gestation.Average(); }
- double GetAveFitness() const { return sum_fitness.Average(); }
-
- double GetAveGenotypeAge() const { return sum_genotype_age.Average();}
-
- double GetAveSize() const { return sum_size.Average(); }
- double GetAveCopySize() const { return sum_copy_size.Average(); }
- double GetAveExeSize() const { return sum_exe_size.Average(); }
-
- double GetEntropy() const { return entropy; }
- double GetSpeciesEntropy() const { return species_entropy; }
- double GetEnergy() const { return energy; }
- double GetEvenness() const { return entropy / Log(num_genotypes); }
- int GetCoalescentDepth() const { return coal_depth; }
-
- double GetAveThresholdAge() const { return sum_threshold_age.Average(); }
- double GetAveSpeciesAge() const { return sum_species_age.Average(); }
-
- double GetMaxFitness() const { return max_fitness; }
- double GetMaxMerit() const { return max_merit; }
- int GetMaxGestationTime() const { return max_gestation_time; }
- int GetMaxGenomeLength() const { return max_genome_length; }
-
- double GetMinFitness() const { return min_fitness; }
- double GetMinMerit() const { return min_merit; }
- int GetMinGestationTime() const { return min_gestation_time; }
- int GetMinGenomeLength() const { return min_genome_length; }
-
-
- // this value gets recorded when a creature with the particular
- // fitness value gets born. It will never change to a smaller value,
- // i.e., when the maximum fitness in the population drops, this value will
- // still stay up.
- double GetMaxViableFitness() const { return max_viable_fitness; }
-
- // Access to data_file_manager (so cPopulation can output files)
- std::ofstream & GetDataFileOFStream(const cString & fname){
- return data_file_manager.GetOFStream(fname); }
- cDataFile & GetDataFile(const cString & fname){
- return data_file_manager.Get(fname); }
-
-
- // User-defined datafile...
- void PrintDataFile(const cString & filename, const cString & format,
- char sep=' ');
-
- // Public calls to output data files (for events)
- void PrintAverageData(const cString & filename);
- void PrintErrorData(const cString & filename);
- void PrintVarianceData(const cString & filename);
- void PrintDominantData(const cString & filename);
- void PrintDominantParaData(const cString & filename);
- void PrintStatsData(const cString & filename);
- void PrintCountData(const cString & filename);
- void PrintTotalsData(const cString & filename);
- void PrintTasksData(const cString & filename);
- void PrintTasksExeData(const cString & filename);
- void PrintReactionData(const cString & filename);
- void PrintResourceData(const cString & filename);
- void PrintSpatialResData(const cString & filename, int i);
- void PrintTimeData(const cString & filename);
- void PrintMutationData(const cString & filename);
- void PrintDivideMutData(const cString & filename);
- void PrintMutationRateData(const cString & filename);
- void PrintInstructionData(const cString & filename);
- void PrintGenotypeMap(const cString & filename);
-};
-
-
-inline void cStats::SetNumGenotypes(int new_genotypes)
-{
- num_genotypes_last = num_genotypes;
- num_genotypes = new_genotypes;
-}
-
-inline void cStats::SetNumCreatures(int new_creatures)
-{
- num_creatures = new_creatures;
-}
-
-inline void cStats::SetNumThreshSpecies(int new_thresh_species)
-{
- num_thresh_species = new_thresh_species;
-}
-
-inline void cStats::SetBreedTrueCreatures(int in_num_breed_true_creatures)
-{
- num_breed_true_creatures = in_num_breed_true_creatures;
-}
-
-inline void cStats::SetNumParasites(int in_num_parasites)
-{
- num_parasites = in_num_parasites;
-}
-
-inline void cStats::SetNumNoBirthCreatures(int in_num_no_birth_creatures)
-{
- num_no_birth_creatures = in_num_no_birth_creatures;
-}
-
-inline void cStats::SetNumSingleThreadCreatures(int in_num_single_thread_creatures)
-{
- num_single_thread_creatures = in_num_single_thread_creatures;
-}
-
-inline void cStats::SetNumMultiThreadCreatures(int in_num_multi_thread_creatures)
-{
- num_multi_thread_creatures = in_num_multi_thread_creatures;
-}
-
-inline void cStats::SetNumModified(int in_num_modified)
-{
- num_modified = in_num_modified;
-}
-
-#endif
Deleted: trunk/source/main/task_entry.cc
===================================================================
--- trunk/source/main/task_entry.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/task_entry.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,27 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
-#endif
-
-////////////////
-// cTaskEntry
-////////////////
-
-cTaskEntry::cTaskEntry(const cString & _name, const cString & _desc,
- int _id, tTaskTest _test_fun)
- : name(_name)
- , desc(_desc)
- , id(_id)
- , test_fun(_test_fun)
-{
-}
-
-cTaskEntry::~cTaskEntry()
-{
-}
Deleted: trunk/source/main/task_entry.hh
===================================================================
--- trunk/source/main/task_entry.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/task_entry.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,35 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef TASK_ENTRY_HH
-#define TASK_ENTRY_HH
-
-#ifndef STRING_HH
-#include "string.hh"
-#endif
-#ifndef TASK_LIB_HH
-#include "task_lib.hh"
-#endif
-
-class cTaskEntry {
-private:
- cString name; // Short keyword for task
- cString desc; // For more human-understandable output...
- int id;
- tTaskTest test_fun;
-public:
- cTaskEntry(const cString & _name, const cString & _desc, int _id,
- tTaskTest _test_fun);
- ~cTaskEntry();
-
- const cString & GetName() const { return name; }
- const cString & GetDesc() const { return desc; }
- const int GetID() const { return id; }
- const tTaskTest GetTestFun() const { return test_fun; }
-};
-
-#endif
Deleted: trunk/source/main/task_lib.cc
===================================================================
--- trunk/source/main/task_lib.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/task_lib.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,1701 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef TASK_LIB_HH
-#include "task_lib.hh"
-#endif
-
-#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
-#endif
-
-extern "C" {
-#include <math.h>
-#include <limits.h>
-}
-
-using namespace std;
-
-////////////////////////
-// cTaskLib (public)
-////////////////////////
-
-cTaskLib::cTaskLib()
- : use_neighbor_input(false)
- , use_neighbor_output(false)
- , input_buffer(3)
- , output_buffer(3)
-{
-}
-
-cTaskLib::~cTaskLib()
-{
- for (int i = 0; i < task_array.GetSize(); i++) {
- delete task_array[i];
- }
-}
-
-cTaskEntry * cTaskLib::AddTask(const cString & name)
-{
- // Determine if this task is already in the active library.
- for (int i = 0; i < task_array.GetSize(); i++) {
- if (task_array[i]->GetName() == name) {
- assert(task_array[i] != NULL);
- return task_array[i];
- }
- }
-
- // Match up this name to its corresponding task
- const int start_size = task_array.GetSize();
-
- if (name == "echo") NewTask(name, "Echo", &cTaskLib::Task_Echo);
- else if (name == "add") NewTask(name, "Add", &cTaskLib::Task_Add);
- else if (name == "sub") NewTask(name, "Sub", &cTaskLib::Task_Sub);
-
- else if (name == "not") NewTask(name, "Not", &cTaskLib::Task_Not);
- else if (name == "nand") NewTask(name, "Nand", &cTaskLib::Task_Nand);
- else if (name == "and") NewTask(name, "And", &cTaskLib::Task_And);
- else if (name == "orn") NewTask(name, "OrNot", &cTaskLib::Task_OrNot);
- else if (name == "or") NewTask(name, "Or", &cTaskLib::Task_Or);
- else if (name == "andn") NewTask(name, "AndNot", &cTaskLib::Task_AndNot);
- else if (name == "nor") NewTask(name, "Nor", &cTaskLib::Task_Nor);
- else if (name == "xor") NewTask(name, "Xor", &cTaskLib::Task_Xor);
- else if (name == "equ") NewTask(name, "Equals", &cTaskLib::Task_Equ);
-
- else if (name == "logic_3AA")
- NewTask(name, "Logic 3AA (A+B+C == 0)", &cTaskLib::Task_Logic3in_AA);
- else if (name == "logic_3AB")
- NewTask(name, "Logic 3AB (A+B+C == 1)", &cTaskLib::Task_Logic3in_AB);
- else if (name == "logic_3AC")
- NewTask(name, "Logic 3AC (A+B+C <= 1)", &cTaskLib::Task_Logic3in_AC);
- else if (name == "logic_3AD")
- NewTask(name, "Logic 3AD (A+B+C == 2)", &cTaskLib::Task_Logic3in_AD);
- else if (name == "logic_3AE")
- NewTask(name, "Logic 3AE (A+B+C == 0,2)", &cTaskLib::Task_Logic3in_AE);
- else if (name == "logic_3AF")
- NewTask(name, "Logic 3AF (A+B+C == 1,2)", &cTaskLib::Task_Logic3in_AF);
- else if (name == "logic_3AG")
- NewTask(name, "Logic 3AG (A+B+C <= 2)", &cTaskLib::Task_Logic3in_AG);
- else if (name == "logic_3AH")
- NewTask(name, "Logic 3AH (A+B+C == 3)", &cTaskLib::Task_Logic3in_AH);
- else if (name == "logic_3AI")
- NewTask(name, "Logic 3AI (A+B+C == 0,3)", &cTaskLib::Task_Logic3in_AI);
- else if (name == "logic_3AJ")
- NewTask(name, "Logic 3AJ (A+B+C == 1,3) XOR", &cTaskLib::Task_Logic3in_AJ);
- else if (name == "logic_3AK")
- NewTask(name, "Logic 3AK (A+B+C != 2)", &cTaskLib::Task_Logic3in_AK);
- else if (name == "logic_3AL")
- NewTask(name, "Logic 3AL (A+B+C >= 2)", &cTaskLib::Task_Logic3in_AL);
- else if (name == "logic_3AM")
- NewTask(name, "Logic 3AM (A+B+C != 1)", &cTaskLib::Task_Logic3in_AM);
- else if (name == "logic_3AN")
- NewTask(name, "Logic 3AN (A+B+C != 0)", &cTaskLib::Task_Logic3in_AN);
- else if (name == "logic_3AO")
- NewTask(name, "Logic 3AO (A & ~B & ~C) [3]", &cTaskLib::Task_Logic3in_AO);
- else if (name == "logic_3AP")
- NewTask(name, "Logic 3AP (A^B & ~C) [3]", &cTaskLib::Task_Logic3in_AP);
- else if (name == "logic_3AQ")
- NewTask(name, "Logic 3AQ (A==B & ~C) [3]", &cTaskLib::Task_Logic3in_AQ);
- else if (name == "logic_3AR")
- NewTask(name, "Logic 3AR (A & B & ~C) [3]", &cTaskLib::Task_Logic3in_AR);
- else if (name == "logic_3AS")
- NewTask(name, "Logic 3AS", &cTaskLib::Task_Logic3in_AS);
- else if (name == "logic_3AT")
- NewTask(name, "Logic 3AT", &cTaskLib::Task_Logic3in_AT);
- else if (name == "logic_3AU")
- NewTask(name, "Logic 3AU", &cTaskLib::Task_Logic3in_AU);
- else if (name == "logic_3AV")
- NewTask(name, "Logic 3AV", &cTaskLib::Task_Logic3in_AV);
- else if (name == "logic_3AW")
- NewTask(name, "Logic 3AW", &cTaskLib::Task_Logic3in_AW);
- else if (name == "logic_3AX")
- NewTask(name, "Logic 3AX", &cTaskLib::Task_Logic3in_AX);
- else if (name == "logic_3AY")
- NewTask(name, "Logic 3AY", &cTaskLib::Task_Logic3in_AY);
- else if (name == "logic_3AZ")
- NewTask(name, "Logic 3AZ", &cTaskLib::Task_Logic3in_AZ);
- else if (name == "logic_3BA")
- NewTask(name, "Logic 3BA", &cTaskLib::Task_Logic3in_BA);
- else if (name == "logic_3BB")
- NewTask(name, "Logic 3BB", &cTaskLib::Task_Logic3in_BB);
- else if (name == "logic_3BC")
- NewTask(name, "Logic 3BC", &cTaskLib::Task_Logic3in_BC);
- else if (name == "logic_3BD")
- NewTask(name, "Logic 3BD", &cTaskLib::Task_Logic3in_BD);
- else if (name == "logic_3BE")
- NewTask(name, "Logic 3BE", &cTaskLib::Task_Logic3in_BE);
- else if (name == "logic_3BF")
- NewTask(name, "Logic 3BF", &cTaskLib::Task_Logic3in_BF);
- else if (name == "logic_3BG")
- NewTask(name, "Logic 3BG", &cTaskLib::Task_Logic3in_BG);
- else if (name == "logic_3BH")
- NewTask(name, "Logic 3BH", &cTaskLib::Task_Logic3in_BH);
- else if (name == "logic_3BI")
- NewTask(name, "Logic 3BI", &cTaskLib::Task_Logic3in_BI);
- else if (name == "logic_3BJ")
- NewTask(name, "Logic 3BJ", &cTaskLib::Task_Logic3in_BJ);
- else if (name == "logic_3BK")
- NewTask(name, "Logic 3BK", &cTaskLib::Task_Logic3in_BK);
- else if (name == "logic_3BL")
- NewTask(name, "Logic 3BL", &cTaskLib::Task_Logic3in_BL);
- else if (name == "logic_3BM")
- NewTask(name, "Logic 3BM", &cTaskLib::Task_Logic3in_BM);
- else if (name == "logic_3BN")
- NewTask(name, "Logic 3BN", &cTaskLib::Task_Logic3in_BN);
- else if (name == "logic_3BO")
- NewTask(name, "Logic 3BO", &cTaskLib::Task_Logic3in_BO);
- else if (name == "logic_3BP")
- NewTask(name, "Logic 3BP", &cTaskLib::Task_Logic3in_BP);
- else if (name == "logic_3BQ")
- NewTask(name, "Logic 3BQ", &cTaskLib::Task_Logic3in_BQ);
- else if (name == "logic_3BR")
- NewTask(name, "Logic 3BR", &cTaskLib::Task_Logic3in_BR);
- else if (name == "logic_3BS")
- NewTask(name, "Logic 3BS", &cTaskLib::Task_Logic3in_BS);
- else if (name == "logic_3BT")
- NewTask(name, "Logic 3BT", &cTaskLib::Task_Logic3in_BT);
- else if (name == "logic_3BU")
- NewTask(name, "Logic 3BU", &cTaskLib::Task_Logic3in_BU);
- else if (name == "logic_3BV")
- NewTask(name, "Logic 3BV", &cTaskLib::Task_Logic3in_BV);
- else if (name == "logic_3BW")
- NewTask(name, "Logic 3BW", &cTaskLib::Task_Logic3in_BW);
- else if (name == "logic_3BX")
- NewTask(name, "Logic 3BX", &cTaskLib::Task_Logic3in_BX);
- else if (name == "logic_3BY")
- NewTask(name, "Logic 3BY", &cTaskLib::Task_Logic3in_BY);
- else if (name == "logic_3BZ")
- NewTask(name, "Logic 3BZ", &cTaskLib::Task_Logic3in_BZ);
- else if (name == "logic_3CA")
- NewTask(name, "Logic 3CA", &cTaskLib::Task_Logic3in_CA);
- else if (name == "logic_3CB")
- NewTask(name, "Logic 3CB", &cTaskLib::Task_Logic3in_CB);
- else if (name == "logic_3CC")
- NewTask(name, "Logic 3CC", &cTaskLib::Task_Logic3in_CC);
- else if (name == "logic_3CD")
- NewTask(name, "Logic 3CD", &cTaskLib::Task_Logic3in_CD);
- else if (name == "logic_3CE")
- NewTask(name, "Logic 3CE", &cTaskLib::Task_Logic3in_CE);
- else if (name == "logic_3CF")
- NewTask(name, "Logic 3CF", &cTaskLib::Task_Logic3in_CF);
- else if (name == "logic_3CG")
- NewTask(name, "Logic 3CG", &cTaskLib::Task_Logic3in_CG);
- else if (name == "logic_3CH")
- NewTask(name, "Logic 3CH", &cTaskLib::Task_Logic3in_CH);
- else if (name == "logic_3CI")
- NewTask(name, "Logic 3CI", &cTaskLib::Task_Logic3in_CI);
- else if (name == "logic_3CJ")
- NewTask(name, "Logic 3CJ", &cTaskLib::Task_Logic3in_CJ);
- else if (name == "logic_3CK")
- NewTask(name, "Logic 3CK", &cTaskLib::Task_Logic3in_CK);
- else if (name == "logic_3CL")
- NewTask(name, "Logic 3CL", &cTaskLib::Task_Logic3in_CL);
- else if (name == "logic_3CM")
- NewTask(name, "Logic 3CM", &cTaskLib::Task_Logic3in_CM);
- else if (name == "logic_3CN")
- NewTask(name, "Logic 3CN", &cTaskLib::Task_Logic3in_CN);
- else if (name == "logic_3CO")
- NewTask(name, "Logic 3CO", &cTaskLib::Task_Logic3in_CO);
- else if (name == "logic_3CP")
- NewTask(name, "Logic 3CP", &cTaskLib::Task_Logic3in_CP);
-
- else if (name == "math_1AA")
- NewTask(name, "Math 1AA (2X)", &cTaskLib::Task_Math1in_AA);
- else if (name == "math_1AB")
- NewTask(name, "Math 1AB (2X/3)", &cTaskLib::Task_Math1in_AB);
- else if (name == "math_1AC")
- NewTask(name, "Math 1AC (5X/4)", &cTaskLib::Task_Math1in_AC);
- else if (name == "math_1AD")
- NewTask(name, "Math 1AD (X^2)", &cTaskLib::Task_Math1in_AD);
- else if (name == "math_1AE")
- NewTask(name, "Math 1AE (X^3)", &cTaskLib::Task_Math1in_AE);
- else if (name == "math_1AF")
- NewTask(name, "Math 1AF (sqrt(X))", &cTaskLib::Task_Math1in_AF);
- else if (name == "math_1AG")
- NewTask(name, "Math 1AG (log(X))", &cTaskLib::Task_Math1in_AG);
- else if (name == "math_1AH")
- NewTask(name, "Math 1AH (X^2+X^3)", &cTaskLib::Task_Math1in_AH);
- else if (name == "math_1AI")
- NewTask(name, "Math 1AI (X^2+sqrt(X))", &cTaskLib::Task_Math1in_AI);
- else if (name == "math_1AJ")
- NewTask(name, "Math 1AJ (abs(X))", &cTaskLib::Task_Math1in_AJ);
- else if (name == "math_1AK")
- NewTask(name, "Math 1AK (X-5)", &cTaskLib::Task_Math1in_AK);
- else if (name == "math_1AL")
- NewTask(name, "Math 1AL (-X)", &cTaskLib::Task_Math1in_AL);
- else if (name == "math_1AM")
- NewTask(name, "Math 1AM (5X)", &cTaskLib::Task_Math1in_AM);
- else if (name == "math_1AN")
- NewTask(name, "Math 1AN (X/4)", &cTaskLib::Task_Math1in_AN);
- else if (name == "math_1AO")
- NewTask(name, "Math 1AO (X-6)", &cTaskLib::Task_Math1in_AO);
- else if (name == "math_1AP")
- NewTask(name, "Math 1AP (X-7)", &cTaskLib::Task_Math1in_AP);
-
- else if (name == "math_2AA")
- NewTask(name, "Math 2AA (sqrt(X+Y))", &cTaskLib::Task_Math2in_AA);
- else if (name == "math_2AB")
- NewTask(name, "Math 2AB ((X+Y)^2)", &cTaskLib::Task_Math2in_AB);
- else if (name == "math_2AC")
- NewTask(name, "Math 2AC (X%Y)", &cTaskLib::Task_Math2in_AC);
- else if (name == "math_2AD")
- NewTask(name, "Math 2AD (3X/2+5Y/4)", &cTaskLib::Task_Math2in_AD);
- else if (name == "math_2AE")
- NewTask(name, "Math 2AE (abs(X-5)+abs(Y-6))", &cTaskLib::Task_Math2in_AE);
- else if (name == "math_2AF")
- NewTask(name, "Math 2AF (XY-X/Y)", &cTaskLib::Task_Math2in_AF);
- else if (name == "math_2AG")
- NewTask(name, "Math 2AG ((X-Y)^2)", &cTaskLib::Task_Math2in_AG);
- else if (name == "math_2AH")
- NewTask(name, "Math 2AH (X^2+Y^2)", &cTaskLib::Task_Math2in_AH);
- else if (name == "math_2AI")
- NewTask(name, "Math 2AI (X^2+Y^3)", &cTaskLib::Task_Math2in_AI);
- else if (name == "math_2AJ")
- NewTask(name, "Math 2AJ ((sqrt(X)+Y)/(X-7))", &cTaskLib::Task_Math2in_AJ);
- else if (name == "math_2AK")
- NewTask(name, "Math 2AK (log(|X/Y|))", &cTaskLib::Task_Math2in_AK);
- else if (name == "math_2AL")
- NewTask(name, "Math 2AL (log(|X|)/Y)", &cTaskLib::Task_Math2in_AL);
- else if (name == "math_2AM")
- NewTask(name, "Math 2AM (X/log(|Y|))", &cTaskLib::Task_Math2in_AM);
- else if (name == "math_2AN")
- NewTask(name, "Math 2AN (X+Y)", &cTaskLib::Task_Math2in_AN);
- else if (name == "math_2AO")
- NewTask(name, "Math 2AO (X-Y)", &cTaskLib::Task_Math2in_AO);
- else if (name == "math_2AP")
- NewTask(name, "Math 2AP (X/Y)", &cTaskLib::Task_Math2in_AP);
- else if (name == "math_2AQ")
- NewTask(name, "Math 2AQ (XY)", &cTaskLib::Task_Math2in_AQ);
- else if (name == "math_2AR")
- NewTask(name, "Math 2AR (sqrt(X)+sqrt(Y))", &cTaskLib::Task_Math2in_AR);
- else if (name == "math_2AS")
- NewTask(name, "Math 2AS (X+2Y)", &cTaskLib::Task_Math2in_AS);
- else if (name == "math_2AT")
- NewTask(name, "Math 2AT (X+3Y)", &cTaskLib::Task_Math2in_AT);
- else if (name == "math_2AU")
- NewTask(name, "Math 2AU (2X+3Y)", &cTaskLib::Task_Math2in_AU);
- else if (name == "math_2AV")
- NewTask(name, "Math 2AV (XY^2)", &cTaskLib::Task_Math2in_AV);
-
- else if (name == "math_3AA")
- NewTask(name, "Math 3AA (X^2+Y^2+Z^2)", &cTaskLib::Task_Math3in_AA);
- else if (name == "math_3AB")
- NewTask(name, "Math 3AB (sqrt(X)+sqrt(Y)+sqrt(Z))", &cTaskLib::Task_Math3in_AB);
- else if (name == "math_3AC")
- NewTask(name, "Math 3AC (X+2Y+3Z)", &cTaskLib::Task_Math3in_AC);
- /*
- Visual Studio.net 2003 gives compiler error:
- fatal error C1061: compiler limit : blocks nested too deeply
- Sherri fixed this by removing the 'else' in the next line.
- -- K
- */
- //else if (name == "math_3AD")
- // NewTask(name, "Math 3AD (XY^2+Z^3)", &cTaskLib::Task_Math3in_AD);
- if (name == "math_3AD")
- NewTask(name, "Math 3AD (XY^2+Z^3)", &cTaskLib::Task_Math3in_AD);
- else if (name == "math_3AE")
- NewTask(name, "Math 3AE ((X%Y)*Z)", &cTaskLib::Task_Math3in_AE);
- else if (name == "math_3AF")
- NewTask(name, "Math 3AF ((X+Y)^2+sqrt(Y+Z))", &cTaskLib::Task_Math3in_AF);
- else if (name == "math_3AG")
- NewTask(name, "Math 3AG ((XY)%(YZ))", &cTaskLib::Task_Math3in_AG);
- else if (name == "math_3AH")
- NewTask(name, "Math 3AH (X+Y+Z)", &cTaskLib::Task_Math3in_AH);
- else if (name == "math_3AI")
- NewTask(name, "Math 3AI (-X-Y-Z)", &cTaskLib::Task_Math3in_AI);
- else if (name == "math_3AJ")
- NewTask(name, "Math 3AJ ((X-Y)^2+(Y-Z)^2+(Z-X)^2)",
- &cTaskLib::Task_Math3in_AJ);
- else if (name == "math_3AK")
- NewTask(name, "Math 3AK ((X+Y)^2+(Y+Z)^2+(Z+X)^2)",
- &cTaskLib::Task_Math3in_AK);
- else if (name == "math_3AL")
- NewTask(name, "Math 3AL ((X-Y)^2+(X-Z)^2)", &cTaskLib::Task_Math3in_AL);
- else if (name == "math_3AM")
- NewTask(name, "Math 3AM ((X+Y)^2+(Y+Z)^2)", &cTaskLib::Task_Math3in_AM);
-
- // communication tasks
- else if (name == "comm_echo")
- NewTask(name, "Echo of Neighbor's Input", &cTaskLib::Task_CommEcho,
- REQ_NEIGHBOR_INPUT);
- else if (name == "comm_not")
- NewTask(name, "Not of Neighbor's INput", &cTaskLib::Task_CommNot,
- REQ_NEIGHBOR_INPUT);
- // Make sure we have actually found a task.
-
- if (task_array.GetSize() == start_size) {
- cerr << "Unknown task entry '" << name << "'." << endl;
- return NULL;
- }
-
- // And return the found task.
- return task_array[start_size];
-}
-
-const cTaskEntry & cTaskLib::GetTask(int id) const
-{
- return *(task_array[id]);
-}
-
-void cTaskLib::SetupTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs,
- const tList<tBuffer<int> > & other_inputs,
- const tList<tBuffer<int> > & other_outputs) const
-{
- input_buffer = inputs;
- output_buffer = outputs;
- other_input_buffers.Copy(other_inputs);
- other_output_buffers.Copy(other_outputs);
-
- SetupLogicTests(inputs, outputs);
-}
-
-void cTaskLib::SetupLogicTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs) const
-{
- // Collect the inputs in a useful form.
- const int num_inputs = input_buffer.GetNumStored();
- int test_inputs[3];
- for (int i = 0; i < 3; i++) {
- test_inputs[i] = (num_inputs > i) ? input_buffer[i] : 0;
- }
- int test_output = output_buffer[0];
-
-
- // Setup logic_out to test the output for each logical combination...
- // Assuming each bit in logic out to be based on the inputs:
- //
- // Logic ID Bit: 7 6 5 4 3 2 1 0
- // Input C: 1 1 1 1 0 0 0 0
- // Input B: 1 1 0 0 1 1 0 0
- // Input A: 1 0 1 0 1 0 1 0
-
- tArray<int> logic_out(8);
- logic_out.SetAll(-1);
-
- // Test all input combos!
- bool func_OK = true; // Have all outputs been consistant?
- for (int test_pos = 0; test_pos < 32; test_pos++) {
- int logic_pos = 0;
- for (int i = 0; i < 3; i++) logic_pos += (test_inputs[i] & 1) << i;
-
- if ( logic_out[logic_pos] != -1 &&
- logic_out[logic_pos] != (test_output & 1) ) {
- func_OK = false;
- break;
- }
- else {
- logic_out[logic_pos] = test_output & 1;
- }
-
- test_output >>= 1;
- for (int i = 0; i < 3; i++) test_inputs[i] >>= 1;
- }
-
- // If there were any inconsistancies, deal with them.
- if (func_OK == false) {
- logic_id = -1;
- return;
- }
-
- // Determine the logic ID number of this task.
- if (num_inputs < 1) { // 000 -> 001
- logic_out[1] = logic_out[0];
- }
- if (num_inputs < 2) { // 000 -> 010; 001 -> 011
- logic_out[2] = logic_out[0];
- logic_out[3] = logic_out[1];
- }
- if (num_inputs < 3) { // 000->100; 001->101; 010->110; 011->111
- logic_out[4] = logic_out[0];
- logic_out[5] = logic_out[1];
- logic_out[6] = logic_out[2];
- logic_out[7] = logic_out[3];
- }
-
- // Lets just make sure we've gotten this correct...
- assert(logic_out[0] >= 0 && logic_out[0] <= 1);
- assert(logic_out[1] >= 0 && logic_out[1] <= 1);
- assert(logic_out[2] >= 0 && logic_out[2] <= 1);
- assert(logic_out[3] >= 0 && logic_out[3] <= 1);
- assert(logic_out[4] >= 0 && logic_out[4] <= 1);
- assert(logic_out[5] >= 0 && logic_out[5] <= 1);
- assert(logic_out[6] >= 0 && logic_out[6] <= 1);
- assert(logic_out[7] >= 0 && logic_out[7] <= 1);
-
- logic_id = 0;
- for (int i = 0; i < 8; i++) logic_id += logic_out[i] << i;
-}
-
-
-double cTaskLib::TestOutput(const cTaskEntry & task) const
-{
- tTaskTest test_fun = task.GetTestFun();
- return (this->*test_fun)();
-}
-
-
-////////////////////////
-// cTaskLib (private)
-////////////////////////
-
-void cTaskLib::NewTask(const cString & name, const cString & desc,
- tTaskTest task_fun, int reqs)
-{
- if (reqs & REQ_NEIGHBOR_INPUT == true) use_neighbor_input = true;
- if (reqs & REQ_NEIGHBOR_OUTPUT == true) use_neighbor_output = true;
-
- const int id = task_array.GetSize();
- task_array.Resize(id+1);
- task_array[id] = new cTaskEntry(name, desc, id, task_fun);
-}
-
-
-double cTaskLib::Task_Echo() const
-{
- const int test_output = output_buffer[0];
- for (int i = 0; i < input_buffer.GetNumStored(); i++) {
- if (input_buffer[i] == test_output) {
- assert(logic_id == 170 || logic_id == 204 || logic_id == 240);
- return 1.0;
- }
- }
- return 0.0;
-}
-
-
-double cTaskLib::Task_Add() const
-{
- const int test_output = output_buffer[0];
- for (int i = 0; i < input_buffer.GetNumStored(); i++) {
- for (int j = 0; j < i; j++) {
- if (test_output == input_buffer[i] + input_buffer[j]) return 1.0;
- }
- }
- return 0.0;
-}
-
-
-double cTaskLib::Task_Sub() const
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] - input_buffer[j]) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Not() const
-{
- if (logic_id == 15 || logic_id == 51 || logic_id == 85) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Nand() const
-{
- if (logic_id == 63 || logic_id == 95 || logic_id == 119) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_And() const
-{
- if (logic_id == 136 || logic_id == 160 || logic_id == 192) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_OrNot() const
-{
- if (logic_id == 175 || logic_id == 187 || logic_id == 207 ||
- logic_id == 221 || logic_id == 243 || logic_id == 245) return 1.0;
-
- return 0.0;
-}
-
-double cTaskLib::Task_Or() const
-{
- if (logic_id == 238 || logic_id == 250 || logic_id == 252) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_AndNot() const
-{
- if (logic_id == 10 || logic_id == 12 || logic_id == 34 ||
- logic_id == 48 || logic_id == 68 || logic_id == 80) return 1.0;
-
- return 0.0;
-}
-
-double cTaskLib::Task_Nor() const
-{
- if (logic_id == 3 || logic_id == 5 || logic_id == 17) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Xor() const
-{
- if (logic_id == 60 || logic_id == 90 || logic_id == 102) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Equ() const
-{
- if (logic_id == 153 || logic_id == 165 || logic_id == 195) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AA() const
-{
- if (logic_id == 1) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AB() const
-{
- if (logic_id == 22) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AC() const
-{
- if (logic_id == 23) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AD() const
-{
- if (logic_id == 104) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AE() const
-{
- if (logic_id == 105) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AF() const
-{
- if (logic_id == 126) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AG() const
-{
- if (logic_id == 127) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AH() const
-{
- if (logic_id == 128) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AI() const
-{
- if (logic_id == 129) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AJ() const
-{
- if (logic_id == 150) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AK() const
-{
- if (logic_id == 151) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AL() const
-{
- if (logic_id == 232) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AM() const
-{
- if (logic_id == 233) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AN() const
-{
- if (logic_id == 254) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AO() const
-{
- if (logic_id == 2 || logic_id == 4 || logic_id == 16) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AP() const
-{
- if (logic_id == 6 || logic_id == 18 || logic_id == 20) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AQ() const
-{
- if (logic_id == 7 || logic_id == 19 || logic_id == 21) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AR() const
-{
- if (logic_id == 8 || logic_id == 32 || logic_id == 64) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AS() const
-{
- if (logic_id == 9 || logic_id == 33 || logic_id == 65) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AT() const
-{
- if (logic_id == 14 || logic_id == 50 || logic_id == 84) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AU() const
-{
- if (logic_id == 24 || logic_id == 36 || logic_id == 66) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AV() const
-{
- if (logic_id == 25 || logic_id == 37 || logic_id == 67) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AW() const
-{
- if (logic_id == 30 || logic_id == 54 || logic_id == 86) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AX() const
-{
- if (logic_id == 31 || logic_id == 55 || logic_id == 87) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AY() const
-{
- if (logic_id == 40 || logic_id == 72 || logic_id == 96) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_AZ() const
-{
- if (logic_id == 41 || logic_id == 73 || logic_id == 97) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BA() const
-{
- if (logic_id == 42 || logic_id == 76 || logic_id == 112) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BB() const
-{
- if (logic_id == 43 || logic_id == 77 || logic_id == 113) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BC() const
-{
- if (logic_id == 61 || logic_id == 91 || logic_id == 103) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BD() const
-{
- if (logic_id == 62 || logic_id == 94 || logic_id == 118) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BE() const
-{
- if (logic_id == 106 || logic_id == 108 || logic_id == 120) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BF() const
-{
- if (logic_id == 107 || logic_id == 109 || logic_id == 121) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BG() const
-{
- if (logic_id == 110 || logic_id == 122 || logic_id == 124) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BH() const
-{
- if (logic_id == 111 || logic_id == 123 || logic_id == 125) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BI() const
-{
- if (logic_id == 130 || logic_id == 132 || logic_id == 144) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BJ() const
-{
- if (logic_id == 131 || logic_id == 133 || logic_id == 145) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BK() const
-{
- if (logic_id == 134 || logic_id == 146 || logic_id == 148) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BL() const
-{
- if (logic_id == 135 || logic_id == 147 || logic_id == 149) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BM() const
-{
- if (logic_id == 137 || logic_id == 161 || logic_id == 193) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BN() const
-{
- if (logic_id == 142 || logic_id == 178 || logic_id == 212) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BO() const
-{
- if (logic_id == 143 || logic_id == 179 || logic_id == 213) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BP() const
-{
- if (logic_id == 152 || logic_id == 164 || logic_id == 194) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BQ() const
-{
- if (logic_id == 158 || logic_id == 182 || logic_id == 214) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BR() const
-{
- if (logic_id == 159 || logic_id == 183 || logic_id == 215) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BS() const
-{
- if (logic_id == 168 || logic_id == 200 || logic_id == 224) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BT() const
-{
- if (logic_id == 169 || logic_id == 201 || logic_id == 225) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BU() const
-{
- if (logic_id == 171 || logic_id == 205 || logic_id == 241) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BV() const
-{
- if (logic_id == 188 || logic_id == 218 || logic_id == 230) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BW() const
-{
- if (logic_id == 189 || logic_id == 219 || logic_id == 231) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BX() const
-{
- if (logic_id == 190 || logic_id == 222 || logic_id == 246) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BY() const
-{
- if (logic_id == 191 || logic_id == 223 || logic_id == 247) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_BZ() const
-{
- if (logic_id == 234 || logic_id == 236 || logic_id == 248) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CA() const
-{
- if (logic_id == 235 || logic_id == 237 || logic_id == 249) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CB() const
-{
- if (logic_id == 239 || logic_id == 251 || logic_id == 253) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CC() const
-{
- if (logic_id == 11 || logic_id == 13 || logic_id == 35 ||
- logic_id == 49 || logic_id == 69 || logic_id == 81) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CD() const
-{
- if (logic_id == 26 || logic_id == 28 || logic_id == 38 ||
- logic_id == 52 || logic_id == 70 || logic_id == 82) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CE() const
-{
- if (logic_id == 27 || logic_id == 29 || logic_id == 39 ||
- logic_id == 53 || logic_id == 71 || logic_id == 83) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CF() const
-{
- if (logic_id == 44 || logic_id == 56 || logic_id == 74 ||
- logic_id == 88 || logic_id == 98 || logic_id == 100) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CG() const
-{
- if (logic_id == 45 || logic_id == 57 || logic_id == 75 ||
- logic_id == 89 || logic_id == 99 || logic_id == 101) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CH() const
-{
- if (logic_id == 46 || logic_id == 58 || logic_id == 78 ||
- logic_id == 92 || logic_id == 114 || logic_id == 116) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CI() const
-{
- if (logic_id == 47 || logic_id == 59 || logic_id == 79 ||
- logic_id == 93 || logic_id == 115 || logic_id == 117) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CJ() const
-{
- if (logic_id == 138 || logic_id == 140 || logic_id == 162 ||
- logic_id == 176 || logic_id == 196 || logic_id == 208) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CK() const
-{
- if (logic_id == 139 || logic_id == 141 || logic_id == 163 ||
- logic_id == 177 || logic_id == 197 || logic_id == 209) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CL() const
-{
- if (logic_id == 154 || logic_id == 156 || logic_id == 166 ||
- logic_id == 180 || logic_id == 198 || logic_id == 210) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CM() const
-{
- if (logic_id == 155 || logic_id == 157 || logic_id == 167 ||
- logic_id == 181 || logic_id == 199 || logic_id == 211) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CN() const
-{
- if (logic_id == 172 || logic_id == 184 || logic_id == 202 ||
- logic_id == 216 || logic_id == 226 || logic_id == 228) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CO() const
-{
- if (logic_id == 173 || logic_id == 185 || logic_id == 203 ||
- logic_id == 217 || logic_id == 227 || logic_id == 229) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Logic3in_CP() const
-{
- if (logic_id == 174 || logic_id == 186 || logic_id == 206 ||
- logic_id == 220 || logic_id == 242 || logic_id == 244) return 1.0;
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AA() const //(2X)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- if (test_output == 2 * input_buffer[i]) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AB() const //(2X/3)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == 2 * input_buffer[i] / 3) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AC() const //(5X/4)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == 5 * input_buffer[i] / 4) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AD() const //(X^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] * input_buffer[i]) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AE() const //(X^3)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] * input_buffer[i] * input_buffer[i])
- return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AF() const //(sqrt(X)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == (int) sqrt((double) abs(input_buffer[i]))) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AG() const //(log(X))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (input_buffer[i] <= 0) continue;
- if (test_output == (int) log((double) input_buffer[i])) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AH() const //(X^2+X^3)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[i] * input_buffer[i] * input_buffer[i])
- return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AI() const // (X^2 + sqrt(X))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] * input_buffer[i] + (int) sqrt((double) abs(input_buffer[i])))
- return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AJ() const // abs(X)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == abs(input_buffer[i])) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AK() const //(X-5)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] - 5) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AL() const //(-X)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == 0 - input_buffer[i]) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AM() const //(5X)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == 5 * input_buffer[i]) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AN() const //(X/4)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] / 4) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AO() const //(X-6)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] - 6) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math1in_AP() const //(X-7)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- if (test_output == input_buffer[i] - 7) return 1.0;
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AA() const //(sqrt(X+Y))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == (int) sqrt((double) abs(input_buffer[i] + input_buffer[j])))
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AB() const //((X+Y)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == (input_buffer[i] + input_buffer[j]) *
- (input_buffer[i] + input_buffer[j])) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AC() const //(X%Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (input_buffer[j] == 0) continue; // mod by zero
- if (test_output == input_buffer[i] % input_buffer[j]) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AD() const //(3X/2+5Y/4)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == 3 * input_buffer[i] / 2 + 5 * input_buffer[j] / 4)
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AE() const //(abs(X-5)+abs(Y-6))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == abs(input_buffer[i] - 5) + abs(input_buffer[j] - 6))
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AF() const //(XY-X/Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (input_buffer[j] == 0) continue;
- if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
- if (test_output == input_buffer[i] * input_buffer[j] -
- input_buffer[i] / input_buffer[j]) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AG() const //((X-Y)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == (input_buffer[i] - input_buffer[j]) *
- (input_buffer[i] - input_buffer[j])) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AH() const //(X^2+Y^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] * input_buffer[i] +
- input_buffer[j] * input_buffer[j]) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AI() const //(X^2+Y^3)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[j] * input_buffer[j] * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AJ() const //((sqrt(X)+Y)/(X-7))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (input_buffer[i] - 7 == 0) continue;
- if (test_output == ((int) sqrt((double) abs(input_buffer[i])) + input_buffer[j]) / (input_buffer[i] - 7)) return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AK() const //(log(|X/Y|))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j || input_buffer[j] == 0 ) continue;
- if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
- if (input_buffer[i] / input_buffer[j] == 0) continue;
- if (test_output == (int) log((double) abs(input_buffer[i] / input_buffer[j])))
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AL() const //(log(|X|)/Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j || input_buffer[j] == 0) continue;
- if (test_output == (int) log((double) abs(input_buffer[i])) / input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AM() const //(X/log(|Y|))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j || log((double) abs(input_buffer[j])) == 0) continue;
- if (0-INT_MAX > input_buffer[i] && log((double) abs(input_buffer[j])) == -1) continue;
- if (test_output == input_buffer[i] / (int) log((double) abs(input_buffer[j])))
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AN() const //(X+Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] + input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AO() const //(X-Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] - input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AP() const //(X/Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j || input_buffer[j] == 0) continue;
- if (0 - INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
- if (test_output == input_buffer[i] / input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AQ() const //(XY)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AR() const //(sqrt(X)+sqrt(Y))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == (int) sqrt((double) abs(input_buffer[i])) + (int) sqrt((double) abs(input_buffer[j])))
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AS() const //(X+2Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] + 2 * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AT() const //(X+3Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] + 3 * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AU() const //(2X+3Y)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == 2 * input_buffer[i] + 3 * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math2in_AV() const //(XY^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < input_size; j++) {
- if (i == j) continue;
- if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j])
- return 1.0;
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AA() const //(X^2+Y^2+Z^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == input_buffer[i] * input_buffer[i] +
- input_buffer[j] * input_buffer[j] +
- input_buffer[k] * input_buffer[k]) return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AB() const //(sqrt(X)+sqrt(Y)+sqrt(Z))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (int) sqrt((double) abs(input_buffer[i])) +
- (int) sqrt((double) abs(input_buffer[j])) + (int) sqrt((double) abs(input_buffer[k])))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AC() const //(X+2Y+3Z)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == input_buffer[i] + 2 * input_buffer[j] +
- 3 * input_buffer[k]) return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AD() const //(XY^2+Z^3)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j] + input_buffer[k] * input_buffer[k] * input_buffer[k])
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AE() const //((X%Y)*Z)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (input_buffer[j] == 0) continue; // mod by zero
- if (test_output == input_buffer[i] % input_buffer[j] * input_buffer[k])
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AF() const //((X+Y)^2+sqrt(Y+Z))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (input_buffer[i] + input_buffer[j]) *
- (input_buffer[i] + input_buffer[j]) +
- (int) sqrt((double) abs(input_buffer[j] + input_buffer[k])))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AG() const //((XY)%(YZ))
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- int mod_base = input_buffer[j] * input_buffer[k];
- if (mod_base == 0) continue;
- if (test_output == (input_buffer[i] * input_buffer[j]) %
- mod_base) return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AH() const //(X+Y+Z)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == input_buffer[i] + input_buffer[j] + input_buffer[k])
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AI() const //(-X-Y-Z)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == 0 - input_buffer[i] - input_buffer[j] - input_buffer[k])
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AJ() const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[j] - input_buffer[k]) * (input_buffer[j] - input_buffer[k]) + (input_buffer[k] - input_buffer[i]) * (input_buffer[k] - input_buffer[i]))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AK() const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[j] + input_buffer[k]) * (input_buffer[j] + input_buffer[k]) + (input_buffer[k] + input_buffer[i]) * (input_buffer[k] + input_buffer[i]))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AL() const //((X-Y)^2+(X-Z)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[i] - input_buffer[k]) * (input_buffer[i] - input_buffer[k]))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_Math3in_AM() const //((X+Y)^2+(Y+Z)^2)
-{
- const int test_output = output_buffer[0];
- const int input_size = input_buffer.GetNumStored();
- for (int i = 0; i < input_size; i ++) {
- for (int j = 0; j < input_size; j ++) {
- for (int k = 0; k < input_size; k ++) {
- if (i == j || j == k || i == k) continue;
- if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[i] + input_buffer[k]) * (input_buffer[i] + input_buffer[k]))
- return 1.0;
- }
- }
- }
- return 0.0;
-}
-
-double cTaskLib::Task_CommEcho() const
-{
- const int test_output = output_buffer[0];
-
- tListIterator<tBuffer<int> > buff_it(other_input_buffers);
-
- while (buff_it.Next() != NULL) {
- tBuffer<int> & cur_buff = *(buff_it.Get());
- const int buff_size = cur_buff.GetNumStored();
- for (int i = 0; i < buff_size; i++) {
- if (test_output == cur_buff[i]) return 1.0;
- }
- }
-
- return 0.0;
-}
-
-double cTaskLib::Task_CommNot() const
-{
- const int test_output = output_buffer[0];
-
- tListIterator<tBuffer<int> > buff_it(other_input_buffers);
-
- while (buff_it.Next() != NULL) {
- tBuffer<int> & cur_buff = *(buff_it.Get());
- const int buff_size = cur_buff.GetNumStored();
- for (int i = 0; i < buff_size; i++) {
- if (test_output == (0-(cur_buff[i]+1))) return 1.0;
- }
- }
-
- return 0.0;
-}
\ No newline at end of file
Deleted: trunk/source/main/task_lib.hh
===================================================================
--- trunk/source/main/task_lib.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/main/task_lib.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,219 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef TASK_LIB_HH
-#define TASK_LIB_HH
-
-#ifndef TARRAY_HH
-#include "tArray.hh"
-#endif
-#ifndef TBUFFER_HH
-#include "tBuffer.hh"
-#endif
-#ifndef TLIST_HH
-#include "tList.hh"
-#endif
-
-class cTaskLib;
-typedef double (cTaskLib::*tTaskTest)() const;
-
-class cString;
-class cTaskEntry;
-class cTaskLib {
-private:
- tArray<cTaskEntry *> task_array;
-
- // What extra information should be sent along when we are evaluating
- // which tasks have been performed?
- bool use_neighbor_input;
- bool use_neighbor_output;
-
- // Active task information...
- mutable tBuffer<int> input_buffer;
- mutable tBuffer<int> output_buffer;
- mutable tList<tBuffer<int> > other_input_buffers;
- mutable tList<tBuffer<int> > other_output_buffers;
- mutable int logic_id;
-
- enum req_list { REQ_NEIGHBOR_INPUT=1,
- REQ_NEIGHBOR_OUTPUT=2,
- UNUSED_REQ_C=4,
- UNUSED_REQ_D=8 };
-private:
- // disabled copy constructor.
- cTaskLib(const cTaskLib &);
-public:
- cTaskLib();
- ~cTaskLib();
-
- int GetSize() const { return task_array.GetSize(); }
-
- cTaskEntry * AddTask(const cString & name);
- const cTaskEntry & GetTask(int id) const;
-
- void SetupTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs,
- const tList<tBuffer<int> > & other_inputs,
- const tList<tBuffer<int> > & other_outputs) const;
- double TestOutput(const cTaskEntry & task) const;
-
- bool UseNeighborInput() const { return use_neighbor_input; }
- bool UseNeighborOutput() const { return use_neighbor_output; }
-
-private: // Direct task related methods
- void NewTask(const cString & name, const cString & desc,
- tTaskTest task_fun, int reqs=0);
- void SetupLogicTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs) const;
-
- double Task_Echo() const;
- double Task_Add() const;
- double Task_Sub() const;
-
- // 1- and 2-Input Logic Tasks
- double Task_Not() const;
- double Task_Nand() const;
- double Task_And() const;
- double Task_OrNot() const;
- double Task_Or() const;
- double Task_AndNot() const;
- double Task_Nor() const;
- double Task_Xor() const;
- double Task_Equ() const;
-
- // 3-Input Logic Tasks
- double Task_Logic3in_AA() const;
- double Task_Logic3in_AB() const;
- double Task_Logic3in_AC() const;
- double Task_Logic3in_AD() const;
- double Task_Logic3in_AE() const;
- double Task_Logic3in_AF() const;
- double Task_Logic3in_AG() const;
- double Task_Logic3in_AH() const;
- double Task_Logic3in_AI() const;
- double Task_Logic3in_AJ() const;
- double Task_Logic3in_AK() const;
- double Task_Logic3in_AL() const;
- double Task_Logic3in_AM() const;
- double Task_Logic3in_AN() const;
- double Task_Logic3in_AO() const;
- double Task_Logic3in_AP() const;
- double Task_Logic3in_AQ() const;
- double Task_Logic3in_AR() const;
- double Task_Logic3in_AS() const;
- double Task_Logic3in_AT() const;
- double Task_Logic3in_AU() const;
- double Task_Logic3in_AV() const;
- double Task_Logic3in_AW() const;
- double Task_Logic3in_AX() const;
- double Task_Logic3in_AY() const;
- double Task_Logic3in_AZ() const;
- double Task_Logic3in_BA() const;
- double Task_Logic3in_BB() const;
- double Task_Logic3in_BC() const;
- double Task_Logic3in_BD() const;
- double Task_Logic3in_BE() const;
- double Task_Logic3in_BF() const;
- double Task_Logic3in_BG() const;
- double Task_Logic3in_BH() const;
- double Task_Logic3in_BI() const;
- double Task_Logic3in_BJ() const;
- double Task_Logic3in_BK() const;
- double Task_Logic3in_BL() const;
- double Task_Logic3in_BM() const;
- double Task_Logic3in_BN() const;
- double Task_Logic3in_BO() const;
- double Task_Logic3in_BP() const;
- double Task_Logic3in_BQ() const;
- double Task_Logic3in_BR() const;
- double Task_Logic3in_BS() const;
- double Task_Logic3in_BT() const;
- double Task_Logic3in_BU() const;
- double Task_Logic3in_BV() const;
- double Task_Logic3in_BW() const;
- double Task_Logic3in_BX() const;
- double Task_Logic3in_BY() const;
- double Task_Logic3in_BZ() const;
- double Task_Logic3in_CA() const;
- double Task_Logic3in_CB() const;
- double Task_Logic3in_CC() const;
- double Task_Logic3in_CD() const;
- double Task_Logic3in_CE() const;
- double Task_Logic3in_CF() const;
- double Task_Logic3in_CG() const;
- double Task_Logic3in_CH() const;
- double Task_Logic3in_CI() const;
- double Task_Logic3in_CJ() const;
- double Task_Logic3in_CK() const;
- double Task_Logic3in_CL() const;
- double Task_Logic3in_CM() const;
- double Task_Logic3in_CN() const;
- double Task_Logic3in_CO() const;
- double Task_Logic3in_CP() const;
-
- // 1-Input math tasks...
- double Task_Math1in_AA() const;
- double Task_Math1in_AB() const;
- double Task_Math1in_AC() const;
- double Task_Math1in_AD() const;
- double Task_Math1in_AE() const;
- double Task_Math1in_AF() const;
- double Task_Math1in_AG() const;
- double Task_Math1in_AH() const;
- double Task_Math1in_AI() const;
- double Task_Math1in_AJ() const;
- double Task_Math1in_AK() const;
- double Task_Math1in_AL() const;
- double Task_Math1in_AM() const;
- double Task_Math1in_AN() const;
- double Task_Math1in_AO() const;
- double Task_Math1in_AP() const;
-
- // 2-Input math tasks...
- double Task_Math2in_AA() const;
- double Task_Math2in_AB() const;
- double Task_Math2in_AC() const;
- double Task_Math2in_AD() const;
- double Task_Math2in_AE() const;
- double Task_Math2in_AF() const;
- double Task_Math2in_AG() const;
- double Task_Math2in_AH() const;
- double Task_Math2in_AI() const;
- double Task_Math2in_AJ() const;
- double Task_Math2in_AK() const;
- double Task_Math2in_AL() const;
- double Task_Math2in_AM() const;
- double Task_Math2in_AN() const;
- double Task_Math2in_AO() const;
- double Task_Math2in_AP() const;
- double Task_Math2in_AQ() const;
- double Task_Math2in_AR() const;
- double Task_Math2in_AS() const;
- double Task_Math2in_AT() const;
- double Task_Math2in_AU() const;
- double Task_Math2in_AV() const;
-
- double Task_Math3in_AA() const;
- double Task_Math3in_AB() const;
- double Task_Math3in_AC() const;
- double Task_Math3in_AD() const;
- double Task_Math3in_AE() const;
- double Task_Math3in_AF() const;
- double Task_Math3in_AG() const;
- double Task_Math3in_AH() const;
- double Task_Math3in_AI() const;
- double Task_Math3in_AJ() const;
- double Task_Math3in_AK() const;
- double Task_Math3in_AL() const;
- double Task_Math3in_AM() const;
-
- // Communication Tasks...
- double Task_CommEcho() const;
- double Task_CommNot() const;
-};
-
-#endif
Modified: trunk/source/testsuites/unit_testsuites/avida.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/avida.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/avida.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef TEST_CASE_H
#include "third-party/yaktest/cTestCase.hh"
Modified: trunk/source/testsuites/unit_testsuites/reaction.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/reaction.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/reaction.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef REACTION_HH
-#include "reaction.hh"
+#include "cReaction.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/reaction_lib.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/reaction_lib.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/reaction_lib.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef REACTION_LIB_HH
-#include "reaction_lib.hh"
+#include "cReactionLib.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/reaction_process.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/reaction_process.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/reaction_process.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef REACTION_PROCESS_HH
-#include "reaction_process.hh"
+#include "cReactionProcess.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/reaction_result.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/reaction_result.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/reaction_result.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef REACTION_RESULT_HH
-#include "reaction_result.hh"
+#include "cReactionResult.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/resource.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/resource.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/resource.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifdef RESOURCE_HH
-#include "resource.hh"
+#include "cResource.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/resource_count.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/resource_count.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/resource_count.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef RESOURCE_COUNT_HH
-#include "resource_count.hh"
+#include "cResourceCount.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/resource_lib.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/resource_lib.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/resource_lib.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef RESOURCE_LIB_HH
-#include "resource_lib.hh"
+#include "cResourceLib.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/spatial_count_elem.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/spatial_count_elem.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/spatial_count_elem.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef SPATIAL_COUNT_ELEM_HH
-#include "spatial_count_elem.hh"
+#include "cSpatialCountElem.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/spatial_res_count.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/spatial_res_count.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/spatial_res_count.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef SPATIAL_RES_COUNT_HH
-#include "spatial_res_count.hh"
+#include "cSpatialResCount.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/species.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/species.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/species.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef SPECIES_HH
-#include "species.hh"
+#include "cSpecies.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/species_control.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/species_control.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/species_control.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,7 +1,7 @@
#include <iostream>
#ifndef SPECIES_CONTROL_HH
-#include "species_control.hh"
+#include "cSpeciesControl.h"
#endif
#ifndef TEST_CASE_H
#include "third-party/yaktest/cTestCase.hh"
Modified: trunk/source/testsuites/unit_testsuites/species_queue.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/species_queue.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/species_queue.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,7 +1,7 @@
#include <iostream>
#ifndef SPECIES_QUEUE_HH
-#include "species_queue.hh"
+#include "cSpeciesQueue.h"
#endif
#ifndef TEST_CASE_H
#include "third-party/yaktest/cTestCase.hh"
Modified: trunk/source/testsuites/unit_testsuites/stats.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/stats.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/stats.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef STATS_HH
-#include "stats.hh"
+#include "cStats.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/task_entry.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/task_entry.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/task_entry.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
+#include "cTaskEntry.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/testsuites/unit_testsuites/task_lib.t.cc
===================================================================
--- trunk/source/testsuites/unit_testsuites/task_lib.t.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/testsuites/unit_testsuites/task_lib.t.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -1,5 +1,5 @@
#ifndef TASK_LIB_HH
-#include "task_lib.hh"
+#include "cTaskLib.h"
#endif
#ifndef TEST_CASE_H
Modified: trunk/source/viewers/bar_screen.cc
===================================================================
--- trunk/source/viewers/bar_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/bar_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -6,7 +6,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "cPopulation.h"
-#include "stats.hh"
+#include "cStats.h"
#include "cEnvironment.h"
#include "bar_screen.hh"
Modified: trunk/source/viewers/environment_screen.cc
===================================================================
--- trunk/source/viewers/environment_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/environment_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -11,16 +11,16 @@
#include "cGenotype.h"
#include "cPopulation.h"
#ifndef REACTION_HH
-#include "reaction.hh"
+#include "cReaction.h"
#endif
#ifndef REACTION_PROCESS_HH
-#include "reaction_process.hh"
+#include "cReactionProcess.h"
#endif
#ifndef RESOURCE_HH
-#include "resource.hh"
+#include "cResource.h"
#endif
-#include "species.hh"
-#include "stats.hh"
+#include "cSpecies.h"
+#include "cStats.h"
#include "cPopulationCell.h"
#include "cOrganism.h"
Modified: trunk/source/viewers/hist_screen.cc
===================================================================
--- trunk/source/viewers/hist_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/hist_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -9,7 +9,7 @@
#include "cGenebank.h"
#include "cGenotype.h"
-#include "species.hh"
+#include "cSpecies.h"
#include "hist_screen.hh"
Modified: trunk/source/viewers/stats_screen.cc
===================================================================
--- trunk/source/viewers/stats_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/stats_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -10,11 +10,11 @@
#include "cGenebank.h"
#include "cGenotype.h"
#include "cPopulation.h"
-#include "species.hh"
-#include "stats.hh"
+#include "cSpecies.h"
+#include "cStats.h"
#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
+#include "cTaskEntry.h"
#endif
#include "stats_screen.hh"
Modified: trunk/source/viewers/symbol_util.cc
===================================================================
--- trunk/source/viewers/symbol_util.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/symbol_util.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -12,7 +12,7 @@
#include "cGenotype.h"
#include "cOrganism.h"
#include "cPopulationCell.h"
-#include "species.hh"
+#include "cSpecies.h"
#include "cConfig.h"
#include "cHardwareBase.h"
#include "cHardware4Stack.h"
Modified: trunk/source/viewers/text_screen.cc
===================================================================
--- trunk/source/viewers/text_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/text_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -7,7 +7,7 @@
#include <fstream>
-#include "species.hh"
+#include "cSpecies.h"
#include "cGenotype.h"
#include "cGenebank.h"
#include "cInjectGenotype.h"
Modified: trunk/source/viewers/view.cc
===================================================================
--- trunk/source/viewers/view.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/view.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -15,7 +15,7 @@
#include "cPhenotype.h"
#include "cPopulation.h"
#include "cPopulationCell.h"
-#include "stats.hh"
+#include "cStats.h"
#include "cTestUtil.h"
#include "cHardwareBase.h"
Modified: trunk/source/viewers/viewer.hh
===================================================================
--- trunk/source/viewers/viewer.hh 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/viewer.hh 2005-10-06 23:02:07 UTC (rev 332)
@@ -9,7 +9,7 @@
#define VIEWERS_HH
#ifndef AVIDA_HH
-#include "avida.hh"
+#include "avida.h"
#endif
#ifndef AVIDA_DRIVER_ANALYZE_HH
Modified: trunk/source/viewers/zoom_screen.cc
===================================================================
--- trunk/source/viewers/zoom_screen.cc 2005-10-05 23:40:31 UTC (rev 331)
+++ trunk/source/viewers/zoom_screen.cc 2005-10-06 23:02:07 UTC (rev 332)
@@ -21,7 +21,7 @@
#include "string_util.hh"
#endif
#ifndef TASK_ENTRY_HH
-#include "task_entry.hh"
+#include "cTaskEntry.h"
#endif
#include "cHardwareCPU.h"
More information about the Avida-cvs
mailing list