//private static Mutex sendMessageMutex = new Mutex();


        public DifferentCarbox(GlobalSettings settings) : base(settings)
        {
            RequireSeed         = true;
            RequiredNumRuleSets = 1;
            AutoPlay            = true;

            Seed = new candidate(OBFunctions.tagconvexhullpoints(settings.seed), settings.numOfRuleSets);

            _runDirectory = Path.Combine(settings.OutputDirAbs, "RandomRuleApplication", CARBOXTYPE);

            if (Directory.Exists(_runDirectory))
            {
                Directory.Delete(_runDirectory, true);
            }
            Directory.CreateDirectory(_runDirectory);

            jobBuffer = new JobBuffer(_runDirectory);

            var learnDirectory = Path.Combine(settings.OutputDirAbs, "morfLearn");

            computation = new Computation(_runDirectory, learnDirectory, "point", "stiff");
            writer      = new StreamWriter(Path.Combine(_runDirectory, CARBOXTYPE + ".txt"));

            System.Random rnd = new System.Random();

            var port = rnd.Next(1, 65535);

            //port = 9999;
            server = new LearningServer(learnDirectory, port, _runDirectory);
            client = new MessageClient(port);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Clean way to minimize a graph.
        /// </summary>
        private designGraph Minimize(designGraph graph)
        {
            var mol = QuickMinimization(OBFunctions.designgraphtomol(graph), IODir + "rank" + ".lmpdat",
                                        IODir + "rank" + ".coeff", false, 0);

            OBFunctions.updatepositions(graph, mol);
            return(OBFunctions.tagconvexhullpoints(graph));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Apply the option to the candidate and store the agent's evaluation.
 /// </summary>
 public void ApplyOption(option opt, candidate cand, bool doMinimize)
 {
     cand.graph.globalVariables.Add(cand.f0); // track fitness values of previous states
     opt.apply(cand.graph, null);
     cand.addToRecipe(opt);
     if (doMinimize)
     {
         cand.graph = Minimize(cand.graph);
     }
     cand.graph = OBFunctions.tagconvexhullpoints(cand.graph);
 }
Exemplo n.º 4
0
        public RandomBaseline(GlobalSettings settings) : base(settings)
        {
            RequireSeed         = true;
            RequiredNumRuleSets = 1;
            AutoPlay            = true;
            Seed          = new candidate(OBFunctions.tagconvexhullpoints(settings.seed), settings.numOfRuleSets);
            _runDirectory = Path.Combine(settings.OutputDirAbs, "RandomBaseline");
            if (Directory.Exists(_runDirectory))
            {
                Directory.Delete(_runDirectory, true);
            }
            Directory.CreateDirectory(_runDirectory);
            var learnDirectory = Path.Combine(settings.OutputDirAbs, "morfLearn");

            computation = new Computation(_runDirectory, learnDirectory, "point", "stiff");
            writer      = new StreamWriter(Path.Combine(_runDirectory, "RandomBaseline.txt"));
            jobBuffer   = new JobBuffer(_runDirectory);
            agent       = new Algorithms.Random(settings);
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        /// <summary>
        /// Initializes SearchProcess properties.
        /// </summary>
        public Bfs(GlobalSettings settings) : base(settings)
        {
            RequireSeed         = true;
            RequiredNumRuleSets = 1;
            AutoPlay            = true;

            _runDirectory = Path.Combine(settings.OutputDirAbs, "BFS");
            if (!Directory.Exists(_runDirectory))
            {
                Directory.CreateDirectory(_runDirectory);
            }
            Seed           = new candidate(OBFunctions.tagconvexhullpoints(settings.seed), settings.numOfRuleSets);
            QueueBFS       = new Queue <BFSNode>();
            allNode        = new HashSet <string>();
            allFinalCand   = new HashSet <string>();
            nodeCnt        = 0;
            candCnt        = 0;
            nodeInfoWriter = new StreamWriter(_runDirectory + "/nodeInfo.txt");
            nodeInfoWriter.WriteLine("SMILE,Depth");
            candInfoWriter = new StreamWriter(_runDirectory + "/candInfo.txt");
            candInfoWriter.WriteLine("SMILE,Depth");
        }