From fa7d8fc3757bda3db7474bf00cf483bc13951d21 Mon Sep 17 00:00:00 2001 From: ZaellixA <axilleaz@protonmail.com> Date: Thu, 21 Nov 2024 18:32:19 +0000 Subject: [PATCH 1/4] Update mutPop.m to use parallel for whenever it is available --- Optimisation/Memetic Algorithm/MATLAB/Functions/mutPop.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Optimisation/Memetic Algorithm/MATLAB/Functions/mutPop.m b/Optimisation/Memetic Algorithm/MATLAB/Functions/mutPop.m index 14b16e0..5e21c1f 100644 --- a/Optimisation/Memetic Algorithm/MATLAB/Functions/mutPop.m +++ b/Optimisation/Memetic Algorithm/MATLAB/Functions/mutPop.m @@ -3,7 +3,7 @@ % Author: Achilles Kappis % e-mail: axilleaz@protonmail.com % -% Date: 05/12/2023 (DD/MM/YYYY) +% Date: 21/11/2024 (DD/MM/YYYY) % % Copyright: MIT % -------------------------------------------------- @@ -182,7 +182,7 @@ function muts = mutPop(pop, mutPerc, mutProb, mutVals, uniqueMuts) % ==================================================== % Create probabilities for the variables to be mutated if isscalar(mutProb) - for mutIdx = nMuts:-1:1 + parfor mutIdx = 1:nMuts if mutProb < 0 % Make sure the number of mutated variables will be exactly that asked [~, varIdx] = maxk(rand(size(pop, 2), 1), abs(mutProb)); -- GitLab From 4072d5709b4b1e9799dfb3e37efd7e4c00540c57 Mon Sep 17 00:00:00 2001 From: ZaellixA <axilleaz@protonmail.com> Date: Thu, 21 Nov 2024 18:33:00 +0000 Subject: [PATCH 2/4] Update selParents.m to use parfor when it is available --- .../Memetic Algorithm/MATLAB/Functions/selParents.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Optimisation/Memetic Algorithm/MATLAB/Functions/selParents.m b/Optimisation/Memetic Algorithm/MATLAB/Functions/selParents.m index dcdbba0..5d878d0 100644 --- a/Optimisation/Memetic Algorithm/MATLAB/Functions/selParents.m +++ b/Optimisation/Memetic Algorithm/MATLAB/Functions/selParents.m @@ -3,7 +3,7 @@ % Author: Achilles Kappis % e-mail: axilleaz@protonmail.com % -% Date: 09/02/2024 (DD/MM/YYYY) +% Date: 21/11/2024 (DD/MM/YYYY) % % Copyright: MIT % -------------------------------------------------- @@ -188,7 +188,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n idx = randi(size(pop, 1), nOffspr, nParent); % Put the parents into the array - for ii = nParent:-1:1 + parfor ii = 1:nParent parents(:, :, ii) = pop(idx(:, ii), :); end @@ -214,7 +214,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n % Choose parents % ==================================================== % Do it for each offspring - for offsprIdx = nOffspr:-1:1 + parfor offsprIdx = 1:nOffspr % Get parent indices based on their probability parentIdx = pickValProb(1:size(pop, 1), fitVals, nParent); -- GitLab From 583daa415b651c136f29344d5a83fd531d34c529 Mon Sep 17 00:00:00 2001 From: ZaellixA <axilleaz@protonmail.com> Date: Thu, 21 Nov 2024 18:35:58 +0000 Subject: [PATCH 3/4] Update CHANGELOG.md with changes in the optimisation topic --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae70ac6..09a9cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +### v0.4.1 ### +** Optimisation - Memetic Algorithm**\ +\* Update `mutPop()` to use the parallel for-loop (`parfor`) whenever it is available.\ +\* Update `selParents()` to use the parallel for-loop (`parfor`) whenever it is available. + +------------------------------------------- + + ### v0.4 ### **Utilities - Generic**\ \* Change the interface of `rotMat3d()`, so that the last argument is a boolean (`logical` in MATLAB), declaring whether the given angles are in degrees (if false, the angles are treated as radians). This is a **backwards incompatible** change.\ -- GitLab From b0afdac2a9fe1a8c59e6660b50e58cd3a244d194 Mon Sep 17 00:00:00 2001 From: ZaellixA <axilleaz@protonmail.com> Date: Thu, 21 Nov 2024 18:36:35 +0000 Subject: [PATCH 4/4] Update version to v0.4.1 in project README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f38a38b..4aac359 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The project is licensed under the ***MIT License***, which is a rather unrestric ## Versioning ## -The project uses [semantic versioning](https://semver.org/) and the current version is **v0.4**. The project hasn't reached v1.0.0 yet so changes that break backwards compatibility may (and have been) introduced in any version update. For information about the changes in each version consult the [CHANGELOG](https://gitlab.com/in-nova/in-nova/-/blob/main/CHANGELOG.md?ref_type=heads). +The project uses [semantic versioning](https://semver.org/) and the current version is **v0.4.1**. The project hasn't reached v1.0.0 yet so changes that break backwards compatibility may (and have been) introduced in any version update. For information about the changes in each version consult the [CHANGELOG](https://gitlab.com/in-nova/in-nova/-/blob/main/CHANGELOG.md?ref_type=heads). #### **Important** -- GitLab