當前位置: 首頁>>代碼示例>>Java>>正文


Java StudentSectioningXMLSaver類代碼示例

本文整理匯總了Java中org.cpsolver.studentsct.StudentSectioningXMLSaver的典型用法代碼示例。如果您正苦於以下問題:Java StudentSectioningXMLSaver類的具體用法?Java StudentSectioningXMLSaver怎麽用?Java StudentSectioningXMLSaver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StudentSectioningXMLSaver類屬於org.cpsolver.studentsct包,在下文中一共展示了StudentSectioningXMLSaver類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCurrentSolutionBackup

import org.cpsolver.studentsct.StudentSectioningXMLSaver; //導入依賴的package包/類
@Override
protected Document createCurrentSolutionBackup(boolean anonymize, boolean idconv) {
       getProperties().setProperty("Xml.SaveBest", "true");
       getProperties().setProperty("Xml.SaveInitial", "true");
       getProperties().setProperty("Xml.SaveCurrent", "true");
       if (anonymize) {
           getProperties().setProperty("Xml.ConvertIds", idconv ? "true" : "false");
           getProperties().setProperty("Xml.SaveOnlineSectioningInfo", "true");
           getProperties().setProperty("Xml.SaveStudentInfo", "false");
           getProperties().setProperty("Xml.ShowNames", "false");
       }

       Document document = new StudentSectioningXMLSaver(this).saveDocument();
       
       if (anonymize) {
           getProperties().setProperty("Xml.ConvertIds", "false");
           getProperties().setProperty("Xml.SaveOnlineSectioningInfo", "true");
           getProperties().setProperty("Xml.SaveStudentInfo", "true");
           getProperties().setProperty("Xml.ShowNames", "true");
       }
       
       return document;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:24,代碼來源:StudentSolver.java

示例2: main

import org.cpsolver.studentsct.StudentSectioningXMLSaver; //導入依賴的package包/類
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);
    }
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:57,代碼來源:Test.java


注:本文中的org.cpsolver.studentsct.StudentSectioningXMLSaver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。