All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aiddl-test.reasoning.constraint.3-queens.aiddl Maven / Gradle / Ivy

Go to download

Provides common types and algorithm implementations for the fast prototyping integrative AI systems with the AIDDL framework.

The newest version!
(#mod self org.aiddl.test.reasoning.constraint.3-queens)

;;(#req Math org.aiddl.eval.math)
;;(#nms MATH (nms-ht functions@Math))

(#req CS org.aiddl.common.reasoning.constraint)

(#req EVAL org.aiddl.eval.namespace)
(#nms nms-base basic-ops@EVAL)
(#nms nms-logic logic-ops@EVAL)
(#nms nms-type type-ops@EVAL)
(#nms nms-num numerical-ops@EVAL)

(#def abs (if (< #self 0) (* -1 #self) #self))

(^integer N 3)

(^Domain@CS D {1 2 3})

(#def diagonal
  (match (?X ?Y ?D) #self
    (lambda (?X ?Y)
      (or
        (has-type ?X ^variable)
        (has-type ?Y ^variable)
        (and
          (!= ?X ?Y)
          (!= (call ^$abs (- ?X ?Y)) ?D))))))
    
(^Problem@CS
  csp
  [
    variables:{?X1 ?X2 ?X3}
    domains:{
      ?X1:$D
      ?X2:$D
      ?X3:$D
    }
    constraints:{
      ((?X1 ?X2) (call ^$diagonal (?X1 ?X2 1)))
      ((?X1 ?X3) (call ^$diagonal (?X1 ?X3 2)))
      ((?X2 ?X3) (call ^$diagonal (?X2 ?X3 1)))
    }])




© 2015 - 2025 Weber Informatics LLC | Privacy Policy