2017 © Pedro Peláez
 

library lpsolve

LPSolve extension as simple PHP library

image

makao/lpsolve

LPSolve extension as simple PHP library

  • Sunday, March 20, 2016
  • by makao
  • Repository
  • 2 Watchers
  • 2 Stars
  • 68 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

LPSolve

LPSolve is a PHP extension for solving linear programming problems. This library provides a wrapper for standard lpsolve() function., (*1)

Installation

Run composer, (*2)

composer require makao/lpsolve

Require autoloader, (*3)

require 'vendor/autoload.php'

Usage

use makao\LPSolve\Constraint;
use makao\LPSolve\Problem;
use makao\LPSolve\Solver;

// Define constraints
$constraints = [
    new Constraint([120, 210, 150.75], LE, 15000),
    new Constraint([110, 30, 125], LE, 4000),
    new Constraint([1, 1, 1], LE, 75)
];

// Or initialize them from string
// $constraints = [
//     Constraint::fromString('120x + 210y + 150.75z <= 15000'),
//     Constraint::fromString('110x + 30y + 125z <= 4000'),
//     Constraint::fromString('1x + 1y + 1z <= 75')
// ];

// Define problem
$problem = new Problem([143, 60, 195], $constraints);

// Solve it!
$solver = new Solver(Solver::MAX); // Can be either Solver::MIN for minimalization
$solution = $solver->solve($problem);

var_dump($solution);

Note: Do not omit coefficient value when create constraint from string., (*4)

There are 3 examples provided in example.php., (*5)

For more information please visit: http://lpsolve.sourceforge.net, (*6)

License

MIT, (*7)

The Versions

20/03 2016

dev-master

9999999-dev

LPSolve extension as simple PHP library

  Sources   Download

MIT

The Requires

  • php >=5.6
  • ext-lpsolve >=5.5.0.8

 

by Avatar makao

php math solver solve programming linear simplex