Skip to content

An error in the function simulate in simulating_component_failure.jl #154

@melikovk

Description

@melikovk

For components that do not fail after a maximal number of time steps function returns zero as a time of failure. This happens for small p values. This can be fixed by setting the initial value in the array to maximal number of time steps (100) and checking for this number in the loop.

function simulate(N, p, max_steps=100)
	v = fill(max_steps, N, N)
	t = 0 
	while any( v .== max_steps ) && t < max_steps
		t += 1
		for i= 1:N, j=1:N
			if rand() < p && v[i,j]==max_steps
				v[i,j] = t
			end					    
		end
	end
	return v
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions