matrix/vector handling with CLIPS

80 views
Skip to first unread message

Mauricio

unread,
Feb 8, 2012, 6:23:06 PM2/8/12
to CLIPSESG
Hi guys,

New in the CLIP/rules world, so hi to all...

I have the task to build a navegation system rules for a robot in a
matrix world, I do have the algorithm in my mind and I even have some
ideas of the rules to check if the robot can move, etc...but I'm
hiting my head to the wall about how to deal with the "matrix
world" (a simple MxN matrix full with "W" (wall), "E" (empty),
"S" (exit) . Width declarative programming is easy piecy, just a
matrix or multidimensional vector, but how in hell do something like
that in CLPIS! :-) ...I'm trying to define a template to simulate a
row and then an "assert" with the value for the matrix, but nomatter
what I try it seems that it dosn't have sense...it shuld be something
trivial for a programing lenguage of any kind right?.

Can someone point me in the right direction?

Thanks

Mauricio

hernan millan

unread,
Feb 9, 2012, 12:15:03 PM2/9/12
to clip...@googlegroups.com

Hello Maurico,

what stop you fron using CLIPSNET with matlab...

hernan


> Date: Wed, 8 Feb 2012 15:23:06 -0800
> Subject: matrix/vector handling with CLIPS
> From: buhoc...@gmail.com
> To: clip...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
> To post to this group, send email to CLIP...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
>
> --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Click on "Edit my membership" link.
> Select the "No Email" radio button.
> Click the "Save these settings" button.
>
> --> IF YOU WANT TO UNSUBSCRIBE <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Sign in
> Click on "Edit my membership" link.
> Click the "Unsubscribe" button.
> Note: This appears to be the most reliable way to unsubscribe
>
> Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.

Mauricio Henriquez

unread,
Feb 9, 2012, 2:38:42 PM2/9/12
to clip...@googlegroups.com
Hi hernan,

Thanks for the suggestion, but is a requirement to use just plain CLIPS.

Mauricio
-- 
Mauricio R. Henriquez Schott
Escuela de Ingeniería en Computación
Universidad Austral de Chile - Sede Puerto Montt
Los Pinos S/N, Balneario de Pelluco, Puerto Montt - Chile
Tel: 65-487440
Fax: 65-277156
mail: mauricio...@uach.cl
buhochileno.vcf

CLIPS Support

unread,
Feb 10, 2012, 12:43:52 AM2/10/12
to CLIPSESG
Represent each position in your matrix with a fact where the indices
of its position in the matrix are stored within it. This is the best
approach when you are reasoning about the matrix itself and your rules
will be referencing arbitrary positions in it. There's a sudoku
example program at http://clipsrules.svn.sourceforge.net/viewvc/clipsrules/examples/sudoku/
which uses this technique for solving puzzles of various sizes (3x3,
4x4,and 5x5). If your matrix is sparse, you can just assert facts for
the positions that are non-empty.

An alternate approach would be to create your own matrix class using
COOL. A matrix would simply be a vector (represented by a multi field)
which could contain other matrixes. You can add getter and setter
functions for retrieving the values stored within the matrix.

Ronald Finkbine

unread,
Feb 14, 2012, 1:48:20 PM2/14/12
to clip...@googlegroups.com
Easiest way to do this (IMHO):
 
The conceptual representation is to put all points as integers. In Clips the clear positions have NO fact with them. The only facts are the WALL clips.
 
I wrote this this over this past weekend. Use Java to display a map (0,0) to (25,25) with most clear points and just one short wall of Ws. The Java representation uses a int matrix for the points. Black color is wall, target is red, ... I have the Java main program set up the facts for original and target points. As well as the wall points.
 
I have Java use the CLIPSJNI lib (open source at sourceforge).
 
The Java main calls the CLIPSJNI lib and executes one rule, then Java runs again and get results of the rule that ran (have Clips rule write results to a defglobal), and Java main then retrieves the data and updates the map on the screen.
 
(deftemplate point
 (slot pType (type SYMBOL)
  (allowed-symbols original wall current previous target history))
 (slot x (type INTEGER))
 (slot y (type INTEGER))
 (slot n (type INTEGER))

At this point I have a nice movement going of the robot from the original point to the target point. Though at this point the robot is going through the walls !!! I am working on the adjacent-to-wall rules (one for each direction).
 
The n (integer) slot is for a history of the current robot position. Therefore I keep a series of these and am using them to play with slope values (local and overall) during the path search.
 
I need to keep playing with this project.


Ronald Finkbine
ronaldf...@hotmail.com

 
> Date: Thu, 9 Feb 2012 21:43:52 -0800
> Subject: Re: matrix/vector handling with CLIPS
> From: garyd...@gmail.com
> To: clip...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages