goga

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2017 License: BSD-3-Clause Imports: 11 Imported by: 0

README

Goga – Go Evolutionary/Genetic Algorithm

Goga is a computer library for developing evolutionary algorithms and, in particular, genetic algorithms. The goal of these algorithms is to solve optimisation problems with (or not) many constraints and many objectives. Also, problems with mixed-type representations such as those with real numbers and integers are considered by Goga.

See the documentation for more details (e.g. how to call functions and use structures).

GoDoc

Examples

Check out examples here

Installation

1 Install dependencies:

Goga depends on the Gosl Go Scientific Library, therefore, please install Gosl first.

2 Install Goga:

go get github.com/cpmech/goga

Documentation

Here, we call user-defined types as structures. These are simply Go types defined as struct. Some may think of these structures as classes. Goga has several global functions as well and tries to avoid complicated constructions.

An allocated structure is called here an object and functions attached to this object are called methods. The variable holding the pointer to an object is always named o in Goga (e.g. like self or this).

Some objects need to be initialised before usage. In this case, functions named Init have to be called (e.g. like constructors).

Authors and license

See the AUTHORS file.

Unless otherwise noted, the Goga source files are distributed under the BSD-style license found in the LICENSE file.

Documentation

Index

Constants

View Source
const (
	INF = 1e+30 // infinite distance
)

constants

Variables

This section is empty.

Functions

func CxInt

func CxInt(a, b, A, B []int, prms *Parameters)

CxInt performs the crossover of genetic data from A and B

Output:
 a and b -- offspring
Example:
       0 1 2 3 4 5 6 7
   A = a b c d e f g h    size = 8
   B = * . . . . * * *    cuts = [1, 5]
        ↑       ↑     ↑   ends = [1, 5, 8]
        1       5     8
   a = a . . . . f g h
   b = * b c d e * * *

func CxIntOrd

func CxIntOrd(a, b, A, B []int, prms *Parameters)

CxIntOrd performs the crossover in a pair of individuals with integer numbers that correspond to a ordered sequence, e.g. for traveling salesman problem

Output:
  a and b -- offspring chromosomes
Note: using OX1 method explained in [1] (proposed in [2])
References:
 [1] Larrañaga P, Kuijpers CMH, Murga RH, Inza I and Dizdarevic S. Genetic Algorithms for the
     Travelling Salesman Problem: A Review of Representations and Operators. Artificial
     Intelligence Review, 13:129-170; 1999. doi:10.1023/A:1006529012972
 [2] Davis L. Applying Adaptive Algorithms to Epistatic Domains. Proceedings of International
     Joint Conference on Artificial Intelligence, 162-164; 1985.
Example:
 data:
       0 1   2 3 4   5 6 7
   A = a b | c d e | f g h        size = 8
   B = b d | f h g | e c a        cuts = [2, 5]
           ↑       ↑       ↑      ends = [2, 5, 8]
           2       5       8
 first step: copy subtours
   a = . . | f h g | . . .
   b = . . | c d e | . . .
 second step: copy unique from subtour's end, position 5
             start adding here
                     ↓                           5 6 7   0 1   2 3 4
   a = d e | f h g | a b c         get from A: | f̶ g̶ h̶ | a b | c d e
   b = h g | c d e | a b f         get from B: | e̶ c̶ a | b d̶ | f h g

func DiffEvol

func DiffEvol(xnew, x, x0, x1, x2 []float64, prms *Parameters)

DiffEvol performs the differential-evolution operation

func FormatXFGH

func FormatXFGH(opt *Optimiser, fmtX, fmtFGH string) (l string)

FormatXFGH formats x, f, g and h to a string Note: (1) only CPU=0 must call this function

(2) use fmtX=="" to prevent output of X values

func GenTrialSolutions

func GenTrialSolutions(sols []*Solution, prms *Parameters, reset bool)

GenTrialSolutions generates (initial) trial solutions

func GenerateCxEnds

func GenerateCxEnds(size, ncuts int, cuts []int) (ends []int)

GenerateCxEnds randomly computes the end positions of cuts in chromosomes

Input:
 size  -- size of chromosome
 ncuts -- number of cuts to be used, unless cuts != nil
 cuts  -- cut positions. can be nil => use ncuts instead
Output:
 ends -- end positions where the last one equals size
Example:
      0 1 2 3 4 5 6 7
  A = a b c d e f g h    size = 8
       ↑       ↑     ↑   cuts = [1, 5]
       1       5     8   ends = [1, 5, 8]

func GetBestFeasible

func GetBestFeasible(opt *Optimiser, iOvaSort int) (best *Solution, feasible []*Solution)

GetBestFeasible returns the best and list of feasible candidates Note: feasible array is sorted by iOva

func GetParetoFront

func GetParetoFront(p, q int, all []*Solution, feasibleOnly bool) (fp, fq []float64, front []int)

GetParetoFront returns Pareto front

func GetParetoFrontRes

func GetParetoFrontRes(p, q int, res [][]float64) (fp, fq []float64, front []int)

GetParetoFrontRes returns results on Pareto front

Input:
 p   -- first column in res
 q   -- second column in res
 res -- e.g. can be either ova or oor

func GetResults

func GetResults(sols []*Solution, ovaOnly bool) (ova, oor [][]float64)

GetResults returns all ovas and oors

Output:
 ova -- [nsol][nova] objective values
 oor -- [nsol][noor] out-of-range values

func MtInt

func MtInt(A []int, prms *Parameters)

MtInt performs the mutation of genetic data from A

Output: modified individual 'A'

func MtIntBin

func MtIntBin(A []int, prms *Parameters)

MtIntBin performs the mutation of a binary chromosome

Output: modified individual 'A'

func MtIntOrd

func MtIntOrd(A []int, prms *Parameters)

MtIntOrd performs the mutation of genetic data from a ordered list of integers A

Output: modified individual 'A'
Note: using DM method as explained in [1] (citing [2])
References:
 [1] Larrañaga P, Kuijpers CMH, Murga RH, Inza I and Dizdarevic S. Genetic Algorithms for the
     Travelling Salesman Problem: A Review of Representations and Operators. Artificial
     Intelligence Review, 13:129-170; 1999. doi:10.1023/A:1006529012972
 [2] Michalewicz Z. Genetic Algorithms + Data Structures = Evolution Programs. Berlin
     Heidelberg: Springer Verlag; 1992
     Joint Conference on Artificial Intelligence, 162-164; 1985.

DM displacement mutation method:
 Ex:
         0 1 2 3 4 5 6 7
     A = a b c d e f g h   s = 2
            ↑     ↑        t = 5
            2     5

     core = c d e  (subtour)  ncore = t - s = 5 - 2 = 3

              0 1 2 3 4
     remain = a b f g h  (remaining)  nrem = size - ncore = 8 - 3 = 5
                     ↑
                     4 = ins

func SortSolutions

func SortSolutions(s []*Solution, idxOva int)

SortSolutions sort solutions either by OVA (single-obj) or Pareto front (multi-obj)

func WriteAllValues

func WriteAllValues(dirout, fnkey string, opt *Optimiser)

Types

type CxInt_t

type CxInt_t func(a, b, A, B []int, prms *Parameters)

CxInt_t defines crossover function for ints

type Generator_t

type Generator_t func(sols []*Solution, prms *Parameters, reset bool)

Generator_t defines callback function to generate trial solutions

type Group

type Group struct {
	Ncur    int         // number of current solutions == len(All) / 2
	All     []*Solution // current and future solutions. half part is a view to Solutions
	Indices []int       // indices of current solutions
	Pairs   [][]int     // randomly selected pairs from Indices
	Metrics *Metrics    // metrics
}

Group holds a group of solutions

func (*Group) Init

func (o *Group) Init(cpu, ncpu int, solutions []*Solution, prms *Parameters)

Init initialises group

func (*Group) Reset

func (o *Group) Reset(cpu, ncpu int, solutions []*Solution)

Reset resets group data

type Mesh

type Mesh struct {
	V [][]float64 // vertices
	C [][]int     // cells
}

type Metrics

type Metrics struct {
	Omin   []float64     // current min ova
	Omax   []float64     // current max ova
	Fmin   []float64     // current min float
	Fmax   []float64     // current max float
	Imin   []int         // current min int
	Imax   []int         // current max int
	Fsizes []int         // front sizes
	Fronts [][]*Solution // non-dominated fronts
	// contains filtered or unexported fields
}

Metrics holds metric data such as non-dominated Pareto fronts

func (*Metrics) Compute

func (o *Metrics) Compute(sols []*Solution) (nfronts int)

Compute computes limits, find non-dominated Pareto fronts, and compute crowd distances

func (*Metrics) Init

func (o *Metrics) Init(nsol int, prms *Parameters)

Init initialises Metrics

type MinProb_t

type MinProb_t func(f, g, h, x []float64, y []int, cpu int)

MinProb_t defines objective functon for specialised minimisation problem

type MtInt_t

type MtInt_t func(a []int, prms *Parameters)

MtInt_t defines mutation function for ints

type ObjFunc_t

type ObjFunc_t func(sol *Solution, cpu int)

ObjFunc_t defines the objective fuction

type Optimiser

type Optimiser struct {

	// input
	Parameters           // input parameters
	ObjFunc    ObjFunc_t // [optional] objective function
	MinProb    MinProb_t // [optional] minimisation problem function
	CxInt      CxInt_t   // [optional] crossover function for ints
	MtInt      MtInt_t   // [optional] mutation function for ints
	Output     Output_t  // [optional] output function

	// essential
	Generator Generator_t // generate solutions
	Solutions []*Solution // current solutions
	Groups    []*Group    // [cpu] competitors per CPU. pointers to current and future solutions
	Metrics   *Metrics    // metrics

	// meshes
	Meshes [][]*Mesh // meshes for (xi,xj) points. [nflt-1][nflt] only upper diagonal entries

	// auxiliary
	Stat                   // structure holding stat data
	Nf, Ng, Nh int         // number of f, g, h functions
	F, G, H    [][]float64 // [cpu] temporary
	// contains filtered or unexported fields
}

Optimiser solves optimisation problems:

Solve:
 min  {Ova[0](x), Ova[1](x), ...} objective values
  x
 s.t. Oor[0](x) = 0
      Oor[1](x) = 0  out-of-range values

A specialised version is also available

Solve:
  min  {f0(x), f1(x), f2(x), ...}  nf functions
   x   g0(x) ≥ 0
       g1(x) ≥ 0  ng inequalities
  s.t. h0(x) = 0
       h1(x) = 0  nh equalities

x = xFlt  or  x = xInt   or  x = {xFlt, Xint}

func (*Optimiser) EvolveOneGroup

func (o *Optimiser) EvolveOneGroup(cpu int) (nfeval int)

EvolveOneGroup evolves one group (CPU)

func (*Optimiser) GetSolutionsCopy

func (o *Optimiser) GetSolutionsCopy() (res []*Solution)

GetSolutionsCopy returns a copy of Solutions

func (*Optimiser) Init

func (o *Optimiser) Init(gen Generator_t, obj ObjFunc_t, fcn MinProb_t, nf, ng, nh int)

Initialises continues initialisation by generating individuals

Optional:  obj  XOR  fcn, nf, ng, nh

func (*Optimiser) PlotAddFltFlt

func (o *Optimiser) PlotAddFltFlt(iFlt, jFlt int, sols []*Solution, args *plt.A)

PlotAddFltFlt adds flt-flt points to existent plot

func (*Optimiser) PlotAddFltOva

func (o *Optimiser) PlotAddFltOva(iFlt, iOva int, sols []*Solution, ovaMult float64, args *plt.A)

PlotAddFltOva adds flt-ova points to existent plot

func (*Optimiser) PlotAddOvaOva

func (o *Optimiser) PlotAddOvaOva(iOva, jOva int, sols []*Solution, feasibleOnly bool, args *plt.A)

PlotAddOvaOva adds ova-ova points to existent plot

func (*Optimiser) PlotAddParetoFront

func (o *Optimiser) PlotAddParetoFront(iOva, jOva int, sols []*Solution, feasibleOnly bool, args *plt.A)

PlotAddParetoFront highlights Pareto front

func (*Optimiser) PlotContour

func (o *Optimiser) PlotContour(iFlt, jFlt, iOva int, pp *PlotParams)

PlotContour plots contour with other components @ x=RefX

If RefX==nil, x can be either @ minimum, maximum, middle or best
For x @ best, Solutions will be sorted

func (*Optimiser) PlotFltFltContour

func (o *Optimiser) PlotFltFltContour(sols0 []*Solution, iFlt, jFlt, iOva int, pp *PlotParams)

PlotFltFlt plots flt-flt contour use iFlt==-1 || jFlt==-1 to plot all combinations

func (*Optimiser) PlotFltOva

