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

aiddl-test.reasoning.constraint.4-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.4-queens)

(#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))

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

(#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 ?X4}
    domains:{
      ?X1:$D
      ?X2:$D
      ?X3:$D
      ?X4:$D      
    }
    constraints:{
      ((?X1 ?X2) (call ^$diagonal (?X1 ?X2 1)))
      ((?X1 ?X3) (call ^$diagonal (?X1 ?X3 2)))
      ((?X1 ?X4) (call ^$diagonal (?X1 ?X4 3)))
      ((?X2 ?X3) (call ^$diagonal (?X2 ?X3 1)))
      ((?X2 ?X4) (call ^$diagonal (?X2 ?X4 2)))
      ((?X3 ?X4) (call ^$diagonal (?X3 ?X4 1)))                  
    }])




© 2015 - 2025 Weber Informatics LLC | Privacy Policy