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 * @version CourseTT 1.3 (University Course Timetabling)<br>
022 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
023 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
024 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
025 * <br>
026 *          This library is free software; you can redistribute it and/or modify
027 *          it under the terms of the GNU Lesser General Public License as
028 *          published by the Free Software Foundation; either version 3 of the
029 *          License, or (at your option) any later version. <br>
030 * <br>
031 *          This library is distributed in the hope that it will be useful, but
032 *          WITHOUT ANY WARRANTY; without even the implied warranty of
033 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
034 *          Lesser General Public License for more details. <br>
035 * <br>
036 *          You should have received a copy of the GNU Lesser General Public
037 *          License along with this library; if not see
038 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
039 */
040public class SolutionEvaluator {
041    
042    public static void main(String[] args) throws Exception {
043        ToolBox.configureLogging();
044        DataProperties properties = ToolBox.loadProperties(new java.io.File(args[0]));
045        properties.putAll(System.getProperties());
046        
047        TimetableModel model = new TimetableModel(properties);
048        Assignment<Lecture, Placement> assignment = new DefaultSingleAssignment<Lecture, Placement>();
049        TimetableXMLLoader loader = new TimetableXMLLoader(model, assignment);
050        loader.setInputFile(new File(args[1]));
051        loader.load();
052        
053        Solution<Lecture, Placement> solution = new Solution<Lecture, Placement>(model, assignment);
054        Test.saveOutputCSV(solution, new File(args[2]));
055    }
056
057}