From 22914c88621d620ed1397d860491587c559f75c2 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 10 Dec 2023 12:04:03 +0100 Subject: [PATCH 01/16] Update RELEASE-NOTES.md --- RELEASE-NOTES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index bc8d04291..598030721 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -2,10 +2,10 @@ ## [4.5.0] - 2023-12-09 ### Added -- engine, gui: entire statistics history are saved along with a simulation +- engine, gui: entire statistical history are saved along with a simulation - gui/statistics: configurable plot heights - gui/statistics: collapse specific plots -- gui/browser: statistics history are up/downloaded along with a simulation +- gui/browser: statistical history are up/downloaded along with a simulation - gui/sim view: draw boundaries of the world - Python script `FindFurtunateTimeline`: constantly monitors populations in a simulation and resort to savepoints in case of extinction From 64a3ef76c097b276eb74fff9b76e30ca771838bd Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 10 Dec 2023 12:06:58 +0100 Subject: [PATCH 02/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c4f165b0..cc52d8806 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Further information and artwork: An Nvidia graphics card with compute capability 6.0 or higher is needed. Please check [https://en.wikipedia.org/wiki/CUDA#GPUs_supported](https://en.wikipedia.org/wiki/CUDA#GPUs_supported). # 💽 Installer -Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2023-11-29) +Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2023-12-10) In the case that the program crashes for an unknown reason, please refer to the troubleshooting section in [alien-project.org/downloads.html](https://alien-project.org/downloads.html). From 6995dcdc78a0af946f9e0796092c1cd61ac1c01c Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 10 Dec 2023 12:25:09 +0100 Subject: [PATCH 03/16] vcpkg.json updated --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index dac285b46..38e04c025 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "alien", - "version": "4.4.3", + "version": "4.5.0", "dependencies": [ { "name": "glew", From 7332a52f6fb05d21cf319ae77f9c01304fdc18c2 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 10 Dec 2023 21:05:36 +0100 Subject: [PATCH 04/16] RELEASE-NOTES.MD: order corrected --- RELEASE-NOTES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 598030721..af2debca9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -12,13 +12,13 @@ ### Changed - gui/statistics: widgets for real time and time horizon parameter are aligned with the other widgets +### Removed +- export statistics function + ### Fixed - in simulation runs via CLI, certain simulation parameters are adjusted as in the GUI (e.g. if the max age balancer is switched on, external energy consumption) - wrong color conversion HSV -> RGB fixed (relevant for mutation and genome size coloring) -### Removed -- export statistics function - ## [4.4.3] - 2023-11-29 ### Added - show text background when rendering is disabled From 3b6f902b45aa664f76d293584a0b55b746fd2691 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 10 Dec 2023 21:47:21 +0100 Subject: [PATCH 05/16] statistics file for startup.sim --- resources/autosave.settings.json | 2 +- resources/autosave.statistics.csv | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 resources/autosave.statistics.csv diff --git a/resources/autosave.settings.json b/resources/autosave.settings.json index b9af67f29..551091115 100644 --- a/resources/autosave.settings.json +++ b/resources/autosave.settings.json @@ -1,6 +1,6 @@ { "general": { - "time step": "85540", + "time step": "0", "zoom": "1.16543949", "center": { "x": "918.00494385", diff --git a/resources/autosave.statistics.csv b/resources/autosave.statistics.csv new file mode 100644 index 000000000..3b90767d5 --- /dev/null +++ b/resources/autosave.statistics.csv @@ -0,0 +1,2 @@ +Time step, Cells (color 0), Cells (color 1), Cells (color 2), Cells (color 3), Cells (color 4), Cells (color 5), Cells (color 6), Cells (accumulated), Self-replicators (color 0), Self-replicators (color 1), Self-replicators (color 2), Self-replicators (color 3), Self-replicators (color 4), Self-replicators (color 5), Self-replicators (color 6), Self-replicators (accumulated), Viruses (color 0), Viruses (color 1), Viruses (color 2), Viruses (color 3), Viruses (color 4), Viruses (color 5), Viruses (color 6), Viruses (accumulated), Cell connections (color 0), Cell connections (color 1), Cell connections (color 2), Cell connections (color 3), Cell connections (color 4), Cell connections (color 5), Cell connections (color 6), Cell connections (accumulated), Energy particles (color 0), Energy particles (color 1), Energy particles (color 2), Energy particles (color 3), Energy particles (color 4), Energy particles (color 5), Energy particles (color 6), Energy particles (accumulated), Average genome cells (color 0), Average genome cells (color 1), Average genome cells (color 2), Average genome cells (color 3), Average genome cells (color 4), Average genome cells (color 5), Average genome cells (color 6), Average genome cells (accumulated), Total energy (color 0), Total energy (color 1), Total energy (color 2), Total energy (color 3), Total energy (color 4), Total energy (color 5), Total energy (color 6), Total energy (accumulated), Created cells (color 0), Created cells (color 1), Created cells (color 2), Created cells (color 3), Created cells (color 4), Created cells (color 5), Created cells (color 6), Created cells (accumulated), Attacks (color 0), Attacks (color 1), Attacks (color 2), Attacks (color 3), Attacks (color 4), Attacks (color 5), Attacks (color 6), Attacks (accumulated), Muscle activities (color 0), Muscle activities (color 1), Muscle activities (color 2), Muscle activities (color 3), Muscle activities (color 4), Muscle activities (color 5), Muscle activities (color 6), Muscle activities (accumulated), Transmitter activities (color 0), Transmitter activities (color 1), Transmitter activities (color 2), Transmitter activities (color 3), Transmitter activities (color 4), Transmitter activities (color 5), Transmitter activities (color 6), Transmitter activities (accumulated), Defender activities (color 0), Defender activities (color 1), Defender activities (color 2), Defender activities (color 3), Defender activities (color 4), Defender activities (color 5), Defender activities (color 6), Defender activities (accumulated), Injection activities (color 0), Injection activities (color 1), Injection activities (color 2), Injection activities (color 3), Injection activities (color 4), Injection activities (color 5), Injection activities (color 6), Injection activities (accumulated), Completed injections (color 0), Completed injections (color 1), Completed injections (color 2), Completed injections (color 3), Completed injections (color 4), Completed injections (color 5), Completed injections (color 6), Completed injections (accumulated), Nerve pulses (color 0), Nerve pulses (color 1), Nerve pulses (color 2), Nerve pulses (color 3), Nerve pulses (color 4), Nerve pulses (color 5), Nerve pulses (color 6), Nerve pulses (accumulated), Neuron activities (color 0), Neuron activities (color 1), Neuron activities (color 2), Neuron activities (color 3), Neuron activities (color 4), Neuron activities (color 5), Neuron activities (color 6), Neuron activities (accumulated), Sensor activities (color 0), Sensor activities (color 1), Sensor activities (color 2), Sensor activities (color 3), Sensor activities (color 4), Sensor activities (color 5), Sensor activities (color 6), Sensor activities (accumulated), Sensor matches (color 0), Sensor matches (color 1), Sensor matches (color 2), Sensor matches (color 3), Sensor matches (color 4), Sensor matches (color 5), Sensor matches (color 6), Sensor matches (accumulated), Reconnector creations (color 0), Reconnector creations (color 1), Reconnector creations (color 2), Reconnector creations (color 3), Reconnector creations (color 4), Reconnector creations (color 5), Reconnector creations (color 6), Reconnector creations (accumulated), Reconnector deletions (color 0), Reconnector deletions (color 1), Reconnector deletions (color 2), Reconnector deletions (color 3), Reconnector deletions (color 4), Reconnector deletions (color 5), Reconnector deletions (color 6), Reconnector deletions (accumulated), Detonations (color 0), Detonations (color 1), Detonations (color 2), Detonations (color 3), Detonations (color 4), Detonations (color 5), Detonations (color 6), Detonations (accumulated) +0.000000000,11655.000000000,20641.000000000,57811.000000000,7556.000000000,3508.000000000,0.000000000,0.000000000,101171.000000000,1467.000000000,1043.000000000,3606.000000000,0.000000000,0.000000000,0.000000000,0.000000000,6116.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,16917.000000000,38353.000000000,51978.000000000,8126.000000000,4775.000000000,0.000000000,0.000000000,120149.000000000,2939.000000000,8374.000000000,23402.000000000,2919.000000000,1425.000000000,0.000000000,0.000000000,39059.000000000,133.693933197,13.286673058,133.345535219,0.000000000,0.000000000,0.000000000,0.000000000,112.954708960,2048700.250000000,2464868.000000000,6648960.000000000,733101.937500000,430252.406250000,0.000000000,0.000000000,12325882.593750000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000 From 578bfb950ca5a4b52a9e94cd95e50cfc9ee473a2 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Thu, 14 Dec 2023 17:28:02 +0100 Subject: [PATCH 06/16] + executeForEachNodeRecursively extended in order to calculate non-separating parts + precision in statistics adapted --- .../EngineGpuKernels/ConstructorProcessor.cuh | 2 +- source/EngineGpuKernels/GenomeDecoder.cuh | 37 +++++++++++-------- source/EngineGpuKernels/MutationProcessor.cuh | 14 +++---- source/EngineGpuKernels/StatisticsKernels.cu | 2 +- source/Gui/SimulationParametersWindow.cpp | 4 +- source/Gui/StatisticsWindow.cpp | 2 +- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/source/EngineGpuKernels/ConstructorProcessor.cuh b/source/EngineGpuKernels/ConstructorProcessor.cuh index 53271b4ab..1aad83b91 100644 --- a/source/EngineGpuKernels/ConstructorProcessor.cuh +++ b/source/EngineGpuKernels/ConstructorProcessor.cuh @@ -365,7 +365,7 @@ ConstructorProcessor::startNewConstruction(SimulationData& data, SimulationStati if (GenomeDecoder::containsSelfReplication(constructor)) { constructor.offspringCreatureId = 1 + data.numberGen1.random(65535); - hostCell->genomeNumNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, toInt(constructor.genomeSize), true); + hostCell->genomeNumNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, toInt(constructor.genomeSize), true, true); } else { constructor.offspringCreatureId = hostCell->creatureId; } diff --git a/source/EngineGpuKernels/GenomeDecoder.cuh b/source/EngineGpuKernels/GenomeDecoder.cuh index bda47f607..71704d620 100644 --- a/source/EngineGpuKernels/GenomeDecoder.cuh +++ b/source/EngineGpuKernels/GenomeDecoder.cuh @@ -14,10 +14,10 @@ public: template __inline__ __device__ static void executeForEachNode(uint8_t* genome, int genomeSize, Func func); template - __inline__ __device__ static void executeForEachNodeRecursively(uint8_t* genome, int genomeSize, Func func); + __inline__ __device__ static void executeForEachNodeRecursively(uint8_t* genome, int genomeSize, bool includedSeparatedParts, Func func); __inline__ __device__ static GenomeHeader readGenomeHeader(ConstructorFunction const& constructor); __inline__ __device__ static int getGenomeDepth(uint8_t* genome, int genomeSize); - __inline__ __device__ static int getNumNodesRecursively(uint8_t* genome, int genomeSize, bool includeRepetitions); + __inline__ __device__ static int getNumNodesRecursively(uint8_t* genome, int genomeSize, bool includeRepetitions, bool includedSeparatedParts); __inline__ __device__ static int getRandomGenomeNodeAddress( SimulationData& data, uint8_t* genome, @@ -106,7 +106,7 @@ __inline__ __device__ void GenomeDecoder::executeForEachNode(uint8_t* genome, in } template -__inline__ __device__ void GenomeDecoder::executeForEachNodeRecursively(uint8_t* genome, int genomeSize, Func func) +__inline__ __device__ void GenomeDecoder::executeForEachNodeRecursively(uint8_t* genome, int genomeSize, bool includedSeparatedParts, Func func) { CHECK(genomeSize >= Const::GenomeHeaderSize) @@ -123,14 +123,19 @@ __inline__ __device__ void GenomeDecoder::executeForEachNodeRecursively(uint8_t* auto cellFunctionFixedBytes = cellFunction == CellFunction_Constructor ? Const::ConstructorFixedBytes : Const::InjectorFixedBytes; auto makeSelfCopy = GenomeDecoder::convertByteToBool(genome[nodeAddress + Const::CellBasicBytes + cellFunctionFixedBytes]); if (!makeSelfCopy) { - auto subGenomeSize = GenomeDecoder::getNextSubGenomeSize(genome, genomeSize, nodeAddress); - nodeAddress += Const::CellBasicBytes + cellFunctionFixedBytes + 3; - subGenomeEndAddresses[depth++] = nodeAddress + subGenomeSize; - - auto repetitions = getNumRepetitions(genome + nodeAddress, true); - subGenomeNumRepetitions[depth] = subGenomeNumRepetitions[depth - 1] * repetitions; - nodeAddress += Const::GenomeHeaderSize; - goToNextSibling = false; + auto deltaSubGenomeStartPos = Const::CellBasicBytes + cellFunctionFixedBytes + 3; + if (!includedSeparatedParts && GenomeDecoder::isSeparating(genome + nodeAddress + deltaSubGenomeStartPos)) { + //skip scanning sub-genome + } else { + auto subGenomeSize = GenomeDecoder::getNextSubGenomeSize(genome, genomeSize, nodeAddress); + nodeAddress += deltaSubGenomeStartPos; + subGenomeEndAddresses[depth++] = nodeAddress + subGenomeSize; + + auto repetitions = GenomeDecoder::getNumRepetitions(genome + nodeAddress, true); + subGenomeNumRepetitions[depth] = subGenomeNumRepetitions[depth - 1] * repetitions; + nodeAddress += Const::GenomeHeaderSize; + goToNextSibling = false; + } } } if (goToNextSibling) { @@ -151,17 +156,19 @@ __inline__ __device__ void GenomeDecoder::executeForEachNodeRecursively(uint8_t* __inline__ __device__ int GenomeDecoder::getGenomeDepth(uint8_t* genome, int genomeSize) { auto result = 0; - executeForEachNodeRecursively(genome, genomeSize, [&result](int depth, int nodeAddress, int repetition) { result = max(result, depth); }); + executeForEachNodeRecursively(genome, genomeSize, true, [&result](int depth, int nodeAddress, int repetition) { result = max(result, depth); }); return result; } -__inline__ __device__ int GenomeDecoder::getNumNodesRecursively(uint8_t* genome, int genomeSize, bool includeRepetitions) +__inline__ __device__ int GenomeDecoder::getNumNodesRecursively(uint8_t* genome, int genomeSize, bool includeRepetitions, bool includedSeparatedParts) { auto result = 0; if (!includeRepetitions) { - executeForEachNodeRecursively(genome, genomeSize, [&result](int depth, int nodeAddress, int repetitions) { ++result; }); + executeForEachNodeRecursively( + genome, genomeSize, includedSeparatedParts, [&result](int depth, int nodeAddress, int repetitions) { ++result; }); } else { - executeForEachNodeRecursively(genome, genomeSize, [&result](int depth, int nodeAddress, int repetitions) { result += repetitions; }); + executeForEachNodeRecursively( + genome, genomeSize, includedSeparatedParts, [&result](int depth, int nodeAddress, int repetitions) { result += repetitions; }); } return result; } diff --git a/source/EngineGpuKernels/MutationProcessor.cuh b/source/EngineGpuKernels/MutationProcessor.cuh index 4f5015940..dfa95dd64 100644 --- a/source/EngineGpuKernels/MutationProcessor.cuh +++ b/source/EngineGpuKernels/MutationProcessor.cuh @@ -166,10 +166,10 @@ __inline__ __device__ void MutationProcessor::propertiesMutation(SimulationData& auto& genome = constructor.genome; auto const& genomeSize = constructor.genomeSize; - auto numNodes = GenomeDecoder::getNumNodesRecursively(genome, genomeSize, false); + auto numNodes = GenomeDecoder::getNumNodesRecursively(genome, genomeSize, false, true); auto node = data.numberGen1.random(numNodes - 1); auto sequenceNumber = 0; - GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, [&](int depth, int nodeAddress, int repetition) { + GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, true, [&](int depth, int nodeAddress, int repetition) { if (sequenceNumber++ != node) { return; } @@ -284,10 +284,10 @@ __inline__ __device__ void MutationProcessor::customGeometryMutation(SimulationD auto& genome = constructor.genome; auto const& genomeSize = constructor.genomeSize; - auto numNodes = GenomeDecoder::getNumNodesRecursively(genome, genomeSize, false); + auto numNodes = GenomeDecoder::getNumNodesRecursively(genome, genomeSize, false, true); auto node = data.numberGen1.random(numNodes - 1); auto sequenceNumber = 0; - GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, [&](int depth, int nodeAddress, int repetition) { + GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, true, [&](int depth, int nodeAddress, int repetition) { if (sequenceNumber++ != node) { return; } @@ -395,7 +395,7 @@ __inline__ __device__ void MutationProcessor::insertMutation(SimulationData& dat //choose a random node position to a constructor with a subgenome int numConstructorsWithSubgenome = 0; - GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, [&](int depth, int nodeAddressIntern, int repetition) { + GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, true, [&](int depth, int nodeAddressIntern, int repetition) { auto cellFunctionType = GenomeDecoder::getNextCellFunctionType(genome, nodeAddressIntern); if (cellFunctionType == CellFunction_Constructor && !GenomeDecoder::isNextCellSelfReplication(genome, nodeAddressIntern)) { ++numConstructorsWithSubgenome; @@ -404,7 +404,7 @@ __inline__ __device__ void MutationProcessor::insertMutation(SimulationData& dat if (numConstructorsWithSubgenome > 0) { auto randomIndex = data.numberGen1.random(numConstructorsWithSubgenome - 1); int counter = 0; - GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, [&](int depth, int nodeAddressIntern, int repetition) { + GenomeDecoder::executeForEachNodeRecursively(genome, genomeSize, true, [&](int depth, int nodeAddressIntern, int repetition) { auto cellFunctionType = GenomeDecoder::getNextCellFunctionType(genome, nodeAddressIntern); if (cellFunctionType == CellFunction_Constructor && !GenomeDecoder::isNextCellSelfReplication(genome, nodeAddressIntern)) { if (randomIndex == counter) { @@ -760,7 +760,7 @@ __inline__ __device__ void MutationProcessor::uniformColorMutation(SimulationDat } GenomeDecoder::executeForEachNodeRecursively( - genome, genomeSize, [&](int depth, int nodeAddress, int repetition) { GenomeDecoder::setNextCellColor(genome, nodeAddress, newColor); }); + genome, genomeSize, true, [&](int depth, int nodeAddress, int repetition) { GenomeDecoder::setNextCellColor(genome, nodeAddress, newColor); }); } __inline__ __device__ bool MutationProcessor::adaptMutationId(SimulationData& data, ConstructorFunction& constructor) diff --git a/source/EngineGpuKernels/StatisticsKernels.cu b/source/EngineGpuKernels/StatisticsKernels.cu index 0e96dfc44..9e66199ef 100644 --- a/source/EngineGpuKernels/StatisticsKernels.cu +++ b/source/EngineGpuKernels/StatisticsKernels.cu @@ -20,7 +20,7 @@ __global__ void cudaUpdateTimestepStatistics_substep2(SimulationData data, Simul statistics.addEnergy(cell->color, cell->energy); if (cell->cellFunction == CellFunction_Constructor && GenomeDecoder::containsSelfReplication(cell->cellFunctionData.constructor)) { statistics.incNumReplicator(cell->color); - auto numNodes = GenomeDecoder::getNumNodesRecursively(cell->cellFunctionData.constructor.genome, cell->cellFunctionData.constructor.genomeSize, true); + auto numNodes = GenomeDecoder::getNumNodesRecursively(cell->cellFunctionData.constructor.genome, cell->cellFunctionData.constructor.genomeSize, true, true); statistics.addNumGenomeNodes(cell->color, numNodes); } if (cell->cellFunction == CellFunction_Injector && GenomeDecoder::containsSelfReplication(cell->cellFunctionData.injector)) { diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index 3732a7892..0b41eaf80 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -598,8 +598,8 @@ void _SimulationParametersWindow::processBase( .name("Cell network decay") .textWidth(RightColumnWidth) .defaultValue(origSimParameters.clusterDecay) - .tooltip("If enabled, entire cell networks will disintegrate when one of their cells is dying because of insufficient energy. This option " - "is useful to minimize the presence of cell corpses."), + .tooltip("If enabled, entire cell networks will disintegrate when one of their cells is dying because of insufficient energy or exceeding " + "the max. age. Furthermore, the dying process is much slower. This option is useful to minimize the presence of damaged cell networks."), simParameters.clusterDecay); ImGui::TreePop(); } diff --git a/source/Gui/StatisticsWindow.cpp b/source/Gui/StatisticsWindow.cpp index 72c108549..fb74c16e5 100644 --- a/source/Gui/StatisticsWindow.cpp +++ b/source/Gui/StatisticsWindow.cpp @@ -289,7 +289,7 @@ void _StatisticsWindow::processTimelineStatistics() ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - processPlot(row++, &DataPointCollection::numDetonations, 6); + processPlot(row++, &DataPointCollection::numDetonations, 8); ImGui::TableSetColumnIndex(1); AlienImGui::Text("Detonations"); From fc63edce91ec9411c22e597cdad941a95784599e Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Thu, 14 Dec 2023 18:26:10 +0100 Subject: [PATCH 07/16] completeness check compares connected genome nodes and number of actual connected cells --- source/Base/Resources.h | 2 +- .../EngineGpuKernels/ConstructorProcessor.cuh | 18 +++++++----------- source/EngineGpuKernels/GenomeDecoder.cuh | 2 +- source/EngineGpuKernels/MutationProcessor.cuh | 4 ++-- source/EngineInterface/GenomeConstants.h | 2 -- vcpkg.json | 2 +- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/source/Base/Resources.h b/source/Base/Resources.h index 177b98239..bbf9a8177 100644 --- a/source/Base/Resources.h +++ b/source/Base/Resources.h @@ -2,7 +2,7 @@ namespace Const { - std::string const ProgramVersion = "4.5.0"; + std::string const ProgramVersion = "4.5.1"; std::string const DiscordLink = "https://discord.gg/7bjyZdXXQ2"; std::string const BasePath = "resources/"; diff --git a/source/EngineGpuKernels/ConstructorProcessor.cuh b/source/EngineGpuKernels/ConstructorProcessor.cuh index 1aad83b91..535567500 100644 --- a/source/EngineGpuKernels/ConstructorProcessor.cuh +++ b/source/EngineGpuKernels/ConstructorProcessor.cuh @@ -100,6 +100,9 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat constructor.isComplete = true; return; } + + auto numConnectedGenomeNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, constructor.genomeSize, true, false); + auto constexpr ContainerSize = 256; Cell* temp[ContainerSize * 2]; HashSet> visitedCells(ContainerSize * 2, temp); @@ -110,7 +113,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat auto connectionIndex = 0; Cell* lastCells[ContainerSize]; int lastIndices[ContainerSize]; - + int scannedCells = 1; do { auto goBack = false; if (connectionIndex < currentCell->numConnections) { @@ -120,14 +123,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat if (nextCell->creatureId != cell->creatureId) { goBack = true; } else { - if (nextCell->cellFunction == CellFunction_Constructor && !GenomeDecoder::hasEmptyGenome(nextCell->cellFunctionData.constructor) - && !nextCell->cellFunctionData.constructor.isConstructionBuilt - && !GenomeDecoder::containsSectionSelfReplication( - nextCell->cellFunctionData.constructor.genome + Const::GenomeHeaderSize, - nextCell->cellFunctionData.constructor.genomeSize - Const::GenomeHeaderSize)) { - constructor.isComplete = false; - return; - } + ++scannedCells; lastCells[depth] = currentCell; lastIndices[depth] = connectionIndex; currentCell = nextCell; @@ -153,7 +149,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat } } while (true); - constructor.isComplete = true; + constructor.isComplete = scannedCells == numConnectedGenomeNodes; } __inline__ __device__ void ConstructorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) @@ -365,7 +361,7 @@ ConstructorProcessor::startNewConstruction(SimulationData& data, SimulationStati if (GenomeDecoder::containsSelfReplication(constructor)) { constructor.offspringCreatureId = 1 + data.numberGen1.random(65535); - hostCell->genomeNumNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, toInt(constructor.genomeSize), true, true); + hostCell->genomeNumNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, toInt(constructor.genomeSize), true, false); } else { constructor.offspringCreatureId = hostCell->creatureId; } diff --git a/source/EngineGpuKernels/GenomeDecoder.cuh b/source/EngineGpuKernels/GenomeDecoder.cuh index 71704d620..aba1e25f3 100644 --- a/source/EngineGpuKernels/GenomeDecoder.cuh +++ b/source/EngineGpuKernels/GenomeDecoder.cuh @@ -621,7 +621,7 @@ __inline__ __device__ void GenomeDecoder::setNextConstructionAngle2(uint8_t* gen __inline__ __device__ void GenomeDecoder::setNextConstructorSeparation(uint8_t* genome, int nodeAddress, bool separation) { - genome[nodeAddress + Const::CellBasicBytes + Const::ConstructorFixedBytes + 3 + Const::ConstructorSeparation] = convertBoolToByte(separation); + genome[nodeAddress + Const::CellBasicBytes + Const::ConstructorFixedBytes + 3 + Const::GenomeHeaderSeparationPos] = convertBoolToByte(separation); } __inline__ __device__ int GenomeDecoder::getNextSubGenomeSize(uint8_t* genome, int genomeSize, int nodeAddress) diff --git a/source/EngineGpuKernels/MutationProcessor.cuh b/source/EngineGpuKernels/MutationProcessor.cuh index dfa95dd64..e4937f009 100644 --- a/source/EngineGpuKernels/MutationProcessor.cuh +++ b/source/EngineGpuKernels/MutationProcessor.cuh @@ -365,7 +365,7 @@ __inline__ __device__ void MutationProcessor::cellFunctionMutation(SimulationDat GenomeDecoder::setNextCellFunctionType(targetGenome, nodeAddress, newCellFunction); GenomeDecoder::setRandomCellFunctionData(data, targetGenome, nodeAddress + Const::CellBasicBytes, newCellFunction, makeSelfCopy, Const::GenomeHeaderSize); if (newCellFunction == CellFunction_Constructor && !makeSelfCopy) { - GenomeDecoder::setNextConstructorSeparation(targetGenome, nodeAddress, false); //currently no subgenome with separation property wished + GenomeDecoder::setNextConstructorSeparation(targetGenome, nodeAddress, false); //currently no sub-genome with separation property wished } for (int i = nodeAddress + Const::CellBasicBytes + origCellFunctionSize; i < genomeSize; ++i) { @@ -449,7 +449,7 @@ __inline__ __device__ void MutationProcessor::insertMutation(SimulationData& dat GenomeDecoder::setNextCellColor(targetGenome, nodeAddress, newColor); GenomeDecoder::setRandomCellFunctionData(data, targetGenome, nodeAddress + Const::CellBasicBytes, newCellFunction, makeSelfCopy, Const::GenomeHeaderSize); if (newCellFunction == CellFunction_Constructor && !makeSelfCopy) { - GenomeDecoder::setNextConstructorSeparation(targetGenome, nodeAddress, false); //currently no subgenome with separation property wished + GenomeDecoder::setNextConstructorSeparation(targetGenome, nodeAddress, false); //currently no sub-genome with separation property wished } for (int i = nodeAddress; i < genomeSize; ++i) { diff --git a/source/EngineInterface/GenomeConstants.h b/source/EngineInterface/GenomeConstants.h index 997918083..a1835037e 100644 --- a/source/EngineInterface/GenomeConstants.h +++ b/source/EngineInterface/GenomeConstants.h @@ -22,8 +22,6 @@ namespace Const auto constexpr ConstructorConstructionAngle1Pos = 3; auto constexpr ConstructorConstructionAngle2Pos = 4; - auto constexpr ConstructorSeparation = 2; - auto constexpr CellBasicBytes = 8; auto constexpr NeuronBytes = 64 + 8 + 8; auto constexpr TransmitterBytes = 1; diff --git a/vcpkg.json b/vcpkg.json index 38e04c025..21ee190ec 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "alien", - "version": "4.5.0", + "version": "4.5.1", "dependencies": [ { "name": "glew", From 4888f515411669390e0bab5d484a184ae67ebd55 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Thu, 14 Dec 2023 18:38:07 +0100 Subject: [PATCH 08/16] ConstructorProcessor.cuh reverted (last commit) --- .../EngineGpuKernels/ConstructorProcessor.cuh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/EngineGpuKernels/ConstructorProcessor.cuh b/source/EngineGpuKernels/ConstructorProcessor.cuh index 535567500..5c07802b8 100644 --- a/source/EngineGpuKernels/ConstructorProcessor.cuh +++ b/source/EngineGpuKernels/ConstructorProcessor.cuh @@ -89,7 +89,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat { auto& constructor = cell->cellFunctionData.constructor; if (!GenomeDecoder::isFirstNode(constructor)) { - return; + return; } auto activity = CellFunctionProcessor::calcInputActivity(cell); if (!isConstructionTriggered(data, cell, activity)) { @@ -100,9 +100,6 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat constructor.isComplete = true; return; } - - auto numConnectedGenomeNodes = GenomeDecoder::getNumNodesRecursively(constructor.genome, constructor.genomeSize, true, false); - auto constexpr ContainerSize = 256; Cell* temp[ContainerSize * 2]; HashSet> visitedCells(ContainerSize * 2, temp); @@ -113,7 +110,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat auto connectionIndex = 0; Cell* lastCells[ContainerSize]; int lastIndices[ContainerSize]; - int scannedCells = 1; + do { auto goBack = false; if (connectionIndex < currentCell->numConnections) { @@ -123,7 +120,14 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat if (nextCell->creatureId != cell->creatureId) { goBack = true; } else { - ++scannedCells; + if (nextCell->cellFunction == CellFunction_Constructor && !GenomeDecoder::hasEmptyGenome(nextCell->cellFunctionData.constructor) + && !nextCell->cellFunctionData.constructor.isConstructionBuilt + && !GenomeDecoder::containsSectionSelfReplication( + nextCell->cellFunctionData.constructor.genome + Const::GenomeHeaderSize, + nextCell->cellFunctionData.constructor.genomeSize - Const::GenomeHeaderSize)) { + constructor.isComplete = false; + return; + } lastCells[depth] = currentCell; lastIndices[depth] = connectionIndex; currentCell = nextCell; @@ -149,7 +153,7 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat } } while (true); - constructor.isComplete = scannedCells == numConnectedGenomeNodes; + constructor.isComplete = true; } __inline__ __device__ void ConstructorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) From 124aa69e525666a75152214517762afbc38889e0 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 15:33:59 +0100 Subject: [PATCH 09/16] color matrix layout correction --- source/Gui/AlienImGui.cpp | 23 ++++++++++------------- source/Gui/SimulationView.cpp | 1 + 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/source/Gui/AlienImGui.cpp b/source/Gui/AlienImGui.cpp index a2afbe429..7b321b795 100644 --- a/source/Gui/AlienImGui.cpp +++ b/source/Gui/AlienImGui.cpp @@ -1675,15 +1675,16 @@ void AlienImGui::BasicInputColorMatrix(BasicInputColorMatrixParameters const& if (isExpanded) { ImGui::BeginGroup(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + scale(130.0f)); - ImGui::Text("[target color]"); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + scale(115.0f)); + ImGui::Text("[target cell color]"); auto startPos = ImGui::GetCursorPos(); - ImGui::SetCursorPos({startPos.x - scale(48), startPos.y + scale(105)}); - RotateStart(ImGui::GetWindowDrawList()); - ImGui::Text("[host color]"); - RotateEnd(90.0f, ImGui::GetWindowDrawList()); + ImGui::SetCursorPos({startPos.x - scale(48), startPos.y + scale(121)}); + auto drawList = ImGui::GetWindowDrawList(); + RotateStart(drawList); + ImGui::Text("[cell color]"); + RotateEnd(90.0f, drawList); ImGui::SetCursorPos(startPos); @@ -1698,12 +1699,8 @@ void AlienImGui::BasicInputColorMatrix(BasicInputColorMatrixParameters const& ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (row == 0 && col > 0) { - ImVec2 pos = ImGui::GetCursorScreenPos(); - ImGui::SetCursorScreenPos(ImVec2(pos.x, pos.y + ImGui::GetStyle().FramePadding.y)); ColorField(Const::IndividualCellColors[col - 1], -1); } else if (row > 0 && col == 0) { - ImVec2 pos = ImGui::GetCursorScreenPos(); - ImGui::SetCursorScreenPos(ImVec2(pos.x, pos.y + ImGui::GetStyle().FramePadding.y)); ColorField(Const::IndividualCellColors[row - 1], -1); } else if (row > 0 && col > 0) { if constexpr (std::is_same()) { @@ -1810,14 +1807,14 @@ void AlienImGui::BasicInputColorMatrix(BasicInputColorMatrixParameters const& //>>>>>>>>>> void AlienImGui::RotateStart(ImDrawList* drawList) { - _rotationStartIndex = ImGui::GetBackgroundDrawList()->VtxBuffer.Size; + _rotationStartIndex = drawList->VtxBuffer.Size; } ImVec2 AlienImGui::RotationCenter(ImDrawList* drawList) { ImVec2 l(FLT_MAX, FLT_MAX), u(-FLT_MAX, -FLT_MAX); // bounds - const auto& buf = ImGui::GetBackgroundDrawList()->VtxBuffer; + const auto& buf = drawList->VtxBuffer; for (int i = _rotationStartIndex; i < buf.Size; i++) l = ImMin(l, buf[i].pos), u = ImMax(u, buf[i].pos); @@ -1838,7 +1835,7 @@ void AlienImGui::RotateEnd(float angle, ImDrawList* drawList) float s = sin((angle + 90.0f) * Const::DegToRad), c = cos((angle + 90.0f) * Const::DegToRad); center = ImRotate(center, s, c) - center; - auto& buf = ImGui::GetBackgroundDrawList()->VtxBuffer; + auto& buf = drawList->VtxBuffer; for (int i = _rotationStartIndex; i < buf.Size; i++) { buf[i].pos = ImRotate(buf[i].pos, s, c) - center; } diff --git a/source/Gui/SimulationView.cpp b/source/Gui/SimulationView.cpp index 56cfa0c0d..c4e7e4610 100644 --- a/source/Gui/SimulationView.cpp +++ b/source/Gui/SimulationView.cpp @@ -1,5 +1,6 @@ #include "SimulationView.h" +#include #include #include #include From d8c52bb5559ebfb3b4f1f437d5f247146029a21c Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 16:48:41 +0100 Subject: [PATCH 10/16] energy and min/normal cell parameter validation --- source/EngineImpl/DescriptionConverter.cpp | 14 +++++++++++++- source/Gui/SimulationParametersWindow.cpp | 6 ++++-- source/Gui/SimulationParametersWindow.h | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/source/EngineImpl/DescriptionConverter.cpp b/source/EngineImpl/DescriptionConverter.cpp index 82d30f5e5..7d2f4cab4 100644 --- a/source/EngineImpl/DescriptionConverter.cpp +++ b/source/EngineImpl/DescriptionConverter.cpp @@ -505,6 +505,16 @@ CellDescription DescriptionConverter::createCellDescription(DataTO const& dataTO return result; } +namespace +{ + void checkAndCorrectInvalidEnergy(float& energy) + { + if (std::isnan(energy) || energy < 0 || energy > 1e12) { + energy = 0; + } + } +} + void DescriptionConverter::addParticle(DataTO const& dataTO, ParticleDescription const& particleDesc) const { auto particleIndex = (*dataTO.numParticles)++; @@ -513,7 +523,8 @@ void DescriptionConverter::addParticle(DataTO const& dataTO, ParticleDescription particleTO.id = particleDesc.id == 0 ? NumberGenerator::getInstance().getId() : particleDesc.id; particleTO.pos = {particleDesc.pos.x, particleDesc.pos.y}; particleTO.vel = {particleDesc.vel.x, particleDesc.vel.y}; - particleTO.energy = particleDesc.energy; + particleTO.energy = particleDesc.energy; + checkAndCorrectInvalidEnergy(particleTO.energy); particleTO.color = particleDesc.color; } @@ -526,6 +537,7 @@ void DescriptionConverter::addCell( cellTO.pos= { cellDesc.pos.x, cellDesc.pos.y }; cellTO.vel = {cellDesc.vel.x, cellDesc.vel.y}; cellTO.energy = cellDesc.energy; + checkAndCorrectInvalidEnergy(cellTO.energy); cellTO.stiffness = cellDesc.stiffness; cellTO.maxConnections = cellDesc.maxConnections; cellTO.executionOrderNumber = cellDesc.executionOrderNumber; diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index 0b41eaf80..45759f169 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -1832,7 +1832,7 @@ void _SimulationParametersWindow::processSpot( } } ImGui::EndChild(); - validationAndCorrection(spot); + validationAndCorrection(spot, parameters); } void _SimulationParametersWindow::onOpenParameters() @@ -1884,13 +1884,14 @@ void _SimulationParametersWindow::validationAndCorrection(SimulationParameters& parameters.cellFunctionConstructorExternalEnergy[i] = std::max(0.0f, parameters.cellFunctionConstructorExternalEnergy[i]); parameters.cellFunctionConstructorExternalEnergySupplyRate[i] = std::max(0.0f, std::min(1.0f, parameters.cellFunctionConstructorExternalEnergySupplyRate[i])); + parameters.baseValues.cellMinEnergy[i] = std::min(parameters.baseValues.cellMinEnergy[i], parameters.cellNormalEnergy[i] * 0.95f); } parameters.baseValues.cellMaxBindingEnergy = std::max(10.0f, parameters.baseValues.cellMaxBindingEnergy); parameters.timestepSize = std::max(0.0f, parameters.timestepSize); parameters.cellMaxAgeBalancerInterval = std::max(1000, std::min(1000000, parameters.cellMaxAgeBalancerInterval)); } -void _SimulationParametersWindow::validationAndCorrection(SimulationParametersSpot& spot) const +void _SimulationParametersWindow::validationAndCorrection(SimulationParametersSpot& spot, SimulationParameters const& parameters) const { for (int i = 0; i < MAX_COLORS; ++i) { for (int j = 0; j < MAX_COLORS; ++j) { @@ -1898,6 +1899,7 @@ void _SimulationParametersWindow::validationAndCorrection(SimulationParametersSp std::max(0.0f, std::min(1.0f, spot.values.cellFunctionAttackerFoodChainColorMatrix[i][j])); } spot.values.radiationAbsorption[i] = std::max(0.0f, std::min(1.0f, spot.values.radiationAbsorption[i])); + spot.values.cellMinEnergy[i] = std::min(parameters.baseValues.cellMinEnergy[i], parameters.cellNormalEnergy[i] * 0.95f); } spot.values.cellMaxBindingEnergy = std::max(10.0f, spot.values.cellMaxBindingEnergy); } diff --git a/source/Gui/SimulationParametersWindow.h b/source/Gui/SimulationParametersWindow.h index 52f78e3d7..f390ad4cc 100644 --- a/source/Gui/SimulationParametersWindow.h +++ b/source/Gui/SimulationParametersWindow.h @@ -26,7 +26,7 @@ class _SimulationParametersWindow : public _AlienWindow void onSaveParameters(); void validationAndCorrection(SimulationParameters& parameters) const; - void validationAndCorrection(SimulationParametersSpot& spot) const; + void validationAndCorrection(SimulationParametersSpot& spot, SimulationParameters const& parameters) const; SimulationController _simController; RadiationSourcesWindow _radiationSourcesWindow; From caf245d9d63ccfb486dd0d059febaba619c7b24e Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 17:10:23 +0100 Subject: [PATCH 11/16] new parameter: radiationAbsorptionLowConnectionPenalty --- source/EngineGpuKernels/ParticleProcessor.cuh | 1 + .../AuxiliaryDataParserService.cpp | 6 ++++++ source/EngineInterface/SimulationParameters.h | 4 ++++ source/Gui/SimulationParametersWindow.cpp | 15 ++++++++++++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/source/EngineGpuKernels/ParticleProcessor.cuh b/source/EngineGpuKernels/ParticleProcessor.cuh index be6241242..7de2f33fc 100644 --- a/source/EngineGpuKernels/ParticleProcessor.cuh +++ b/source/EngineGpuKernels/ParticleProcessor.cuh @@ -101,6 +101,7 @@ __inline__ __device__ void ParticleProcessor::collision(SimulationData& data) auto energyToTransfer = particle->energy * radiationAbsorption; energyToTransfer *= max(0.0f, 1.0f - Math::length(cell->vel) * cudaSimulationParameters.radiationAbsorptionVelocityPenalty[cell->color]); + energyToTransfer *= powf(toFloat(cell->numConnections + 1) / 7.0f, cudaSimulationParameters.radiationAbsorptionLowConnectionPenalty[cell->color]); if (particle->energy < 1) { diff --git a/source/EngineInterface/AuxiliaryDataParserService.cpp b/source/EngineInterface/AuxiliaryDataParserService.cpp index 4f4375ff8..97b08c6dc 100644 --- a/source/EngineInterface/AuxiliaryDataParserService.cpp +++ b/source/EngineInterface/AuxiliaryDataParserService.cpp @@ -259,6 +259,12 @@ namespace defaultParameters.radiationAbsorptionVelocityPenalty, "simulation parameters.radiation.absorption velocity penalty", parserTask); + encodeDecodeProperty( + tree, + parameters.radiationAbsorptionLowConnectionPenalty, + defaultParameters.radiationAbsorptionLowConnectionPenalty, + "simulation parameters.radiation.absorption low connection penalty", + parserTask); encodeDecodeProperty( tree, parameters.highRadiationMinCellEnergy, diff --git a/source/EngineInterface/SimulationParameters.h b/source/EngineInterface/SimulationParameters.h index b21b5bcc0..e9cd40a1e 100644 --- a/source/EngineInterface/SimulationParameters.h +++ b/source/EngineInterface/SimulationParameters.h @@ -48,6 +48,7 @@ struct SimulationParameters float radiationVelocityPerturbation = 0.5f; ColorVector radiationMinCellAge = {0, 0, 0, 0, 0, 0, 0}; ColorVector radiationAbsorptionVelocityPenalty = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; + ColorVector radiationAbsorptionLowConnectionPenalty = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; ColorVector highRadiationFactor = {0, 0, 0, 0, 0, 0, 0}; ColorVector highRadiationMinCellEnergy = {500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f}; bool clusterDecay = false; @@ -185,6 +186,9 @@ struct SimulationParameters if (radiationAbsorptionVelocityPenalty[i] != other.radiationAbsorptionVelocityPenalty[i]) { return false; } + if (radiationAbsorptionLowConnectionPenalty[i] != other.radiationAbsorptionLowConnectionPenalty[i]) { + return false; + } if (cellFunctionInjectorRadius[i] != other.cellFunctionInjectorRadius[i]) { return false; } diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index 45759f169..fbb82b50a 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -463,6 +463,17 @@ void _SimulationParametersWindow::processBase( .defaultValue(origSimParameters.baseValues.radiationAbsorption) .tooltip("The fraction of energy that a cell can absorb from an incoming energy particle can be specified here."), simParameters.baseValues.radiationAbsorption); + AlienImGui::SliderFloat( + AlienImGui::SliderFloatParameters() + .name("Absorption low connection penalty") + .textWidth(RightColumnWidth) + .colorDependence(true) + .min(0) + .max(5.0f) + .format("%.1f") + .defaultValue(origSimParameters.radiationAbsorptionLowConnectionPenalty) + .tooltip("When this parameter is increased, cells with fewer cell connections will absorb less energy from an incoming energy particle."), + simParameters.radiationAbsorptionLowConnectionPenalty); AlienImGui::SliderFloat( AlienImGui::SliderFloatParameters() .name("Absorption velocity penalty") @@ -473,7 +484,7 @@ void _SimulationParametersWindow::processBase( .logarithmic(true) .format("%.1f") .defaultValue(origSimParameters.radiationAbsorptionVelocityPenalty) - .tooltip("When this parameter is increased, cells with higher velocity can absorb less energy from an incoming energy particle."), + .tooltip("When this parameter is increased, cells with higher velocity will absorb less energy from an incoming energy particle."), simParameters.radiationAbsorptionVelocityPenalty); AlienImGui::SliderFloat( AlienImGui::SliderFloatParameters() @@ -1877,6 +1888,8 @@ void _SimulationParametersWindow::validationAndCorrection(SimulationParameters& parameters.cellFunctionAttackerGenomeSizeBonus[i][j] = std::max(0.0f, parameters.cellFunctionAttackerGenomeSizeBonus[i][j]); } parameters.baseValues.radiationAbsorption[i] = std::max(0.0f, std::min(1.0f, parameters.baseValues.radiationAbsorption[i])); + parameters.radiationAbsorptionVelocityPenalty[i] = std::max(0.0f, parameters.radiationAbsorptionVelocityPenalty[i]); + parameters.radiationAbsorptionLowConnectionPenalty[i] = std::max(0.0f, parameters.radiationAbsorptionLowConnectionPenalty[i]); parameters.cellFunctionConstructorPumpEnergyFactor[i] = std::max(0.0f, std::min(1.0f, parameters.cellFunctionConstructorPumpEnergyFactor[i])); parameters.cellFunctionAttackerSensorDetectionFactor[i] = std::max(0.0f, std::min(1.0f, parameters.cellFunctionAttackerSensorDetectionFactor[i])); parameters.cellFunctionDetonatorChainExplosionProbability[i] = From e44cf1d33a5bd97db4ee3c7189a039eba3e58ca8 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 17:29:13 +0100 Subject: [PATCH 12/16] GCC compile error fixed --- source/EngineImpl/DescriptionConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/EngineImpl/DescriptionConverter.cpp b/source/EngineImpl/DescriptionConverter.cpp index 7d2f4cab4..64923e6a2 100644 --- a/source/EngineImpl/DescriptionConverter.cpp +++ b/source/EngineImpl/DescriptionConverter.cpp @@ -509,7 +509,7 @@ namespace { void checkAndCorrectInvalidEnergy(float& energy) { - if (std::isnan(energy) || energy < 0 || energy > 1e12) { + if (isnan(energy) || energy < 0 || energy > 1e12) { energy = 0; } } From bf754e654e90b2af71a8841892cd853ab8d7598a Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 18:20:49 +0100 Subject: [PATCH 13/16] make decay rate configurable --- source/EngineGpuKernels/CellProcessor.cuh | 6 ++---- source/Gui/SimulationParametersWindow.cpp | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/EngineGpuKernels/CellProcessor.cuh b/source/EngineGpuKernels/CellProcessor.cuh index 8b11e3bd3..43444f2e4 100644 --- a/source/EngineGpuKernels/CellProcessor.cuh +++ b/source/EngineGpuKernels/CellProcessor.cuh @@ -745,16 +745,14 @@ __inline__ __device__ void CellProcessor::decay(SimulationData& data) auto cellMaxAge = cudaSimulationParameters.cellMaxAge[cell->color]; if (cellMaxAge > 0 && cell->age > cellMaxAge) { - if (data.timestep % 20 == index % 20) { //slow down destruction process to avoid too many deletion jobs - cellDestruction = true; - } + cellDestruction = true; } if (cellDestruction) { if (cudaSimulationParameters.clusterDecay) { cell->livingState = LivingState_Dying; } else { - if (data.timestep % 20 == index % 20) { //slow down destruction process to avoid too many deletion jobs + if (data.numberGen1.random() < cudaSimulationParameters.clusterDecayProb[cell->color]) { CellConnectionProcessor::scheduleDeleteCell(data, index); } } diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index fbb82b50a..f642bd395 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -604,13 +604,27 @@ void _SimulationParametersWindow::processBase( ICON_FA_CARET_RIGHT" If the transformation of energy particles to " "cells is activated, an energy particle will transform into a cell if the energy of the particle exceeds the normal value."), simParameters.cellNormalEnergy); + AlienImGui::SliderFloat( + AlienImGui::SliderFloatParameters() + .name("Decay rate of dying cells") + .colorDependence(true) + .textWidth(RightColumnWidth) + .min(1e-6f) + .max(0.05f) + .format("%.6f") + .logarithmic(true) + .defaultValue(origSimParameters.clusterDecayProb) + .tooltip( + "The probability per time step with which a cell will disintegrate (i.e. transform into an energy particle) provided that one of the following conditions is satisfied:\n" ICON_FA_CARET_RIGHT + " the cell has too low energy,\n" ICON_FA_CARET_RIGHT " the cell is in 'Dying' state\n" ICON_FA_CARET_RIGHT " the cell has exceeded the maximum age.") + , simParameters.clusterDecayProb); AlienImGui::Checkbox( AlienImGui::CheckboxParameters() .name("Cell network decay") .textWidth(RightColumnWidth) .defaultValue(origSimParameters.clusterDecay) .tooltip("If enabled, entire cell networks will disintegrate when one of their cells is dying because of insufficient energy or exceeding " - "the max. age. Furthermore, the dying process is much slower. This option is useful to minimize the presence of damaged cell networks."), + "the max. age. This option is useful to minimize the presence of damaged cell networks."), simParameters.clusterDecay); ImGui::TreePop(); } From 6ea26dc4494b9c7fe94f8225f9f11b892240ad7b Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 18:28:52 +0100 Subject: [PATCH 14/16] RELEASE-NOTES.md --- RELEASE-NOTES.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index af2debca9..2d32e3137 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,17 @@ # Release notes +## [4.5.1] - 2023-12-16 +### Added +- new simulation parameters to reduce energy particle absorption for cells with fewer connections +- new simulation parameters to configure the decay probability of dying cells +- validation of normal and minimal cell energies in parameter window + +### Changed +- parameter 'Genome size bonus' only takes into account the genome of the non-separating parts + +### Fixed +- layout problems with the display of color matrices fixed + ## [4.5.0] - 2023-12-09 ### Added - engine, gui: entire statistical history are saved along with a simulation From 9c50196a2374d640e32c8dfc94d4ad3a977fc712 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 18:29:53 +0100 Subject: [PATCH 15/16] RELEASE-NOTES.md --- RELEASE-NOTES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2d32e3137..7ba13b04a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -4,10 +4,10 @@ ### Added - new simulation parameters to reduce energy particle absorption for cells with fewer connections - new simulation parameters to configure the decay probability of dying cells -- validation of normal and minimal cell energies in parameter window +- validation of normal and minimal cell energies in the simulation parameter window ### Changed -- parameter 'Genome size bonus' only takes into account the genome of the non-separating parts +- parameter 'Genome size bonus' only takes into account the non-separating parts of the genome ### Fixed - layout problems with the display of color matrices fixed From 357289ebdf24fca0eef77ba74308d30daa58d5dc Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 16 Dec 2023 18:33:08 +0100 Subject: [PATCH 16/16] GCC compile error fixed --- RELEASE-NOTES.md | 2 +- source/EngineImpl/DescriptionConverter.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7ba13b04a..7bcd40622 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -4,7 +4,7 @@ ### Added - new simulation parameters to reduce energy particle absorption for cells with fewer connections - new simulation parameters to configure the decay probability of dying cells -- validation of normal and minimal cell energies in the simulation parameter window +- validation of normal and minimal cell energy parameters in the simulation parameter window ### Changed - parameter 'Genome size bonus' only takes into account the non-separating parts of the genome diff --git a/source/EngineImpl/DescriptionConverter.cpp b/source/EngineImpl/DescriptionConverter.cpp index 64923e6a2..fbb5a3351 100644 --- a/source/EngineImpl/DescriptionConverter.cpp +++ b/source/EngineImpl/DescriptionConverter.cpp @@ -1,5 +1,6 @@ #include "DescriptionConverter.h" +#include #include #include @@ -509,7 +510,7 @@ namespace { void checkAndCorrectInvalidEnergy(float& energy) { - if (isnan(energy) || energy < 0 || energy > 1e12) { + if (std::isnan(energy) || energy < 0 || energy > 1e12) { energy = 0; } }