資源描述:
《動態(tài)規(guī)劃方程(dynamic programming equation)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、動態(tài)規(guī)劃方程(Dynamicprogrammingequation)1.resourceissues1---machineallocationproblem,//f[i][j]givesIminKresourcemaximumFor,i:=1,to,N,doFor,j:=0,to,m,doFor,k:=0,to,J,doIf,f[i-1,k]+value[i,j-k]>f[i,j],then,f[i,j]:=f[i-1,k]+value[I,j-k];2.resourceissues2------01knapsackproblemFo
2、ri:=1,to,num,do,and//f[i][j]representthemaximumbackpackvalueofJcapacitywithIitemsFor,j:=1,to,money,doF[I,j]:=max(f[i-1,j-v[i]]+w[i],f[i-1,j]);3.lineardynamicprogramming1-simplestlongestsubsequenceF:=max{f[j]+1}4.subdivisionproblem1StonemergeF[i,j]:=min(f[i,k]+f[k+1,j]+s
3、um[i,j]);{for,i:=1,to,N,doFor,j:=i,to,N,doFor,k:=i,to,J,doS[i,j]:=s[i,j]+a[k];For,i:=1,to,N,doS[i,i]:=0;}Fori:=ndownto1do//f[i][j]representsthemaximumvalueoftheI-JintervalTheForj:=i+1tondo//s[i][j]indicatesthephysicalstrengthrequiredtomergetheI-JFor,k:=i,to,J-1,doIf,f[i
4、,j]>f[i,k]+f[k+1,j]+s[i,k]+s[k+1,j]Then,f[i,j]:=f[i,k]+f[k+1,j]+s[i,k]+s[k+1,j];5.subdivisionproblem2PolygonsubdivisionF[I,j]:=min(f[i,k]+f[k,j]+a[k]*a[j]*a);6.subdivisionproblem3ProductmaximumFori:=1tondo//f[i][j]Isaidthelength,withKmaximummultiplicationF[i][0]:=s[1][i
5、];For,i:=1,to,N,doFor,j:=1,to,K,doIfi>jthenFor,l:=1,to,I-J,doIff[i-l][j-1]*s[i-l+1][i]>f[i][j]thenF[i][j]:=f[i-l][j-1]*s[i-l+1][i];7.resourceissues3Systemreliability(fullbackpack)F[i,j]:=max{f[i-1,j-c*k]*P[I,x]}8.greedydynamicprogramming1FastfoodproblemF[i,J,k]:=max{f[i
6、-1,j',k']+(T-(j-j'),*p1-(k-k')*p2)divp3}9.greedydynamicprogramming2F=min{{f(i-k)}stone(not){f(i-k)}+1}(stone)+greedycompressionstate{for,i:=1,to,shi2[m]+100,doFor,j:=s,to,t,doIf(i-s>=0),and(pd[i]),then,if,f[i-j]+1=0),and(f[i-j]
7、8、otherootnodemodel)F[I,j]:=max{f[I,k-1]*f[k+1,j]+c[k]}{ProgramConsoar;VarF:array[0..100,0..100]oflongint;Tree:a