close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 3932


Ignore:
Timestamp:
2016-05-29T23:30:31-07:00 (8 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/pair-queue.lisp

    r3931 r3932  
    5454
    5555(defclass selection-strategy ()
    56   ((pair-key-fn   :initform nil :initarg :pair-key-fn :accessor pair-key-fn)
    57    (pair-order-fn :initform nil :initarg :pair-order-fn :accessor pair-order-fn))
     56  ((pair-key-fn   :initform (error "Must specify PAIR-KEY-FN") :initarg :pair-key-fn :accessor pair-key-fn)
     57   (pair-order-fn :initform (error "Must specify PAIR-ORDER-FN") :initarg :pair-order-fn :accessor pair-order-fn))
    5858  (:documentation "Represents a critical pair selection strategy.  The
    5959two ingredients of a strategy is a function PAIR-KEY-FUNCTION which
     
    6262determine which pair is more promising and should be considered first."))
    6363
    64 (defclass critical-pair-queue (selection-strategy)
     64(defmethod print-object ((self selection-strategy) stream)
     65  (print-unreadable-object (self stream :type t :identity t)
     66    (with-accessors ((pair-key-fn pair-key-fn)
     67                     (pair-order-fn pair-order-fn))
     68        self
     69      (format stream "PAIR-KEY-FN=~A PAIR-ORDER-FN=~A"
     70              pair-key-fn pair-order-fn))))
     71
     72(defclass normal-selection-strategy (selection-strategy)
     73  ((pair-key-fn :initform #'(lambda (p q) (universal-lcm (leading-monomial p) (leading-monomial q))))
     74   (pair-order-fn :initform #'lex>))
     75  (:documentation "The normal selection strategy for a given monomial order MONOMIAL-ORDER-FN. A pair
     76with the minimal LCM of leading monomials is selected."))
     77
     78
     79(defclass critical-pair-queue ()
    6580  ((pq :initform (make-priority-queue
    6681                  :element-type 'critical-pair
     
    95110
    96111
    97 (defun make-normal-strategy (monomial-order-fn)
    98   "Make a normal selection strategy for a given monomial order MONOMIAL-ORDER-FN. A pair
    99 with the minimal LCM of leading monomials is selected."
    100   (make-instance 'selection-strategy
    101                  :pair-key-fn #'(lambda (p q) (universal-lcm (leading-monomial p) (leading-monomial q)))
    102                  :pair-order-fn monomial-order-fn))
    103112
    104113(defun make-min-total-degree-strategy ()
Note: See TracChangeset for help on using the changeset viewer.