Exemple #1
0
 private void GetCMAESModel(out LinearModel model, CMAESData.ObjectiveFunction objFun)
 {
     model = new LinearModel(Distribution, Dimension, objFun, false,
         new DirectoryInfo(String.Format(@"{0}\..", FileInfo.DirectoryName)));
 }
Exemple #2
0
        public LinearModel(string distribution, string dimension, CMAESData.ObjectiveFunction objFun,
            bool timedependent, DirectoryInfo dataDir)
            : this(null, Features.Mode.Local, 16, 1, !timedependent, distribution, dimension, Model.CMAES)
        {
            string pat = String.Format("full.{0}.{1}.{2}.weights.{3}",
                distribution, dimension, objFun, timedependent ? "timedependent" : "timeindependent");

            DirectoryInfo dir = new DirectoryInfo(String.Format(@"{0}\CMAES\weights", dataDir.FullName));
            Regex reg = new Regex(pat);
            var files = dir.GetFiles("*.csv").Where(path => reg.IsMatch(path.ToString())).ToList();

            if (files.Count <= 0)
                throw new Exception(String.Format("Cannot find any weights belonging to {0}!", pat));

            FileInfo = files[0];

            LinearModel[] w = ReadLoggedLinearWeights(files[0], distribution, dimension, Model.CMAES);
            LocalWeights = w[0].LocalWeights;
        }