frePPLev2.0
open source Production PLanning
  • Home
  • Documentation
    • Getting started
    • Modeling guide
    • User guide
    • Installation guide
    • Developer guide
    • FAQ
  • C++ API

Linear programming solver module

This module implements a linear programming solver.
The solver is intended primarly for prototyping purposes. A linear programming model can quickly be built and validated in a generic way.

Important: This solver module is licensed under the GPL, which is different from the AGPL license normally used by frePPLe.

The module uses the “GNU Linear Programming Kit” library (aka GLPK) to solve the LP model
The solver works as follows:

  • The solver expects a model file and a data file as input.
    The model file represents the mathematical representation of the problem to solve. It can be edited to meet your specfic business problem.
    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.
    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.
  • The solver solves for a number of objectives in sequence.
    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.
  • After solving for all objectives the solution is written to a solution file.
    The user is responsible for all processing of this solution file. A convenient way is again to use the Python module.

The unit test lp_solver1 shows how a capacity allocation problem is solved with the module.
Different business problems will obviously require a different formulation.

Technical implementation

The module is based on the GLPK (GNU Linear Programming Kit) package. More information on the package can be found on http://www.gnu.org/software/glpk/glpk.html.

Go through the following steps for a typical usage of this solver:

  • Load the Python and the LPsolver modules with commands as follows in the init.xml file:
    frepple.loadmodule("mod_lp_solver.so")
  • Copy your model file and Python code into your $FREPPLE_HOME directory.
    Assume the function exportData is used for exporting the data file, and the function importSolution is used to read the solution file.

  • Export the data files, run the solver and import the solution with the following Python commands:
    exportData("mymodel.dat")
    lp = frepple.solver_lp(loglevel=2,
       modelfile="mymodel.mod",
       datafile="mymodel.dat",
       solutionfile="mymodel.sol",
       minimum=True,
       objective=["column_name_1", "column_name_2", "column_name_3"])
    lp.solve()
    importSolution("mymodel.sol")
    • Getting started
    • Modeling guide
      • Simplified domain model
      • Detailed domain model
      • Environment variables
      • Python interpreter
      • Global parameters
      • Buffer
      • Calendar
      • Customer
      • Demand
      • Flow
      • Item
      • Load
      • Location
      • Operation
      • Suboperation
      • Operationplan
      • Problem
      • Resource
      • SetupMatrix
      • Skill
      • Resource skill
      • Solver
      • Extension modules
        • Forecast module
        • REST web service module
        • Linear programming solver module
        • OpenERP connector module
    • User guide
      • Main features
      • Supported browsers
      • Getting around
        • Logging in
        • Logging out
        • Changing password
        • Navigation
          • Menu bar
          • Jump search
          • Context menus
          • Browser bookmarks
        • Filtering data
        • Sorting data
        • Selecting time buckets
        • Exporting data
        • Importing data
        • User preferences
        • User permissions and roles
      • Screens
        • Data input
        • Supply Path / Where Used
        • Comments
        • History – Audit trail
        • Plan analysis
          • Problem report
          • Constraint report
          • Inventory report
          • Inventory detail report
          • Resource report
          • Resource Gantt report
          • Resource detail report
          • Operation report
          • Operation detail report
          • Demand report
          • Demand detail report
          • Demand Gantt report
          • Forecast report
          • Performance indicator report
        • Execute
      • Batch commands
        • manage.py (manage.exe on Windows)
        • frepple (frepple.exe on Windows)
        • freppleservice.exe (Windows only)
    • Installation guide
      • Windows installer
      • Compiling on Windows
      • Linux binary packages
      • Compiling on Linux
      • Compiling on debian-based linux
      • Compiling on Red Hat based Linux
      • Compiling from the subversion source code repository
      • Running the VMWare virtual machine
      • Other platforms
      • Configuring the user interface
      • Configuring multiple models in the user interface
      • Configuring as a Python extension module
    • FAQ
    • Developer guide
      • Code structure
      • Class diagram
      • Solver
        • Solver features
        • Planning algorithm
          • Top level loop
          • Demand solver
          • Buffer solver
          • Flow solver
          • Load solver
          • Operation solver
          • Resource solver
        • Cluster and level algorithm
      • Extension modules
      • Version control
      • Style guide
      • Portability
      • Security
      • Internationalization
      • Translating the user interface
      • Adding or customizing a report
      • Unit tests
        • buffer_procure_1
        • calendar
        • callback
        • cluster
        • constraints_combined_1
        • constraints_combined_2
        • constraints_leadtime_1
        • constraints_material_1
        • constraints_material_2
        • constraints_material_3
        • constraints_material_4
        • constraints_resource_1
        • constraints_resource_2
        • constraints_resource_3
        • constraints_resource_4
        • constraints_resource_5
        • datetime
        • deletion
        • demand_policy
        • flow_alternate_1
        • flow_alternate_2
        • flow_effective
        • forecast_1
        • forecast_2
        • forecast_3
        • forecast_4
        • forecast_5
        • forecast_6
        • jobshop
        • load_alternate
        • load_effective
        • lpsolver_1
        • multithreading
        • name
        • operation_alternate
        • operation_available
        • operation_effective
        • operation_pre_post
        • operation_routing
        • pegging
        • problems
        • python_1
        • python_2
        • python_3
        • safety_stock
        • sample_module
        • scalability_1
        • scalability_2
        • scalability_3
        • setup_1
        • setup_2
        • skill
        • xml
        • xml_remote
    • License
      • GNU Affero General Public License
      • GNU Free Documentation License
    • Third party add-ons
  • Copyright © 2010-2013 frePPLe bvba