diff --git a/Web/PartB_Random.php b/Web/PartB_Random.php new file mode 100644 index 0000000..7add841 --- /dev/null +++ b/Web/PartB_Random.php @@ -0,0 +1,224 @@ +$d){ + $profit[$key]=rand(10,50); +} + +//print_r($profit); + +//create cost based off dVariable +$cost=array(); +foreach($dvariable as $key=>$dv){ + $cost[$dv]=rand(2,8); +} +//print_r($cost); + +//Create Actual Profit Array + +$actualProfit1=array(); +foreach($departments as $d){ + $v=$profit[$d]; + foreach($suppliers as $s){ + $actualProfit1["{$s}_{$d}"]=$v-$cost["{$s}_{$d}"]; + } +} +//print_r($actualProfit1); + + + + +//print_r($dvariable); + +//-------------------------------------------------------------------------- +//Create OSIL file + +$os=new WEBIS\OS; + +foreach($dvariable as $dv){ + $v=$os->addVariable("$dv"); + $os->addObjCoef("$dv", $actualProfit1[$dv]); +} + +//Create Demand Constraints +foreach($departments as $d){ + $os->addConstraint(NULL,$demand[$d]); + foreach($suppliers as $s){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} + +//Create Supply Constraints + +foreach($suppliers as $s){ + $os->addConstraint($supply[$s],NULL); + foreach($departments as $d){ + $os->addConstraintCoef("{$s}_{$d}",1); + } + } + //print_r($os); + +?> + + + + + +Decision Support Systems IMSE 7420 Final + + +

J.D.Stumpf-------Jdspn6

+

Decision Support Systems IMSE 7420 Final (E1)

+

Supply Data

+ + +$s"; + } +echo""; +foreach($supply as $s){ + echo""; + } +echo""; +?> + +
Supplier
Supply$s
+

Demand Data

+ + +$d"; + } +echo""; +foreach($demand as $d){ + echo""; + } +echo""; +?> + +
Department
Demand$d
+

Profit Data

+ + +$d"; + } +echo""; +foreach($profit as $p){ + echo""; + } +echo""; +?> + +
Department
Profit$p
+ +

Profit-Shipping Data

+ + +$d"; + } +echo""; +foreach($actualProfit1 as $p){ + echo""; + } +echo""; +?> + + +
Supplier to Department
Actual Profit$p
+ +

OSIL OSRL Optimization Solution

+ + + +solve(); +echo "
Objective Value
$objvalue" +?> +
+ +

Shipment Values

+ + + +$s\n"; +} +?> + +"; + foreach($suppliers as $s){ + echo ""; + } + } +?> +
$d".$os->getVariable("{$s}_{$d}")."
+
+Back to Index Page + + + + + + + diff --git a/Web/PartB_RandomRefactor.php b/Web/PartB_RandomRefactor.php new file mode 100644 index 0000000..50ca3c7 --- /dev/null +++ b/Web/PartB_RandomRefactor.php @@ -0,0 +1,217 @@ +$d){ + $profit[$key]=rand(10,50); +} + +//print_r($profit); + +//create cost based off dVariable +$cost=array(); +foreach($dvariable as $key=>$dv){ + $cost[$dv]=rand(2,8); +} +//print_r($cost); + +//Create Actual Profit Array + +$actualProfit1=array(); +foreach($departments as $d){ + $v=$profit[$d]; + foreach($suppliers as $s){ + $actualProfit1["{$s}_{$d}"]=$v-$cost["{$s}_{$d}"]; + } +} + +//print_r($dvariable); + +//-------------------------------------------------------------------------- +//Create OSIL file + +$os=new WEBIS\OS; + +foreach($dvariable as $dv){ + $v=$os->addVariable("$dv"); + $os->addObjCoef("$dv", $actualProfit1[$dv]); +} +//Create Demand Constraints +foreach($departments as $d){ + $os->addConstraint(NULL,$demand[$d]); + foreach($suppliers as $s){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} +//Create Supply Constraints + +foreach($suppliers as $s){ + $os->addConstraint($supply[$s],NULL); + foreach($departments as $d){ + $os->addConstraintCoef("{$s}_{$d}",1); + } + } + //print_r($os); +?> + + + + +Decision Support Systems IMSE 7420 Final + + +

J.D.Stumpf-------Jdspn6

+

Decision Support Systems IMSE 7420 Final (E1)

+

Supply Data

+ + +$s"; + } +echo""; +foreach($supply as $s){ + echo""; + } +echo""; +?> + +
Supplier
Supply$s
+

Demand Data

+ + +$d"; + } +echo""; +foreach($demand as $d){ + echo""; + } +echo""; +?> + +
Department
Demand$d
+

Profit Data

+ + +$d"; + } +echo""; +foreach($profit as $p){ + echo""; + } +echo""; +?> + +
Department
Profit$p
+ +

Profit-Shipping Data

+ + +$d"; + } +echo""; +foreach($actualProfit1 as $p){ + echo""; + } +echo""; +?> + + +
Supplier to Department
Actual Profit$p
+ +

OSIL OSRL Optimization Solution

+ + + +solve(); +echo "
Objective Value
$objvalue" +?> +
+ +

Shipment Values

+ + + +$s\n"; +} +?> + +"; + foreach($suppliers as $s){ + echo ""; + } +} +?> +
$d".$os->getVariable("{$s}_{$d}")."
+
+Back to Index Page + + + + + diff --git a/Web/PartB_Refactor.php b/Web/PartB_Refactor.php new file mode 100644 index 0000000..d7f6709 --- /dev/null +++ b/Web/PartB_Refactor.php @@ -0,0 +1,193 @@ + $value) { + $actualProfit[$key] = $profit[$key] - $cost[$key]; +} +$actualProfit1=array(); +foreach($suppliers as $key=>$s){ + foreach($departments as $key=>$d){ + $actualProfit1["{$s}_{$d}"] = $actualProfit[$key]; + } +} + +//Create Indexed Array for Supply Capacity +$supplyVal=array(); +for($i=0;$i<($numSuppliers);$i++){ + $supplyVal["S-$i"]=$capacity[$i]; +} + +//Created Indexed Array for Store Demand +$demandVal=array(); +for($i=0;$i<($numDepartments);$i++){ + $demandVal["D-$i"]=$demand[$i]; +} +//Create Decision Variable +$dvariable=array(); +foreach($suppliers as $s){ + foreach($departments as $d){ + $dvariable[]="{$s}_{$d}"; + } +} + +//-------------------------------------------------------------------------- +//Create OSIL file +$os=new WEBIS\OS; + +foreach($dvariable as $dv){ + $v=$os->addVariable("$dv"); + $os->addObjCoef("$dv", $actualProfit1[$dv]); +} + +//Create Demand Constraints +foreach($departments as $d){ + $os->addConstraint(NULL,$demandVal[$d]); + foreach($suppliers as $s){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} +//Create Supply Constraints +foreach($suppliers as $s){ + $os->addConstraint($supplyVal[$s],NULL); + foreach($departments as $d){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} + +?> + + + +Decision Support Systems IMSE 7420 Final + + +

Decision Support Systems IMSE 7420 Final (E1)

+

Supply Data

+ + +$s"; + } +echo""; +foreach($supplyVal as $s){ + echo""; + } +echo""; +?> + +
Supplier
Supply$s
+

Demand Data

+ + +$d"; + } +echo""; +foreach($demandVal as $d){ + echo""; + } +echo""; +?> + +
Department
Demand$d
+

Profit Data

+ + +$d"; + } +echo""; +foreach($profitDisplay as $p){ + echo""; + } +echo""; +?> + +
Department
Profit$p
+ +

Profit-Shipping Data

+ + +$d"; + } +echo""; +foreach($actualProfit as $p){ + echo""; + } +echo""; +?> + +
Supplier to Department
Actual Profit$p
+ +

OSIL OSRL Optimization Solution

+ + +solve(); +echo "
Objective Value
$objvalue" +?> +
+

Shipment Values

