Пример #1
0
 public BasicHeu(GAPInstance gap)
 {
     GAP     = gap;
     n       = GAP.numcli;
     capLeft = (int[])GAP.cap.Clone();
     m       = GAP.numserv;
 }
Пример #2
0
        public string solveInstance(string selection, string param)
        {
            string dataDirectory = (string)AppDomain.CurrentDomain.GetData("DataDirectory");
            string path          = dataDirectory + "\\" + selection + ".json";

            try {
                GAP = JsonConvert.DeserializeObject <GAPInstance>(File.ReadAllText(path));
            } catch (Exception e) {
                return(e.Message);
            }
            bh = new BasicHeu(GAP);
            try {
                switch (param)
                {
                case "Opt10":
                    int solGAP = bh.GAP10();
                    return("" + solGAP);

                case "SA":
                    int solSA = bh.simulatedAnnealing();
                    return("" + solSA);

                case "TS":
                    int solTS = bh.tabuSearch();
                    return("" + solTS);

                default:
                    int solFind = bh.constructiveEuFirstSol();
                    return("" + solFind);
                }
            } catch (Exception e) {
                return(e.Message);
            }
        }