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
|
// An example with equality, inequality constraints, variable bounds, initial guess and options
C = [1 1 1;
1 1 0;
0 1 1;
1 0 0;
0 0 1]
d = [89;
67;
53;
35;
20;]
A = [3 2 1;
2 3 4;
1 2 3];
b = [191
209
162];
Aeq = [1 2 1];
beq = 10;
lb = repmat(0.1,3,1);
ub = repmat(4,3,1);
x0 = repmat(0,3,1);
options = list("MaxIter", 300);
//Output
//Optimal Solution Found.
// lambda =
//
// lower: [5.357D-12,2.334D-11,5.356D-12]
// upper: [78,6.963D-12,49]
// eqlin: 95
// ineqlin: [1.206D-13,1.146D-13,1.449D-13]
// output =
//
// Iterations: 8
// ConstrViolation: 8.000D-08
// exitflag =
//
// 0
// residual =
//
// 80.
// 62.
// 48.
// 31.
// 16.
// resnorm =
//
// 13765.
// xopt =
//
// 4.
// 1.0000000
// 4.
[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0,options)
|