HW2 - 110306073.ipynb - Colaboratory
HW2 - 110306073.ipynb - Colaboratory
ipynb - Colaboratory
print(mTables.Status == grb.GRB.OPTIMAL)
print(mTables.display())
#Print optimal decisions
for v in mTables.getVars():
print(v.VarName, v.X)
#Print optimal objective value
optobj=mTables.getObjective()
print(optobj.getValue())
Root relaxation: objective 2.333333e+03, 2 iterations, 0.00 seconds (0.00 work units)
Question 2
print(mPlayers.Status == grb.GRB.OPTIMAL)
print(mPlayers.display())
#Print optimal decisions
for v in mPlayers.getVars():
print(v.VarName, v.X)
#Print optimal objective value
optobj=mPlayers.getObjective()
print(optobj.getValue())
https://colab.research.google.com/drive/1PgTa_9nRm7RC6s_1WNFoSSOki8AR_YgB#scrollTo=BUp1Pj9S56xF&printMode=true 2/3
2023/3/19 上午11:50 HW2_110306073.ipynb - Colaboratory
Optimize a model with 24 rows, 7 columns and 61 nonzeros
Model fingerprint: 0x0a2c2874
Variable types: 0 continuous, 7 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 3e+00]
Objective range [1e+00, 3e+00]
Bounds range [0e+00, 0e+00]
RHS range [1e+00, 1e+01]
Presolve removed 24 rows and 7 columns
Presolve time: 0.00s
Presolve: All rows and columns removed
Solution count 1: 10
https://colab.research.google.com/drive/1PgTa_9nRm7RC6s_1WNFoSSOki8AR_YgB#scrollTo=BUp1Pj9S56xF&printMode=true 3/3