org.cpsolver.coursett

## Class Test

- java.lang.Object
- - org.cpsolver.coursett.Test

- All Implemented Interfaces:
    SolutionListener<Lecture,Placement>

      public class Test
      extends Object
      implements SolutionListener<Lecture,Placement>

  A main class for running of the solver from command line.
  Usage:
  java -Xmx1024m -jar coursett1.1.jar config.properties [input_file] [output_folder]
  See http://www.unitime.org for example configuration files and banchmark data sets.
  The test does the following steps:
  - Provided property file is loaded (see `DataProperties`).
  - Output folder is created (General.Output property) and loggings is setup (using log4j).
  - Input data are loaded (calling `ProblemLoader.load()`).
  - Solver is executed (see `Solver`).
  - Resultant solution is saved (calling `ProblemSaver.save()`, when General.Save property is set to true.
  Also, a log and a CSV (comma separated text file) is created in the output folder.
  Version:
    CourseTT 1.3 (University Course Timetabling)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Test(String[] args)` Solver Test

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bestCleared(Solution<Lecture,Placement> solution)` Called by the solution when method `Solution.clearBest()` is called.
    `void` | `bestRestored(Solution<Lecture,Placement> solution)` Called by the solution when method `Solution.restoreBest()` is called.
    `void` | `bestSaved(Solution<Lecture,Placement> solution)` Called by the solution when method `Solution.saveBest()` is called.
    `void` | `getInfo(Solution<Lecture,Placement> solution, Map<String,String> info)` Called by the solution when it is asked to produce info table, see `Solution.getInfo()`.
    `void` | `getInfo(Solution<Lecture,Placement> solution, Map<String,String> info, Collection<Lecture> variables)` Called by the solution when it is asked to produce info table, see `Solution.getInfo()`.
    `static String` | `getVersionString()` Current version
    `void` | `init(Solver<Lecture,Placement> solver)` Solver initialization
    `static void` | `main(String[] args)`
    `void` | `notify(Solution<Lecture,Placement> solution)` Add a line into the output CSV file when a enw best solution is found.
    `static void` | `printClassInfo(PrintWriter pw, TimetableModel model)` Class information
    `static void` | `printRoomInfo(PrintWriter pw, TimetableModel model, Assignment<Lecture,Placement> assignment)` Print room utilization
    `static void` | `printSomeStuff(Solution<Lecture,Placement> solution)` Create info.txt with some more information about the problem
    `static void` | `saveOutputCSV(Solution<Lecture,Placement> s, File file)`
    `static void` | `setupLogging(File logFile, boolean debug)` Setup log4j logging
    `void` | `solutionUpdated(Solution<Lecture,Placement> solution)` Called by the solution when it is updated, see `Solution.update(double)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Test

          public Test(String[] args)

      Solver Test
      Parameters:
        `args` - command line arguments

  - ### Method Detail

    - #### getVersionString

          public static String getVersionString()

      Current version
      Returns:
        version string

    - #### init

          public void init(Solver<Lecture,Placement> solver)

      Solver initialization
      Parameters:
        `solver` - current solver

    - #### setupLogging

          public static void setupLogging(File logFile,
                                          boolean debug)

      Setup log4j logging
      Parameters:
        `logFile` - log file
        `debug` - true if debug messages should be logged (use -Ddebug=true to enable debug message)

    - #### main

          public static void main(String[] args)

    - #### bestCleared

          public void bestCleared(Solution<Lecture,Placement> solution)

      Description copied from interface: `SolutionListener`
      Called by the solution when method `Solution.clearBest()` is called.
      Specified by:
        `bestCleared` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution

    - #### bestRestored

          public void bestRestored(Solution<Lecture,Placement> solution)

      Description copied from interface: `SolutionListener`
      Called by the solution when method `Solution.restoreBest()` is called.
      Specified by:
        `bestRestored` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution

    - #### bestSaved

          public void bestSaved(Solution<Lecture,Placement> solution)

      Description copied from interface: `SolutionListener`
      Called by the solution when method `Solution.saveBest()` is called.
      Specified by:
        `bestSaved` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution

    - #### getInfo

          public void getInfo(Solution<Lecture,Placement> solution,
                              Map<String,String> info)

      Description copied from interface: `SolutionListener`
      Called by the solution when it is asked to produce info table, see `Solution.getInfo()`. A listener can also add some its info into this table.
      Specified by:
        `getInfo` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution
        `info` - produced info table

    - #### getInfo

          public void getInfo(Solution<Lecture,Placement> solution,
                              Map<String,String> info,
                              Collection<Lecture> variables)

      Description copied from interface: `SolutionListener`
      Called by the solution when it is asked to produce info table, see `Solution.getInfo()`. A listener can also add some its info into this table.
      Specified by:
        `getInfo` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution
        `info` - produced info table
        `variables` - only variables from this set are included

    - #### solutionUpdated

          public void solutionUpdated(Solution<Lecture,Placement> solution)

      Description copied from interface: `SolutionListener`
      Called by the solution when it is updated, see `Solution.update(double)`.
      Specified by:
        `solutionUpdated` in interface `SolutionListener<Lecture,Placement>`
      Parameters:
        `solution` - source solution

    - #### notify

          public void notify(Solution<Lecture,Placement> solution)

      Add a line into the output CSV file when a enw best solution is found.
      Parameters:
        `solution` - current solution

    - #### printRoomInfo

          public static void printRoomInfo(PrintWriter pw,
                                           TimetableModel model,
                                           Assignment<Lecture,Placement> assignment)

      Print room utilization
      Parameters:
        `pw` - writer
        `model` - problem model
        `assignment` - current assignment

    - #### printClassInfo

          public static void printClassInfo(PrintWriter pw,
                                            TimetableModel model)

      Class information
      Parameters:
        `pw` - writer
        `model` - problem model

    - #### printSomeStuff

          public static void printSomeStuff(Solution<Lecture,Placement> solution)
                                     throws IOException

      Create info.txt with some more information about the problem
      Parameters:
        `solution` - current solution
      Throws:
        `IOException` - an exception that may be thrown

    - #### saveOutputCSV

          public static void saveOutputCSV(Solution<Lecture,Placement> s,
                                           File file)