[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] XML Result Output from glpsol
From: |
Nigel Galloway |
Subject: |
Re: [Help-glpk] XML Result Output from glpsol |
Date: |
Thu, 10 May 2007 12:00:38 +0100 |
Andrzej,
Following is a simple example. I don't have an example starting with CPLEX to
hand.
Using the following mathProg:
/* decision variables */
var x ;
var y ;
var z ;
/* objective function */
/* Constraints */
s.t. A : 3*x + 2*y - z = 7;
s.t. B : 4*x + 9*y = 2;
s.t. C : x + 5*y - 3*z = 0;
solve;
display : x;
printf : "x=%f\n",x > 'out.sol';
printf : "y=%f\n",y >> 'out.sol';
printf : "z=%f\n",z >> 'out.sol';
end;
which translates to the following fml/xml
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<mathProgram xmlns="http://FML/lpfml.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FML/lpfml.xsd lpfml.xsd">
<linearProgramDescription>
<source>gplk_test</source>
<maxOrMin>min</maxOrMin>
<numberRows>3</numberRows>
<numberVars>3</numberVars>
</linearProgramDescription>
<linearProgramData>
<rows>
<row rowLB="7" rowName="A" rowUB="7"/>
<row rowLB="2" rowName="B" rowUB="2"/>
<row rowLB="0" rowName="C" rowUB="0"/>
</rows>
<columns>
<col colLB="-1.79769e+308" colName="x" colType="C" objVal="0"/>
<col colLB="-1.79769e+308" colName="y" colType="C" objVal="0"/>
<col colLB="-1.79769e+308" colName="z" colType="C" objVal="0"/>
</columns>
<amatrix>
<sparseMatrix>
<pntANonz>
<el>3</el>
<el>6</el>
<el>8</el>
</pntANonz>
<rowIdx>
<el>0</el>
<el>1</el>
<el>2</el>
<el>0</el>
<el>1</el>
<el>2</el>
<el>0</el>
<el>2</el>
</rowIdx>
<nonz>
<el>3</el>
<el>4</el>
<el>1</el>
<el>2</el>
<el>9</el>
<el>5</el>
<el>-1</el>
<el>-3</el>
</nonz>
</sparseMatrix>
</amatrix>
</linearProgramData>
</mathProgram>
Note the pntANonz tells fml that rowIdx & nonz
1..3 apply to x, 4..6 to y, and the rest to z.
then > FMLSolve --parser=osiglpk gplk_test.xml
Using GLPK on problem gplk_test.xml
Parsing took (seconds): 0.01
Solving took (seconds): 0.01
Writing output file: gplk_test.xml_out.xml
and the output?
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<mathProgram xmlns="http://FML/lpfml.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FML/lpfml.xsd lpfml.xsd">
<linearProgramDescription>
<source>gplk_test</source>
<maxOrMin>min</maxOrMin>
<numberRows>3</numberRows>
<numberVars>3</numberVars>
</linearProgramDescription>
<linearProgramSolution>
<primalSolution>
<sol idx="0" name="x" val="2.75"/>
<sol idx="1" name="y" val="-1"/>
<sol idx="2" name="z" val="-0.75"/>
</primalSolution>
<dualSolution>
<sol idx="0" name="A" val="0"/>
<sol idx="1" name="B" val="0"/>
<sol idx="2" name="C" val="0"/>
</dualSolution>
<status statusId="optimalSolutionFound"/>
<solverMessage> Solved using an OSI Solver</solverMessage>
</linearProgramSolution>
</mathProgram>
as luck would have it
x = 2.75, y = -1, and z = -0.75 is correct.
and > FMLSolve --parser=osiclp gplk_test.xml
Using CLP on problem gplk_test.xml
Parsing took (seconds): 0.01
Coin0506I Presolve 0 (-3) rows, 0 (-3) columns and 0 (-8) elements
Clp3002W Empty problem - 0 rows, 0 columns and 0 elements
Clp0000I Optimal - objective value 0
Coin0511I After Postsolve, objective 0, infeasibilities - dual 0 (0), primal 0
(0)
Clp0006I 0 Obj 0
Clp0006I 0 Obj 0
Clp0000I Optimal - objective value 0
Solving took (seconds): 0.02
Writing output file: gplk_test.xml_out.xml
which I won't reproduce as it's the same.
Regards,
Nigel Galloway
> ----- Original Message -----
> From: "Andrzej Urbanowicz" <address@hidden>
> To: "Nigel Galloway" <address@hidden>
> Subject: Re: [Help-glpk] XML Result Output from glpsol
> Date: Fri, 4 May 2007 18:03:30 +0400
>
>
> Hi Nigel ,
>
> Can you send any simple working example how to use it?
>
> I download fml package from the page but i did not find any working
> example. I found only documentation for classes.
>
> I have installed linux on my computer with glpk 4.15. My problem is
> written in CPLEX format. How to use fml to get xml as output?
>
>
> Andrzej
>
>
>
> On 5/4/07, Nigel Galloway <address@hidden> wrote:
> > I use the following:
> >
> > http://gsbkip.chicagogsb.edu/fml/fml.html
> >
> > Her you will find:
> >
> > Source Code: The C++ source code for all of the libraries for
> > reading and parsing XML files that validate against the LPFML
> > Schema.
> >
> > Documentation: The documentation for the libraries generated by Doxygen.
> >
> > Binaries: A set of libraries for the Windows and Linux platforms.
> > These libraries are the compiled C++ source code and may be used
> > to link with solvers such as CLP, GLPK, and LINDO.
> >
> > License: License information for our libraries.
> > Test Problems: A set of linear programming instances in XML
> > format including many of the NETLIB test problems.
> >
> > Paper: A pdf of the paper, ``LPFML: A W3C XML Schema for Linear
> > Programming'' describing this work.
> >
> > LPFML Schema: The W3C Schema and corresponding documentation for
> > validating instances of linear programming problems.
> >
> > I use these on Unix easily. If you need any help there fine, if
> > you use Windows let me know how it goes.
> >
> > Regards,
> >
> > Nigel Galloway
> >
> > > ----- Original Message -----
> > > From: "Andrzej Urbanowicz" <address@hidden>
> > > To: address@hidden
> > > Subject: [Help-glpk] XML Result Output from glpsol
> > > Date: Wed, 2 May 2007 01:27:34 +0400
> > >
> > >
> > > Hi ,
> > >
> > > I am student at Warsow University of technology and I am looking for
> > > something to parse the result of optimisation from glpsol.
> > > It will be easier if the output will by in XML format. Are there any
> > > library to parse it ?
> > >
> > >
> > > regards
> > > Andzrej Urbanowicz
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Help-glpk mailing list
> > > address@hidden
> > > http://lists.gnu.org/mailman/listinfo/help-glpk
> >
> > >
> >
> >
> > --
> > _______________________________________________
> > Surf the Web in a faster, safer and easier way:
> > Download Opera 9 at http://www.opera.com
> >
> > Powered by Outblaze
> >
>
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze