Question: How can i reduce the runtime

I just started using Maple few weeks ago, so i am very new to Maple. I tried to write a program to:

1. read data from excel

2. process the data obtained from different excel sheets to find different possible combinations and calculate costs

3. then to find the minimum cost option

program i wrote is

> with(ExcelTools);
> SHEET1 := Import("analysis.xls", "su1", "A4");
`output redirected...`> print(); # input placeholder
                           Array(%id = 153131340)
> SHEET2 := Import("analysis.xls", "su2", "A4");
`output redirected...`> print(); # input placeholder
                           Array(%id = 174416124)
> SHEET3 := Import("analysis.xls", "su3", "A4");
`output redirected...`> print(); # input placeholder
                           Array(%id = 174418356)
> SHEET4 := Import("analysis.xls", "su4", "A4");
`output redirected...`> print(); # input placeholder
                           Array(%id = 174418108)
> SHEET5 := Import("analysis.xls", "su5", "A4");
`output redirected...`> print(); # input placeholder
                           Array(%id = 174417860)
> COST := Import("cost-impact.xls", "cost", "A10");
`output redirected...`> print(); # input placeholder
                           Array(%id = 174414636)
> IMPACT := Import("cost-impact.xls", "impact", "A10");
`output redirected...`> print(); # input placeholder
                           Array(%id = 184343712)
> MAXCOST := 10000000000000;
> OPTIMAL := Array(1 .. 11, 1 .. 71);
> GLOBAL := Array(1 .. 11, 1 .. 71);
> for SU1 to 7777 do for i to 71 do GLOBAL(1, i) := SHEET1(SU1, i) end do; for SU2 to 7777 do for i to 71 do GLOBAL(2, i) := SHEET2(SU2, i) end do; for SU3 to 7777 do for i to 71 do GLOBAL(3, i) := SHEET3(SU3, i) end do; for SU4 to 7777 do for i to 71 do GLOBAL(4, i) := SHEET4(SU4, i) end do; for SU5 to 7777 do for i to 71 do GLOBAL(5, i) := SHEET5(SU5, i) end do; for CS to 5 do GLOBAL(6, CS) := 0 end do; for CT to 6 do for GS to 60 do GLOBAL(CT+5, GS+5) := GLOBAL(1, GS+5)*IMPACT(3, CT+1)+GLOBAL(2, GS+5)*IMPACT(4, CT+1)+GLOBAL(3, GS+5)*IMPACT(5, CT+1)+GLOBAL(4, GS+5)*IMPACT(6, CT+1)+GLOBAL(5, GS+5)*IMPACT(7, CT+1) end do end do; for CU to 6 do for YEAR to 6 do GLOBAL(CU+5, 66) := 15*((GLOBAL(CU+5, YEAR+5)+GLOBAL(CU+5, YEAR+11))*(1/2))*COST(CU+1, YEAR+1); GLOBAL(CU+5, 67) := 15*((GLOBAL(CU+5, YEAR+17)+GLOBAL(CU+5, YEAR+23))*(1/2))*COST(CU+1, YEAR+1); GLOBAL(CU+5, 68) := 15*((GLOBAL(CU+5, YEAR+29)+GLOBAL(CU+5, YEAR+35))*(1/2))*COST(CU+1, YEAR+1); GLOBAL(CU+5, 69) := 15*((GLOBAL(CU+5, YEAR+41)+GLOBAL(CU+5, YEAR+47))*(1/2))*COST(CU+1, YEAR+1); GLOBAL(CU+5, 70) := 15*((GLOBAL(CU+5, YEAR+53)+GLOBAL(CU+5, YEAR+59))*(1/2))*COST(CU+1, YEAR+1) end do end do; TOTCOST := add(GLOBAL(j, 66), j = 1 .. 11)+add(GLOBAL(j, 67), j = 1 .. 11)+add(GLOBAL(j, 68), j = 1 .. 11)+add(GLOBAL(j, 69), j = 1 .. 11)+add(GLOBAL(j, 70), j = 1 .. 11); if TOTCOST < MAXCOST then OPTIMAL := GLOBAL; Export(OPTIMAL, "analysis.xls", "optimal", "B4") else GLOBAL := 0 end if end do end do end do end do end do;
> %

 

 

even after 6-7 hours i cannot get a solution. If i reduce the loop size to from 1 to 6 do, then i get a solution within few miniutes.

Can anyone help me with this. i really appreciate any help :)

Thanks

Please Wait...