checking.lisp 964 B

123456789101112131415161718192021222324252627282930
  1. ;;;; checking.lisp
  2. ;;;;
  3. ;;;; Copyright (c) 2020 Samuel W. Flint <swflint@flintfam.org>
  4. (in-package #:lcsp)
  5. ;;; "lcsp" goes here.
  6. (defmethod check-constraint (constraint vvps &key suppress-cc-update-p) :around
  7. (let ((result (call-next-method)))
  8. (unless suppress-cc-update-p
  9. (incf (constraint-checks (problem constraint))))
  10. result))
  11. (defmethod check-constraint ((constraint <constraint-combined>) vvps &key &allow-other-keys)
  12. (let ((value t))
  13. (do* ((constraints (constraints constraint) (rest constraints))
  14. (constr (first constraints) (first constraints)))
  15. ((or (not value) (null constr)) value)
  16. (setf value (check-constraint constr vvps :suppress-cc-update-p t)))))
  17. (defun fix-vvps (vvps constraint)
  18. (let ((variables (variables constraint)))
  19. (mapcar #'(lambda (var)
  20. (find var vvps
  21. :key #'car
  22. :test #'equal))
  23. variables)))
  24. ;;; End lcsp