help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Algebraic modelling language integrated in C# for GLPK.


From: yo yo
Subject: [Help-glpk] Algebraic modelling language integrated in C# for GLPK.
Date: Mon, 25 Feb 2008 13:04:19 +0000 (GMT)

Hello,

Few weeks ago, I was looking for an Algebraic modelling language integrated in 
C# for GLPK rather than MathProg. I have found one for C++ called FlopC++ (COIN 
Project).
I spent a lot of time and could not get it working. It is too much complicated 
to write something right, there is no error messages, and documentation is very 
poor.
Finally I gave up.
However, the Idea of redefining operators and using templates to adapt the C 
syntax to something more mathematical is quite good and it is also possible in 
C#.
The other thing is the OSI interface to call a broad of solver is also very 
good.

Then I decided to craft something in pure C# for GLPK that I called FlopC#.
 Here are some examples of what is possible with my language:

            FCS_Set SITE = new FCS_Set("SITE");
            SITE.Add(6);
            FCS_Set PRODUCTS = new FCS_Set("PRODUCTS");
            PRODUCTS.Add(4);

            FCS_Subset STOCKABLE = new FCS_Subset(SITE, PRODUCTS);
            STOCKABLE.Add(SITE["SITE1"], PRODUCTS["PRODUCTS3"]);
  

            FCS_Constraint stockmax = new FCS_Constraint(STOCKABLE);
            FCS_Index s = new FCS_Index();
            FCS_Index p = new FCS_Index();
            FCS_Variable stock = new FCS_Variable(STOCKABLE);
            FCS_Variable import = new FCS_Variable(STOCKABLE);
            
              //here is where i write constraints like flopc++
            stockmax[s] =  3 * stock[s] + import[s]<=4;  //will generate 
constraints for each element of STOCKABLE
            stockmax[STOCKABLE[s,p]] = 3 * stock[STOCKABLE[s,p]] + import[s] == 
4;
            

            FCS_Model model = new FCS_Model();
            model.AddConstraints(stockmax);
            model.CreateProblem();
            model.Minimise(import[s]);

I just started yesterday so for the moment I have just put in place base blocks.
Quite a lot of works is needed to get something usable.
I didn't release the code yet, but If there are some people interested in 
working on or using it, please let me know.

Thanks,
YO.




      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
http://mail.yahoo.fr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]