xxxxxxxxxx1
1
using Plotsxxxxxxxxxx1
1
plotly()xxxxxxxxxx1
1
using Random, StatsBase0x0001e240
-1659974861
1073470649
358281436
1073351076
-836744907
1073086183
1497051007
1072821109
960204239
1073516083
-342501482
1073266846
-1718403935
1073376000
-1321583464
1073263548
1129201718
1073404550
-1413096746
1073044152
-761652241
1073037584
-1988158346
1073300352
-1977759271
1347447899
1840933752
-1237490475
382
0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
0x00000000000000000000000000000000
1002
0
xxxxxxxxxx1
1
Random.seed!(123456)20xxxxxxxxxx7
1
begin2
PRODUCTOS_POR_LOTE = 1203
MIN_DEFECTUOSOS_POR_LOTE = 34
MAX_DEFECTUOSOS_POR_LOTE = 85
N_ITERACIONES = 1006
N_PRODUCTOS_EXTRAIDOS = 207
endsimulacion (generic function with 1 method)xxxxxxxxxx21
1
function simulacion(2
N::Int;3
prod_por_lote::Int = PRODUCTOS_POR_LOTE,4
rango_defectuosos::UnitRange = MIN_DEFECTUOSOS_POR_LOTE:MAX_DEFECTUOSOS_POR_LOTE,5
n_prod_extraidos::Int = N_PRODUCTOS_EXTRAIDOS6
)::Float647
saldo_inicial::Float64 = 0.08
lote::BitArray{1} = BitArray(undef, prod_por_lote)9
num_defectuosos::Int = 010
for i in 1:N11
num_defectuosos = rand(rango_defectuosos)12
fill!(lote, false)13
lote[sample(1:prod_por_lote, num_defectuosos, replace = false)] .= true14
if (sum(sample(lote, n_prod_extraidos, replace = false)) ≥ 2)15
saldo_inicial -= 25.016
else17
saldo_inicial += 100.018
end19
end20
saldo_inicial / N21
endf (generic function with 1 method)xxxxxxxxxx6
1
function f(x::Int,y::Int)2
if y < x3
return NaN4
end5
simulacion(10000; rango_defectuosos=x:y)6
endxxxxxxxxxx1
1
plot(0:10, 0:10, f, st=:scatter, xlabel="Minimo de defectos", ylabel="Máximo de defectos")x
1
surface(0:10, 0:10, f, xlabel="Minimo de defectos", ylabel="Máximo de defectos", camera=(-20,160))