diff --git a/WCS/os.php b/WCS/os.php
index 10cba79..3fda891 100644
--- a/WCS/os.php
+++ b/WCS/os.php
@@ -11,11 +11,11 @@ class OS {
private $osil=NULL;
private $osrl=NULL;
private $var=array(); // Reverse IDX mapping ($idx->$name).
- private $value=NULL; // Solution value.
- private $solution=NULL;
+ public $value=NULL; // Solution value.
+ public $solution=NULL;
- function __construct($maxOrMin='min') {
+ function __construct($maxOrMin='max') {
$osil=new \SimpleXMLElement('');
$osil->addChild('instanceHeader')->addChild('name',php_uname('n').' '.date('c'));
$data=$osil->addChild('instanceData');
diff --git a/Web/.gitignore b/Web/.gitignore
new file mode 100644
index 0000000..34f73a0
--- /dev/null
+++ b/Web/.gitignore
@@ -0,0 +1,2 @@
+/solution.xml
+/test.xml
diff --git a/Web/E1bInClass.php b/Web/E1bInClass.php
new file mode 100644
index 0000000..ec5f406
--- /dev/null
+++ b/Web/E1bInClass.php
@@ -0,0 +1,209 @@
+demand=$dem;
+ $this->profit=$p;
+ }
+}
+
+$departmentDem["$departments[0]"]=new Department(600,20);
+$departmentDem["$departments[1]"]=new Department(200,30);
+$departmentDem["$departments[2]"]=new Department(300,40);
+$departmentDem["$departments[3]"]=new Department(100,25);
+$departmentDem["$departments[4]"]=new Department(300,25);
+
+
+class Supplier{
+ public $capacity;
+ public $pCost;
+
+ function __construct($c,$pc){
+ $this->capacity=$c;
+ $this->pCost=$pc;
+ }
+}
+
+$supplierCap["$suppliers[0]"] = new Supplier(600,10);
+$supplierCap["$suppliers[1]"] = new Supplier(300,14);
+$supplierCap["$suppliers[2]"] = new Supplier(200,40);
+$supplierCap["$suppliers[3]"] = new Supplier(500,11);
+
+
+//print_r($departmentDem);
+//print_r($supplierCap);
+
+class Distance{
+
+ public $distance;
+ function __construct($dist){
+ $this->distance=$dist;
+ }
+}
+
+
+$distanceMatrix["$suppliers[0]-$departments[0]"]=new Distance(2);
+$distanceMatrix["$suppliers[0]-$departments[1]"]=new Distance(3);
+$distanceMatrix["$suppliers[0]-$departments[2]"]=new Distance(3);
+$distanceMatrix["$suppliers[0]-$departments[3]"]=new Distance(3);
+$distanceMatrix["$suppliers[0]-$departments[4]"]=new Distance(3);
+
+$distanceMatrix["$suppliers[1]-$departments[0]"]=new Distance(5);
+$distanceMatrix["$suppliers[1]-$departments[1]"]=new Distance(2);
+$distanceMatrix["$suppliers[1]-$departments[2]"]=new Distance(4);
+$distanceMatrix["$suppliers[1]-$departments[3]"]=new Distance(4);
+$distanceMatrix["$suppliers[1]-$departments[4]"]=new Distance(2);
+
+$distanceMatrix["$suppliers[2]-$departments[0]"]=new Distance(3);
+$distanceMatrix["$suppliers[2]-$departments[1]"]=new Distance(2);
+$distanceMatrix["$suppliers[2]-$departments[2]"]=new Distance(8);
+$distanceMatrix["$suppliers[2]-$departments[3]"]=new Distance(2);
+$distanceMatrix["$suppliers[2]-$departments[4]"]=new Distance(2);
+
+$distanceMatrix["$suppliers[3]-$departments[0]"]=new Distance(3);
+$distanceMatrix["$suppliers[3]-$departments[1]"]=new Distance(2);
+$distanceMatrix["$suppliers[3]-$departments[2]"]=new Distance(4);
+$distanceMatrix["$suppliers[3]-$departments[3]"]=new Distance(2);
+$distanceMatrix["$suppliers[3]-$departments[4]"]=new Distance(2);
+
+
+//print_r($distanceMatrix);
+
+$os=new \WebIS\OS;
+//assertTrue($os->solve());
+
+
+//echo $distanceMatrix["S1-D1"]->distance;
+
+//setting up the objective function
+foreach($suppliers as $s){
+ foreach($departments as $d){
+ $var="${s}-${d}";
+ $os->addVariable($var);
+ $os->addObjCoef($var,$departmentDem[$d]->profit - $distanceMatrix["$var"]->distance - $supplierCap[$s]->pCost);
+ //print $departmentDem[$d]->profit - $distanceMatrix["$var"]->distance - $supplierCap[$s]->pCost;
+ print "\n";
+ //print "$var\n";
+
+}
+}
+
+//adding the constraints
+
+
+$x=0;
+foreach($supplierCap as $s ){
+ $x+=1;
+ $ub = $s->capacity;
+ //print $ub;
+ //print $s;
+ $os->addConstraint(NULL,$ub);
+ foreach($departments as $key){
+ $currentKey="S$x-${key}";
+ $os->addConstraintCoef($currentKey,1);
+ //print $currentKey;
+ }
+}
+
+$x=0;
+foreach($departmentDem as $d ){
+ $x+=1;
+ $lb = $d->demand;
+ $os->addConstraint($lb,NULL);
+ foreach($suppliers as $k){
+ $currKey="${k}-D$x";
+ $os->addConstraintCoef($currKey,1);
+ //print $currentKey;
+ }
+}
+
+$x=0;
+foreach($supplierCap as $s ){
+ $x+=1;
+ $lb = 100;
+ $os->addConstraint($lb,NULL);
+ foreach($departments as $key){
+ $currentKey="S$x-${key}";
+ $os->addConstraintCoef($currentKey,1);
+ //print $currentKey;
+ }
+}
+
+
+$os->solve();
+
+
+
+$x=0;
+$a=0;
+foreach($supplierCap as $s ){
+ $x+=1;
+ foreach($departments as $key){
+ $currentKey="S$x-${key}";
+ //print_r($os->getVariable($currentKey));
+ //print $currentKey;
+ print "\n";
+ $currentRevenue = $os->getVariable($currentKey);
+ $revenue["$suppliers[$a]"]=$revenue["$suppliers[$a]"]+$currentRevenue;
+ }
+ $a+=1;
+}
+
+//print_r($revenue);
+
+$x=0;
+foreach($departments as $key){
+ $a=0;
+
+ foreach($supplierCap as $s ){
+ $a+=1;
+ $currentKey="S$a-${key}";
+ //print_r($os->getVariable($currentKey));
+ //print $currentKey;
+ $currentProfit = $os->getVariable($currentKey);
+ $profit["$departments[$x]"]=$profit["$departments[$x]"]+$currentProfit;
+
+ }
+ $x+=1;
+}
+
+
+
+//print_r($totalProfit);
+//print_r($profit);
+
+//print_r($os->value);
+
+
+
+?>
+
diff --git a/Web/E1bInClassOutput.php b/Web/E1bInClassOutput.php
new file mode 100644
index 0000000..3cc15f9
--- /dev/null
+++ b/Web/E1bInClassOutput.php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+Exam 1
+
+
+EXAM InClass INPUT AND OUTPUT
+
+
+The maximum profit = $$os->solution";
+
+//shipping matrix
+echo "Shipping Matrix";
+echo "
\n";
+
+foreach($suppliers as $s){
+ echo " | $s | ";
+}
+foreach($departments as $d){
+ echo "
---|
${d} ";
+ foreach($suppliers as $s){
+ $var="${s}-${d}";
+ $val=$os->getVariable($var);
+ echo " | $val | ";
+ }
+ echo "
---|
\n";
+}
+echo "
";
+echo "\n
";
+
+echo "\n";
+
+
+//capacity matrix
+echo "Capacity Matrix";
+echo "
\n";
+
+foreach($suppliers as $s){
+ echo " | $s | ";
+}
+echo "
---|
";
+echo " | ";
+foreach($supplierCap as $sc){
+ echo "$sc->capacity | ";
+}
+echo "
";
+echo "\n
";
+
+echo "\n";
+
+
+
+//Demand matrix
+echo "Demand Matrix";
+echo "
\n";
+
+foreach($departments as $d){
+ echo " | $d | ";
+}
+echo "
---|
";
+echo " | ";
+foreach($departmentDem as $dd){
+ echo "$dd->demand | ";
+}
+echo "
";
+echo "\n
";
+
+echo "\n";
+
+//Profit matrix
+echo "Profit Matrix";
+echo "
\n";
+
+foreach($departments as $d){
+ echo " | $d | ";
+}
+echo "
---|
";
+echo " | ";
+foreach($departmentDem as $dd){
+ echo "$$dd->profit | ";
+}
+echo "
";
+echo "\n
";
+
+echo "\n";
+
+
+//Distance matrix
+echo "Distance Matrix";
+echo "
\n";
+
+foreach($suppliers as $s){
+ echo " | $s | ";
+}
+foreach($departments as $d){
+ echo "
---|
${d} ";
+ foreach($suppliers as $s){
+ $var="${s}-${d}";
+ $val=$distanceMatrix[$var]->distance;
+ echo " | $val | ";
+ }
+ echo "
---|
\n";
+}
+echo "
";
+echo "\n
";
+echo "\n";
+echo "\n\n";
+?>
+
+