Dynamic Programming and Applications Water Allocation - I Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Objectives To discuss the Water Allocation Problem To explain and develop recursive equations for backward approach To explain and develop recursive equations for forward approach 2 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Introduction Dynamic Programming : Sequential or multistage decision making process Water Allocation problem is solved as a sequential process using dynamic programming Water Allocation Problem Consider a canal supplying water for three different crops Maximum capacity of the canal is Q units of water. Amount of water allocated to each field as xi Field 3 x3 x1 Field 1 x2 Field 2 3 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Water Allocation Problem… Net benefits from producing the crops can be expressed as a function of the water allotted. NB1 ( x1 ) 5 x1 0.5 x1 2 NB2 ( x2 ) 8 x2 1.5 x2 NB3 ( x3 ) 7 x3 x3 2 2 Optimization Problem: Determine the optimal allocations xi to each crop that maximizes the total net benefits from all the three crops 4 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Solution using Dynamic Programming Structure the problem as a sequential allocation process or a multistage decision making procedure. Allocation to each crop is considered as a decision stage in a sequence of decisions. Amount of water allocated to crop i is xi Net benefit from this allocation is NBi(xi) Introduce one state variable Si :- Amount of water available to the remaining (3-i) crops State transformation equation can be written as Si 1 Si xi defines the state in the next stage 5 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Sequential Allocation Process The allocation problem is shown as a sequential process 6 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Backward Recursive Equations Objective function: To maximize the net benefits 3 max NBi ( xi ) i 1 Subjected to the constraints x1 x2 x3 Q 0 xi Q for i 1,2,3 Let f1 (Q) be the maximum net benefits that can be obtained from allocating water to crops 1,2 and 3 3 f1 (Q ) max NBi ( xi ) x1 x2 x3 Q x1 , x2 , x3 0 i 1 7 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Backward Recursive Equations… Transforming this into three problems each having only one decision f1 (Q) max NB1 ( x1 ) max NB2 ( x2 ) max NB3 ( x3 ) x1 x2 x3 0 x1 Q 0 x2 Q x1 S 2 0 x S 3 2 x2 S 3 variable Now starting from the last stage, let f 3 ( S3 ) be the maximum net benefits from crop 3. State variable S 3 for this stage can vary from 0 to Q Thus, f 3 ( S 3 ) max NB3 ( x3 ) x3 0 x3 S 3 8 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Backward Recursive Equations… But S3 S 2 x2 . Therefore f 3 ( S3 ) f 3 ( S 2 x2 ) Hence, f1 (Q) max NB1 ( x1 ) max NB2 ( x2 ) f 3 ( S 2 x2 ) x1 x2 0 x1 Q 0 x Q x1 S 2 2 Now, let f 2 (S2 ) be the maximum benefits derived from crops 2 and 3 for a given quantity S 2 which can vary between 0 and Q Therefore, 9 f 2 (S2 ) max x2 0 x2 Q x1 S 2 Water Resources Planning and Management: M4L2 NB2 ( x2 ) f 3 ( S 2 x2 ) D Nagesh Kumar, IISc Backward Recursive Equations… Now since S2 Q x1 , f1 (Q) can be rewritten as f1 (Q) max NB1 ( x1 ) f 2 (Q x1 ) x1 0 x1 Q Once the value of f 3 ( S3 ) is calculated, the value of f 2 ( S 2 ) can be determined, from which f1 (Q) can be determined. 10 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Forward Recursive Equations Let the function f i ( Si ) be the total net benefit from crops 1 to i for a given input of Si which is allocated to those crops. Considering the first stage, f1 ( S1 ) max NB1 ( x1 ) x1 x1 S1 Solve this equation for a range of S1 values from 0 to Q Considering the first two crops, for an available quantity of S 2 , f 2 (S2 ) can be written as f 2 ( S 2 ) max NB2 ( x2 ) f1 ( S 2 x2 ) x2 x2 S 2 11 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Forward Recursive Equations… S2 ranges from 0 to Q Considering the whole system, f 3 ( S3 ) can be expressed as, f 3 ( S3 ) max NB3 ( x3 ) f 2 ( S3 x3 ) x3 x3 S 3 Q If the whole Q units of water should be allocated then the value of S 3 can be taken as equal to Q Otherwise, S 3 will take a range of values from 0 to Q 12 Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc Thank You Water Resources Planning and Management: M4L2 D Nagesh Kumar, IISc