承接 nivshah/simplex-calculator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nivshah/simplex-calculator

Composer 安装命令:

composer require nivshah/simplex-calculator

包简介

Simple tool for linear programming problems solving

README 文档

README

Forked from https://github.com/uestla/Simplex-Calculator

About

PHP library for solving linear programming problems using dual simplex algorithm.

NOTE: Basis cycling detection is not implemented.

Uses bcsub to calculate fractions from decimals in order to avoid floating point issues.

Installation

The recommended way is to use Composer:

composer require uestla/simplex-calculator

You can also download the latest release as a ZIP file.

Conventions

Please name all your input variables as x<n> where <n> is a natural number (see example below for details).

Usage

Loading library

// using Composer
require_once __DIR__ . '/vendor/autoload.php';

// using manual download
require_once __DIR__ . '/Simplex/simplex.php';

Defining and solving simplex tasks

// define task: Maximize x1 + 2x2
$task = new Simplex\Task(new Simplex\Func(array(
	'x1' => 1,
	'x2' => 2,
)));

// add constraints

// 3x1 + 2x2 <= 24
$task->addRestriction(new Simplex\Restriction(array(
	'x1' => 3,
	'x2' => 2,

), Simplex\Restriction::TYPE_LOE, 24));

// -2x1 - 4x2 >= -32
$task->addRestriction(new Simplex\Restriction(array(
	'x1' => -2,
	'x2' => -4,

), Simplex\Restriction::TYPE_GOE, -32));

// create solver
$solver = new Simplex\Solver($task);

// get solutions
$solution = $solver->getSolution(); // array('x1' => 0, 'x2' => 8, 'x3' => 8, 'x4' => 0)
$alternativeSolutions = $solver->getAlternativeSolution(); // array(array('x1' => 4, 'x2' => 6, 'x3' => 0, 'x4' => 0))

// get optimal value
$optimum = $solver->getSolutionValue($solution); // 16

// print solutions
$printer = new Simplex\Printer;
$printer->printSolution($solver);

// or print the whole solution process
$printer->printSolver($solver);

Solutions

$solver->getSolutions() returns primary optimal solution. The value can be of 3 types:

  • array - vector with optimal coefficients to each input variable
  • false - optimal solution does not exist
  • null - not enough steps to find solution

By default, solver stops the calculation after 16 simplex tables. You can increase the maximum steps limit with the second parameter:

$solver = new Simplex\Solver($task, 32);

$solver->getAlternativeSolutions() returns array of other optimal solutions if any have been found. It may return:

  • array - array of vectors with alternative optimal solutions
  • null - no alternative optimal solution found

nivshah/simplex-calculator 适用场景与选型建议

nivshah/simplex-calculator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 78 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「programming」 「Algorithm」 「simplex」 「linear」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nivshah/simplex-calculator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nivshah/simplex-calculator 我们能提供哪些服务?
定制开发 / 二次开发

基于 nivshah/simplex-calculator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 78
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-19