Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 54cac1c2268db633d66eeff1b4faa585 > files > 51

frepple-doc-0.8.1-3.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  <title>Frepple / Linear programming solver module</title>
  <link rel='stylesheet' href='../styles.css' type='text/css' />
  <!--PageHeaderFmt-->  
</head>
<body>
<div id="container">

<div id="menubar">
  
<div id="logo" align="center">
<br/><img src='../frepple.bmp' alt="frepple" /><br/>
<a href='http://www.frepple.com/'>
<strong>a Free<br/>Production Planning<br/>Library</strong>
</a></div>
<div id="menu">
<br/>
<h3><a href='../Main/HomePage.html'>Main</a></h3>
<h3><a href='../UI/Main.html'>User Manual</a></h3>
<h3><a href='../Tutorial/Main.html'>Tutorial</a></h3>
<h3><a href='Main.html'>Reference Manual</a></h3>
<h3><a href='../Main/FAQ.html'>FAQ</a></h3>
<h3><a href='../reference/index.html'>C++ API</a></h3>
<br/><div>
</div>  
</div>
</div>

<div id="content">
<br/>
<!--PageText-->
<div id='wikitext'>
<p><a class='wikilink' href='../Main/HomePage.html'>Main</a> &gt; <span class='wikitrail'><a class='wikilink' href='Main.html'>Reference Manual</a> > <a class='wikilink' href='Modules.html'>Extension modules</a> > <a class='selflink' href='ModulesLPsolver.html'>Linear programming solver module</a></span>
</p>
<p class='vspace'>This module implements a linear programming solver.<br />The solver is intended primarly for prototyping purposes. A linear programming model can quickly be built and validated in a generic way.
</p>
<p class='vspace'><strong>Important:</strong> This solver module is licensed under the GPL, which is different from the GLPL license normally used by frePPLe. 
</p>
<p class='vspace'>The module uses the "GNU Linear Programming Kit" library (aka GLPK) to solve the LP model<br />The solver works as follows:
</p><ul><li>The solver expects a <strong>model file</strong> and a <strong>data file</strong> as input.<br />  The model file represents the mathematical representation of the problem to solve. It can be edited to meet your specfic business problem.<br />  The data file holds the data to be loaded into the problem. If no data file is specified, the data section in the model file is used instead.<br />  The user needs to create these files. A convenient way to generate the data file is to use the Python module. See the unit test lp_solver1 for an example.
</li><li>The solver solves for a number of objectives in sequence.<br />  After solving an objective's optimal value, the solver freezes the objective value as a constraint and start for the next objective. Subsequent objectives can thus never yield a solution that is suboptimal for the previous objectives.
</li><li>After solving for all objectives the solution is written to a <strong>solution file</strong>.<br />  The user is responsible for all processing of this solution file. A convenient way is again to use the Python module.
</li></ul><p class='vspace'>The unit test lp_solver1 shows how a capacity allocation problem is solved with the module.<br />Different business problems will obviously require a different formulation.
</p>
<div class='vspace'></div><h2>Technical implementation</h2>
<p>The module is based on the GLPK (GNU Linear Programming Kit) package. More information on the package can be found on <a target='_blank'  class='urllink' href='http://www.gnu.org/software/glpk/glpk.html' rel='nofollow'>http://www.gnu.org/software/glpk/glpk.html</a>.
</p>
<p class='vspace'>Go through the following steps for a typical usage of this solver:
</p><ul><li>Load the Python and the LPsolver modules with commands as follows in the init.xml file:
</li></ul><pre>    frepple.loadmodule(&quot;mod_lp_solver.so&quot;)
</pre><div class='vspace'></div><ul><li>Copy your model file and Python code into your $FREPPLE_HOME directory.<br />  Assume the function exportData is used for exporting the data file, and the function importSolution is used to read the solution file.
<div class='vspace'></div></li><li>Export the data files, run the solver and import the solution with the following Python commands:
</li></ul><pre>    exportData(&quot;mymodel.dat&quot;)
    lp = frepple.solver_lp(loglevel=2,
       modelfile=&quot;mymodel.mod&quot;,
       datafile=&quot;mymodel.dat&quot;,
       solutionfile=&quot;mymodel.sol&quot;,
       minimum=True,
       objective=[&quot;column_name_1&quot;, &quot;column_name_2&quot;, &quot;column_name_3&quot;])
    lp.solve()
    importSolution(&quot;mymodel.sol&quot;)
</pre>
</div>

<!--PageFooterFmt-->
<!--HTMLFooter-->
</div></div>
</body>
</html>