1. Go to this page and download the library: Download kerigard/lpsolve library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kerigard / lpsolve example snippets
use Kerigard\LPSolve\Constraint;
use Kerigard\LPSolve\Problem;
use Kerigard\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('x + y + z <= 75')
// ];
// Define problem
$problem = new Problem([143, 60, 195], $constraints);
// Solve it!
$solver = new Solver(Solver::MAX); // Can be either Solver::MIN for minimization
$solution = $solver->solve($problem);
var_dump($solution);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.