+ + +$s\n"; +} +?> + +"; +foreach($suppliers as $s){ +echo ""; +echo "\n"; +} +} +?> +
$d".$os->getVariable("{$s}_{$d}")."
+ + + + + + diff --git a/Web/partB.php b/Web/partB.php new file mode 100644 index 0000000..b147639 --- /dev/null +++ b/Web/partB.php @@ -0,0 +1,258 @@ + + $value) { + $actualProfit[$key] = $profit[$key] - $cost[$key]-$productionCost[$key]; +} +echo"\n"; +echo "ActualProfit"; +print_r($actualProfit); + +$actualProfit1=array(); +foreach($suppliers as $key=>$s){ + foreach($departments as $key=>$d){ + $actualProfit1["{$s}_{$d}"] = $actualProfit[$key]; + } +} +print_r($actualProfit1); + +//Create Indexed Array for Supply Capacity +$supplyVal=array(); +for($i=0;$i<($numSuppliers);$i++){ + $supplyVal["S-$i"]=$capacity[$i]; +} +echo "SupplyVal"; +print_r($supplyVal); + +//Created Indexed Array for Store Demand +$demandVal=array(); +for($i=0;$i<($numDepartments);$i++){ + $demandVal["D-$i"]=$demand[$i]; +} +//echo "demandVal"; +//print_r($demandVal); + +//Create Decision Variable +$dvariable=array(); +foreach($suppliers as $s){ + foreach($departments as $d){ + $dvariable[]="{$s}_{$d}"; + } +} +print_r($dvariable); + +//-------------------------------------------------------------------------- +//Create OSIL file + +$os=new WEBIS\OS; + +foreach($dvariable as $dv){ + $v=$os->addVariable("$dv"); + $os->addObjCoef("$dv", $actualProfit1[$dv]); +} +print_r($dvariable); +//Create Demand Constraints +foreach($departments as $d){ + $os->addConstraint(NULL,$demandVal[$d]); + foreach($suppliers as $s){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} + +//Create Supply Constraints + +foreach($suppliers as $s){ + $os->addConstraint($supplyVal[$s],NULL); + foreach($departments as $d){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} +//print_r($os); +//Create minimum 100 constraint +foreach($suppliers as $s){ + $os->addConstraint(NULL,$supplyMin[$s]); + foreach($departments as $d){ + $os->addConstraintCoef("{$s}_{$d}",1); + } +} +?> + +getVariable("S-0_D-0"); + $sumOne=$sumOne+$os->getVariable("S-0_D-1"); + $sumOne=$sumOne+ $os->getVariable("S-0_D-1"); + +echo"Print SumOne"; +echo $sumOne; + + +?> + + + + +Decision Support Systems IMSE 7420 Final + + +

J.D.Stumpf-------Jdspn6

+

Decision Support Systems IMSE 7420 Final (E1)

+

Supply Data

+ + +$s"; + } +echo""; +foreach($supplyVal as $s){ + echo""; + } +echo""; +?> + +
Supplier
Supply$s
+

Demand Data

+ + +$d"; + } +echo""; +foreach($demandVal as $d){ + echo""; + } +echo""; +?> + +
Department
Demand$d
+

Profit Data

+ + +$d"; + } +echo""; +foreach($profitDisplay as $p){ + echo""; + } +echo""; +?> + +
Department
Profit$p
+ +

Profit-Shipping Data

+ + +$d"; + } +echo""; +foreach($actualProfit as $p){ + echo""; + } +echo""; +?> + +
Supplier to Department
Actual Profit$p
+ +

OSIL OSRL Optimization Solution

+ + + +solve(); +echo "
Objective Value
$objvalue" +?> +
+

Shipment Values

+ + +$s\n"; +} +?> + +"; +foreach($suppliers as $s){ +echo ""; +echo "\n"; +} +} +?> + +
$d".$os->getVariable("{$s}_{$d}")."
+
+

Revenues

+ + +$s "; + } +?> + + + +
Supplier
Revenues
+ +Back to Index Page + + + + + + + + + + +