Skip to content
Snippets Groups Projects
Commit 2addd70b authored by Achilles Kappis's avatar Achilles Kappis
Browse files

Merge branch 'TopolOptimUpdate' into 'main'

Minor update of some of the optimisation functions

See merge request in-nova/in-nova!11
parents 600fcddf b0afdac2
No related branches found
No related tags found
1 merge request!11Minor update of some of the optimisation functions
### 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 ### ### v0.4 ###
**Utilities - Generic**\ **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.\ \* 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.\
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
% Author: Achilles Kappis % Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com % e-mail: axilleaz@protonmail.com
% %
% Date: 05/12/2023 (DD/MM/YYYY) % Date: 21/11/2024 (DD/MM/YYYY)
% %
% Copyright: MIT % Copyright: MIT
% -------------------------------------------------- % --------------------------------------------------
...@@ -182,7 +182,7 @@ function muts = mutPop(pop, mutPerc, mutProb, mutVals, uniqueMuts) ...@@ -182,7 +182,7 @@ function muts = mutPop(pop, mutPerc, mutProb, mutVals, uniqueMuts)
% ==================================================== % ====================================================
% Create probabilities for the variables to be mutated % Create probabilities for the variables to be mutated
if isscalar(mutProb) if isscalar(mutProb)
for mutIdx = nMuts:-1:1 parfor mutIdx = 1:nMuts
if mutProb < 0 if mutProb < 0
% Make sure the number of mutated variables will be exactly that asked % Make sure the number of mutated variables will be exactly that asked
[~, varIdx] = maxk(rand(size(pop, 2), 1), abs(mutProb)); [~, varIdx] = maxk(rand(size(pop, 2), 1), abs(mutProb));
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
% Author: Achilles Kappis % Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com % e-mail: axilleaz@protonmail.com
% %
% Date: 09/02/2024 (DD/MM/YYYY) % Date: 21/11/2024 (DD/MM/YYYY)
% %
% Copyright: MIT % Copyright: MIT
% -------------------------------------------------- % --------------------------------------------------
...@@ -188,7 +188,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n ...@@ -188,7 +188,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n
idx = randi(size(pop, 1), nOffspr, nParent); idx = randi(size(pop, 1), nOffspr, nParent);
% Put the parents into the array % Put the parents into the array
for ii = nParent:-1:1 parfor ii = 1:nParent
parents(:, :, ii) = pop(idx(:, ii), :); parents(:, :, ii) = pop(idx(:, ii), :);
end end
...@@ -214,7 +214,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n ...@@ -214,7 +214,7 @@ function [parents, parentsVec] = selParents(selType, fitVals, pop, offsprPerc, n
% Choose parents % Choose parents
% ==================================================== % ====================================================
% Do it for each offspring % Do it for each offspring
for offsprIdx = nOffspr:-1:1 parfor offsprIdx = 1:nOffspr
% Get parent indices based on their probability % Get parent indices based on their probability
parentIdx = pickValProb(1:size(pop, 1), fitVals, nParent); parentIdx = pickValProb(1:size(pop, 1), fitVals, nParent);
......
...@@ -87,7 +87,7 @@ The project is licensed under the ***MIT License***, which is a rather unrestric ...@@ -87,7 +87,7 @@ The project is licensed under the ***MIT License***, which is a rather unrestric
## Versioning ## ## 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** #### **Important**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment