{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Rec11_sol

# Rec11_sol - Fall 2010 Optimization I(ORIE 3300/5300...

This preview shows pages 1–4. Sign up to view the full content.

Fall 2010 Optimization I (ORIE 3300/5300) Recitation 11 Solution AMPL book problem 20-4 (a) In this problem, we construct a simple knapsack problem. The model and data files are below. AMPL yields the following solution: ampl: model knapsack.mod; data knapsack.dat; solve; CPLEX 11.2.0: optimal integer solution; objective 2000 1 MIP simplex iterations 0 branch-and-bound nodes ampl: display In; In [*] := a 0 b 0 c 0 d 1 e 1 f 1 g 0 h 0 i 0 j 1 Model File: set OBJECTS; param weight {OBJECTS} > 0; param value {OBJECTS} > 0; param capacity > 0; var In {OBJECTS} binary; maximize Total_Value: sum {i in OBJECTS} value[i]*In[i]; subject to Weight_Limit: sum {i in OBJECTS} weight[i]*In[i] <= capacity; Data File: param capacity := 100; param: OBJECTS: weight value := a 55 1000 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Fall 2010 Optimization I (ORIE 3300/5300) b 50 800 c 40 750 d 35 700 e 30 600 f 30 550 g 15 250 h 15 200 i 10 200 j 5 150 ; (b) Now, we have two knapsacks each with a capacity of 50. The main modification is to index the variable In by both OBJECTS and the set of knapsacks. AMPL yields the following solution: ampl: model knapsacks.mod; data knapsacks.dat; solve; CPLEX 11.2.0: optimal integer solution; objective 1950 21 MIP simplex iterations 0 branch-and-bound nodes 4 cover cuts 2 clique cuts 1 Gomory cut 2 zero-half cuts ampl: display In; In := a 1 0 a 2 0 b 1 0 b 2 0 c 1 0 c 2 1 d 1 0 d 2 0 e 1 1 e 2 0 f 1 0 f 2 0 g 1 1 g 2 0 h 1 0 h 2 0 i 1 0 i 2 1 j 1 1 j 2 0 ; Model File: 2
Fall 2010 Optimization I (ORIE 3300/5300) set OBJECTS; param weight {OBJECTS} > 0; param value {OBJECTS} > 0; param capacity > 0;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}