MOEA Framework 2.3
API Specification

org.moeaframework.core
Class PopulationIO

java.lang.Object
  extended by org.moeaframework.core.PopulationIO

public class PopulationIO
extends Object

Collection of static methods for reading and writing populations to files. The write(java.io.File, java.lang.Iterable) and read(java.io.File) methods should be used when storing and retrieving solutions to be used by this framework. The writeObjectives(java.io.File, java.lang.Iterable) and readObjectives(java.io.BufferedReader) should be used when the data is accessed by external programs, as these two methods store the data in a human-readable form.


Method Summary
static Population read(File file)
          Reads a population from the specified file.
static Population readObjectives(BufferedReader reader)
          Parses the objective vectors contained in the specified reader, returning the resulting population.
static Population readObjectives(File file)
          Reads a set of objective vectors from the specified file.
static void write(File file, Iterable<Solution> solutions)
          Writes a collection of solutions to the specified file.
static void writeObjectives(File file, Iterable<Solution> solutions)
          Writes the objective vectors of all solutions to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readObjectives

public static Population readObjectives(BufferedReader reader)
                                 throws IOException
Parses the objective vectors contained in the specified reader, returning the resulting population. This method does not close the reader.

Parameters:
reader - the reader containing the objective vectors
Returns:
a population containing all objective vectors read
Throws:
IOException - if an I/O error occurred

readObjectives

public static Population readObjectives(File file)
                                 throws IOException
Reads a set of objective vectors from the specified file. Files read using this method should only have been created using the writeObjectives method.

Parameters:
file - the file containing the objective vectors
Returns:
a population containing all objective vectors in the specified file
Throws:
IOException - if an I/O exception occurred

writeObjectives

public static void writeObjectives(File file,
                                   Iterable<Solution> solutions)
                            throws IOException
Writes the objective vectors of all solutions to the specified file. Files created using this method should only be loaded using the loadObjectives method.

Parameters:
file - the file to which the objective vectors are written
solutions - the solutions whose objective vectors are written to the specified file
Throws:
IOException - if an I/O exception occurred

write

public static void write(File file,
                         Iterable<Solution> solutions)
                  throws IOException
Writes a collection of solutions to the specified file. Files written using this method should only be read using the read(java.io.File) method. This method relies on serialization.

Parameters:
file - the file to which the solutions are written
solutions - the solutions to be written in the specified file
Throws:
IOException - if an I/O exception occurred

read

public static Population read(File file)
                       throws IOException
Reads a population from the specified file. Files read using this method should only have been created using the write(java.io.File, java.lang.Iterable) method. This method relies on serialization.

Parameters:
file - the file containing the population
Returns:
a population containing all solutions in the specified file
Throws:
IOException - if an I/O exception occurred

MOEA Framework 2.3
API Specification

Copyright 2009-2014 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Hosted by Get MOEA Framework at SourceForge.net. Fast, secure and Free Open Source software downloads