Commit f1576271 authored by Kevin Scaman's avatar Kevin Scaman

allStrategy added

parent b4c0846b
......@@ -66,7 +66,7 @@ rngInfo = rng;
% Control strategy parameters
btot = 5; % number of available treatment resources
strategies = createStrategies(btot, 'LRIE');%'RAND', 'LRSR', 'LRIE'); % which strategies to test (baseline, static, dynamic): for more info see the documentation of this function
strategies = createStrategies(btot, 'LRIE', 'RAND');%, 'LRSR', 'MN'); % which strategies to test (baseline, static, dynamic): for more info see the documentation of this function
% Simulation and experimentation parameters
simulationPars = struct;
......
%smallWorldGraph - A generator for Small World graphs.
%%RANDOMSEED Creates an infection state with exactly infection_seed_sz
%randomSeed - Creates an infection state with exactly infection_seed_sz
%infected nodes among N distributed at random.
% function [infected, seed_sz] = randomSeed (N, infection_seed_sz)
%
......
%allStrategy - It creates a strategy object for the ALL strategy.
%
% function [treatments, strategyInternalState] = ...
% allStrategy (~, strategyInternalState)
%
% Input:
% - <void par>: this is a dummy parameter for reasons of being compatible
% with other functions that create a strategy object.
% - strategyInternalState: a structure with all the internal information
% of the strategy state.
%
% Output:
% - treatments: a vector indicating with ones the nodes that re going to
% be treated.
% - strategyInternalState: a structure with the internal state of the
% strategy.
%---
% This is part of the DRA Simulator package for Dynamic Resource Allocation
% strategies aiming to suppress SIS epidemics. See the comments header
% of the main script DRAsimulator.m and the README.md for more details.
% This package is distributed under GNU GPL v.3 or later.
%
% Copyright (c) by Argyris Kalogeratos and Kevin Scaman, 2015.
%---
function [treatments, strategyInternalState] = allStrategy (~, strategyInternalState)
if(isfield(strategyInternalState, 'graph'))
strategyInternalState.N = size(strategyInternalState.graph, 1);
% Cleaning the internal state.
strategyInternalState = rmfield(strategyInternalState, 'graph');
strategyInternalState = rmfield(strategyInternalState, 'infectionSeed');
end
treatments = true(strategyInternalState.N, 1);
end
......@@ -63,7 +63,7 @@ for strategyName=varargin
strategies.RAND = @(idx, state) randomStrategy(idx, state, btot, true);
end
if(strcmp(strategyName, 'ALL'))
strategies.ALL = @(idx, state) [ones(size(state.graph, 1), 1), state];
strategies.ALL = @(idx, state) allStrategy(idx, state);
end
%-------------------------
......@@ -78,7 +78,7 @@ for strategyName=varargin
if(strcmp(strategyName, 'LN'))
strategies.LN = @(idx, state) staticStrategy(idx, state, @(G, infected) -full(sum(G, 1))', btot, 'LN', true);
end
if(strcmp(strategyName, 'SRAI') || strcmp(strategyName, 'LRSR'))
if(strcmp(strategyName, 'LRSR'))
strategies.LRSR = @(idx, state) staticStrategy(idx, state, @(G, infected) dropInMaxEigenValueApprox(G), btot, 'LRSR', true); % approximated version
end
......
......@@ -4,7 +4,7 @@
% nullStrategy (~, strategyInternalState)
%
% Input:
% - <void par>: this is a dummy parameter for reasons of being compatibil
% - <void par>: this is a dummy parameter for reasons of being compatible
% with other functions that create a strategy object.
% - strategyInternalState: a structure with all the internal information
% of the strategy state.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment