Changes

Jump to navigation Jump to search
1,510 bytes added ,  10:09, 28 September 2018
no edit summary
Line 265: Line 265:  
<source lang="cpp">
 
<source lang="cpp">
 
{ feasible: true, result: 2625, bounded: true, mb: 75, ma: 45 }</source>
 
{ feasible: true, result: 2625, bounded: true, mb: 75, ma: 45 }</source>
 +
 +
 +
'''ExampleLP6: Manufacturing Problem<br>'''
 +
A factory manufactures three products, which require three resources – labor, materials and administration.
 +
The unit profits on these products are $10, $6 and $4 respectively.  There are 100 hr of labor, 600 lb of
 +
material, and 300hr of administration available per day.  In order to determine the optimal product mix,
 +
the following LP model is formulated and solve:<br>
 +
 +
<div id="z3lp6" style="font-size:16px">'''z3 code: Manufacturing Problem'''</div>
 +
<source lang="cpp">
 +
var solver = require('javascript-lp-solver'),
 +
results,
 +
    model = {
 +
    "name": "Factory Problem",
 +
    "optimize": "profit",
 +
    "opType": "max",
 +
    "constraints": {
 +
        "labor": {
 +
            "max": 100(h)
 +
        },
 +
        "material": {
 +
            "max": 600(lb)
 +
        },
 +
"administration": {
 +
            "max": 300(h)
 +
        }
 +
    },
 +
    "variables": {
 +
        "a": {
 +
            "labor": 1(h),
 +
            "material": 10(lb),
 +
"administration": 2(h),
 +
"profit": 10(USD)
 +
        },
 +
        "b": {
 +
            "labor": 1(h),
 +
            "material": 4(lb),
 +
"administration": 2(h),
 +
"profit": 6(USD)
 +
        },
 +
"c": {
 +
            "labor": 1(h),
 +
            "material": 5(lb),
 +
"administration": 6(h),
 +
"profit": 4(USD)
 +
        }
 +
    },
 +
};
 +
console.log(solver.Solve(model));</source>
 +
 +
<div style="font-size:18px">'''Solution:'''</div>
 +
<source lang="cpp">
 +
{ feasible: true,
 +
  result: 733.33333333,
 +
  bounded: true,
 +
  b: 66.66666667,
 +
  a: 33.33333333 }</source>
writer
1,835

edits

Navigation menu