;;; -*- Mode:Lisp; Package:ONTOLINGUA-USER; Syntax:Common-Lisp; Base:10 -*-

;;;   VT-DESIGN: a restricted class of configuration design

;;; Last modification: 19 May 1994

;;; Added these functions to the list of allowable ones :
;;;  'square 'sqrt 'floor 'invsin

(in-package "ONTOLINGUA-USER")

(define-theory VT-DESIGN (components-with-constraints

  "This ontology specializes the general theory of
components-with-constraints for the VT problem.
It defines the type of components that are to be designed and the restricted
set of operators that may appear in constraints.  It specializes the more
general configuration design theory by adding commitments to a notion of
optimality based on a cost function.

Modified 19 May 1994. Added SQUARE SQRT FLOOR INVSIN
to list of functions allowed in constraints.

Modified 30 July 1994.  Integrated with the more general component
assembly family, which replaces the old configuration-design theory.")

(in-theory 'VT-DESIGN)


(define-class VT-COMPONENT (?component)
 "A VT component is just a component as defined
by the configuration-design ontology, except that we define a slot
for the cost."
  :def (and (component ?component)
            (value-type ?component HAS-CONSTRAINT vt-constraint)
            (has-parameter-slot ?component COMPONENT.COST)
            (cost-quantity (COMPONENT.COST ?component)))

  :issues (("Why not include the sum of subparts in the cost metric?"
           "That assumes linear combination function for cost, which
            is a domain specific assumption.")))

(define-function COMPONENT.COST (?component) :-> ?cost
   "The monetary cost of a component in a design."
   :def (and (component ?component)
	     (cost-quantity ?cost)))

(define-class COST-QUANTITY (?q)
  "A scalar quantity of the physical dimension 'currency'.  By use of
the standard-dimensions theory, costs can be stated in a
variety of known currencies, and translation can be accomodated."

  :def (and (scalar-quantity ?q)
	    (= (quantity.dimension ?q) currency-dimension)))

(define-class COMPONENT-CLASS (?c)
  "The meta class of component classes."
  :iff-def (subclass-of ?c component))

(define-relation OPTIMAL-COMPONENT (?comp ?component-class)
  "An optimal-component is the least costly instance
of a component class.  To evaluate this relation will
require making some kind of closed-world assumption over
possible components."

  :iff-def (and (component ?comp)
		(component-class ?component-class)
		(instance-of ?comp ?component-class)
		(=> (instance-of ?other-component ?component-class)
		    (=< (component.cost ?comp)
                        (component.cost ?other-component)))))

;;;   Limitations on the constraint language

(define-class VT-CONSTRAINT (?c)
  "All VT constraints have a restricted form, specified by
  :def (and (object-constraint ?c)
            (vt-constraint-sentence (constraint.expression ?c))))

(define-class VT-CONSTRAINT-SENTENCE (?sentence)
  "A VT constraint-sentence is a constraint-sentence with the logical
operators, relational constants, and attribute operators restricted as
listed below."
  :def (and (constraint-expression ?sentence)
              (one-of 'and 'or 'not '=> '<= '<=>)
              (one-of '= '/= '< '> '=< '>= 'member)

(define-class FUNCTION-ALLOWED-IN-VT-CONSTRAINT (?function-constant)
  "A function-constant is allowed in a VT constraint iff it is the name
of a part-slot, a parameter-slot, or it is one of the operators allowed
by VT."
  :iff-def (or (subpart-slot (denotation ?function-constant))
	       (parameter-slot (denotation ?function-constant))
	       (member ?function-constant
		       (setof '+ '- '* '/ 'setof 'square
			      'sqrt 'floor 'invsin))))

(define-class VT-CONSTANT (?constant)
  "A VT-constant is a constant (i.e., not a variable) that denotes
a VT-component, or valid value for a VT parameter-slot."
  :iff-def (and (constant ?constant)
		(value-allowed-for-vt-term (denotation ?constant))))

(define-class VALUE-ALLOWED-FOR-VT-TERM (?value)
  "A restriction on the possible values of component attributes in VT."
  :iff-def (or (number ?value)
	       (string ?value)
	       (vt-component ?value)
	       (component-class ?value)))  ; used by model-id

;; These functions used in vt-domain

(define-function SQUARE (?x) :-> ?y
  := (* ?x ?y))

(define-function INVSIN (?sin) :-> ?angle
  :iff-def (= (sin ?angle) ?sin))

This Lisp-to-HTML translation was brought to you by
François Gerbaux and Tom Gruber