I'm sorry. The new season is going very strong, even without Daleks. Thinking about it, dalek-ai would also have been a cool and fitting name. But we're here to discuss other matters...
The goal for this week was to have a working constraint store implemented in Python. I got about 90% of that. I finished the representation of the constraints, variables and various Python terms. It is possible to parse a string like "pred(C,3,pred(C))" and match it with "pred('ab',3,A)". Variables will be bound correctly, impossible unifications will be detected, etc. This is a huge step forwards, I think: matching is central in the system I want and it was one of the more tricky things to get right. My notes of a course on AI I followed have helped me nicely here - never thought I'd have to implement the Martelli-Montanari algorithm but good thing I keep my notes :). I also added a whole load of testcases because I wasn't really sure about getting all of this right. I might have some regressions later on if I have to tweak the design, so I'll be able to notice and resolve that quickly with the tests. It seems unit testing fits into Python nicely, "batteries included" is a good selling point indeed.
So what I didn't implement was a fully working constraint store. Now, I don't think it'll be really hard to do, I just need to store a collections (a Python set should do) of those constraints and I should manage to get them out again by matching (which already works). However, I just didn't find the time anymore to actually implement it.
I have exams right now, and they're pretty much taking all my time from me. First time ever I'm actively exploiting the timing of my exam (whether it's before or after noon) in my schedule. Previous years I'd always take the rest of the day off, but that won't be possible this year... So I'm slowing down a bit on TP. Next week, I just plan to finish the constraint store. After next week, I should have a few days to work on TP (assuming I can keep myself awake), so I'll be doing a bit more, but right now, it's just not possible.
I've also improved the wiki page a bit. It now has some milestones and, perhaps more important, my current planning. I had to change it around a bit because I'll be spending more time on designing the rule engine and less time on individual rules. Which is all in all a good thing, as that should allow fairly rapid development of new AI variations. I'm sure you're all waiting for the epic battle of the Human and the 7 slightly-different-yet-indistinguishable AIs: Doc-AI, Grumpy-AI, Happy-AI, Sneezy-AI, Bashful-AI, Sleepy-AI, and Dopey-AI.
Actually, that might be cool.
Friday, June 6, 2008
EX-TER-MI-NATE! U-NI-FI-CATE! (week 2 status report)
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...
Monday, May 26, 2008
Official start
I suppose I'm the 501st person to use this title, but hey... Can't stress it enough. Summer of Code has officially started.
Since the last post ("last week" is not really correct here) I didn't really do a lot for SoC. I had two deadlines for big projects at school, including one were we worked on for 24 hours straight. That's 24h in the pc labs, see the sun set and rise again, watching those that left the labs the day before come back in, cursing at UML modeling tools that won't listen and team members who won't listen either, ... I'm still a bit frustrated about it all, it seems. But the project was done in time, classes have ended, and there is time for SoC now.
I had a look at libtpclient-py and I'm still not entirely sure what to make from it, but I suppose that will follow quickly enough.
I've been thinking about the design. It's still a bit rough, but I feel I'm on to something. The basic idea for the driving force behind the AI would be a CHR-like production rule system, coupled with an initialization (state -> contraint store) and a finalization phase (constraint store -> orders) each turn. I'm currently musing on how to represent storage in the working memory between turns to allow multi-turn strategies to work out. I had two things in mind: either labeling certain predicates as being temporary and prune them during finalization, or creating a second (permanent) storage that will be added to the constraint store during initialization. The first one seems nicer but might be impractical to work with, I've got to think a bit more about that.
The big advantage to this system is that it would completely decouple the search algorithm from the data, and split the data (in as far as you can call a set of rules data) in "ruleset data" and "strategy data". Thus, the system can be reused by different rulesets if someone provides useful initialization/finalization code, and the same init/finalize code can be used by multiple AIs who differ in their rule database.
Next week: a working client, a finalized design for the rule engine.
Oh, and I got the gift. The package had arrived a long time ago, but it's the first time in 2 weeks I went home. It certainly looks like an interesting read, thank you Google!
Thursday, May 15, 2008
Debian and other fun
First, in case you use Debian, Ubuntu, *buntu, or any other Debian derivate make sure you have secure keys. See http://lists.debian.org/debian-security-announce/2008/msg00152.html for more information.
Today, I had to read that and regenerate my keys. Coincidentally, I'm currently studying how all this stuff works in our course of "discrete maths". I found it to be quite shocking that something as important as OpenSSL (or to be more precise, the Debian variety of OpenSSL) had a security flaw for 2 years. Considering the recent uptake of Ubuntu, it might mean that a million of people are vulnerable right now. Granted, most normal people don't use DSA, but from the SoC students of last and this year, for example, there might be a lot of victims. Big ouch.
In more positive news, a friend of mine had a recommendation for Python learners and masters: The Python Challenge. A notpron kind of thing were every step has to be solved with Python. Have fun.
Monday, May 12, 2008
It seems like I'm the main (if not only) blogger here, so I'll utilize this little piece of Internet to report about my Summer of Code experiences.
Well, I'll do that when I have them. For now, I'm still hard at work for school and that's likely to remain for the next 1.5 months. However, since SoC starts in a few weeks, I'll have to start the careful balancing act of combining two stressful attention-craving things. Yikes!
So, what HAVE I done until now?
We (my mentor nash and I) have decided on a name for the project. It's going to be "daneel-ai", named after the famous robotic rule-based decision maker. I don't foresee my AI saving mankind, but it would be a nice side-effect.
I've been reading about Git, managed to make a local repository and made my first push to the central server, then forgot everything about it. It just doesn't stick around in my brain. I suppose this will be better when I have to use Git daily, for now, I still like SVN more. The power of a familiar environment.
Finally, I've started Python study, working my way through Dive Into Python. Currently around page 100. I'm still a bit unconvinced. I swear by object-oriented principles for any project that is bigger than a few hundred lines of code, and Python doesn't seem very elegant for OOP. Handling self all the time, no protected methods, ... On the other hand, lambdas and list comprehensions are lovely, but (as minor nitpick) I don't like the "for ... in" syntax. In Haskell, you can clearly make the separation between variables (which are alphanumerics) and syntax (which is basically | and <-). In Python, it's all words, often all lowercase. I don't find that to be promoting readability. But all in all, I suppose it's one of the least bad languages we have...
Anyone know a decent Linux IDE for Python? I couldn't get PyDev for Eclipse to install - it freezes when I input the environment info. Any others?
Tuesday, April 22, 2008
SoC is on!
Hello!
I'll take the honors of the first post. This blog was started for students of Google's Summer of Code to give updates on their work and to talk about their experiences. I'm one such student. Other students, mentors and related persons can also be found in the link list to the right.
This summer, I'll be working on an AI client for Reach For The Stars. For those interested in details, you can have a look at my proposal summary. For those interested in the really gory details, you can take a look at a more detailed proposal on the TP wiki.
So, there is a lot of work to be done this summer. Let's get the ball rolling. Good luck to my fellow SoC students, especially to those of TP!