genopt.db
Class ResultManager

java.lang.Object
  extended by genopt.db.ResultManager

public class ResultManager
extends java.lang.Object

Object that holds all Points of each main and sub iteration.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Nested Class Summary
protected  class ResultManager.ResultPoint
          inner class with result point
 
Field Summary
protected  ContinuousParameter[] conPar
          array with all continuous, free parameters
protected  int dimCon
          number of continuous, free parameters
protected  int dimDis
          number of discrete, free parameters
protected  int dimF
          number of function values
protected  DiscreteParameter[] disPar
          array with all discrete, free parameters
protected  GenOpt go
          reference to GenOpt object
private static java.lang.String LS
          System dependent line separator
protected  int maiIteNum
          number of the main iteration
protected  java.lang.String[] nameF
          function names
protected  java.lang.String[] outFilNam
          name (including path) of output files
private static java.lang.String[] OUTFILNAM
          Name of output file with main iteration steps only
protected  java.lang.String outFilPat
          path of the output files
protected  java.util.LinkedList<ResultManager.ResultPoint> ptsMai
          list with results of the main interation
protected  java.util.LinkedList<ResultManager.ResultPoint> ptsSub
          list with results of the main interation
protected  int resNum
          number of result entry of all and sub iterations, starting with 0
protected static int simNum
          number of function evaluations
protected  int subIteNum
          number of the sub iteration
 
Constructor Summary
ResultManager(GenOpt GenOptRef, java.lang.String outputFilePath, java.lang.String outputFileHeader, java.lang.String[] functionNames, ContinuousParameter[] cPar, DiscreteParameter[] dPar)
           
 
Method Summary
 void append(java.lang.String s)
          appends a String to the output listing files
 double getAbsDifMaiObjFunVal()
          Gets the absolute difference of the last objective function value and the second last objective function value (but not the absolute value of the difference) where both are values of the a main iteration
 Point[] getAllPoint(int numberOfValues)
          Gets an array with the points of all iteration steps (including subiterations).
 int getDimensionContinuous()
          gets the number of continuous, free parameters
 int getDimensionDiscrete()
          gets the number of discrete, free parameters
 int getDimensionF()
          gets the number of function values
 Point getMinimumPoint()
          Gets the point with the lowest objective function value of the main iterations
 int getMinimumPointSimulationNumber()
          Gets the run number with the lowest objective function value of the main iterations
protected  ResultManager.ResultPoint getMinimumResultPoint()
          Gets the ResultPoint with the lowest objective function value of the main iterations with the highest step number.
 java.lang.String[] getNameContinuousAndDiscrete()
          gets the names of the variables
 java.lang.String[] getNameF()
          gets the names of the function values
 int getNumberOfAllResults()
          Returns the number of all results
 int getNumberOfMaiIteration()
          Returns the number of the main iterations
static int getNumberOfSimulation()
          Returns the number of simulations
 double getRelDifMaiObjFunVal()
          Gets the relative difference of the last objective function value and the second last objective function value where both are values of a main iteration
 int getSimulationNumber()
          gets the run number
static void increaseNumberOfFunctionEvaluation()
          Increases the number of function evaluations
private  void increaseResultNumber(int runIde)
          Increases the number of the result entry, sets the number of the main and the sub iteration and writes the output to the text files.
private  void printPoint(ResultManager.ResultPoint rp, int runIde)
          Prints a ResultPoint to the output file
 void reportMinimum(java.lang.String comment)
          Reports the minimum point to the output files
 void resetResultNumber()
          Resets the counter of the main and sub iterations to 1.
 void setNewTrial(Point x, int runIde)
          Sets the new point
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LS

private static final java.lang.String LS
System dependent line separator


OUTFILNAM

private static final java.lang.String[] OUTFILNAM
Name of output file with main iteration steps only


go

protected GenOpt go
reference to GenOpt object


conPar

protected ContinuousParameter[] conPar
array with all continuous, free parameters


disPar

protected DiscreteParameter[] disPar
array with all discrete, free parameters


ptsMai

protected java.util.LinkedList<ResultManager.ResultPoint> ptsMai
list with results of the main interation


ptsSub

protected java.util.LinkedList<ResultManager.ResultPoint> ptsSub
list with results of the main interation


dimCon

protected int dimCon
number of continuous, free parameters


dimDis

protected int dimDis
number of discrete, free parameters


dimF

protected int dimF
number of function values


nameF

protected java.lang.String[] nameF
function names


outFilPat

protected java.lang.String outFilPat
path of the output files


outFilNam

protected java.lang.String[] outFilNam
name (including path) of output files


resNum

protected int resNum
number of result entry of all and sub iterations, starting with 0


simNum

protected static int simNum
number of function evaluations


maiIteNum

