    001package org.cpsolver.coursett;
    002
    003import java.io.File;
    004
    005import org.cpsolver.coursett.model.Lecture;
    006import org.cpsolver.coursett.model.Placement;
    007import org.cpsolver.coursett.model.TimetableModel;
    008import org.cpsolver.ifs.assignment.Assignment;
    009import org.cpsolver.ifs.assignment.DefaultSingleAssignment;
    010import org.cpsolver.ifs.solution.Solution;
    011import org.cpsolver.ifs.util.DataProperties;
    012import org.cpsolver.ifs.util.ToolBox;
    013
    014/**
    015 * A simple class that just loads a solution and saves information about it in a CSV file (output.csv format). <br>
    016 * <br>
    017 * Usage:<br>
    018 * java -Xmx1024m -jar coursett1.3.jar -cp org.cpsolver.coursett.SolutionEvaluator config.properties soultion.xml output.csv<br>
    019 * <br>
    020 *
    021 * @author  Tomáš Müller
    022 * @version CourseTT 1.3 (University Course Timetabling)<br>
    023 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
    024 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
    025 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
    026 * <br>
    027 *          This library is free software; you can redistribute it and/or modify
    028 *          it under the terms of the GNU Lesser General Public License as
    029 *          published by the Free Software Foundation; either version 3 of the
    030 *          License, or (at your option) any later version. <br>
    031 * <br>
    032 *          This library is distributed in the hope that it will be useful, but
    033 *          WITHOUT ANY WARRANTY; without even the implied warranty of
    034 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    035 *          Lesser General Public License for more details. <br>
    036 * <br>
    037 *          You should have received a copy of the GNU Lesser General Public
    038 *          License along with this library; if not see
    039 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
    040 */
    041public class SolutionEvaluator {
    042
    043    public static void main(String[] args) throws Exception {
    044        ToolBox.configureLogging();
    045        DataProperties properties = ToolBox.loadProperties(new java.io.File(args[0]));
    046        properties.putAll(System.getProperties());
    047
    048        TimetableModel model = new TimetableModel(properties);
    049        Assignment<Lecture, Placement> assignment = new DefaultSingleAssignment<Lecture, Placement>();
    050        TimetableXMLLoader loader = new TimetableXMLLoader(model, assignment);
    051        loader.setInputFile(new File(args[1]));
    052        loader.load();
    053
    054        Solution<Lecture, Placement> solution = new Solution<Lecture, Placement>(model, assignment);
    055        Test.saveOutputCSV(solution, new File(args[2]));
    056    }
    057
    058}