Search in sources :

Example 1 with ProgressWriter

use of org.cpsolver.ifs.util.ProgressWriter in project cpsolver by UniTime.

the class Test method main.

public static void main(String[] args) {
    try {
        Progress.getInstance().addProgressListener(new ProgressWriter(System.out));
        if (args.length == 0) {
            ToolBox.configureLogging();
            DataProperties config = new DataProperties(System.getProperties());
            config.setProperty("Termination.StopWhenComplete", "false");
            config.setProperty("Termination.TimeOut", "60");
            config.setProperty("General.Output", System.getProperty("user.dir"));
            test2(config);
            return;
        }
        File inputCfg = new File(args[0]);
        DataProperties properties = ToolBox.loadProperties(inputCfg);
        if (args.length == 3) {
            File xmlFile = new File(args[1]);
            String outDir = args[2] + File.separator + (sDateFormat.format(new Date()));
            properties.setProperty("General.Output", outDir.toString());
            System.out.println("Input file: " + xmlFile);
            System.out.println("Output folder: " + properties.getProperty("General.Output"));
            (new File(outDir)).mkdirs();
            ToolBox.configureLogging(outDir, null);
            test3(properties, xmlFile);
        } else if (properties.getProperty("INCLUDE_REGEXP") != null) {
            test(inputCfg, null, null, properties.getProperty("INCLUDE_REGEXP"), (args.length > 1 ? args[1] : null));
        } else {
            String outDir = properties.getProperty("General.Output", ".") + File.separator + inputCfg.getName().substring(0, inputCfg.getName().lastIndexOf('.')) + File.separator + sDateFormat.format(new Date());
            if (args.length > 1)
                outDir = args[1] + File.separator + (sDateFormat.format(new Date()));
            properties.setProperty("General.Output", outDir.toString());
            System.out.println("Output folder: " + properties.getProperty("General.Output"));
            (new File(outDir)).mkdirs();
            ToolBox.configureLogging(outDir, null);
            test2(properties);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ProgressWriter(org.cpsolver.ifs.util.ProgressWriter) DataProperties(org.cpsolver.ifs.util.DataProperties) File(java.io.File) Date(java.util.Date)

Example 2 with ProgressWriter

use of org.cpsolver.ifs.util.ProgressWriter in project cpsolver by UniTime.

the class Test method main.

public static void main(String[] args) {
    try {
        Progress.getInstance().addProgressListener(new ProgressWriter(System.out));
        File inputCfg = new File(args[0]);
        DataProperties properties = ToolBox.loadProperties(inputCfg);
        String outDir = properties.getProperty("General.Output", ".") + File.separator + inputCfg.getName().substring(0, inputCfg.getName().lastIndexOf('.')) + File.separator + sDateFormat.format(new Date());
        (new File(outDir)).mkdirs();
        properties.setProperty("General.Output", outDir.toString());
        ToolBox.configureLogging(outDir, null);
        test(properties);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ProgressWriter(org.cpsolver.ifs.util.ProgressWriter) DataProperties(org.cpsolver.ifs.util.DataProperties) File(java.io.File) Date(java.util.Date)

Example 3 with ProgressWriter

use of org.cpsolver.ifs.util.ProgressWriter in project cpsolver by UniTime.

the class Test method batchSectioning.

/** Batch sectioning test 
     * @param cfg solver configuration
     * @return resultant solution
     **/
public static Solution<Request, Enrollment> batchSectioning(DataProperties cfg) {
    Solution<Request, Enrollment> solution = load(cfg);
    if (solution == null)
        return null;
    StudentSectioningModel model = (StudentSectioningModel) solution.getModel();
    if (cfg.getPropertyBoolean("Test.ComputeSectioningInfo", true))
        model.clearOnlineSectioningInfos();
    Progress.getInstance(model).addProgressListener(new ProgressWriter(System.out));
    solve(solution, cfg);
    return solution;
}
Also used : Request(org.cpsolver.studentsct.model.Request) CourseRequest(org.cpsolver.studentsct.model.CourseRequest) ProgressWriter(org.cpsolver.ifs.util.ProgressWriter) Enrollment(org.cpsolver.studentsct.model.Enrollment)

Example 4 with ProgressWriter

use of org.cpsolver.ifs.util.ProgressWriter in project cpsolver by UniTime.

the class Test method main.

/**
     * RPP test.
     * 
     * @param args
     *            the command line arguments
     */
public static void main(String[] args) {
    try {
        Progress.getInstance().addProgressListener(new ProgressWriter(System.out));
        File inputCfg = new File(args[0]);
        DataProperties properties = ToolBox.loadProperties(inputCfg);
        if (properties.getProperty("INCLUDE_REGEXP") != null) {
            if (args.length > 1)
                properties.setProperty("General.Output", args[1]);
            test(inputCfg, null, null, properties.getProperty("INCLUDE_REGEXP"), (args.length > 1 ? args[1] : null));
        } else {
            String outDir = properties.getProperty("General.Output", ".") + File.separator + inputCfg.getName().substring(0, inputCfg.getName().lastIndexOf('.')) + File.separator + sDateFormat.format(new Date());
            if (args.length > 1)
                outDir = args[1] + File.separator + (sDateFormat.format(new Date()));
            (new File(outDir)).mkdirs();
            properties.setProperty("General.Output", outDir.toString());
            System.out.println("Output folder: " + properties.getProperty("General.Output"));
            ToolBox.configureLogging(outDir, null);
            boolean mpp = properties.getPropertyBoolean("General.MPP", false);
            if (mpp)
                testMPP(properties);
            else
                test(properties);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ProgressWriter(org.cpsolver.ifs.util.ProgressWriter) DataProperties(org.cpsolver.ifs.util.DataProperties) File(java.io.File) PrologFile(org.cpsolver.ifs.util.PrologFile) Date(java.util.Date)

Example 5 with ProgressWriter

use of org.cpsolver.ifs.util.ProgressWriter in project cpsolver by UniTime.

the class Test method main.

public static void main(String[] args) {
    try {
        Progress.getInstance().addProgressListener(new ProgressWriter(System.out));
        File inputCfg = new File(args[0]);
        DataProperties properties = ToolBox.loadProperties(inputCfg);
        if (properties.getProperty("INCLUDE_REGEXP") != null) {
            test(inputCfg, null, null, properties.getProperty("INCLUDE_REGEXP"), (args.length > 1 ? args[1] : null));
        } else {
            String outDir = properties.getProperty("General.Output", ".") + File.separator + inputCfg.getName().substring(0, inputCfg.getName().lastIndexOf('.')) + File.separator + sDateFormat.format(new Date());
            if (args.length > 1)
                outDir = args[1] + File.separator + (sDateFormat.format(new Date()));
            properties.setProperty("General.Output", outDir.toString());
            System.out.println("Output folder: " + properties.getProperty("General.Output"));
            (new File(outDir)).mkdirs();
            ToolBox.configureLogging(outDir, null);
            test(properties);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ProgressWriter(org.cpsolver.ifs.util.ProgressWriter) DataProperties(org.cpsolver.ifs.util.DataProperties) File(java.io.File) Date(java.util.Date)

Aggregations

ProgressWriter (org.cpsolver.ifs.util.ProgressWriter)5 File (java.io.File)4 Date (java.util.Date)4 DataProperties (org.cpsolver.ifs.util.DataProperties)4 PrologFile (org.cpsolver.ifs.util.PrologFile)1 CourseRequest (org.cpsolver.studentsct.model.CourseRequest)1 Enrollment (org.cpsolver.studentsct.model.Enrollment)1 Request (org.cpsolver.studentsct.model.Request)1