func (o *Optimiser) PlotFltOva(sols0 []*Solution, iFlt, iOva int, ovaMult float64, pp *PlotParams)

PlotFltOva plots flt-ova points

func (*Optimiser) PlotOvaOvaPareto

func (o *Optimiser) PlotOvaOvaPareto(sols0 []*Solution, iOva, jOva int, pp *PlotParams)

PlotOvaOvaPareto plots ova-ova Pareto values

func (*Optimiser) PlotStar

func (o *Optimiser) PlotStar()

PlotStar plots star with normalised OVAs

func (*Optimiser) PrintStatF

func (o *Optimiser) PrintStatF(idxF int)

PrintStatF print statistical information corresponding to objective function idxF

func (*Optimiser) PrintStatF1F0

func (o *Optimiser) PrintStatF1F0()

PrintStatF1F0 prints statistical analysis for two-objective problems

emin, eave, emax, edev -- errors on f1(f0)
lmin, lave, lmax, ldev -- arc-lengths along f1(f0) curve

func (*Optimiser) PrintStatIGD

func (o *Optimiser) PrintStatIGD()

PrintStatIGD prints statistical IGD analysis for multi-objective problems

func (*Optimiser) PrintStatMultiE

func (o *Optimiser) PrintStatMultiE()

PrintStatMultiE prints statistical error analysis for multi-objective problems

func (*Optimiser) Reset

func (o *Optimiser) Reset(reSeed bool)

Reset resets all variables for a next sample run

func (*Optimiser) RunMany

func (o *Optimiser) RunMany(dirout, fnkey string, constantSeed bool)

RunMany runs many trials in order to produce statistical data

func (*Optimiser) Solve

func (o *Optimiser) Solve()

Solve solves optimisation problem

func (*Optimiser) Tournament

func (o *Optimiser) Tournament(A, B, a, b *Solution, m *Metrics)

Tournament performs the tournament among 4 individuals

type Output_t

type Output_t func(time int, sols []*Solution)

Output_t defines a function to perform output of data during the evolution

type Parameters

type Parameters struct {

	// sizes
	Nova int // number of objective values
	Noor int // number of out-of-range values
	Nsol int // total number of solutions
	Ncpu int // number of cpus

	// time
	Tmax  int // final time
	DtExc int // delta time for exchange
	DtOut int // delta time for output

	// options
	DEC      float64 // C-coefficient for differential evolution
	Pll      bool    // parallel
	Seed     int     // seed for random numbers generator
	GenType  string  // generation type: "latin", "halton", "rnd"
	LatinDup int     // Latin Hypercube duplicates number
	EpsH     float64 // minimum value for 'h' constraints
	Verbose  bool    // show messages
	VerbStat bool    // show messages in Stat
	VerbTime bool    // show time messages
	GenAll   bool    // generate all solutions together; i.e. not within each group/CPU
	Nsamples int     // run many samples
	BinInt   int     // flag that integers represent binary numbers if BinInt > 0; thus Nint=BinInt
	ClearFlt bool    // clear flt if corresponding int is 0
	ExcTour  bool    // use exchange via tournament
	ExcOne   bool    // use exchange one randomly
	NormFlt  bool    // normalise float values
	UseMesh  bool    // use meshes to control points movement
	Nbry     int     // number of points along boundary / per iFlt (only if UseMesh==true)

	// crossover and mutation of integers
	IntPc       float64 // probability of crossover for ints
	IntNcuts    int     // number of cuts in crossover of ints
	IntPm       float64 // probability of mutation for ints
	IntNchanges int     // number of changes during mutation of ints

	// range
	FltMin []float64 // minimum float allowed
	FltMax []float64 // maximum float allowed
	IntMin []int     // minimum int allowed
	IntMax []int     // maximum int allowed

	// derived
	Nflt   int       // number of floats
	Nint   int       // number of integers
	DelFlt []float64 // max float range
	DelInt []int     // max int range

	// extra variables not directly related to GOGA (for convenience of having a reader already)
	Strategy int  // strategy
	PlotSet1 bool // plot set of graphs 1
	PlotSet2 bool // plot set of graphs 2
	ProbNum  int  // problem number

	// for mesh method
	NumXiXjPairs  int // number of (Xi,Xj) pairs
	NumXiXjBryPts int // number of points along the boundaries of one (Xi,Xj) plane
	NumExtraSols  int // total number of extra solutions due to all (Xi,Xj) boundaries
}

