Kristine Hauff
e-mail:  kkh@wolf.cs

Domain:  sewing

This sewing domain is able to sew a dress, a shirt, a skirt, pants, and/or
shorts given an amount of fabric, a pattern, thread, and any extra notions
desired (buttons, elastic, lace, or zipper).  Every time a pattern piece is
cut out of the fabric, it causes the amount-of-fabric to decrease by:

  (amount of fabric for size 1   +   (size of pattern - 1))
          (in inches)

In other words, each additional pattern size for the garment gets 
incremented by one inch.  Given an amount of fabric in inches, this
domain will complete the garment if enough fabric is given and fail
if it does not.  Also, more than one garment can be sewn at the same
time since the garment is associated with its thread, fabric, the amount
of fabric, notions, pattern, and pattern size.  Any garment can have no 
notions or one choice from all of the notions.  An example goal looks like:

 (with-lace RED-DRESS LACE RED-FABRIC 500 DRESS-PATTERN 7 RED-THREAD)

It is read as:  I want a dress of size seven with lace given 500 inches
of red fabric, red thread, and lace.


Approximate hours:  about 32 hours, including research


This sewing domain is similar to the machining domain in the prodigy 
directory.  It is similar to it because that domain cuts objects from
an original piece.  However, it simplifies the domain by discarding
one of the pieces and making the other the original, thus making only
static generators.  My sewing domain must keep both of the pieces that
were separate - the original fabric or pattern and the individual
pieces created.  Thus a need for non-static generators are needed.


To the best of my knowledge this sewing domain does not use tricks from
other domains.  It calculates the size of the fabric piece needed and
subtracts this amount from the total amount of fabric available, which
is always associated with that particular garment.  This association
between the garment sewn and all of its materials needed allows this
domain to sew more than one garment at a time.



------------------------------------------------------------------------------
                           * * * NOTES * * *
------------------------------------------------------------------------------

Non-static Predicates Used:

The predicate pattern-cut-out is a non-static generator for patternpiece
and size because it gets added to the state in the CUT-PATTERN operator.
It has to be non-static for the following reason:  given a pattern that
contains all of the individual pattern pieces stamped on it, each piece
must be cut apart from the original pattern sheet.  Because more pattern
pieces exist than the original pattern, a non-static generator must be 
used.

Both predicates have-fabric-piece and have-fabric-part are non-static
generators since they both get added and deleted.  In the CUT-FABRIC
operator an individual fabric piece cut out by a pattern is created
from the original fabric piece.  Because more fabric pieces are cut
out of the original fabric piece, a non-static generator must be used.
When the individual fabric pieces are sewn together, together they form
a fabric part (have-fabric-part).  Thus two items forming one must use
a non-static generator to represent the final product.

Amount-of-fabric must be a non-static generator since the state can only
contain one value for the amount of fabric that a piece contains.  Hence
when a new value is calculated the old value must be deleted from the 
state and the new value must be added.  Because this value is bound to
only one garment's fabric piece, it will not cause problems when the
values bind since the fabric-amount is always associated with the garment.


------------------------------------------------------------------------------
                       * * * Project 3 Answers * * *
------------------------------------------------------------------------------

1a.  A main real-world problem that could not be modeled in Prodigy includes
     finding the best goal revolving around pattern pieces.  In this domain
     it is assumed that the pattern given for the garment will always contain
     the same pieces (ie. a skirt will contain four pieces: left & right front
     skirt and left & right back skirt).  If a pattern given to this domain
     has different pieces representing an unique design, it cannot sew that 
     garment because it will not know what to do with that design.

     NOTE: This domain represents most patterns because most patterns follow a
           basic design, which is modeled here.

     Another real-world problem is dealing with two-dimensional space.  I was
     not able to lay out the pattern pieces all together so the pattern curves
     could fit together in the least amount of fabric space.

     The language was expressive enough to encode all of the sewing domain
     preconditions and effects but not the search control knowledge.  It needed
     the fact that Prodigy could look ahead in the state to see if something
     added during backtracking was present in the state.  Instead I had to make
     assumptions according to the pattern given instead of the individual fabric
     pieces that were sewn and ready to be surged.

1b.  I thought it would be difficult to sew two garments at the same time.  Instead
     it turned out to be easy because of the association of garment with everything
     relevant to it (ie. the shirt RED-SHIRT has fabric, a pattern, thread, pattern
     pieces, and other notions all associated with it).  Thus when more that one
     garment is sewn, Prodigy keeps track of which garment goes with which notion.

     Also keeping track of the amount of material on hand was easy by using lisp
     functions and associating the amount of fabric left with the fabric.  There
     is only one fabric piece with an amount at any given time.

1c.  Prodigy has useful tracing features that allow the user to know how Prodigy
     analyzes the control rules (I liked schst).  Also for such a step-by-step
     process, Prodigy follows an orderly fashion to succeed at its goal by
     fulfilling all of the preconditions.  This allowed the the sewing domain to
     almost perfectly model the steps in sewing a garment.  Now a machine is
     needed to interpret these commands to execute them in real life.

1d.  I would allow Prodigy to look ahead in the state to see if something
     added during backtracking was present in the state.  This would have made
     this sewing domain complete as far as being able to choose which serging 
     method is used for each individual part of the garment.










