Thanks for the tips. Jarno
On Mon, Aug 24, 2009 at 10:39 AM, Wolfgang Laun<wolfgang.l...@gmail.com> wrote: > Here are some ideas for instructive or simply difficult exercises. I have > indicated the approximate difficulty and/or effort with 0 through 4. Notice, > though, that 4 may be difficult for novices, and that >=3 requires "fluent > Java". > > *** Movie Database (1) > Given XML data on flicks, actors and roles: > <database> > <movie title="Casablanca"/> > ... > <actor name="Humphrey Bogart"/> > <actor name="Ingrid Bergman"/> > ... > <role actor="Humphrey Bogart" movie="Casablanca"/> > <role actor="Ingrid Bergman" movie="Casablanca"/> > ... > </database> > load this into WM. Write rules such as > - all movies of some actor/actrice; > - all actors/actrices of a movie > . all movies where two given actors/actrices are in the cast > > *** Shortest path (3) > Given XML data on cities and travel costs > <graph start="Indianapolis" goal="Columbus"> > <nodes id="Atlanta"/> > <nodes id="Boston"/> > <nodes id="Columbus"/> > ... > <edges nodeA="Atlanta" nodeB="Boston" cost="5"/> > ... > <edges nodeA="Boston" nodeB="Columbus" cost="6"/> > ... > </graph> > load this into WM. Study Dijkstra's Algorithm for finding the shortest path > and implement it using rules. > > *** Polygons and Points (3) > Given XML data describing a polygon and some isolated points P1, P2,... > inside or outside of the polygon: > <database> > <polygon name="M"> > <edge> > <p1 name="p1" x="0" y="0"/> > <p2 name="p2" x="10" y="0"/> > </edge> > ... > <edge> > <p1 name="p5" x="0" y="10"/> > <p2 name="p1" x="0" y="0"/> > </edge> > </polygon> > > <point name="P1" x="4" y="4" /> > <point name="P2" x="20" y="5" /> > ... > </database> > load this data into WM. Write a rule determining, for each point, whether it > is inside or > outside. (The basic algorithm can be found in textbooks on geometry.) > > *** Lexical Analysis > Implement a Lexical Analyzer. > (a) Write individual rules for all combinations of <state,token-class>, > doing the action on the RHS (2) > (b) Design a generic rule interpreting facts defining > <state,token-class,action>. (4) > > *** Range Checking > (a) Write a rule checking whether some (numeric) slot s of fact F is in > [a,b], reporting out-of-bounds. (0) > (b) Design a system that will accept any number of facts of type R defining > <F,s,a,b>. > Write a rule matching an R-fact with F=F' if there are facts from F' present > in the WM > and create (programmatically) the corresponding range-checking rule. Add the > rules to the Engine and > run. (4) > > *** Populating a Grid (2) > Given m x n (m,n >= 1) facts Cell<x,y,b> (x, y integer) representing an > m-by-n grid, write rules setting slot b > in the border cells, i.e. where x=1 or y=1 or x=m or y=n. Make sure you > achieve the minimum amount of > rule activations! > > *** Battleships (2) > Given a quadrant of sea, represented by a 10x10 grid, where battleships may > be located in 1,2, 3 or > 4 horizontal or vertical neighbouring cells, write rules ascertaining that > the situation is "safe": > no battleship may occupy a cell that this one of the 8 immediate neighbours > of a cell occupied > by another battleship. Report violations. > > -W > > On Sun, Aug 23, 2009 at 4:34 PM, Wolfgang Laun <wolfgang.l...@gmail.com> > wrote: >> >> The Jess wiki contains some interesting examples, I should mention, since >> you didn't. >> >> Also, you might look at other (public domain) RBS and theit examples. >> Sometimes you'd have to rewrite (Drools doesn't use CLIPS as a language), >> sometimes you might be able to take it with perhaps just minor adaptions >> (CLIPS). >> >> -W >> >> >> On Sun, Aug 23, 2009 at 12:17 PM, jarno niemelä <jar...@iki.fi> wrote: >> >> > Hello. >> > >> > I am planning a rule based programming course and we are using JESS >> > for programming assignments. >> > And being typical lazy teacher I would appreciate any material that >> > anyone is willing to share to get me started :) >> > >> > We are using "JESS in action" as a course book but I could use good >> > references on programming assignments and >> > other couse related materials. >> > >> > So if anyone has material they are willing to share or can suggest >> > good programming examples or excercises on top of >> > what comes with JESS and good, I would greatly appreciate that. >> > >> > The focus of the course is to give students enough experience so that >> > they could start using JESS and other rule engines >> > in their future work assignments and when they go out working for >> > companies. >> > >> > I am using rule based systems in my own work and have noticed that >> > they save a huge amount of work in complex real life >> > systems so I would like to train future generations of engineers that >> > they don't have to hard code business logic with Java or Python >> > and spend most of their time on constant re-factoring. >> > >> > Also I would appreciate any pointers on other good books to read on >> > rule based programming and using them in business environment. >> > >> > Jarno >> > >> > >> > -------------------------------------------------------------------- >> > To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' >> > in the BODY of a message to majord...@sandia.gov, NOT to the list >> > (use your own address!) List problems? Notify >> > owner-jess-us...@sandia.gov > -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov. --------------------------------------------------------------------