public override void setArgs(string CSVArgs) { var vals = ParsingUtils.separateCSV(CSVArgs); eavesdroppingRadius = double.Parse(vals[0]); remainingReward = double.Parse(vals[1]); }
public override List <ARewardFunction> getRewardFunctions(string CSVArgsStart, string CSVArgsEnd, string jump) { List <ARewardFunction> res = new List <ARewardFunction>(); if (CSVArgsEnd.Length == 0) { ConstantExponentialDecay r = new ConstantExponentialDecay(); r.setArgs(CSVArgsStart); res.Add(r); return(res); } try { var vals1 = ParsingUtils.separateCSV(CSVArgsStart); var vals2 = ParsingUtils.separateCSV(CSVArgsEnd); double eavesdroppingRadius = double.Parse(vals1[0]); double remainingRewardMin = double.Parse(vals1[1]); double remainingRewardMax = double.Parse(vals2[1]); double remainingRewardJump = double.Parse(jump); for (; remainingRewardMin < remainingRewardMax + remainingRewardJump; remainingRewardMin += remainingRewardJump) { remainingRewardMin = Math.Min(remainingRewardMin, remainingRewardMax); res.Add(new ConstantExponentialDecay(eavesdroppingRadius, remainingRewardMin)); } return(res); } catch (Exception) { throw new Exception("jump param should only contain jump value for remaining reward"); } }
public override bool init(AGameGraph G, FrontsGridRoutingGameParams prm, IPolicyGUIInputProvider pgui, Dictionary <string, string> policyParams) { graph = (GridGameGraph)G; gameParams = prm; myRand = new ThreadSafeRandom(); repeatSuccessProb = double.Parse( ColumnProbabalisticRoutingPursuers.REPEAT_SUCCUSSFULL_COLUMN_HIT.tryRead(policyParams)); var probStrings = ParsingUtils.separateCSV(ColumnProbabalisticRoutingPursuers.PROBABILITY_PER_COLUMN.tryRead(policyParams)); probPerColGroup = probStrings.ConvertAll((s) => { return(double.Parse(s)); }); colGroups = new List <List <Point> >(); int colIdxStart = 0; columnIdxToColGroup = new List <int>(); for (int colGroup = 0; colGroup < probStrings.Count; ++colGroup) { int colIdxEnd = (int)Math.Min(graph.WidthCellCount, (int)Math.Round((1 + colGroup) * ((float)(graph.WidthCellCount) / probStrings.Count))); colGroups.Add(new List <Point>()); for (; colIdxStart < colIdxEnd; ++colIdxStart) { columnIdxToColGroup.Add(colGroup); for (int y = 0; y < graph.HeightCellCount; ++y) { colGroups.Last().Add(new Point(colIdxStart, y)); } } colIdxStart = colIdxEnd; } return(true); }