Parameters hold all configuration parameters

func (*Parameters) CalcDerived

func (o *Parameters) CalcDerived()

CalcDerived computes derived variables and checks consistency

func (*Parameters) DeNormalise1

func (o *Parameters) DeNormalise1(r []float64)

DeNormalise1 de-normalises r ∈ [0,1] values into x ∈ [xmin,xmax]

Output: r becomes x

func (*Parameters) Default

func (o *Parameters) Default()

Default sets default parameters

func (*Parameters) EnforceRange

func (o *Parameters) EnforceRange(i int, x float64) float64

EnforceRange makes sure x is within given range

func (*Parameters) LogParams

func (o *Parameters) LogParams() (l string)

LogParams returns a log with current parameters

func (*Parameters) Normalise4

func (o *Parameters) Normalise4(x, x0, x1, x2 []float64) (r, r0, r1, r2 []float64)

Normalise4 normalises x ∈ [xmin,xmax] values into r ∈ [0,1]

func (*Parameters) Read

func (o *Parameters) Read(filenamepath string)

Read reads configuration parameters from JSON file

type PlotParams

type PlotParams struct {

	// output directory and filename
	DirOut string // output directory; default = "/tmp/goga"
	FnKey  string // filename key

	// auxiliary
	YfuncX  YfuncX_t // y(x) function to plot from FltMin[iFlt] to FltMax[iFlt]
	NptsYfX int      // number of points for y(x) function
	Extra   func()   // extra plotting commands

	// options
	NoF          bool      // without f(x)
	NoG          bool      // without g(x)
	NoH          bool      // without h(x)
	WithAux      bool      // plot Solution.Aux (with the same colors as g(x))
	OnlyAux      bool      // plot only Solution.Aux
	Limits       bool      // plot limits of variables in contour
	FeasibleOnly bool      // plot feasible solutions only
	WithAll      bool      // with all points
	NoFront      bool      // do not show Pareto front
	Simple       bool      // simple contour
	Npts         int       // number of points for contour
	IdxH         int       // index of h function to plot. -1 means all
	RefX         []float64 // reference x vector with the other values in case Nflt > 2
	Xrange       []float64 // to override x-range
	Yrange       []float64 // to override y-range
	ContourAt    string    // if RefX==nil, options: "minimum", "maximum", "middle", "best" (default)
	Xlabel       string    // x-axis label
	Ylabel       string    // y-axis label

	// plot arguments
	AxEqual    bool   // plot: equal scales
	ArgsLeg    *plt.A // plot: arguments for legend
	ArgsF      *plt.A // plot: f(x) function
	ArgsG      *plt.A // plot: g(x) function
	ArgsH      *plt.A // plot: h(x) function
	ArgsAux    *plt.A // plot: format for auxiliary field
	ArgsSols0  *plt.A // plot: points indicating initial solutions
	ArgsSols   *plt.A // plot: points indicating final solutions
	ArgsBest   *plt.A // plot: points indicating best solution
	ArgsFront  *plt.A // plot: points on Pareto front
	ArgsYfX    *plt.A // plot: y(x) function
	ArgsSimple *plt.A // plot: simple contours
}

PlotParams holds parameters to customize plots

func NewPlotParams

func NewPlotParams(simple bool) (o *PlotParams)

NewPlotParams allocates and sets default PlotParams

type Solution

type Solution struct {
	Id    int       // identifier (for debugging). future solutions have negative ids
	Fixed bool      // cannot be changed
	Ova   []float64 // objective values
	Oor   []float64 // out-of-range values
	Flt   []float64 // floats
	Int   []int     // ints

	// metrics
	WinOver   []*Solution // solutions dominated by this solution
	Nwins     int         // number of wins => current len(WinOver)
	Nlosses   int         // number of solutions dominating this solution
	FrontId   int         // Pareto front rank
	DistCrowd float64     // crowd distance
	DistNeigh float64     // closest neighbour distance
	Closest   *Solution   // closest neighbour

	// auxiliary
	Aux float64 // auxiliary data to be stored at each solution; e.g. limit state function value
	// contains filtered or unexported fields
}

Solution holds solution values

func CheckFront0

func CheckFront0(opt *Optimiser, verbose bool) (nfailed int, front0 []*Solution)

CheckFront0 returns front0 and number of failed/success