protected int maiIteNum
number of the main iteration


subIteNum

protected int subIteNum
number of the sub iteration

Constructor Detail

ResultManager

public ResultManager(GenOpt GenOptRef,
                     java.lang.String outputFilePath,
                     java.lang.String outputFileHeader,
                     java.lang.String[] functionNames,
                     ContinuousParameter[] cPar,
                     DiscreteParameter[] dPar)
              throws java.io.IOException
Parameters:
GenOptRef - reference to GenOpt object
outputFilePath - path of the output file
outputFileHeader - header to be written to the output file
functionNames - Array of String where each String holds the name of a function value
cPar - array containing the continuous parameters
dPar - array containing the discrete parameters
Throws:
java.io.IOException
Method Detail

append

public void append(java.lang.String s)
            throws java.io.IOException
appends a String to the output listing files

Parameters:
s - String to be appended to output listing files
Throws:
java.io.IOException

increaseNumberOfFunctionEvaluation

public static void increaseNumberOfFunctionEvaluation()
Increases the number of function evaluations


resetResultNumber

public void resetResultNumber()
Resets the counter of the main and sub iterations to 1.


increaseResultNumber

private void increaseResultNumber(int runIde)
Increases the number of the result entry, sets the number of the main and the sub iteration and writes the output to the text files.
You must call this function at every new iteration step and after the last iteration step of the optimization (to get the last result reported)

Parameters:
runIde - 0 if main iteration, 1 if sub iteration

setNewTrial

public void setNewTrial(Point x,
                        int runIde)
                 throws java.io.IOException
Sets the new point

Parameters:
x - Point to be reported
runIde - 0 if main iteration, 1 if sub iteration
Throws:
java.io.IOException

getNumberOfSimulation

public static int getNumberOfSimulation()
Returns the number of simulations

Returns:
the number of simulations

getNumberOfAllResults

public int getNumberOfAllResults()
Returns the number of all results

Returns:
the number of all results

getNumberOfMaiIteration

public int getNumberOfMaiIteration()
Returns the number of the main iterations

Returns:
the number of the main iterations

getAllPoint

public Point[] getAllPoint(int numberOfValues)
Gets an array with the points of all iteration steps (including subiterations).

Parameters:
numberOfValues - number of iteration steps of which the datas are wanted, counting backwards from the current iteration step
Returns:
array containing the points

reportMinimum

public void reportMinimum(java.lang.String comment)
                   throws java.io.IOException
Reports the minimum point to the output files

Throws:
java.io.IOException

printPoint

private void printPoint(ResultManager.ResultPoint rp,
                        int runIde)
                 throws java.io.IOException
Prints a ResultPoint to the output file

Parameters:
rp - ResultPoint to be printed
runIde - 0 if main iteration, 1 if sub iteration
Throws:
java.io.IOException

getMinimumPoint

public Point getMinimumPoint()
Gets the point with the lowest objective function value of the main iterations

Returns:
the point with the lowest objective function value of the main iterations

getMinimumPointSimulationNumber

public int getMinimumPointSimulationNumber()
Gets the run number with the lowest objective function value of the main iterations

Returns:
the run number with the lowest objective function value of the main iterations

getMinimumResultPoint

protected ResultManager.ResultPoint getMinimumResultPoint()
Gets the ResultPoint with the lowest objective function value of the main iterations with the highest step number.

Returns:
the ResultPoint with the lowest objective function value of the main iterations

getAbsDifMaiObjFunVal

public double getAbsDifMaiObjFunVal()
Gets the absolute difference of the last objective function value and the second last objective function value (but not the absolute value of the difference) where both are values of the a main iteration

Returns:
f(k)-f(k-1) where f is the objective function value and k is a counter for the main iteration

getRelDifMaiObjFunVal

public double getRelDifMaiObjFunVal()
Gets the relative difference of the last objective function value and the second last objective function value where both are values of a main iteration

Returns:
(f(k)-f(k-1))/f(k) where f is the objective function value and k is a counter for the main iteration

getNameContinuousAndDiscrete

public java.lang.String[] getNameContinuousAndDiscrete()
gets the names of the variables

Returns:
an array with all the names of the variables

getNameF

public java.lang.String[] getNameF()
gets the names of the function values

Returns:
an array with all the names of the function values

getDimensionContinuous

public int getDimensionContinuous()
gets the number of continuous, free parameters

Returns:
the number of continuous, free parameters

getDimensionDiscrete

public int getDimensionDiscrete()
gets the number of discrete, free parameters

Returns:
the number of discrete, free parameters

getDimensionF

public int getDimensionF()
gets the number of function values

Returns:
the number of function values

getSimulationNumber

public int getSimulationNumber()
gets the run number

Returns:
the run number