Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic a7 #49

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions WCS/os.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class OS {
static $solver="\\WebIS\\bin\OSSolverService.exe";
static $tmp="\\WebIS\\tmp\\"; // trailing slash required.

private $osil=NULL;
private $osrl=NULL;
private $var=array(); // Reverse IDX mapping ($idx->$name).
private $value=NULL; // Solution value.
public $osil=NULL;
public $osrl=NULL;
public $var=array(); // Reverse IDX mapping ($idx->$name).
public $value=NULL; // Solution value.

private $linear=FALSE;
public $linear=FALSE;

function __construct($maxOrMin='min') {
function __construct($maxOrMin='max') {
$osil=new \SimpleXMLElement('<osil/>');
$osil->addChild('instanceHeader')->addChild('name',php_uname('n').' '.date('c'));
$data=$osil->addChild('instanceData');
Expand Down
49 changes: 49 additions & 0 deletions WCS/topic_a6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

require_once 'Work-Cell-Scheduler/WCS/os.php';


$os=New WebIS\OS;

//variables & OF values
$os->addVariable('x11');
$os->addObjCoef('x11','3');
$os->addVariable('x12');
$os->addObjCoef('x12','2');
$os->addVariable('x21');
$os->addObjCoef('x21','1');
$os->addVariable('x22');
$os->addObjCoef('x22','5');
$os->addVariable('x31');
$os->addObjCoef('x31','5');
$os->addVariable('x32');
$os->addObjCoef('x32','4');

//contraints
$os->addConstraint($ub=45);
$os->addConstraintCoef('x11',1);
$os->addConstraintCoef('x12',1);

$os->addConstraint($ub=60);
$os->addConstraintCoef('x21',1);
$os->addConstraintCoef('x22',1);

$os->addConstraint($ub=35);
$os->addConstraintCoef('x31',1);
$os->addConstraintCoef('x32',1);

$os->addConstraint($lb=50);
$os->addConstraintCoef('x11',1);
$os->addConstraintCoef('x21',1);
$os->addConstraintCoef('x31',1);

$os->addConstraint($lb=60);
$os->addConstraintCoef('x12',1);
$os->addConstraintCoef('x22',1);
$os->addConstraintCoef('x32',1);

//Solve world hunger!
$os->solve();


print_r($os);
Loading