public String runeva() { string filepath = null; // save the file on the server if (HttpContext.Request.Form.Files.Any()) { var httpPostedFile = HttpContext.Request.Form.Files[0]; if (httpPostedFile != null) { filepath = Path.Combine(environment.WebRootPath + "/UploadedFiles", httpPostedFile.FileName); using (var fileStream = new FileStream(filepath, FileMode.Create)) { httpPostedFile.CopyTo(fileStream); } } } var sm = new ProductionSolutionManager(new MySqlConnectionRetriever(_config)); SolutionManager.SetResource(new MillProductionResources(filepath)); sm.run(); var collectionWrapper = new { slns = sm.population.Select(x => new { x.solutionid, x.batchid, x.objectiveEvaluation }) }; return(SerializeAndReturn(collectionWrapper)); }
public String getObjectives() { var sm = new ProductionSolutionManager(new MySqlConnectionRetriever(_config)); var collectioWrapper = new { objs = sm.objs.Select(x => x.name) }; return(SerializeAndReturn(collectioWrapper)); }
public String runWithRules() { var ruleDefinations = new List <RuleElements>(); //.FirstOrDefault(x=>x == "ruleDef") //foreach (var objs in HttpContext.Request.Form["ruleDef"]) //{ // ruleDefinations.Add(DeserializeData<RuleElements>(objs)); //} ruleDefinations = DeserializeData <List <RuleElements> >(HttpContext.Request.Form["ruleDef"]); var sm = new ProductionSolutionManager(new MySqlConnectionRetriever(_config)); var bid = Convert.ToInt32(HttpContext.Request.Form["batchId"][0]); sm.rerun(convertToRuleList(ruleDefinations), bid); var collectionWrapper = new { slns = sm.population.Select(x => new { x.solutionid, x.batchid, x.objectiveEvaluation }) }; return(SerializeAndReturn(collectionWrapper)); }