From 9afdca7e08d0cdabd0358e876e62466bffba0500 Mon Sep 17 00:00:00 2001 From: mgabyurango Date: Mon, 23 Dec 2024 13:17:38 -0500 Subject: [PATCH] adjustment on sdp module adjustment on the initialization for the last epoch --- .../sdp_problem_solutions/sdp_maquinas.py | 37 +++++++++--------- jmarkov/sdp/__pycache__/dtsdp.cpython-311.pyc | Bin 8000 -> 7809 bytes jmarkov/sdp/dtsdp.py | 2 +- tests/tests_dtsdp.py | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/examples/dtsdp_problem_examples/sdp_problem_solutions/sdp_maquinas.py b/examples/dtsdp_problem_examples/sdp_problem_solutions/sdp_maquinas.py index d6bc864..607b6b6 100644 --- a/examples/dtsdp_problem_examples/sdp_problem_solutions/sdp_maquinas.py +++ b/examples/dtsdp_problem_examples/sdp_problem_solutions/sdp_maquinas.py @@ -13,36 +13,37 @@ # Decisiones A = np.array(["Reemplazar","No Reemplazar"]) # Retornos Inmediatos -R = np.zeros((len(E), len(estados), len(A))) -for t in range(len(E)): - for s_index,i in enumerate(estados): - for posA,a in enumerate(A): - if(i=="Excelente" and a=="Reemplazar"): - R[t,s_index,posA]=-1000000 - elif(i=="Excelente" and a=="No Reemplazar"): - R[t,s_index,posA]=100 +R = np.zeros((len(E),len(S),len(A))) +# Recorremos sobre las épocas +for t in range(len(E)): + # Recorremos sobre los estados: + for s_index, i in enumerate(S): + # Recorremos sobre las decisiones: + for a_index, a in enumerate(A): + if i=='Excelente' and a=='Reemplazar': + R[t,s_index,a_index] = -1000 + elif i=='Excelente' and a=='No Reemplazar': + R[t,s_index,a_index] = 100 elif(i=="Bueno" and a=="Reemplazar"): - R[t,s_index,posA]=-100 + R[t,s_index,a_index]=-100 elif(i=="Bueno" and a=="No Reemplazar"): - R[t,s_index,posA]=80 + R[t,s_index,a_index]=80 elif(i=="Promedio" and a=="Reemplazar"): - R[t,s_index,posA]=-100 + R[t,s_index,a_index]=-100 elif(i=="Promedio" and a=="No Reemplazar"): - R[t,s_index,posA]=50 + R[t,s_index,a_index]=50 elif(i=="Malo" and a=="Reemplazar"): - R[t,s_index,posA]=-100 + R[t,s_index,a_index]=-100 elif(i=="Malo" and a=="No Reemplazar"): - R[t,s_index,posA]=10 + R[t,s_index,a_index]=10 # Matrices de transición -probs = {t:np.zeros((len(A), len(estados), len(estados))) for t in E} - matNoReemplazar = np.array([[0.7,0.3,0,0], [0,0.7,0.3,0], - [0,0,0.7,0.3], + [0,0,0.6,0.4], [0,0,0,1]]) -matReemplazar = np.array([[1,0,0,0], +matReemplazar = np.array([[0,0,0,0], [0.7,0.3,0,0], [0.7,0.3,0,0], [0.7,0.3,0,0]]) diff --git a/jmarkov/sdp/__pycache__/dtsdp.cpython-311.pyc b/jmarkov/sdp/__pycache__/dtsdp.cpython-311.pyc index d7ec90463951d7cedff4c6f40d258e3f4ebf53c1..388822e14afc3a36a1700c623630ac61d99feac4 100644 GIT binary patch delta 3116 zcmaJ@eN0=|6@Q=pz~A3C1{=&rV$vjpv=EYjL{gwM2~k3uq>PLio(%?r;n@ivd&E>~ zE0R#j=u-6&q1MyV%xchpz*bKm{u*PHa;)9H!`Xwh_d;E8)df0-hvg||-FR6%u6$uUQvi=(=W zWR68OWR+JFWQJHg1UJx8Z0cxb9VOOD=$_G0VV$5pXxJ_fQ7+lWrX4lbp@{7o95q1V z>lR56x8W(YZsT?xSV57z0!_CmXa-Jult{p$>Fr9KVh5+%!Ks6Ku4sn@J|(2(bZ;=- z7ET}3hbYbfw3XX2@iR8J&(}n7JEjP!I1?DKab_?~aTcKMus}>(fp&0C&i)43?c^L? zgx_`d992(}UFdE4Ra!mTi*oci<*y&&_6O9!cr^-e0}an#zamk98PHGyDbTkVa1nz( zXa0$<+YIQptPB0#YIs>7dexh5BLoIGIoMbtu)t}y`V_!vw>TO&-4;gyr@wn$F-+2i zTruj@6(ftP=LD|;4IZ1|@fFkovup3bk#F|lAI#4Ep+6#BO5qlYR){fj^W zb))v)<@*Dx0~y1)tl=E`u6o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