Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code
[maxima.git] / share / cobyla / ex / ex9.mac
blob310eaef57e54d48466e63d06fab33d2b5485995b
1 /*
2  * Test problem 9 (Hock and Schittkowski 100)
3  *
4  * f = (x1-10)^2 + 5*(x2-12)^2 + x3^4 + 3*(x4-11)^2 + 
5  *       10*x5^6 + 7*x6^2 + x7^4 - 4*x6*x7 - 10*x6 - 8*x7
6  * 127-2*x1^2-3*x2^4-x3-4*x4^2-5*x5 >= 0
7  * 282-7*x1-3*x2-10*x3^2-x4+x5 >= 0
8  * 196-23*x1-x2^2-6*x6^2+8*x7 >= 0
9  * -4*x1^2-x2^2+3*x1*x2-2*x3^2-5*x6+11*x7 >= 0
10  *
11  */
13 fmin_cobyla((x1-10)^2 + 5*(x2-12)^2 + x3^4 + 3*(x4-11)^2 + 
14              10*x5^6 + 7*x6^2 + x7^4 - 4*x6*x7 - 10*x6 - 8*x7,
15             makelist(concat(x,k), k, 1, 7),
16             makelist(1,k,1,7), 
17             constraints = [
18              127-2*x1^2-3*x2^4-x3-4*x4^2-5*x5 >= 0,
19              282-7*x1-3*x2-10*x3^2-x4+x5 >= 0,
20              196-23*x1-x2^2-6*x6^2+8*x7 >= 0,
21              -4*x1^2-x2^2+3*x1*x2-2*x3^2-5*x6+11*x7 >= 0
22             ],
23             iprint = 1);
25 /* Output
27    Normal return from subroutine COBYLA
29    NFVALS =  414   F = 6.806301E+02    MAXCV = 2.295009E-11
30    X = 2.330501E+00   1.951373E+00  -4.775347E-01   4.365725E+00  -6.244864E-01
31        1.038131E+00   1.594227E+00
33 [[x1 = 2.330500551903484,x2 = 1.951372521275321,
34           x3 = -.4775346704060226,x4 = 4.365725270693961,
35           x5 = -.6244864327244813,x6 = 1.038131344158587,
36           x7 = 1.594227021522186],680.6300573744938,
37          414, 0]
40 /* True output
42        Output from test problem 9 (Hock and Schittkowski 100)
44    Normal return from subroutine COBYLA
46    NFVALS =  410   F = 6.806301E+02    MAXCV = 2.399014E-11
47    X = 2.330500E+00   1.951373E+00  -4.775345E-01   4.365725E+00  -6.244873E-01
48        1.038131E+00   1.594226E+00