Thursday, April 14, 2011

Modeling vs writing code

Recently I delivered a prototype model that implements some supply chain functionality and will be integrated into an  Enterprise Resource Planning (ERP) system. The model was implemented in Microsoft Solver Foundation. I often find expressing optimization models in code somewhat cumbersome and less productive than using a more compact modeling language. So I chose to use the same approach as shown here: http://yetanothermathprogrammingconsultant.blogspot.com/2009/05/ms-oml-model-using-c-and-data-from.html. I.e. embed the model in a C# but still use the modeling language (in this case OML). Of course the model itself (about 50 lines) is much “smaller” than all the code needed to prepare the data and getting the data in and out (even though the .NET DataTables have nice functionality to process data – even without using LINQ).

2 comments:

  1. I think that coding in an OO language (such as Java) using an API to a solver (such as Concert for CPLEX) gives you a bit more flexibility in how you construct and store modeling elements. But your OML approach makes the model itself considerably more visible (and readable) in the code, which is great both for maintenance and for explaining to someone what the code is doing.

    ReplyDelete
  2. Looks like a good idea. I personally use AIMMS as a modelling system and am quite satisfied in terms of how easy it is to model and visualize.
    I'm not really into the heavy programming languages. I prefer to focus on the models and leave the rest to a good frame work.
    Cheers

    ReplyDelete