# Question:Greedy Heuristic in Maple

## Question:Greedy Heuristic in Maple

Maple
Maple Professionals: I wish to prgramm a greedy heuristic in maple and would be more than grateful, if someone could help me, since I am no expert in programming. The problem is a simple stocking problem. There are two parts I wish to stock in my warehouse. I know their demand, delivery time and item cost. From the demand and the delivery time I can calculate the expected backorders given a specified number of units in stock based on a poisson distribution. In the greedy heuristic step by step I increase the stock of all items by 1 and then calculate the reduction in expected backorders divided by the item cost (some kind of "bang per buck"). I then compare the reduction over all items and increase the stock by one for the item with the highest reduction. For the output I wish maple to show me the stock level of the two items and the sum of the expected backorders over the two items at each stage of the algorithm. I only got so far, to programm how two calculate the bang per buck in the first stage, where delta represents the "bang per buck": ``` Depot Optimization Problem > restart; > with(stats): > with(student): ___________________________________________________________________________________ Lead Times(years) > L := 0.1; L := 0.08; Average Base Demand per year > lambda := 10; lambda := 50; Item Cost (\$ 1000) > c := 5; c := 1; Starting Point: Inventory Level > s := 0; s := 0; Increase in system effetiveness per dollar(Bang per Buck) > for i to 2 do Delta[i] := ((sum((k-s[i])*(L[i]*lambda[i])^k*evalf(exp(-L[i]*lambda[i]))/factorial(k), k = s[i]+1 .. infinity))-(sum((k-s[i]-1)*(L[i]*lambda[i])^k*evalf(exp(-L[i]*lambda[i]))/factorial(k), k = s[i]+2 .. infinity)))/c[i] end do > for max(delta, delta) do s[i]= s[i]+1 end do ``` I would be more than grateful for any help from your side, Thx so much in advance, Fred ﻿