Esempio n. 1
0
func main() {

	// GA parameters
	opt := new(goga.Optimiser)
	opt.Default()
	opt.Nsol = 6
	opt.Ncpu = 1
	opt.Tf = 10
	opt.EpsH = 1e-3
	opt.Verbose = true
	opt.GenType = "latin"
	//opt.GenType = "halton"
	//opt.GenType = "rnd"
	opt.NormFlt = false
	opt.UseMesh = true
	opt.Nbry = 3

	// define problem
	opt.RptName = "9"
	opt.RptFref = []float64{0.0539498478}
	opt.RptXref = []float64{-1.717143, 1.595709, 1.827247, -0.7636413, -0.7636450}
	opt.FltMin = []float64{-2.3, -2.3, -3.2, -3.2, -3.2}
	opt.FltMax = []float64{+2.3, +2.3, +3.2, +3.2, +3.2}
	ng, nh := 0, 3
	fcn := func(f, g, h, x []float64, ξ []int, cpu int) {
		f[0] = math.Exp(x[0] * x[1] * x[2] * x[3] * x[4])
		h[0] = x[0]*x[0] + x[1]*x[1] + x[2]*x[2] + x[3]*x[3] + x[4]*x[4] - 10.0
		h[1] = x[1]*x[2] - 5.0*x[3]*x[4]
		h[2] = math.Pow(x[0], 3.0) + math.Pow(x[1], 3.0) + 1.0
	}

	// check
	if false {
		f := make([]float64, 1)
		h := make([]float64, 3)
		fcn(f, nil, h, opt.RptXref, nil, 0)
		io.Pforan("f(xref)  = %g  (%g)\n", f[0], opt.RptFref[0])
		io.Pforan("h0(xref) = %g\n", h[0])
		io.Pforan("h1(xref) = %g\n", h[1])
		io.Pforan("h2(xref) = %g\n", h[2])
	}

	// initialise optimiser
	nf := 1
	opt.Init(goga.GenTrialSolutions, nil, fcn, nf, ng, nh)

	// output function
	T := make([]float64, opt.Tf+1)                    // [nT]
	X := utl.Deep3alloc(opt.Nflt, opt.Nsol, opt.Tf+1) // [nx][nsol][nT]
	F := utl.Deep3alloc(opt.Nova, opt.Nsol, opt.Tf+1) // [nf][nsol][nT]
	U := utl.Deep3alloc(opt.Noor, opt.Nsol, opt.Tf+1) // [nu][nsol][nT]
	opt.Output = func(time int, sols []*goga.Solution) {
		T[time] = float64(time)
		for j, s := range sols {
			for i := 0; i < opt.Nflt; i++ {
				X[i][j][time] = s.Flt[i]
			}
			for i := 0; i < opt.Nova; i++ {
				F[i][j][time] = s.Ova[i]
			}
			for i := 0; i < opt.Noor; i++ {
				U[i][j][time] = s.Oor[i]
			}
		}
	}

	// initial population
	fnk := "one-obj-prob9-dbg"
	//S0 := opt.GetSolutionsCopy()
	goga.WriteAllValues("/tmp/goga", fnk, opt)

	// solve
	opt.Solve()

	// print
	if false {
		io.Pf("%13s%13s%13s%13s%10s\n", "f0", "u0", "u1", "u2", "feasible")
		for _, s := range opt.Solutions {
			io.Pf("%13.5e%13.5e%13.5e%13.5e%10v\n", s.Ova[0], s.Oor[0], s.Oor[1], s.Oor[2], s.Feasible())
		}
	}

	// plot: time series
	//a, b := 100, len(T)
	a, b := 0, 1 //len(T)
	if false {
		plt.SetForEps(2.0, 400)
		nrow := opt.Nflt + opt.Nova + opt.Noor
		for j := 0; j < opt.Nsol; j++ {
			for i := 0; i < opt.Nflt; i++ {
				plt.Subplot(nrow, 1, 1+i)
				plt.Plot(T[a:b], X[i][j][a:b], "")
				plt.Gll("$t$", io.Sf("$x_%d$", i), "")
			}
		}
		for j := 0; j < opt.Nsol; j++ {
			for i := 0; i < opt.Nova; i++ {
				plt.Subplot(nrow, 1, 1+opt.Nflt+i)
				plt.Plot(T[a:b], F[i][j][a:b], "")
				plt.Gll("$t$", io.Sf("$f_%d$", i), "")
			}
		}
		for j := 0; j < opt.Nsol; j++ {
			for i := 0; i < opt.Noor; i++ {
				plt.Subplot(nrow, 1, 1+opt.Nflt+opt.Nova+i)
				plt.Plot(T[a:b], U[i][j][a:b], "")
				plt.Gll("$t$", io.Sf("$u_%d$", i), "")
			}
		}
		plt.SaveD("/tmp/goga", fnk+"-time.eps")
	}

	// plot: x-relationships
	if true {
		plt.SetForEps(1, 700)
		ncol := opt.Nflt - 1
		for i := 0; i < opt.Nflt-1; i++ {
			for j := i + 1; j < opt.Nflt; j++ {
				plt.Subplot(ncol, ncol, i*ncol+j)
				if opt.UseMesh {
					opt.Meshes[i][j].CalcDerived(0)
					opt.Meshes[i][j].Draw2d(false, false, nil, 0)
				}
				for k := 0; k < opt.Nsol; k++ {
					plt.Plot(X[i][k][a:b], X[j][k][a:b], "ls='none', marker='.'")
				}
				plt.Gll(io.Sf("$x_%d$", i), io.Sf("$x_%d$", j), "")
			}
		}
		plt.SaveD("/tmp/goga", fnk+"-x.eps")
	}
}
Esempio n. 2
0
func main() {

	// GA parameters
	opt := new(goga.Optimiser)
	opt.Default()
	opt.Nsol = 50
	opt.Ncpu = 1
	opt.Tf = 1000
	opt.Nsamples = 10
	opt.EpsH = 1e-3
	opt.Verbose = false
	opt.GenType = "latin"
	opt.NormFlt = false

	// options for report
	opt.HistNsta = 6
	opt.HistLen = 13
	opt.RptFmtF = "%.5f"
	opt.RptFmtFdev = "%.2e"
	opt.RptFmtX = "%.3f"

	opt.RptName = "9"
	opt.RptFref = []float64{0.0539498478}
	opt.RptXref = []float64{-1.717143, 1.595709, 1.827247, -0.7636413, -0.7636450}
	opt.FltMin = []float64{-2.3, -2.3, -3.2, -3.2, -3.2}
	opt.FltMax = []float64{+2.3, +2.3, +3.2, +3.2, +3.2}
	ng, nh := 0, 3
	fcn := func(f, g, h, x []float64, ξ []int, cpu int) {
		f[0] = math.Exp(x[0] * x[1] * x[2] * x[3] * x[4])
		h[0] = x[0]*x[0] + x[1]*x[1] + x[2]*x[2] + x[3]*x[3] + x[4]*x[4] - 10.0
		h[1] = x[1]*x[2] - 5.0*x[3]*x[4]
		h[2] = math.Pow(x[0], 3.0) + math.Pow(x[1], 3.0) + 1.0
	}

	// check
	if false {
		f := make([]float64, 1)
		h := make([]float64, 3)
		fcn(f, nil, h, opt.RptXref, nil, 0)
		io.Pforan("f(xref)  = %g  (%g)\n", f[0], opt.RptFref[0])
		io.Pforan("h0(xref) = %g\n", h[0])
		io.Pforan("h1(xref) = %g\n", h[1])
		io.Pforan("h2(xref) = %g\n", h[2])
		return
	}

	// initialise optimiser
	nf := 1
	opt.Init(goga.GenTrialSolutions, nil, fcn, nf, ng, nh)

	// solve
	//opt.RunMany("/tmp/goga", "functions")
	opt.RunMany("", "")
	goga.StatF(opt, 0, true)
	opts := []*goga.Optimiser{opt}
	textSize := `\scriptsize  \setlength{\tabcolsep}{0.5em}`
	miniPageSz, histTextSize := "4.1cm", `\fontsize{5pt}{6pt}`
	nRowPerTab := 9
	title := "Constrained single objective problem 9"
	goga.TexReport("/tmp/goga", "tmp_one-obj-prob9", title, "one-ob-prob9", 1, nRowPerTab, true, false, textSize, miniPageSz, histTextSize, opts)
	goga.TexReport("/tmp/goga", "one-obj-prob9", title, "one-obj-prob9", 1, nRowPerTab, false, false, textSize, miniPageSz, histTextSize, opts)
}
Esempio n. 3
0
// Output:
//  lsf  -- limit state function
//  βref -- reference β (if available)
//  vars -- random variables data
func get_simple_data(opt *goga.Optimiser) (lsf LSF_T, vars rnd.Variables) {

	var desc string
	var βref float64
	var xref []float64
	switch opt.ProbNum {

	case 1:
		desc = "SMB1/BS5"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 0.1*math.Pow(x[0]-x[1], 2) - (x[0]+x[1])/SQ2 + 2.5, 0.0
		}
		βref = 2.5 // from SMB
		xref = []float64{1.7677, 1.7677}
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
		}

	case 2:
		desc = "SMB2/BS6"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return -0.5*math.Pow(x[0]-x[1], 2) - (x[0]+x[1])/SQ2 + 3, 0.0
		}
		βref = 1.658 // from BS6
		xref = []float64{-0.7583, 1.4752}
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
		}

	case 3:
		desc = "SMB3/GR6"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 2 - x[1] - 0.1*math.Pow(x[0], 2) + 0.06*math.Pow(x[0], 3), 0.0
		}
		βref = 2 // from SMB
		xref = []float64{0, 2}
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
		}

	case 4:
		desc = "SMB4/GR8"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 3 - x[1] + 256*math.Pow(x[0], 4), 0.0
		}
		βref = 3 // from SMB
		xref = []float64{0, 3}
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
		}

	case 5:
		desc = "SMB5/GW1" // modified GW1
		shift := 0.0      // 0.1
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 1 + math.Pow(x[0]+x[1]+shift, 2)/4 - 4*math.Pow(x[0]-x[1]+shift, 2), 0.0
		}
		βref = 0.3536 // from SMB
		xref = []float64{-βref * SQ2 / 2.0, βref * SQ2 / 2.0}
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
			&rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20},
		}

	case 6:
		desc = "SMB7/SSGK1a" // SSGK case 1
		lsf = func(x []float64, cpu int) (float64, float64) {
			return math.Pow(x[0], 3) + math.Pow(x[1], 3) - 18, 0.0
		}
		βref = 2.2401 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 5, Min: -50, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 5, Min: -50, Max: 50},
		}

	case 7:
		desc = "SMB8/SSGK1b" // SSGK case 2
		lsf = func(x []float64, cpu int) (float64, float64) {
			return math.Pow(x[0], 3) + math.Pow(x[1], 3) - 18, 0.0
		}
		βref = 2.2260 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 5, Min: -50, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 9.9, S: 5, Min: -50, Max: 50},
		}

	case 8:
		desc = "SMB9/GR7"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 2.5 - 0.2357*(x[0]-x[1]) + 0.0046*math.Pow(x[0]+x[1]-20, 4), 0.0
		}
		βref = 2.5 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 3, Min: -50, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 3, Min: -50, Max: 50},
		}

	case 9:
		desc = "SMB10/SSGK2"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return math.Pow(x[0], 3) + math.Pow(x[1], 3) - 67.5, 0.0
		}
		βref = 1.9003 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 5, Min: -50, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 5, Min: -50, Max: 50},
		}

	case 10:
		desc = "SMB11/GR2"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return x[0]*x[1] - 146.14, 0.0
		}
		βref = 5.4280 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 78064.4, S: 11709.7, Min: 1000, Max: 150000},
			&rnd.VarData{D: rnd.D_Normal, M: 0.0104, S: 0.00156, Min: -0.05, Max: 0.05},
		}

	case 11:
		desc = "SMB12/GW2"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 2.2257 - 0.025*SQ2*math.Pow(x[0]+x[1]-20, 3)/27 + 0.2357*(x[0]-x[1]), 0.0
		}
		βref = 2.2257 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 3, Min: -50, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 10, S: 3, Min: -50, Max: 50},
		}

	case 12:
		desc = "SMB14/HM7.6"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return x[0]*x[1] - 1140, 0.0
		}
		βref = 5.2127 // from SMB // from here: 5.210977819456551
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Lognormal, M: 38, S: 3.8, Min: 20, Max: 60},
			&rnd.VarData{D: rnd.D_Lognormal, M: 54, S: 2.7, Min: 40, Max: 70},
		}

	// more than 2 variables -----------------------------------------------------------------

	case 13:
		desc = "SMB6/GR3"
		lsf = func(x []float64, cpu int) (float64, float64) {
			sum := 0.0
			for i := 0; i < 9; i++ {
				sum += x[i] * x[i]
			}
			return 2.0 - 0.015*sum - x[9], 0.0
		}
		βref = 2.0 // from SMB
		vars = make([]*rnd.VarData, 10)
		for i := 0; i < 10; i++ {
			vars[i] = &rnd.VarData{D: rnd.D_Normal, M: 0, S: 1, Min: -20, Max: 20}
		}
		opt.Nsol = 120
		opt.Ncpu = 4

	case 14:
		desc = "KLH1/CX1"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return x[0] + 2.0*x[1] + 2.0*x[2] + x[3] - 5.0*x[4] - 5.0*x[5], 0.0
		}
		βref = 2.348 // from CX1
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 50, S: 15, Min: 5, Max: 150},
			&rnd.VarData{D: rnd.D_Lognormal, M: 40, S: 12, Min: 5, Max: 120},
		}
		opt.Nsol = 60
		opt.Ncpu = 2

	case 15:
		desc = "SMB16/KLH2"
		lsf = func(x []float64, cpu int) (float64, float64) {
			s := x[0] + 2.0*x[1] + 2.0*x[2] + x[3] - 5.0*x[4] - 5.0*x[5]
			for i := 0; i < 6; i++ {
				s += 0.001 * math.Sin(1000*x[i])
			}
			return s, 0.0
		}
		βref = 2.3482 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 120, S: 12, Min: 50, Max: 200},
			&rnd.VarData{D: rnd.D_Lognormal, M: 50, S: 15, Min: 5, Max: 150},
			&rnd.VarData{D: rnd.D_Lognormal, M: 40, S: 12, Min: 5, Max: 120},
		}
		opt.Nsol = 60
		opt.Ncpu = 2

	case 16:
		desc = "SMB17/MS5"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return -240758.1777 + 10467.364*x[0] + 11410.63*x[1] +
				3505.3015*x[2] - 246.81*x[0]*x[0] - 285.3275*x[1]*x[1] - 195.46*x[2]*x[2], 0.0
		}
		βref = 0.8292 // from SMB
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Lognormal, M: 21.2, S: 0.1, Min: 20, Max: 22},
			&rnd.VarData{D: rnd.D_Lognormal, M: 20.0, S: 0.2, Min: 19, Max: 21},
			&rnd.VarData{D: rnd.D_Lognormal, M: 9.2, S: 0.1, Min: 8, Max: 10},
		}
		opt.Nsol = 30

	case 17:
		desc = "SMB18/SSGK4a" // SSGK case 1
		lsf = func(x []float64, cpu int) (float64, float64) {
			return x[0]*x[1] - 78.12*x[2], 0.0
		}
		βref = 3.3221 // from SMB or 3.31819 from SSGK
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Normal, M: 2e7, S: 5e6, Min: 1e6, Max: 4e7},
			&rnd.VarData{D: rnd.D_Normal, M: 1e-4, S: 2e-5, Min: 1e-5, Max: 2e-4},
			&rnd.VarData{D: rnd.D_Gumbel, M: 4, S: 1.0, Min: 1, Max: 15},
		}
		opt.Nsol = 30

	case 18:
		desc = "SMB19/SSGK4b" // SSGK case 2
		lsf = func(x []float64, cpu int) (float64, float64) {
			return x[0]*x[1] - 78.12*x[2], 0.0
		}
		βref = 4.45272 // from SSGK
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Lognormal, M: 2e7, S: 5e6, Min: 1e6, Max: 5e7},
			&rnd.VarData{D: rnd.D_Lognormal, M: 1e-4, S: 2e-5, Min: 1e-5, Max: 3e-4},
			&rnd.VarData{D: rnd.D_Gumbel, M: 4, S: 1.0, Min: 1, Max: 15},
		}
		opt.Nsol = 30

	case 19:
		desc = "SMB20/SSGK5"
		lsf = func(x []float64, cpu int) (float64, float64) {
			return 1.1 - 0.00115*x[0]*x[1] + 0.00157*x[1]*x[1] + 0.00117*x[0]*x[0] +
				+0.0135*x[1]*x[2] - 0.0705*x[1] - 0.00534*x[0] - 0.0149*x[0]*x[2] +
				-0.0611*x[1]*x[3] + 0.0717*x[0]*x[3] - 0.226*x[2] + 0.0333*x[2]*x[2] +
				-0.558*x[2]*x[3] + 0.998*x[3] - 1.339*x[3]*x[3], 0.0
		}
		βref = 2.42031 // from SSGK
		vars = rnd.Variables{
			&rnd.VarData{D: rnd.D_Frechet, L: 8.782275, A: 4.095645, Min: 8, Max: 12},
			&rnd.VarData{D: rnd.D_Normal, M: 25, S: 5, Min: 5, Max: 50},
			&rnd.VarData{D: rnd.D_Normal, M: 0.8, S: 0.2, Min: 0.1, Max: 2.0},
			&rnd.VarData{D: rnd.D_Lognormal, M: 0.0625, S: 0.0625, Min: 0.001, Max: 0.4},
		}
		opt.Nsol = 40

	default:
		chk.Panic("simple problem number %d is invalid", opt.ProbNum)
	}
	opt.RptName = desc
	opt.RptName = io.Sf("%d", opt.ProbNum)
	opt.RptFref = []float64{βref}
	opt.RptXref = xref
	return
}
Esempio n. 4
0
func main() {

	// GA parameters
	opt := new(goga.Optimiser)
	opt.Default()
	opt.Tf = 500
	opt.Nsamples = 1000
	opt.Verbose = false
	opt.GenType = "latin"

	// enlarge box; add more constraint equations
	strategy2 := true

	// options for report
	opt.HistNsta = 6
	opt.HistLen = 13
	opt.RptFmtF = "%.5f"
	opt.RptFmtFdev = "%.2e"
	opt.RptFmtX = "%.3f"

	opt.Ncpu = 4
	opt.RptName = "2"
	opt.RptFref = []float64{-15.0}
	opt.RptXref = []float64{1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1}
	opt.FltMin = make([]float64, 13)
	opt.FltMax = make([]float64, 13)
	xmin, xmax := 0.0, 1.0
	if strategy2 {
		xmin, xmax = -0.5, 1.5
	}
	for i := 0; i < 9; i++ {
		opt.FltMin[i], opt.FltMax[i] = xmin, xmax
	}
	opt.FltMin[12], opt.FltMax[12] = xmin, xmax
	xmin, xmax = 0, 100
	if strategy2 {
		xmin, xmax = -1, 101
	}
	for i := 9; i < 12; i++ {
		opt.FltMin[i], opt.FltMax[i] = xmin, xmax
	}
	ng := 9
	if strategy2 {
		ng += 9 + 9 + 3 + 3 + 2
	}
	fcn := func(f, g, h, x []float64, ξ []int, cpu int) {
		s1, s2, s3 := 0.0, 0.0, 0.0
		for i := 0; i < 4; i++ {
			s1 += x[i]
			s2 += x[i] * x[i]
		}
		for i := 4; i < 13; i++ {
			s3 += x[i]
		}
		f[0] = 5.0*(s1-s2) - s3
		g[0] = 10.0 - 2.0*x[0] - 2.0*x[1] - x[9] - x[10]
		g[1] = 10.0 - 2.0*x[0] - 2.0*x[2] - x[9] - x[11]
		g[2] = 10.0 - 2.0*x[1] - 2.0*x[2] - x[10] - x[11]
		g[3] = 8.0*x[0] - x[9]
		g[4] = 8.0*x[1] - x[10]
		g[5] = 8.0*x[2] - x[11]
		g[6] = 2.0*x[3] + x[4] - x[9]
		g[7] = 2.0*x[5] + x[6] - x[10]
		g[8] = 2.0*x[7] + x[8] - x[11]
		if strategy2 {
			for i := 0; i < 9; i++ {
				g[9+i] = x[i]
				g[18+i] = 1.0 - x[i]
			}
			for i := 0; i < 3; i++ {
				g[27+i] = x[9+i]
				g[30+i] = 100.0 - x[9+i]
			}
			g[33] = x[12]
			g[34] = 1.0 - x[12]
		}
	}

	// number of trial solutions
	opt.Nsol = len(opt.FltMin) * 10

	// initialise optimiser
	nf, nh := 1, 0
	opt.Init(goga.GenTrialSolutions, nil, fcn, nf, ng, nh)

	// solve
	opt.RunMany("", "")
	goga.StatF(opt, 0, true)
	opts := []*goga.Optimiser{opt}
	textSize := `\scriptsize  \setlength{\tabcolsep}{0.5em}`
	miniPageSz, histTextSize := "4.1cm", `\fontsize{5pt}{6pt}`
	nRowPerTab := 9
	title := "Constrained single objective problem 2"
	goga.TexReport("/tmp/goga", "tmp_one-obj-prob2", title, "one-ob-prob2", 1, nRowPerTab, true, false, textSize, miniPageSz, histTextSize, opts)
	goga.TexReport("/tmp/goga", "one-obj-prob2", title, "one-obj-prob2", 1, nRowPerTab, false, false, textSize, miniPageSz, histTextSize, opts)
}