Sunday, June 1, 2008

After a week... (week 1 status report)

After a week of SoC, I haven't actually done really much. Well, I've done a lot, but not much to show off.The plans for last week were to create a connecting client and to finalize the design. I've finished the first and half-finished the second, read on...

The connecting client was fairly trivial given the amount of work that is done by libtpclient-py. Still, I had to study libtpclient-py extensively and I now think I know how to use it. I'm not the only student to use this library, and the research by jmingtan (who is working on a new client using pyOgre) and his correspondence with mithro (the creator and until recently only user of the library) has helped me a lot. They started some documentation on the wiki that summarizes the exact information I needed: how to connect to the server and how to use the cache. The information is already slightly out of date, even - the ("long" awaited) separation between the threading and the connection is done. So with all that information, I made the client by actually just copying some code from tpsai-py. It's a start.

Most of the start of the week, I tried to understand the way object, orders, the cache and the server interact in libtpclient-py. I made small changes in tpsai-py (a client using an old version of the library, and in need of updates) to get it working with the newest version. Not having any knowledge of how exactly tpsai-py works or what the changes between the old and new lib are, I didn't really dare to change a lot. I think I got it to send orders to the server eventually, but I got a bit confused about whether I was doing things right. Especially the new "create before" and "create after" commands, deprecating the older "create" command (which takes a slot where to place it, if I got it right), made me feel unsure about what I was doing. While I could probably sort it out, that would take too much work. I've got a more advanced bot to write. If it's finished, I can reimplement the tpsai-py reasoning in daneel-ai if that's still wanted. ;)

I spend today thinking about the design and writing about my idea on the wiki (comments always welcome!). I've done research on CHR, the language I plan to use/steal ideas from/... It's mostly an academic language, so I've read a few papers to gather ideas. Most of CHR is done in Prolog which gives a really powerful combination, and there's also a Java implementation which looks fairly cumbersome. Since Python (unfortunately?) leans closer to Java than to Prolog, I have to think carefully about how to design CHR in Python. Some things I'm used to from the SWIProlog implementation are not a given: non-ground variables, backtracking, matching, ... Backtracking will probably have to be dropped, but the other two (and probably a lot of other things) are a requirement for a working CHR implementation. So I suppose I'll have some happy fun time coding these declarative concepts in Python.

The design isn't really finished (see the wiki page for status), but I think it's a bit hard to continue at the moment. I have the big parts, so I think it's time to start coding on the small parts and see where I get blocked.

All in all, I didn't have that much time this week, and it won't be better the next few weeks. Thursday to Friday I worked on a school project. Fairly interesting thing: a comparison of a few very high level AI languages for constraint problems (yep, including CHR). Not finished yet, I'm afraid, but we did the hard work (implement a sudoku/kuromasu solver and run some tests), now we just have to write the report. Saturday we had a family gathering for a birthday. And inbetween I'm still studying, operating systems at the moment.

Next week, I'll start on the CHR implementation. I plan to have the constraint store with the ability to add knowledge to it. This will involve creating a few classes to represent the store, constraints, logical variables, and who knows what else I'll encounter. After that, I'll see if I can get the entries of the cache into the constraint store, which is essentially the initialization phase. Apart from that, I'll spend my time with computer networks, as I have exam of it next week Monday, the 8th. And we still need to write that paper on constraint languages. Busy times...

No comments: