# 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