summaryrefslogtreecommitdiff
path: root/modules/optimization/tests/unit_tests/lmitool.dia.ref
blob: 59d8b35682456f8c7925575153f632781c75cd43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
//
// <-- CLI SHELL MODE -->
//<-- ENGLISH IMPOSED -->
// Constants
rand("seed", 0);
n  = 2;
A1 = rand(n, n);
A2 = rand(n, n);
Xs = diag(1:n);
Q1 = -(A1'*Xs+Xs*A1+0.1*eye());
Q2 = -(A2'*Xs+Xs*A2+0.2*eye());
// Redefining messagebox() to avoid popup
prot = funcprot();
funcprot(0);
function messagebox(msg, msg_title, info)
endfunction
funcprot(prot);
lmitool("prob", "X", "A1, A2"); // Create prob.sci
deletefile "prob.sci";
copyfile("SCI/modules/optimization/demos/prob_bak.sci", "prob.sci"); // Replace prob.sci by prob_bak.sci
exec("prob.sci", -1);
X = prob(A1, A2); // Run optimization
lmisolver: Construction of canonical representation.
lmisolver: Basis Construction.
lmisolver:     FEASIBILITY PHASE.

    primal obj.  dual obj.  dual. gap 
     6.66e-01    -5.03e+02   5.03e+02
     8.37e+01    -4.99e+02   5.83e+02
     6.88e+01    -2.80e+00   7.16e+01
     4.33e+00    -2.67e+00   7.00e+00
     5.65e-01    -1.78e-01   7.43e-01
    -9.58e-02    -1.57e-01   6.13e-02
lmisolver: Target value reached.
lmisolver: feasible solution found.
lmisolver:       OPTIMIZATION PHASE.

    primal obj.  dual obj.  dual. gap 
    -2.76e+00    -3.62e+00   8.56e-01
    -3.13e+00    -3.27e+00   1.35e-01
    -3.14e+00    -3.16e+00   1.62e-02
    -3.14e+00    -3.14e+00   1.62e-03
    -3.14e+00    -3.14e+00   1.27e-04
    -3.14e+00    -3.14e+00   1.40e-05
    -3.14e+00    -3.14e+00   4.40e-07
    -3.14e+00    -3.14e+00   4.54e-08
    -3.14e+00    -3.14e+00   4.06e-09
lmisolver: optimal solution found
refX = [1.0635042 0; 0 2.0784841];
refY = 0;
refZ = list([0.0731600 0.7080179; 0.7080179 0.7186999], [0.1154910 0.5345239; 0.5345239 1.4843684]);
refC = -1.0635042;
[Y, Z, c] = prob_eval(X); // Check evaluaton function value at the point found
assert_checkalmostequal(X, refX, [], 1d-6);
assert_checkalmostequal(Y, refY, [], 1d-6);
assert_checkalmostequal(Z(1), refZ(1), [], 1d-6);
assert_checkalmostequal(Z(2), refZ(2), [], 1d-6);
assert_checkalmostequal(c, refC, [], 1d-6);
deletefile "prob.sci"; // Delete created file