Search in sources :

Example 1 with StudentSectioningXMLLoader

use of org.cpsolver.studentsct.StudentSectioningXMLLoader in project cpsolver by UniTime.

the class Test method main.

public static void main(String[] args) {
    try {
        System.setProperty("jprof", "cpu");
        BasicConfigurator.configure();
        DataProperties cfg = new DataProperties();
        cfg.setProperty("Neighbour.BranchAndBoundTimeout", "5000");
        cfg.setProperty("Suggestions.Timeout", "1000");
        cfg.setProperty("Extensions.Classes", DistanceConflict.class.getName() + ";" + TimeOverlapsCounter.class.getName());
        cfg.setProperty("StudentWeights.Class", StudentSchedulingAssistantWeights.class.getName());
        cfg.setProperty("StudentWeights.PriorityWeighting", "true");
        cfg.setProperty("StudentWeights.LeftoverSpread", "true");
        cfg.setProperty("StudentWeights.BalancingFactor", "0.0");
        cfg.setProperty("Reservation.CanAssignOverTheLimit", "true");
        cfg.setProperty("Distances.Ellipsoid", DistanceMetric.Ellipsoid.WGS84.name());
        cfg.setProperty("StudentWeights.MultiCriteria", "true");
        cfg.setProperty("CourseRequest.SameTimePrecise", "true");
        cfg.setProperty("log4j.rootLogger", "INFO, A1");
        cfg.setProperty("log4j.appender.A1", "org.apache.log4j.ConsoleAppender");
        cfg.setProperty("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout");
        cfg.setProperty("log4j.appender.A1.layout.ConversionPattern", "%-5p %c{2}: %m%n");
        cfg.setProperty("log4j.logger.org.hibernate", "INFO");
        cfg.setProperty("log4j.logger.org.hibernate.cfg", "WARN");
        cfg.setProperty("log4j.logger.org.hibernate.cache.EhCacheProvider", "ERROR");
        cfg.setProperty("log4j.logger.org.unitime.commons.hibernate", "INFO");
        cfg.setProperty("log4j.logger.net", "INFO");
        cfg.setProperty("Xml.LoadBest", "false");
        cfg.setProperty("Xml.LoadCurrent", "false");
        cfg.putAll(System.getProperties());
        PropertyConfigurator.configure(cfg);
        final Test test = new Test(cfg);
        final File input = new File(args[0]);
        StudentSectioningXMLLoader loader = new StudentSectioningXMLLoader(test.model(), test.assignment());
        loader.setInputFile(input);
        loader.load();
        test.run();
        Solver<Request, Enrollment> s = new Solver<Request, Enrollment>(cfg);
        s.setInitalSolution(test.model());
        StudentSectioningXMLSaver saver = new StudentSectioningXMLSaver(s);
        File output = new File(input.getParentFile(), input.getName().substring(0, input.getName().lastIndexOf('.')) + "-" + cfg.getProperty("run", "r0") + ".xml");
        saver.save(output);
        test.stats(input);
    } catch (Exception e) {
        sLog.error("Test failed: " + e.getMessage(), e);
    }
}
Also used : StudentSchedulingAssistantWeights(org.cpsolver.studentsct.online.selection.StudentSchedulingAssistantWeights) Solver(org.cpsolver.ifs.solver.Solver) DistanceConflict(org.cpsolver.studentsct.extension.DistanceConflict) DataProperties(org.cpsolver.ifs.util.DataProperties) Request(org.cpsolver.studentsct.model.Request) CourseRequest(org.cpsolver.studentsct.model.CourseRequest) FreeTimeRequest(org.cpsolver.studentsct.model.FreeTimeRequest) Enrollment(org.cpsolver.studentsct.model.Enrollment) StudentSectioningXMLSaver(org.cpsolver.studentsct.StudentSectioningXMLSaver) File(java.io.File) NoSuchElementException(java.util.NoSuchElementException) IOException(java.io.IOException) StudentSectioningXMLLoader(org.cpsolver.studentsct.StudentSectioningXMLLoader)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 NoSuchElementException (java.util.NoSuchElementException)1 Solver (org.cpsolver.ifs.solver.Solver)1 DataProperties (org.cpsolver.ifs.util.DataProperties)1 StudentSectioningXMLLoader (org.cpsolver.studentsct.StudentSectioningXMLLoader)1 StudentSectioningXMLSaver (org.cpsolver.studentsct.StudentSectioningXMLSaver)1 DistanceConflict (org.cpsolver.studentsct.extension.DistanceConflict)1 CourseRequest (org.cpsolver.studentsct.model.CourseRequest)1 Enrollment (org.cpsolver.studentsct.model.Enrollment)1 FreeTimeRequest (org.cpsolver.studentsct.model.FreeTimeRequest)1 Request (org.cpsolver.studentsct.model.Request)1 StudentSchedulingAssistantWeights (org.cpsolver.studentsct.online.selection.StudentSchedulingAssistantWeights)1