Manish, I am not really sure when you say GLPK in your post. It seems that you are referring to MathProg (GMPL) in GLPK/MathProg or you are referring really to GLPK API C/C++ implementation of your model.
There are examples using GLPK API in C in calling MathProg (*.mod), MPS (*.mps) in glpk-4.42/examples folder. Have a look at the examples with c extensions (*.c). The mplsamp2.c has function in calling MathProg (*.mod) model and data (*. dat). The sudoku.mod and sudoku.dat which are the model and data being call in the c program. It seems that you are referring to Knapsack problem (LP and DP), (master and slave). Jeff Kantor webpage has DP converted in LP model. Noli On 2/17/10, Manish Jain <[email protected]> wrote: > Hi all, > I have my source code written in AMPL for Cplex, and I am currently porting > it GLPK. > The models don't work as is, since the original source code has some > AMPL/CPlex specific commands. > Besides, I am more comfortable writing scripts in C++ than with scripting in > AMPL; however, I find that writing models in AMPL is easier. > > I have been able to convert most of my models to GLPK my adding rows, > columns and generating the model row by row, column by column. > > I also saw in the manual that there is a function to load models and data > files, however, I want to generate data on the fly i.e. I just want to load > a model, and then > generate data segments in the code. The requirement is such because I have a > custom Branch and Price routine, and have two independent models for the > 'master' > and the 'slave'. > > Example model: > > param n; > set N := {1..n}; > . > . > . > var x {N} >= 0; > . > . > . > maximize objective: ... > subject to: > . > . > . > > What is the preferred way to do this, since I wasn't able to set the values > of the parameters from the C++ code :| > > > Manish Jain > University of Southern California > _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
