LP final, problem 5

2743 days ago by haynef

p is the LP to be solved.

p = MixedIntegerLinearProgram(maximization=True) 
       

x1,x2,x3,x4 represent xCMP, xYDS, xTD and xINT respectively.

setting "nonnegetive=True" applies the constraing that all variables be greater than or equal to 0.

v = p.new_variable(real=True, nonnegative=True) x1,x2,x3,x4=v['x1'],v['x2'],v['x3'],v['x4'] 
       

W is EFF(Watson)

S is EFF(Schuessler)

B is EFF(Bryant)

W=(69*x1+738*x2+9*x3-4*x4)/100 S=(10*x1+102*x2+0*x3-1*x4)/15 B=(4*x1+19*x2+0*x3-0*x4)/5 
       

Adding the constraints that for each player's optimal weights, no player's efficiency rating should be above 200.

p.add_constraint((69*x1+738*x2+9*x3-4*x4)/100<=200) p.add_constraint((10*x1+102*x2+0*x3-1*x4)/15<=200) p.add_constraint((4*x1+19*x2+0*x3-0*x4)/5<=200) 
       

Solve the LP for Watson's optimized rating then print the weights used to achieve this.

p.set_objective(W) print "Watson's optimized efficiency rating:", p.solve() a=p.get_values(x1) b=p.get_values(x2) c=p.get_values(x3) d=p.get_values(x4) print "x1=", a print "x2=", b print "x3=", c print "x4=", d 
       
Watson's optimized efficiency rating: 200.0
x1= 0.0
x2= 0.0
x3= 2222.22222222
x4= 0.0
Watson's optimized efficiency rating: 200.0
x1= 0.0
x2= 0.0
x3= 2222.22222222
x4= 0.0

Print the efficiency rating for all three players using Watson's optimized weights.

print "Watson: ", (69*a+738*b+9*c-4*d)/100 print "Schuessler:", (10*a+102*b+0*c-1*d)/15 print "Bryant: ", (4*a+19*b+0*c+0*d)/5 
       
Watson:     200.0
Schuessler: 0.0
Bryant:     0.0
Watson:     200.0
Schuessler: 0.0
Bryant:     0.0

Solve the LP for Schuessler's optimized rating then print the weights used to achieve this.

p.set_objective(S) print "Schuessler's optimized efficiency rating:", p.solve() a=p.get_values(x1) b=p.get_values(x2) c=p.get_values(x3) d=p.get_values(x4) print "x1=", a print "x2=", b print "x3=", c print "x4=", d 
       
Schuessler's optimized efficiency rating: 191.021734715
x1= 218.159658745
x2= 6.70322973796
x3= 0.0
x4= 0.0
Schuessler's optimized efficiency rating: 191.021734715
x1= 218.159658745
x2= 6.70322973796
x3= 0.0
x4= 0.0

Print the efficiency rating for all three players using Schuessler's optimized weights.

print "Watson: ", (69*a+738*b+9*c-4*d)/100 print "Schuessler:", (10*a+102*b+0*c-1*d)/15 print "Bryant: ", (4*a+19*b+0*c+0*d)/5 
       
Watson:     200.0
Schuessler: 191.021734715
Bryant:     200.0
Watson:     200.0
Schuessler: 191.021734715
Bryant:     200.0
p.set_objective(B) print "Bryant's optimized efficiency rating:", p.solve() a=p.get_values(x1) b=p.get_values(x2) c=p.get_values(x3) d=p.get_values(x4) print "x1=", a print "x2=", b print "x3=", c print "x4=", d 
       
Bryant's optimized efficiency rating: 200.0
x1= 218.159658745
x2= 6.70322973796
x3= 0.0
x4= 0.0
Bryant's optimized efficiency rating: 200.0
x1= 218.159658745
x2= 6.70322973796
x3= 0.0
x4= 0.0

Print the efficiency rating for all three players using Bryant's optimized weights.

print "Watson: ", (69*a+738*b+9*c-4*d)/100 print "Schuessler:", (10*a+102*b+0*c-1*d)/15 print "Bryant: ", (4*a+19*b+0*c+0*d)/5 
       
Watson:     200.0
Schuessler: 191.021734715
Bryant:     200.0
Watson:     200.0
Schuessler: 191.021734715
Bryant:     200.0

Each player's optimized efficiency ratings are as followed.

Watson:      200

Schuessler: 191

Bryant:       200