• Subject: Re: [ANN] Rima 0.05: Math Programming for Lua
• From: Geoff Leyland <geoff_leyland@...>
• Date: Tue, 29 Mar 2011 09:09:53 +1300

```Hi Gaspard,

On 29/03/2011, at 8:39 AM, Gaspard Bucher wrote:

> Hi Geoff !
>

Thank you!

> I might say something stupid here, so please don't shout. From my understanding, the constraints used in the models are like walls through which one may never pass. Is there a way to do AI with your tool by moving parts of the constraints into the objective and by using statistical models ? Or is this a totally different domain (the mathematical world of symbols versus the muddy waters of statistics) ?

I'm afraid I know next to nothing about AI, but it's certainly possible to move constraints into the objective.

(I apologise to the rest of the list if this is too far off-topic, if so, let me know and I'll take it off the list).

In a purely linear framework, suppose you have a simple constraint like x <= 5, then, you're right, in the math programming sense all feasible solutions will have x <= 5.  But perhaps what you really mean is that you'd prefer x to be less than 5, but it certainly can't be more than 6.
In that case you could, for example, replace the constraint with:
x - y <= 5
0 <= y <= 1
and give y some cost c.  Then, if x is 6, y will have to be 1 and you'll pay 1*c for violating your soft constraint.
Picking a good value for c is another question - maybe have a look at http://en.wikipedia.org/wiki/Lagrange_multiplier for a start.

> I will definitely bookmark your project and try to use it in some life simulations (constraints as physics, objective as energy minimization)...

You can probably find more specialized algorithms for minimising energy, but let me know how you get on!

Cheers,
Geoff

```