diff --git a/doc/images/H4-crop.pdf b/doc/images/H4-crop.pdf new file mode 100644 index 0000000..e7ad82a Binary files /dev/null and b/doc/images/H4-crop.pdf differ diff --git a/doc/images/H4.pdf b/doc/images/H4.pdf new file mode 100644 index 0000000..c0e0c9d Binary files /dev/null and b/doc/images/H4.pdf differ diff --git a/src/algorithm/swarm.clj b/src/algorithm/swarm.clj index 6b2c8d0..365e82e 100644 --- a/src/algorithm/swarm.clj +++ b/src/algorithm/swarm.clj @@ -76,7 +76,7 @@ (when running (send *agent* updateParticle)) ;; "recursive" call (def velocity (util/addV - (util/mulV (repeat 0.995) (:velocity particle)) ;; repeat 1's allow easy "on-the-fly" modification + (util/mulV (repeat 1) (:velocity particle)) ;; repeat 1's allow easy "on-the-fly" modification (util/mulV (repeat 1) (repeat (:stubborness particle)) (util/subV (:best particle) (:position particle))) (util/mulV (repeat 1) (repeat (- 1 (:stubborness particle))) (util/subV (updateGroupBest (:groupId particle) (:position particle)) (:position particle))))) (def position (util/addV (:position particle) (util/mulV (repeat 0.01) velocity))) diff --git a/src/benchmark/scaling.clj b/src/benchmark/scaling.clj index 6cf42cf..e36deae 100644 --- a/src/benchmark/scaling.clj +++ b/src/benchmark/scaling.clj @@ -15,7 +15,7 @@ (first (psa/ps)) (Thread/sleep dTime) (psa/stopPs) - (println (str (apply + (map :iterations (map deref psa/swarm)))))) - ;; (System/exit 0)) + (println (str (apply + (map :iterations (map deref psa/swarm))))) + (System/exit 0)) ;;(-main "10000" "8") diff --git a/src/visualize/core.clj b/src/visualize/core.clj index 521c550..28c75b4 100644 --- a/src/visualize/core.clj +++ b/src/visualize/core.clj @@ -6,7 +6,7 @@ (require '[utility.core :as util]) (def hack (agent 0)) ;; allows delayed execution of ps (def viewSize 768) -(def maxX (.getWidth(.getScreenSize (java.awt.Toolkit/getDefaultToolkit)))) ;; 2560 +(def maxX (* 0.66 (.getWidth(.getScreenSize (java.awt.Toolkit/getDefaultToolkit))))) ;; 2560 (def viewsPerLine (Math/floor(/ maxX viewSize))) (defn dimensionIndexToOffset [index] @@ -43,18 +43,19 @@ (def groupBest (apply concat (map transformPosition (map :position (if (= :partition psa/groupMode) (map (fn [a] (deref (last a))) psa/groupBest) (map deref psa/groupBest)))))) + (q/stroke 255 255 255) + (q/stroke-weight 5) ;; set pointsize for groupbest to 5 + (doseq [[x y] groupBest] + (q/point x y )) (q/stroke 0 255 0) (q/stroke-weight 3) ;; set pointsize for position and best (doseq [[x y] position] (q/point x y )) (q/stroke 255 0 0) (doseq [[x y] best] - (q/point x y )) - (q/stroke 255 255 255) - (q/stroke-weight 5) ;; set pointsize for groupbest to 5 - (doseq [[x y] groupBest] (q/point x y ))) + (defn visualRun [& args] (q/sketch :title "PSO" @@ -62,7 +63,8 @@ :setup setup :draw draw-state)) ;; dim gCount sSize sRange fFun -(psa/setSwarmProperties 2 8 1024 600 (fn [a] (-(atf/h3 a)))) +;;(psa/setSwarmProperties 2 8 1024 600 (fn [a] (+(apply atf/h2 a)))) +(psa/setSwarmProperties 8 4 256 1 (fn [a] (-( atf/h3 a)))) (psa/resetPs) (visualRun)