yadruchchik gatishil programming

moolatah richard eae. yanni sadar kele. yadruchchik gatishil programming heey anishchitatemadhye nirnay ghenyachya samasyanche modelling aanee nirakaran karnyasathiche eka tantra aahe. yadruchchik programming aanee gatishil programingshi jawalun sambandhit, yadruchchik gatishil programming heey bellman samikaranachya swarupat chhananikhalil samasyeche pratinidhitva karate. anishchitatechya parshvabhumivar changlya paddhatine kase vagave heey tharvanare dhoran mojane haah yamagcha uddesh aahe.
eka preranadayi udaharan mhanje jugar khel.
jugarikade $2 asatat, teela 4 vela sandhicha khel khelanyachi parvanagi asate aanee tiche dhyey kiman $6 midvanyachi tichi sambhavyata vadhavane heey asate. jarr jugari khelachya khelavar $1 formula thevato, tarr sambhavyatesah tee khel jinkate, prarambhik paij parat ghete aanee tee tichi bhandavali sthitee $1 formula neey vadhavate; sambhavyatesah 0.6, tee paijchi rakkam $1 gamavate; serve khel jodinusar swatantra asatat. khelachya konatyahi khelavar, jugar tyaa khelachya suruvatila upalabdh asalelya paishapeksha jaast paishanvar paij lavu shakat nahee.
yaa samasyeche pratikruti tayar karnyasathi aanee sattebajiche dhoran nishchit karnyasathi yadruchchik gatishil programingcha vapar keela jaau shakato, jeey udaharanarth, sattebajichya kshitijachya akheris kiman $6 chee sampatti midvanyachi jugaryachi sambhavyata vadhavate.
lakshat ghya qee khelalya jaau jaau khelanchya sankhyevar maryada nasel tarr samasya suprasiddha sentcha eka prakar banate. pietersberg virodhabhas.
aupcharik parshvabhoomi.
sootra 4 tappyanvar paribhashit kelelya swatantra pranalicha vichar qaraa jyamadhye pratyek tappyache sootra 5 dware darshavile jaate
sootra _ 20 heey, 'ishtatam dhoran' chey anusaran karoon midavalelya ishtatam kharch/bakshisache pratinidhitva karoo dya. sootra _ 21 chya tappyanvaril dhoran. tyanantarchya goshtinmadhye samanyata naan gamavata aapan bakshis jastit jaast karnyachya mandanicha vichar karoo. nirdharak gatishil programingmadhye samanyatah khaleel rachana gheuun karyatmak samikarananshi vyavhar keela jaato.
jethe sootra _ 19 aanee pranalichi seema aut aahe 
sootra _ 25 jastit jaast jaast ishtatam krutincha sanch nishchit karane haah uddesh aahe. vartaman sthitee sootra _ 13 aanee vartaman krutee sootra _ 17 dile tarr, aaplyala sadhyachya tappyat surakshit kelele bakshis "nishchitpane mahit aahe" aanee-sthitee sankraman karya sootra _ 28-bhavishyatil sthitee jyachya dishene pranali sankraman karate.
tathapi, vyavharat, jaree aaplyala sadhyachya tappyachya suruvatila pranalichi sthitee tasech ghetalelya nirnayachi mahitee asali taree, pudhil tappyachya suruvatila pranalichi sthitee aanee sadhyachya kalavadhiche bakshis heey bahudha yadruchchik chull asatat jeey keval sadhyachya tappyachya shevati pahile jaau shakatat.
yadruchchik gatishil programming asha samasyanshi sambandhit aahe jyamadhye vartaman kalavadhiche bakshis aanee/kinwa pudhil kalavadhichi sthitee yadruchchik aahe, i.eae. bahu-stariy yadruchchik pranalinsah. dilelya niyojanachya kshitijavar apekshit (savalatichya) bakshis jastit jaast midvane heey nirnay nirnay uddisht asate.
tyanchya sarvat samanya swarupat, yadruchchik gatishil karyakram khaleel rachana gheuun karyatmak samikarananshi vyavhar karatat.
kuthe?
markov nirnay prakriya hii yadruchchik gatishil karyakramanchya eka vishesh vargache pratinidhitva karate jyamadhye antarnihit yadruchchik prakriya hii eka sthir prakriya aahe jyamadhye markov gunadharm darshavila jaato.
eka yadruchchik gatishil karyakram mhanoon jugar khel.
jugar khel haah eka yadruchchik gatishil karyakram mhanoon khalilpramane tayar keela jaau shakatoh formula _ 44 khel aahet (i.eae. niyojan kshitijamadhye)
formula _ 56 hii sambhavyata asoo dya, qee chauthya khelachya akheris, jugarakade kiman $6 aahet, kaaran tichyakade game formula _ 8 chya suruvatila $45 formula aahe. 
karyatmak samikaran prapt karnyasathi, sootra _ 62 heey sootra _ 56 prapt karnare paij mhanoon paribhashit qaraa, nantar khelachya sootra _ 64 chya suruvatila
sootra _ 74 sathee karyatmak samikaran sootra _ 75 aahe, jethe sootra _ 62 sootra _ 77 madhye shrenibaddha aahe; sootra _ 78 shodhane heey uddisht aahe.
karyatmak samikaran dilyas, khalee namood kelyapramane, forward recursion kinwa backward recursion algoridamdware sarvottam sattebaji dhoran prapt kele jaau shakate.
upay paddhati.
backward recursion kinwa forward recursion algoridam vaparoon yadruchchik gatishil programs ishtatmatesathi sodavale jaau shakatat. kamgiri sudharanyasathi samanyatah memoisation vapar keela jaato. tathapi, nirdharak gatishil programingpramanech tyachya yadruchchik prakaralahi aayamipanacha shaap aahe. yaa karanastav andaje upay paddhati samanyatah vyavharik anuprayoganmadhye vaparlya jaatat.
mage punaravartan.
eka baddh sthitee jaaga dilee tarr, "backward recursion" antim tappyatil sootra _ 4 shhee sambandhit pratyek sambhavya sthitee sootra _ 80 sathee sootra _ 79 saranibaddha karoon suru hote. ekada hii moolye saranibaddha kelee gelee qee, sambandhit ishtatam sthitee-avalambun asalelya krutee sootra _ 82 saha, stage sootra _ 83 varr jaane aanee stage sootra _ 83 shhee sambandhit serve sambhavya avasthansathi sootra _ 84 saranibaddha karane shakya aahe. prakriya pahilya tappyaparyantchya serve urvarit tappyancha vichar karoon suru rahate. ekada hii saranikaran prakriya purn jhaali qee, sootra 86-prarambhik sthitee sootra 45 dilele ishtatam dhoranache moolya-tasech sambandhit ishtatam krutee sootra 88 sahajpane tableveroon punarprapt kele jaau shakate. ganana hii magasalelya paddhatine pudhe jaat asalyane, heey spasht aahe qee magas punaravruttimule mothya sankhyene sthitichi ganana houu shakate jyaa sootra _ 86 chya gananesathi aavashyak naheet.
pudhe punaravrutti.
kalavadhi 1 chya suruvatila pranaliche prarambhik sthitee sootra _ 45 dile, tarr "forward recursion" heey karyatmak samikaran ("forward paas") uttarottar vistaroon sootra _ 86 mojate. yamadhye dilelya sootra _ 93 chee ganana karnyasathi aavashyak asalelya serve sootra _ 92 sathee punaravrutti coll samavisht aahet. ishtatam dhoranache moolya aanee tyachi rachana nantar ("backward paas") dware punarprapt kelee jaate jyamadhye heey nilambit punaravrutti coll sodavale jaatat. backward recursionpeksha eka mahattvacha farak mhanje formula 94 keval formula 86 chya gananesathi sambandhit asalelya avasthansathi mojale jaate. aadhich vicharat ghetalelya avasthanchi punarganane talhanyasathi memoisation vapar keela jaato.
udaharaneh jugar.
purvi charcha kelelya jugar khelachya udaharananchya sandarbhat aapan pudhe punaravrutti spasht karoo. aapan vichar karoon 'forward paas' suru karato.
sootra _ 96
yaa tappyavar aapan adyap sootra 97 mojale nahee, jeey sootra 78 mojanyasathi aavashyak aahet; aapan pudhe jaato aanee yaa vastunchi ganana karato. heey sootra _ 99 lakshat ghya, tyamule ekhadi vyakti memoisation laabh gheu shakate aanee aavashyak ganana fakt ekdach karoo shakate.
sootra _ 101
sootra _ 102
sootra _ 103
sootra _ 104
sootra _ 105
aata aapan sootra 78 mojanyasathi aavashyak asalelya serve sootra 80 sathee sootra 106 mojale aahe. tathapi, yamule sootra 109 samavisht asalelya atirikt nilambit punaravrutti jhalya aahet. aapan pudhe jaato aanee yaa mulyanchi ganana karato.
sootra _ 111
sootra _ 112
sootra _ 113
sootra _ 114
sootra _ 115
sootra _ 116
tappa 4 haah aaplya pranalitil shevatcha tappa asalyane, sootra _ 117 heey khalilpramane sahajpane mojalya mojalya seema atinche pratinidhitva karate.
sootra _ 118
yaa tappyavar, suruvatila, tappa 3 samavisht asalelya 'backward paas' dware ishtatam dhoran aanee tyache moolya pudhe nene aanee punarprapt karane shakya aahe.
sootra _ 120
sootra _ 121
sootra _ 122
sootra _ 123
sootra _ 124
sootra _ 125
aanee mug, tappa 2.
sootra _ 127
sootra _ 128
sootra _ 129
sootra _ 130
sootra _ 131
shevati aapan ishtatam dhoranache moolya sootra _ 132 punarprapt karato.
sootra _ 133
heey ishtatam dhoran aahe jeey purvi spasht kele gele aahe. lakshat ghya qee samaan ishtatam moolya sutrakade nenari anek ishtatam dhorane aahet; udaharanarth, pahilya khelat eka tarr $1 kinwa $2 chaa paij lavu shakato.
payathanchi amalbajavani. yaa udaharanachi sampoorn python amalbajavani pudhilpramane aahe.
aayat yadee tankan karnyapasoon, tupal
meem mhanoon memoise aayat qaraa
functool aayat qaraa 
varg smaranh 
 dafe _ _ init _ _ (self, funk): 
 swatahsathi.funk = funk 
 swatahsathi.memoised = {} 
 swatahsathi.paddhat cashey = {} 
 dafe _ _ coll _ _ (self, * aarg): 
 swatakade parat jaa.cashey midwa (swatah.memoised, argus, 
 lambah swatah.funk (* aarg)) 
 dafe _ _ gett _ _ (self, oo. bii. jeey., oo. bii. jeey. type): 
 swatakade parat jaa.cashey midwa (swatah.methad cashey, oo. bii. jeey., 
 lambah lambah _ _ (functool.aanshik (swayam.funk, oo. bii. jeey.))) 
 dafe cashey _ gett (self, cashey, qee, funk): 
 prayatna karah 
 parat cashey [kall] 
 qee-error vagalatah 
 cashey [qee] = funk () 
 parat cashey [kall] 
 dii. eff. reset (swayam):
 swatahsathi.memoised = {} 
 swatahsathi.paddhat cashey = {} 
