Eight step procedures: Difference between revisions
No edit summary |
|||
Line 46: | Line 46: | ||
=Numerical Example= | =Numerical Example= | ||
Weight capacity of C=5 and N=4 | Weight capacity of C=5 and N=2 | ||
Item types are stages: n=1,2 | |||
Remaining capacity s= 1,2,3,4,5 | |||
<math> | |||
U_{2}(5)\, =\, 0,1,...,min\left \{ a[2], \left \lfloor \frac{5}{w[2]}\right \rfloor \right \} | |||
</math>= '''{0,1,2}''' | |||
Boundary Conditions: <math>f^{*}_{n+1}(s) = 0</math>, ''s=0,1,2,3,4,5'' ''C=5'' | |||
<math> f^{*}_{n}(s)= \overset{max}{j=0,1,...,min\left \{ a[n],\left \lfloor \frac{s}{w[n]} \right \rfloor \right \}} \left \{ b[n,j]+ f^{*}_{n+1}(s-j*w[n]) \right \} </math> | |||
{| class="wikitable" | |||
|+ | |||
!Unused Capacity s | |||
!<math>f^{*}_{1}(s)</math> | |||
!Type 1 opt <math>U^{*}_{1}(s)</math> | |||
!<math>f^{*}_{2}(s)</math> | |||
!Type 2 opt <math>U^{*}_{2}(s)</math> | |||
!<math>f^{*}_{3}(s)</math> | |||
|- | |||
|5 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|- | |||
|4 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|- | |||
|3 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|- | |||
|2 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|- | |||
|1 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|- | |||
|0 | |||
| | |||
| | |||
| | |||
| | |||
|0 | |||
|} | |||
=Applications= | =Applications= |
Revision as of 01:10, 22 November 2020
Author: Eljona Pushaj, Diana Bogdanowich, Stephanie Keomany
Steward: Fengqi You
Introduction
Theory, Methodology, and/or Algorithmic Discussion
Methodology
To solve a problem using the 8-step procedure, one must use the following steps:
Step 1: Specify the stages of the problem
The stages of a dynamic programming problem can be defined as points where decisions are made. These are often denoted with the variable .
Step 2: Specify the states for each stage
The states of a problem are defined as the knowledge necessary to make a decision, or . We set equal to the maximum value of .
Step 3: Specify the allowable actions for each state in each stage
This can be defined as:
Step 4: Describe the optimization function using an English-language description.
In this sentence, we describe the optimization function for each state, or , and each stage, or . This can also be called
Step 5: Define the boundary conditions
This helps create a starting point to finding a solution to the problem. First, we set for all values of . Here, we can note that
Step 6: Define the recurrence relation
During this step, we make an allowable decision involving items for the remaining capacity for items . We can write this statement as:
Step 7: Compute the optimal value from the bottom-up
In this step, a table is made containing all , , and optimal values for all variables. This step can be done manually or by using programming.
Step 8: Arrive at the optimal solution
Once the value for is computed, we would look at the optimal decision that corresponds to the table entry for that value. We start with the optimal value for our first , calculate our remaining space , and use that value to arrive at an optimal value for all .
Numerical Example
Weight capacity of C=5 and N=2
Item types are stages: n=1,2
Remaining capacity s= 1,2,3,4,5
= {0,1,2}
Boundary Conditions: , s=0,1,2,3,4,5 C=5
Unused Capacity s | Type 1 opt | Type 2 opt | |||
---|---|---|---|---|---|
5 | 0 | ||||
4 | 0 | ||||
3 | 0 | ||||
2 | 0 | ||||
1 | 0 | ||||
0 | 0 |