func GetFeasible

func GetFeasible(sols []*Solution) (feasible []*Solution)

GetFeasible returns all feasible solutions

func NewSolution

func NewSolution(id, nsol int, prms *Parameters) (o *Solution)

NewSolution allocates new Solution

func NewSolutions

func NewSolutions(nsol int, prms *Parameters) (res []*Solution)

NewSolutions allocates a number of Solutions

func (*Solution) Compare

func (A *Solution) Compare(B *Solution) (A_dominates, B_dominates bool)

Compare compares two solutions

func (*Solution) CopyInto

func (A *Solution) CopyInto(B *Solution)

CopyInto copies essential data into B

func (*Solution) Distance

func (A *Solution) Distance(B *Solution, fmin, fmax []float64, imin, imax []int) (dist float64)

Distance computes (genotype) distance between A and B

func (*Solution) Feasible

func (o *Solution) Feasible() bool

Feasible tells whether this solution is feasible or not

func (*Solution) Fight

func (A *Solution) Fight(B *Solution) (A_wins bool)

Fight implements the competition between A and B

func (*Solution) Reset

func (o *Solution) Reset(id int)

Reset rests state; i.e. zeroes all values

type Stat

type Stat struct {

	// stat
	Nfeval     int             // number of function evaluations
	SysTimes   []time.Duration // all system times for each run
	SysTimeAve time.Duration   // average of all system times
	SysTimeTot time.Duration   // total system (real/CPU) time

	// formatting data for reports
	RptName         string    // problem name
	RptFref         []float64 // reference OVAs
	RptXref         []float64 // reference flts
	RptFmin         []float64 // min OVAs for reports/graphs
	RptFmax         []float64 // max OVAs for reports/graphs
	RptFmtF         string    // format for fmin, fave and fmax
	RptFmtFdev      string    // format for fdev
	RptFmtE         string    // format for emin, eave and emax
	RptFmtEdev      string    // format for edev
	RptFmtL         string    // format for lmin, lave and lmax
	RptFmtLdev      string    // format for ldev
	RptFmtX         string    // format for x values
	RptWordF        string    // word to use for 'f'; e.g. '\beta'
	RptDesc         string    // description text
	HistFmt         string    // format in histogram
	HistDelFmin     float64   // Δf for minimum f value in histogram
	HistDelFmax     float64   // Δf for minimum f value in histogram
	HistDelEmin     float64   // Δe for minimum e value in histogram
	HistDelEmax     float64   // Δe for minimum e value in histogram
	HistDelFminZero bool      // use zero for Δf (min)
	HistDelFmaxZero bool      // use zero for Δf (max)
	HistDelEminZero bool      // use zero for Δe (min)
	HistDelEmaxZero bool      // use zero for Δe (max)
	HistNdig        int       // number of digits in histogram
	HistNsta        int       // number of stations in histogram
	HistLen         int       // number of characters (bar length) in histogram

	// RunMany: best solutions
	BestOvas      [][]float64 // best OVAs [nova][nsamples]
	BestFlts      [][]float64 // best flts [nflt][nsamples]
	BestInts      [][]int     // best ints [nint][nsamples]
	BestOfBestOva []float64   // [nova]
	BestOfBestFlt []float64   // [nflt]
	BestOfBestInt []int       // [nint]

	// RunMany: checking multi-obj problems
	F1F0_func      func(f0 float64) float64  // f1(f0) function
	F1F0_err       []float64                 // max(error(f1))
	F1F0_arcLen    []float64                 // arc-length: spreading on (f0,f1) space
	F1F0_arcLenRef float64                   // reference arc-length along f1(f0) curve
	F1F0_f0ranges  [][]float64               // ranges of f0 values to compute arc-length
	Multi_fcnErr   func(f []float64) float64 // computes Pareto-optimal front error with many OVAs
	Multi_err      []float64                 // max(error(f[i]))
	Multi_fStar    [][]float64               // reference points on Pareto front [npoints][nova]
	Multi_IGD      []float64                 // IGD metric

	// RunMany: statistics: F
	Fmin []float64 // minimum of each F [iOva]
	Fave []float64 // average of each F [iOva]
	Fmax []float64 // maximum of each F [iOva]
	Fdev []float64 // deviation of each F [iOva]

	// RunMany: statistics: E and L
	Emin float64 // minimum E
	Eave float64 // avarage E
	Emax float64 // maximum E
	Edev float64 // deviation in E
	Lmin float64 // minimum L
	Lave float64 // avarage L
	Lmax float64 // maximum L
	Ldev float64 // deviation in L

	// RunMany: statistics: IGD
	IGDmin float64 // minimum IGD
	IGDave float64 // avarage IGD
	IGDmax float64 // maximum IGD
	IGDdev float64 // deviation in IGD
}

