help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] using lpx_read_model


From: Duilio Foschi
Subject: [Help-glpk] using lpx_read_model
Date: Thu, 11 Sep 2003 10:42:15 +0200

I have a program written in Delphi 3.

I have added an optimization module.

The MOD file is dynamically built and the GLPSOL is executed.

The OUT file is interpreted and the results shown in the GUI.

This works ok.

Now I decided that it would be nicer to invoke the lpx_read_model function
in the GLPK-4.DLL .

As Delphi would not find the "lpx_read_model" function in the DLL, I did
some experiments and Borland TDUMP revealed that the exact function name
stored in the DLL is "glp_lpx_read_model".

So I declared the function as

function glp_lpx_read_model(model:pchar; data:pchar ; output:pchar ):pointer;
external 'glpk-4.dll';

and called it with

var
   p:pointer;   
begin
   p:=glp_lpx_read_model('a.mod',nil,'a.out');

This code should work, but the only result I have seen so far (and - God
knows why - only once) is an OUT file made of 2 lines only: 

Start of output
End of output

(more or less: unfortunately I have deleted the file and was not able to
get it any more).

The returned p is NIL, and this means that the model could not be created.

On the other hand, if I write 

glpsol -m ab.mod -o ab.out

ev works ok.

Could somebody help ?

Thank you

Duilio Foschi






reply via email to

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