# How to represent constraints for optimization problems in a data model?

I am at the moment writing a program focusing on asset allocation and I am thinking about how I should represent my constraints in the data model.

The first approach that came to mind was to define some categories to classify the constraints so that they could be stored in a table according to their "category" (for example, unary constraints x>=y, binary constraints y

I then came up with another idea which is to define my own "constraint language" with its own grammar and to store it as a string in the database (like Sum("Equities")<Percent(20,Portfolio)). This would imply writing a parser. I could also opt to use an XML representation of the constraints to use one of the many XML parsers.

I wanted to know if anyone had another potential solution and if you knew about some papers discussing this subject?

-
What kind of restrictions are you talking about? For the linear restrictions you mention a matrix is the way to go. –  Bob Jansen Jul 5 '11 at 17:45
yeah they're not all linear –  SRKX Jul 7 '11 at 7:04

A lot of people use mathematical modelling languages/formats like the proprietary AMPL (see http://en.wikipedia.org/wiki/AMPL) or MPS (see http://en.wikipedia.org/wiki/MPS_%28format%29) to define optimization problems. There are also open source alternatives for a subset of problems (like for example the GNU Linear Programming Kit with its language).

Hans Mittelmann has collected a lot of useful information including test cases under http://plato.asu.edu/guide.html. However, using an optimizer that understands for example AMPL may be not the best approach.

-