Example #1
0
        public AbstractMetaExperiment(string rootdir, string expname, string fullname, bool create)
        {
            Name = expname;

            _outdir = Path.Combine(rootdir, fullname);
            if (!Directory.Exists(_outdir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_outdir);
                }
                else
                {
                    throw new Exception("Directory " + _outdir + " does not exist!");
                }
            }

            _distdir = Path.Combine(_outdir, DIST_DIR);
            if (!Directory.Exists(_distdir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_distdir);
                }
                else
                {
                    throw new Exception("Directory " + _distdir + " does not exist!");
                }
            }

            if (create)
            {
                if (!File.Exists(TableGenerationConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + TableGenerationConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(TableGenerationConfig.FileName(rootdir), TableGenerationConfig.FileName(_outdir));

                if (!File.Exists(TrajectoryFactorySetConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + TrajectoryFactorySetConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(TrajectoryFactorySetConfig.FileName(rootdir), TrajectoryFactorySetConfig.FileName(_outdir));

                if (!File.Exists(AgentEvaluationFactorySetConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + AgentEvaluationFactorySetConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(AgentEvaluationFactorySetConfig.FileName(rootdir), AgentEvaluationFactorySetConfig.FileName(_outdir));

                string distribfile = Path.Combine(rootdir, TEMPLATE_DIST_FILE);
                if (!File.Exists(distribfile))
                {
                    throw new Exception("File " + distribfile + " does not exist!");
                }
                File.Copy(distribfile, Path.Combine(_outdir, TEMPLATE_DIST_FILE));

                string iterfile = Path.Combine(ApplicationConfig.EXECDIR, DIST_SPACE_ITER_SPEC_FILE);
                if (!File.Exists(iterfile))
                {
                    throw new Exception("File " + iterfile + " does not exist!");
                }
                File.Copy(iterfile, Path.Combine(_outdir, DIST_SPACE_ITER_SPEC_FILE));
            }

            TableConfig = TableGenerationConfig.Factory(_outdir);
            TrajConfig  = TrajectoryFactorySetConfig.Factory(_outdir);
            EvalConfig  = AgentEvaluationFactorySetConfig.Factory(_outdir);

            LoadTemplateDistribution();
            LoadDistributionSpaceIteratorSpecification();
        }
Example #2
0
        protected AbstractExperiment(string rootdir, string expname, string fullname, bool create)
        {
            Name  = expname;
            _resb = null;
            _simb = null;

            _root = rootdir;

            _outdir = Path.Combine(rootdir, fullname);
            if (!Directory.Exists(_outdir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_outdir);
                }
                else
                {
                    throw new Exception("Directory " + _outdir + " does not exist!");
                }
            }
            _popdir = Path.Combine(_outdir, POP_DIR);
            if (!Directory.Exists(_popdir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_popdir);
                }
                else
                {
                    throw new Exception("Directory " + _popdir + " does not exist!");
                }
            }
            _trajdir = Path.Combine(_outdir, TRAJ_DIR);
            if (!Directory.Exists(_trajdir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_trajdir);
                }
                else
                {
                    throw new Exception("Directory " + _trajdir + " does not exist!");
                }
            }
            _bsedir = Path.Combine(_outdir, BSE_DIR);
            if (!Directory.Exists(_bsedir))
            {
                if (create)
                {
                    Directory.CreateDirectory(_bsedir);
                }
                else
                {
                    throw new Exception("Directory " + _bsedir + " does not exist!");
                }
            }

            if (create)
            {
                if (!File.Exists(TableGenerationConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + TableGenerationConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(TableGenerationConfig.FileName(rootdir), TableGenerationConfig.FileName(_outdir));

                if (!File.Exists(TrajectoryFactorySetConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + TrajectoryFactorySetConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(TrajectoryFactorySetConfig.FileName(rootdir), TrajectoryFactorySetConfig.FileName(_outdir));

                if (!File.Exists(AgentEvaluationFactorySetConfig.FileName(rootdir)))
                {
                    throw new Exception("File " + AgentEvaluationFactorySetConfig.FileName(rootdir) + " does not exist!");
                }
                File.Copy(AgentEvaluationFactorySetConfig.FileName(rootdir), AgentEvaluationFactorySetConfig.FileName(_outdir));

                string distribfile = Path.Combine(rootdir, ACTUAL_DIST_FILE);
                if (!File.Exists(distribfile))
                {
                    throw new Exception("File " + distribfile + " does not exist!");
                }
                File.Copy(distribfile, Path.Combine(_outdir, ACTUAL_DIST_FILE));
            }

            TableConfig = TableGenerationConfig.Factory(_outdir);
            TrajConfig  = TrajectoryFactorySetConfig.Factory(_outdir);
            EvalConfig  = AgentEvaluationFactorySetConfig.Factory(_outdir);

            LoadActualDistribution();
        }