1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<HEAD>
<TITLE>LPFML</TITLE>
<style TYPE="text/css"> BODY { font-family:verdana,arial,helvetica; margin:0; }
</style>
</HEAD>
<BODY>
<TABLE STYLE="TABLE-LAYOUT:fixed" class="clsContainer" CELLPADDING="15" CELLSPACING="0"
WIDTH="100%" BORDER="0">
<TR>
<TD VALIGN="top">
<h1 align="left"><u>LPFML</u></h1>
<p>LPFML is a modeling format in XML structure. It started as its own project but is now part of the bigger COIN-OR OSlL project</p>
<p>See <a href="https://www.coin-or.org/OS/OSlL.html">https://www.coin-or.org/OS/OSlL.html</a> for the home page of this tool and examples.</p>
<p>lp_solve can read/write and solve these LPFML models directly via the xli_LPFML XLI driver (see <a href="XLI.htm">External Language Interfaces</a>).</p>
<h4>Reading LPFML models</h4>
It reads such a model in above format and can solve it then.<br>
<br>
For example:
<pre>
lp_solve -rxli xli_LPFML <a href="#parinc.xml">parinc.xml</a>
</pre>
<p>This gives as result:</p>
<pre>
Value of objective function: 7667.94172245
Actual values of the variables:
x1 539.984
x2 252.011
</pre>
<h5>Options</h5>
<p>none</p>
<h4>Generating LPFML models</h4>
<p>The XLI can also create a LPFML model.</p>
<p>For example:</p>
<pre>
lp_solve <a href="#model.lp">model.lp</a> -wxli xli_LPFML model.xml
</pre>
<p>This gives as model.xml:</p>
<pre>
<?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></source>
<maxOrMin>max</maxOrMin>
<numberRows>4</numberRows>
<numberVars>2</numberVars>
</linearProgramDescription>
<linearProgramData>
<rows>
<row rowName="cutanddye" rowUB="630"/>
<row rowName="sewing" rowUB="600"/>
<row rowName="finishing" rowUB="708"/>
<row rowName="inspectandpack" rowUB="135"/>
</rows>
<columns>
<col colName="x1" colType="C" objVal="10"/>
<col colName="x2" colType="C" objVal="9"/>
</columns>
<amatrix>
<sparseMatrix>
<pntANonz>
<el>4</el>
<el>8</el>
</pntANonz>
<rowIdx>
<el>0</el>
<el>1</el>
<el>2</el>
<el>3</el>
<el>0</el>
<el>1</el>
<el>2</el>
<el>3</el>
</rowIdx>
<nonz>
<el>0.7</el>
<el>0.5</el>
<el>1</el>
<el>0.1</el>
<el>1</el>
<el>0.8333</el>
<el>0.6667</el>
<el>0.25</el>
</nonz>
</sparseMatrix>
</amatrix>
</linearProgramData>
</mathProgram>
</pre>
<h5>Options</h5>
<p>The XLI accepts several options:</p>
<pre>
-b64
-comp Compress.
-can Canonical.
</pre>
<h4>API</h4>
<p>Use the lpsolve API call <a href="read_XLI.htm">read_XLI</a> to read a model
and <a href="write_XLI.htm">write_XLI</a> to write a model.
See also <a href="XLI.htm">External Language Interfaces</a>.
</p>
<h4>IDE</h4>
<p>Also from within the IDE, this XLI can be used. However, some entries
must be added in LpSolveIDE.ini (in the folder where the IDE is installed).
</p>
<p>In the [XLI] section the following must be added:</p>
<pre>
lib4=xli_LPFML
</pre>
<p>And a new section for the LPFML XLI must also be added:</p>
<pre>
[xli_LPFML]
extension=.xml
language=XML
</pre>
<p>Then make sure that the xli_LPFML.dll is available for the IDE.
This must be done by placing this dll in the IDE folder or in the
Windows system32 folder. There are also 2 extra dlls needed:
Xalan-C_1_6_0.dll and xerces-c_2_3_0.dll.
It is advised to put these in the system32 folder</p>
<h4>Example models</h4>
<a name="parinc.xml"></a>
<h5>parinc.xml</h5>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Sample XML file generated by XMLSPY v5 U (http://www.xmlspy.com)-->
<!-- $Id: parinc.xml,v 1.8 2003/08/08 19:50:04 kipp Exp $ -->
<mathProgram xmlns="http://FML/lpfml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://FML/lpfml.xsd
http://gsbkip.uchicago.edu/fml/testproblems/lpfml.xsd">
<linearProgramDescription>
<source>Par Inc. Problem from Anderson, Sweeny, and Williams</source>
<maxOrMin>max</maxOrMin>
<objConstant>0.</objConstant>
<numberRows>4</numberRows>
<numberVars>2</numberVars>
</linearProgramDescription>
<linearProgramData>
<rows>
<row rowName="cutanddye" rowUB="630" />
<row rowName="sewing" rowUB="600"/>
<row rowName="finishing" rowUB="708"/>
<row rowName="inspectandpack" rowUB="135" />
</rows>
<columns>
<col objVal="10.0" colName="x1" colType="C" colLB="0.0" />
<col objVal="9" colName="x2" colType="C" colLB="0.0" />
</columns>
<amatrix>
<sparseMatrix>
<pntANonz>
<el>4</el>
<el>8</el>
</pntANonz>
<rowIdx>
<el>0</el>
<el>1</el>
<el>2</el>
<el>3</el>
<el>0</el>
<el>1</el>
<el>2</el>
<el>3</el>
</rowIdx>
<nonz>
<el>.7</el>
<el>.5</el>
<el>1.0</el>
<el>0.1</el>
<el>1.0</el>
<el>0.8333</el>
<el>0.6667</el>
<el>0.25</el>
</nonz>
</sparseMatrix>
</amatrix>
</linearProgramData>
<linearProgramSolution>
<primalSolution>
<sol idx="1" name="x1" val="540"/>
<sol idx="2" name="x2" val="252"/>
</primalSolution>
<dualSolution>
<sol idx="1" name="cutanddye" val="4.37457"/>
<sol idx="3" name="finishing" val="6.9378"/>
</dualSolution>
<optimalValue>7667.94</optimalValue>
<status statusId="optimalSolutionFound">Put in here any other status message desired</status>
<solverMessage>This was solved using LINDO from LINDO Systems, Inc.</solverMessage>
</linearProgramSolution>
</mathProgram>
</pre>
<a name="model.lp"></a>
<h5>model.lp</h5>
<pre>
/* Objective function */
max: +10 x1 +9 x2;
/* Constraints */
cutanddye: +0.7 x1 +x2 <= 630;
sewing: +0.5 x1 +0.8333 x2 <= 600;
finishing: +x1 +0.6667 x2 <= 708;
inspectandpack: +0.1 x1 +0.25 x2 <= 135;
</pre>
</TD>
</TR>
</TABLE>
</BODY>
</html>
|