varg sthiteeh
 jugaryachya vidhvansak samasyechi sthitee
 dafe _ _ init _ _ (self, teeh int, wealth float):
 rajya nirmata
 yuktivadah
 tii {int}-- kalavadhi
 sampatti {float}-prarambhik sampatti
 swatahsathi.tii, swatah.sampatti = tii, sampatti
 dafe _ _ iqa _ _ (swayam, itar): 
 swatakade parat jaa.__dct _ _ = = =
 dafe _ _ stra _ _ (self):
 parat ess. aar. (swayam.tii) + "+ ess. aar. (swayam.sampatti)
 dafe _ _ hash _ _ (self):
 return hash (ess. aar. (self))
vargatil jugaryancha trasah
 dafe _ _ init _ _ (self, betting horizonh int, targetwhealth float, pii. emm. eff.: list [list [tupal [int, float]]]):
 jugaryacha vidhvans samasya
 yuktivadah
 sattebaji kshitij {int}-sattebaji kshitij
 lakshyit sampatti-- lakshyit sampatti
 pii. emm. eff. {yadee [yadee [tupal [int, float]]]}-sambhavyata vastuman karya
 #udaharan chull aarambh qaraa
 swatahsathi.kshitij, swatah.lakshyit sampatti, swatah.pii. emm. eff. = betting horizon, target commonwealth, pii. emm. eff.
 #lambdas
 swatahsathi.aii. jee. = lambda esah [aay sathee aay shreneet (0, minit (swayam.lakshyit rashtrakul// 2, ess.sampatti) + 1)] #krutee utpadak
 swatahsathi.ess. tii. = lambda ess, aii, aarah sthitee (ess.tii + 1, ess.sampatti-aaa + aaa * aar) #rajya sankraman
 swatahsathi.4 = lambda ess, aii, aarah 1 jarr ess.sampatti-aaa + aaa * aar> = swa.lakshyit rashtrakul itar 0 #tatkal moolya karya
 swatahsathi.cashey _ kriya = {} #ishtatam sthitee/krutee jodyansah cashey
 dafe eff (swayam, sampattih float)-> floath
 ess = sthitee (0, sampatti)
 swatakade parat parat (ess)
 dafe kyu (self, teeh int, wealth float)-> floath
 ess = rajya (tii, sampatti)
 swatakade parat jaa.cashey _ kriya [ess. aar. (ess)]
 @memoize
 dii. eff. eff. (swayam, esah sthitee)-> floath
 #forward punaravrutti
 v = kamal (
 [berries ([pii [1] * * (swayam.ess. tii. (ess, aii, pii [0])) 
 jarr ess.tii <swa.betting horizon-1 itar swa.4 (s, a, p [0]) #bhavishyatil moolya
 swatahsathi pii.pii. emm. eff. [ess.tii]]) #yadruchchik chull prapti
 swatahsathi.aii. jee. (ess)]) #kriya
 opt _ aii = lambda eh berries ([pii [1] * * (swayam.ess. tii. (ess, aii, pii [0])) 
 jarr ess.tii <swa.betting horizon-1 itar swa.4 (ess, aii, pii [0])) 
 swatahsathi pii.pii. emm. eff. [ess.tii]]) = = vhee 
 q = [k sathee k filtermadhye (opt _ aii, self.aii. jee. (ess)] #sarvottam krutee yadee punarprapt qaraa
 swatahsathi.jarr bool (kyu) asel tarr cashey _ action [ess. aar. (ess)] = kyu [0] anyatha konihi #shabdakoshat krutee sathavat nahee
 parat qaraa v #paratava moolya
gr, prarambhik _ sampatti = jugarancha jeev (* * udaharan), 2
print ("f _ 1" (+ str (prarambhik _ sampatti) + "):" + str (gr.f (prarambhik _ sampatti)) 
tii, prarambhik _ sampatti = 1,1
print ("b _" + str (t + 1) + "(" + str (prarambhik _ sampatti) + "):" + str (gr.q (t, prarambhik _ sampatti)))
jaava amalbajavani. jugar chalavatat.jaava hii vareel udaharanachi swatantra [[jaava 8]] amalbajavani aahe.
andaje gatishil programming.
[[majbutikaran shikshan]] chaa parichay.andaje dynamic programming]] dware pradan kele jaate.
sandarbh.
[[vargah gatishil programming]]
[[vargah ishtatam niyantran]]
[[vargah optimization algoridam aanee paddhati]]
[[vargah yadruchchik anukulan]]

