I am presenting Constraint Programming for Java Developers at the JavaOne conference on Oct.1 at 10:00 – 11:00 am in San Francisco
I would love to see your presentation…
I have a hard time explaining how CP works.
Most people see it as black magic and hence are suspicious…
I made my presentation yesterday at this major Java event and it seems it generated quite an interest to CP among real-world developers. I had 60+ people at my session and a very involved audience of Java developers with many good questions afterwards. Oracle plans to publish my presentation but meanwhile you may find it at http://openrules.com/pdf/CONS3255_Feldman.pdf. I demonstrated many concrete CSP samples that you may find and run yourself – see the project “org.jcp.jsr331.tck” downloadable from http://openrules.com/jsr331. Let me know if you need any assistance.
I attended your session at JavaOne and thoroughly enjoy it. I can’t wait to see how I can apply to my projects.
Thank you very much Jacob.
I looked at the slides and the example gives the intuition but still I think (and many others do 😉 that CP becomes more interesting once we have combinatorial problems and we need some efficient exploration algorithms: backtracking, branch and bound, etc.
So, I doubt any developers (even without a PhD in operation research) would do such for imbrications.
I’m doing my PhD and I’m perfectly fine with implement OP algorithms, so what motivates me to use CP is that the solution is usually “elegant” and can easily be extended. Although I find it harder to explain (in a paper for example) as the search mechanism really depends on how the solver perform the propagation, etc. and of course we may write constraints differently depending on the solver we use…
However, I think that the fact of having CP solvers implementing only a small set of mathematical operators and the lack of proper debugging mechanisms makes CP less attractive. For example, I wanted to specify constraints with ontology-based subsumption, which is a partial order relation, and had to do some coding to make it feasible in Choco. Moreover, the only way to correct a bug is by simple examples and it gets really fastidious :s while object programming languages have pretty good debugging mechanism.
Java developers appreciate how “elegantly” CP API allows them to represent complex CSPs treating unknown decision variables similarly to known integers or sets, utilizing different predefined binary and global constraints and combining them using traditional O-O techniques. I warned the audience that this simplicity should not mislead them that solving small problems with the default search algorithms will automatically resolve large scale problems, for which expert knowledge may make a major impact. But CP certainly puts Java developers in a very flexible framework to address the most complex problems.
From practical experience with different CP solvers, I know that in real-world applications we always find a way to address the most complex problems that initially may look intractable. Let me disagree with your reasons for CP being “less attractive”. CP solvers (and JSR-331 too) usually cover not only a “small set of mathematical operators” but almost all major math and logical operators defined on different types of constrained objects. More importantly, you always may define your own operators. Of course, if you want to define operators/constraints on your own objects you have to implement them yourself. You can do it by simply combining the existing constraints and logical operators (see e.g. http://openrules.com/jsr331/JSR331.UserManual.pdf p.44) or by implementing completely new constraints with your own propagators. The latter capability is usually provided by a CP Solver, and JSR-331 has it too but not in the official standard (at least yet). Let me know if you want to try it and I will give you an access to an initial implementation of custom propagators.
I agree that debugging may be tricky in some cases because of the non-deterministic nature of CP. However, CP solvers usually provide you with useful “hooks” to trace and to understand what’s going on. Besides, with open source solvers you may use the standard Java debugger with your own break points.
Anyway, while general statements are usually too generic, it is always more productive to try a tool on your own problem and to address a concrete issue. If you have such issues with JSR-331, please let me know. Thanks,
See also this blog post http://blog.decaresystems.ie/2012/10/02/javaone-2012-day-1/
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Join 16 other followers