type TexReport

type TexReport struct {

	// constants
	DroundCte time.Duration // constant for dround(duration) function

	// input
	Opts []*Optimiser // all optimisers

	// options
	Title        string  // title of table
	RtableNotes  string  // footnotes for table with results
	ItableNotes  string  // footnotes for table with input data
	XtableNotes  string  // footnotes for table with x values
	XtableFontSz string  // formatting string for size of text in x-values table
	TableColSep  float64 // column separation in table
	UseGeom      bool    // use TeX geometry package
	Landscape    bool    // landscape paper
	RunPDF       bool    // generate PDF
	DescHeader   string  // description header

	// title and description
	ShowNsamples    bool // show Nsamples
	ShowDescription bool // show description

	// columns: input data columns
	ShowNsol  bool // show Nsol
	ShowNcpu  bool // show Ncpu
	ShowTmax  bool // show Tmax
	ShowDtExc bool // show Dtexc
	ShowDEC   bool // show DE coefficient

	// columns: stat columns
	ShowNfeval     bool // show Nfeval
	ShowSysTimeAve bool // show SysTimeAve
	ShowSysTimeTot bool // show SysTimeTot

	// columns: results columns
	ShowFref bool // show Fref
	ShowFmin bool // show Fmin
	ShowFave bool // show Fave
	ShowFmax bool // show Fmax
	ShowFdev bool // show Fdev
	ShowX01  bool // show x[0] and x[1] in table
	ShowAllX bool // show all x values in table
	ShowXref bool // show X references as well as X values

	// columns: multi-objective columns
	ShowEmin   bool // show Emin
	ShowEave   bool // show Eave
	ShowEmax   bool // show Emax
	ShowEdev   bool // show Edev
	ShowLmin   bool // show Lmin
	ShowLave   bool // show Lave
	ShowLmax   bool // show Lmax
	ShowLdev   bool // show Ldev
	ShowIGDmin bool // show IGDmin
	ShowIGDave bool // show IGDave
	ShowIGDmax bool // show IGDmax
	ShowIGDdev bool // show IGDdev
	// contains filtered or unexported fields
}

TexReport produces TeX table report

func NewTexReport

func NewTexReport(opts []*Optimiser) (o *TexReport)

NewTexReport allocates new TexReport object

func (*TexReport) GenTable

func (o *TexReport) GenTable() (K []string, nrows int, F map[string]io.FcnRow, M map[string]string)

GenTable generates table for TeX report

K -- column keys
nrows -- number of rows
F -- map of functions: key => function returning formatted row value
M -- maps key to tex formatted text of this key (i.e. equation)

func (*TexReport) Generate

func (o *TexReport) Generate(dirout, fnkey string)

Generate generates report

func (*TexReport) SetColumnsAll

func (o *TexReport) SetColumnsAll(flag bool)

SetColumnsAll sets flags to generate all columns

func (*TexReport) SetColumnsDefault

func (o *TexReport) SetColumnsDefault()

SetColumnsDefault sets default flags for table

func (*TexReport) SetColumnsInputData

func (o *TexReport) SetColumnsInputData()

SetColumnsInput sets flags to generate a table with input parameters

func (*TexReport) SetColumnsMultiObj

func (o *TexReport) SetColumnsMultiObj(usingIGD bool)

SetColumnsMultiObj sets flags to generate a table for multi-objective problems

func (*TexReport) SetColumnsSingleObj

func (o *TexReport) SetColumnsSingleObj(showX01, showAllX bool)

SetColumnsSingleObj sets flags to generate a table for single-objective problems

func (*TexReport) SetColumnsXvalues

func (o *TexReport) SetColumnsXvalues()

SetColumnsXvalues sets flags to generate a table with xvalues

type YfuncX_t

type YfuncX_t func(x float64) float64

YfuncX_t defines the folowing simple function: y(x), usually used in plots

Directories

Path Synopsis
oneobj-cec06
+build ignore
+build ignore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL