mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Remove duplicate algorithm
This commit is contained in:
parent
f67141e3d9
commit
93e8182eb9
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace phpOMS\Algorithm;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Task status enum.
|
||||
*
|
||||
* @category Tasks
|
||||
* @package Modules
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class AlgorithmType extends Enum
|
||||
{
|
||||
/* public */ const BRUTEFORCE = 0;
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knappsack;
|
||||
use phpOMS\Algorithm\AlgorithmType;
|
||||
|
||||
/**
|
||||
* Knappsack algorithm implementations
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Auth
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Backpack
|
||||
{
|
||||
private $costMaximum = 0;
|
||||
|
||||
private $value = 0;
|
||||
|
||||
private $cost = 0;
|
||||
|
||||
private $items = [];
|
||||
|
||||
private $population = [];
|
||||
|
||||
public function __construct(float $costMaximum)
|
||||
{
|
||||
$this->costMaximum = $costMaximum;
|
||||
}
|
||||
|
||||
public function addPopulationItem(ItemInterface $item) : bool
|
||||
{
|
||||
if (isset($this->population[$item->getId()])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->population[$item->getId()] = $item;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setPopulationItem(ItemInterface $item) /* : void */
|
||||
{
|
||||
$this->population[$item->getId()] = $item;
|
||||
}
|
||||
|
||||
public function setCostCalculation(\Closure $callback) /* : void */
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function setValueCalculation(\Closure $callback) /* : void */
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function setTestPopulationBuilder(\Closure $callback) /* : void */
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function pack(int $type)
|
||||
{
|
||||
switch ($type) {
|
||||
case AlgorithmType::BRUTEFORCE:
|
||||
return $this->bruteforce();
|
||||
default:
|
||||
throw new \Exception('Invalid algorithm type');
|
||||
}
|
||||
}
|
||||
|
||||
public function bruteforce()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knappsack;
|
||||
|
||||
/**
|
||||
* Shape interface.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Math
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface ItemInterface
|
||||
{
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user