Skip to content

Commit

Permalink
Exploration Step Method (#143)
Browse files Browse the repository at this point in the history
* Added Exploration Step Method

* Removed Print Function Calls.
  • Loading branch information
JannikNordmeyer authored Jun 6, 2024
1 parent ed9c112 commit bb3775c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/clojure/conexp/fca/exploration.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
conexp.fca.implications)
(:require [clojure.core.reducers :as r]))


(defn exploration-step
"Conduct one exploration step using counterexamples and background knowledge about implications"
[ctx input-implications]
(loop [implications input-implications
last (close-under-implications implications #{}),
ctx ctx]
(if (not last)
{:implications (difference (set implications) (set input-implications)) :context ctx}
(let [conclusion-from-last (context-attribute-closure ctx last)]
(if (= last conclusion-from-last)
(recur implications
(next-closed-set (attributes ctx)
(clop-by-implications implications)
last)
ctx)
(let [newimp (make-implication last conclusion-from-last)]
(recur (conj implications newimp) nil ctx)) ;; new candidate implication
)))))

;;; Helpers

(defn falsifies-implication?
Expand Down

0 comments on commit bb3775c

Please sign in to comment.