Skip to content

Commit

Permalink
uberjar stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximsa committed Oct 16, 2021
1 parent 2380a19 commit dbcd795
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Binary file added doc/images/H4-crop.pdf
Binary file not shown.
Binary file added doc/images/H4.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/algorithm/swarm.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark/scaling.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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")
14 changes: 8 additions & 6 deletions src/visualize/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -43,26 +43,28 @@
(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"
:size [10 10] ;; set size in setup, prevents a window manager bug
: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)

0 comments on commit dbcd795

Please sign in to comment.