frePPLeOpen source Production Planning
  • Home
  • Documentation
  • C++ API

Linear programming solver module

This module implements a linear programming solver.

The solver is currently only suitable for prototyping purposes. Further development of this module will continue in function of implementation projects interested in this functionality.

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 specific 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
      • 1 – Introduction
      • 2 – Installation
      • 3 – Entering data
      • 4 – Modelling concepts
      • 5 – Your first model
      • 6 – Your first plan
    • 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
    • User guide
      • Supported browsers
      • Getting around
        • Logging in
        • Logging out
        • Changing password
        • Navigation
          • Menu bar
          • Jump search
          • Context menus
        • Filtering data
        • Sorting data
        • Selecting time buckets
        • Exporting data
        • Importing data
        • Customizing a screen
        • User preferences
        • User permissions and roles
        • Comments
        • History – Audit trail
      • Data maintenance screens
      • Supply Path / Where Used
      • Plan analysis screens
        • 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
      • Execution screen
      • Batch commands
        • frepplectl
        • frepple
        • freppleservice.exe (Windows only)
    • Installation guide
      • Windows installer
      • Compiling on Windows
      • Linux binary packages
      • Compiling on Linux
      • Compiling from the source code repository
      • Running the VMWare virtual machine
      • Other platforms
      • Configuring multiple models in the user interface
      • Configuring as a Python extension module
    • Extension modules
      • Forecast module
      • Order quoting module
      • REST web service module
      • OpenERP connector module
      • Linear programming solver module
    • Technical guide
      • Architecture
      • Source code repository
      • User interface
        • Creating an extension app
        • Translating the user interface
        • Adding or customizing a report
        • Style guide
      • Solver engine
        • Code structure
        • Class diagram
        • Planning algorithm
          • Top level loop
          • Demand solver
          • Buffer solver
          • Flow solver
          • Load solver
          • Operation solver
          • Resource solver
        • Cluster and level algorithm
        • Extension modules
        • Style guide
        • Portability
      • Security
      • 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
    • FAQ
    • License
      • GNU Affero General Public License
      • GNU Free Documentation License
    • Third party add-ons
  • Copyright © 2010-2013 frePPLe bvba