public static T[] NumericArrayFromInterval(StepInterval <T> stepInt) { return(NumericArrayFromInterval(stepInt.min, stepInt.max, stepInt.step)); }
public override void SetDefaultConstants() { base.SetDefaultConstants(); //directories and files config this.BaseFilePath = "./"; this.EnvBaseFilePath = "../../../../bin/config"; this.CondorServerBaseEnvPath = "../config/"; this.CondorScriptPath = "./submit"; this.DestinationTestsDir = Path.GetFullPath("Tests/"); this.PreviousPhaseID = "Optim"; this.TestMeasuresName = "TestMeasures"; this.TestIDPrefix = "IM"; //"IMGP"; //"IM"; //test-related constants var stepInterval = new StepInterval <double>(-1, 1, .1); //(-1, 1, .2); //.1m; //.25m; //1m; //.2m this.ParamsStepIntervals = StepInterval <double> .CreateArray(stepInterval, 5); this.NumTimeSteps = 100000; this.NumSimulations = 10; //208; //1; //4; //16; //208; //104; //48; this.NumSamples = 100; //100; // this.NumTimeSteps; //environment-related constants this.NumStepsPerSeason = 5000; //10000; this.MaxMoveActionsRequired = 30; this.RandStart = true; //true; //false; //learning-related constants this.Temperature = 3.0f; // this.NumTimeSteps; this.Epsilon = 1.0f; this.Discount = 0.9f; this.LearningRate = 0.3f; this.MaximalChangeThreshold = 0.0001f; //0; // this.ExploratoryDecay = 1.0001f; //1.0001f; //1.00004f; // n gr c v er this.SingleTestParameters = new ArrayParameter(new[] { -.1, .10, -.1, .10, .60 }); //persistence //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, -.7, 0.1, 0.2 }); //persistence gp //this.SingleTestParameters = new ArrayParameter(new[] { .00, .10, .60, .00, .30 }); //diff prey season //this.SingleTestParameters = new ArrayParameter(new[] { .00, .20, -.5, .10, .20 }); //diff prey season gp //this.SingleTestParameters = new ArrayParameter(new[] { .10, -.2, .10, .00, .60 }); //poisoned prey season //this.SingleTestParameters = new ArrayParameter(new[] { .00, -.1, .40, -.1, .40 }); //poisoned prey season gp //this.SingleTestParameters = new ArrayParameter(new[] { .10, .00, -.2, .00, .70 }); //lairs //this.SingleTestParameters = new ArrayParameter(new[] { .10, .00, -.3, .40, .20 }); //lairs gp //this.SingleTestParameters = new ArrayParameter(new[] { -.4, .00, .00, .50, .10 }); //hunger-thirst //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, -.2, .50, .30 }); //hunger-thirst gp //this.SingleTestParameters = new ArrayParameter(new[] { .40, .00, -.1, .20, -.3 }); //moving preys //this.SingleTestParameters = new ArrayParameter(new[] { 1.0, .00, .00, .00, .00 }); //moving preys gp //this.SingleTestParameters = new ArrayParameter(new[] { .10, .10, .10, .60, .10 }); //eat all dots gp //this.SingleTestParameters = new ArrayParameter(new[] { .20, .10, .20, .20, .30 }); //pacman gp //this.SingleTestParameters = new ArrayParameter(new[] { -.2, .20, .10, .50, .00 }); //power pellets gp //this.SingleTestParameters = new ArrayParameter(new[] { .50, .00, .10, .20, .20 }); //rewarding dots gp //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, -.3, .00, .70 }); //universal //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, .00, .00, 1.0 }); //extrinsic only //this.SingleTestParameters = new ArrayParameter(new[] { .20, .20, .20, .20, .20 }); //equal-weights //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, .00, .00, .00 }); //random //this.SingleTestParameters = new ArrayParameter(new[] { .00, .00, .00, 1.00, .00 }); //one feature ((ArrayParameter)this.SingleTestParameters).Header = this.ParamIDNames; this.GraphicsEnabled = true; this.SingleTestType = (uint)TestType.Persistence; this.CellSize = 50; this.MaxCPUsUsed = ProcessUtil.GetCPUCount(); //3; this.MultipleTestTypes = new [] { (uint)TestType.Lairs, (uint)TestType.HungerThirst, (uint)TestType.MovingPreys, (uint)TestType.Persistence, (uint)TestType.PoisonedSeason, (uint)TestType.DifferentPreySeason, (uint)TestType.PowerPellets, (uint)TestType.RewardingDots, (uint)TestType.EatAllDots, (uint)TestType.Pacman, //(uint) TestType.AllForagingTests }; }
public override void SetDefaultConstants() { base.SetDefaultConstants(); this.SimpleTests = true; this.DestinationTestsDir = Path.GetFullPath("../../../../../../experiments/2014-SOCIAL"); this.PreviousPhaseID = "Top5"; //ParallelOptimizationTest.OPTIM_TESTS_ID; this.TestIDPrefix = ""; var envBasePath = string.Format("multiagent{0}", (this.SimpleTests ? "-medium/" : "/")); //"-simple/" : "/"); this.EnvBaseFilePath += envBasePath; this.CondorServerBaseEnvPath += envBasePath; this.TestListFilePath = Path.GetFullPath("../../../../bin/config/testsconfig.csv"); //IMRL-related constants var socInt = new StepInterval <double>(.0, .8, .1); // .2m; //.25m; var fitInt = new StepInterval <double>(.2, 1, .2); // .2m; //.25m; this.ParamsStepIntervals = new[] { socInt, socInt, socInt, socInt, socInt, socInt, fitInt }; this.SameAgentParameters = true; // false; // true; this.ParamIDNames = new[] { "Worse", "Hunger", "Pres", "Ext Echo", "Int Echo", "Perf", "Fit" }; this.ParamIDLetters = new[] { 'w', 'h', 'p', 'e', 'i', 'o', 'f' }; //test-related constants this.NumTimeSteps = this.SimpleTests ? 10000u : 50000u; //5000u : 50000u; // 100000; this.NumSimulations = 16; //1; //8; //16; //208; //104; //48; this.NumSamples = 100; // this.NumTimeSteps; this.RandStart = true; //learning-related constants this.Epsilon = 1.0; this.Discount = 0.9; this.LearningRate = 0.3; //0.9; // 0.3; this.MaximalChangeThreshold = 0.0001; //0; // this.ExploratoryDecay = this.SimpleTests ? 1.001 : 1.0002; //1.001 : 1.0002; // 1.0001; //1.00005; this.CellSize = this.SimpleTests ? 100 : 50; this.MaxCPUsUsed = ProcessUtil.GetCPUCount(); //3; //ProcessUtil.GetCPUCount(); // 'w', 'h', 'p', 'e', 'i', 'o', 'f' //this.DefaultTestParameters = new SocialArrayParameter(3, new[] { -.2, 0, .8 }); // 212 //this.DefaultTestParameters = new SocialArrayParameter(3, new[] {0, .8, .2}); // 211 //this.DefaultTestParameters = new SocialArrayParameter(3, new[] { -.4, -.2, .4 }); // S211ElectricLever this.SingleTestParameters = new SocialArrayParameter(3, new[] { .14, .14, .14, .14, .14, .15, .15 }); //equal weights //this.DefaultTestParameters = new SocialArrayParameter(3, new[] {0, 0, 1d}); //extrinsic only //this.DefaultTestParameters = new SocialArrayParameter(3, new[] { 0, 0, 0d }); //random agents this.SingleTestType = (uint)TestType.S212; //creates list of tests types to run this.MultipleTestTypes = new[] { //(uint) TestType.S222, (uint)TestType.S211 //(uint) TestType.S212, //(uint) TestType.S211ElectricLever, //(uint) TestType.S211Lever, //(uint) TestType.S211HeavyLever, //(uint) TestType.S2112Levers, //(uint) TestType.S2122Levers, //(uint) TestType.S2222Levers //(uint)TestType.S313, //(uint)TestType.S311, //(uint)TestType.S323, }; }
/// <summary> /// This function will adjust the startDate by the number of intervals specified. /// If the new date is not a trade date, the date will be corrected to the nearest trading date in the direction specified. /// </summary> /// <param name="interval">The steps size</param> /// <param name="steps">The signed number of steps to move</param> /// <param name="startDate">The initial starting date</param> /// <param name="correction">The direction to move if the result is not a trading date</param> /// <param name="cal"></param> /// <returns></returns> // // Modified Following: A Business Day Convention whereby payment days that fall on a Holiday or Saturday or a Sunday roll forward to the next TARGET Business Day, // unless that day falls in the next calendar month, in which case the payment day rolls backward to the immediately preceding TARGET Business Day. // public static DateTime DateAdd(StepInterval interval, int steps, DateTime startDate, Direction correction, Calendar cal) { List<int> dts = GetTradeDates(cal); DateTime newDate = startDate; switch (interval) { case StepInterval.Day: newDate = startDate.AddDays(steps); break; case StepInterval.Week: newDate = startDate.AddDays(steps * 7); break; case StepInterval.Month: newDate = startDate.AddMonths(steps); break; case StepInterval.Year: newDate = startDate.AddYears(steps); break; // ReSharper disable RedundantEmptyDefaultSwitchBranch default: break; // ReSharper restore RedundantEmptyDefaultSwitchBranch } if (correction == Direction.modifiedForward) { var adjDate = DateAdd(interval, steps, startDate, Direction.forward, cal); if (adjDate.Month == newDate.Month) return adjDate; return DateAdd(interval, steps, startDate, Direction.backward, cal); } int i = dts.BinarySearch(DateUtility.IntDate(newDate)); if (i < 0) { i = ~i - 1; if (correction == Direction.forward) i++; } return DateUtility.NetDate(dts[i]); }