[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Constraint Programming in Lisp (a query)
Date: Sun, 9 Sep 90 21:35:20 PDT
From: tcipro!ramu@unix.sri.com (Ramu Iyer)
I'd like to know if there is any code out there
that will help me solve constraints -- actually a
set of linear inequalities -- in Lisp. I am told
there is such a scheme in Scheme (no pun intended :-).
...
--Ramu
Email: ramu%tcipro.uucp@unix.sri.com
I guess I don't understand the problem. Are you willing to write a
straightforward Simplex funtion yourself? I've done things such as the
singular value decomposition of matrices using Lisp as a programming
language augmented by a few of the built-in matrix functions. For
example, (MAKE-ARRAY (LIST NROWS NCOLUMNS) ... ) creates what you and
I think of as a matrix having NROWS rows and NCOLUMNS columns which
can be treated using AREF and (SETF (AREF ... )) to implement typical
row-column operations.
Also, there are a small number of functions documented in the
"Operations on Matrices Section" which handle some operations quickly;
I suggest you rely on them when possible. For example, given a MATRIX,
(MATH:MULTIPLY-MATRICES (MATH:TRANSPOSE-MATRIX MATRIX) MATRIX) is a
quick and simple way to compute a typical form.
One aspect of style that is appropriate when you're analyzing a few
large matrices is based on the observation that matrix programming
often requires the re-use of certain matrix forms, e.g., the
"transpose times itself" above. One way to deal with this is to create
Flavors or Classes representing matrices; have one Matrix Instance
slot point to the matrix itself and others point to saved computed
matrices that you expect will be needed over and over.
-- Bud Frawley