Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
feat(pso): update meta-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardosrodrigues0 authored and marmitar committed Nov 6, 2023
1 parent 7bed3d4 commit 4d915e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import MCSP.TestLib.Sample (ShuffleMethod (..), SimpleEnum, StringParameters (..

randomPair :: SimpleEnum a => Random (String a, String a)
randomPair = do
r <- uniformR 5 10
s <- uniformR 5 30
n <- uniformR (2 * r + s) 80
r <- uniformR 3 10
s <- uniformR 5 20
n <- uniformR (2 * r + s) 120
randomPairWith
StringParameters
{ size = n,
Expand Down
5 changes: 3 additions & 2 deletions src/MCSP/Heuristics/PSOBased.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module MCSP.Heuristics.PSOBased (
mcspSwarm,
pso,
partitionWeights,
edgeSizeWeights,
Expand Down Expand Up @@ -70,7 +71,7 @@ import MCSP.System.Random (Random, Seed, generateWith)
defaultUpdater :: Updater Edge
defaultUpdater =
sumM
[ randomVelocity >>= weighted 1.2,
[ randomVelocity >>= weighted 5.0,
weighted 0.005 localGuideDirection,
weighted 0.005 globalGuideDirection
]
Expand Down Expand Up @@ -102,7 +103,7 @@ edgeSizeWeights es = do
initialWeights :: Ord a => Pair (String a) -> Vector Edge -> Random (Vector Weight)
initialWeights strs edges =
choice
[ (1, uniformSN $ length edges),
[ (10, uniformSN $ length edges),
(1, edgeSizeWeights edges),
(1, partitionWeights (evalMeta $ combineS strs) edges),
(1, partitionWeights (evalMeta $ greedy strs) edges)
Expand Down

0 comments on commit 4d915e1

Please sign in to comment.