-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.m
136 lines (107 loc) · 4.63 KB
/
main.m
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
%diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\1\1a,b,c.txt')
disp('--------------------------------------------problem 1-------------------------------------------')
%problem1()
diary off
%diary on
%diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\2\2.txt')
disp('************************************************************************************')
disp('--------------------------------------------problem 2-------------------------------------------')
%problem2()
diary off
%diary on
%diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\3\3.txt')
disp('************************************************************************************')
disp('--------------------------------------------problem 3-------------------------------------------')
%problem3()
diary off
disp('************************************************************************************')
disp('--------------------------------------------problem 4 SteepestDecent BackTrack-------------------------------------------')
%F1 = steepest_backtrack([-1,1]',.7,.7,500);
%F1 ;
%F2 = steepest_backtrack([2,1]',.7,.7,500);
%F2;
%F3 = steepest_backtrack([0,1]',.7,.7,500);
%F3;
disp('************************************************************************************')
disp('--------------------------------------------problem 4 Newton BackTrack -------------------------------------------')
%N1 = Newton_backtrack([-1,1]',.5,.1,500);
%N1;
%N2 = Newton_backtrack([2,1]',.5,.1,500);
%N2;
%N3 = Newton_backtrack([0,1]',.7,.1,500);
%N3;
%diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\4\SteepestDecent Cubic[0 1].txt')
disp('************************************************************************************')
disp('--------------------------------------------problem 4 SteepestDecent Cubic -------------------------------------------')
%steepest_cubic(x1,c,itr_num)
%disp ('initial point [-1 1]')
%F1 = steepest_cubic([-1,1]',.7,10);
%disp ('F*')
%F1(end)
%disp ('initial point [2 1]')
%F2 = steepest_cubic([2,1]',.7,60);
%disp ('F*')
%F2(end)
%disp (' initial point [0 1]')
%F3 = steepest_cubic([0,1]',.1,10);
%disp ('F*')
%F3 (end)
disp('************************************************************************************')
disp('--------------------------------------------problem 4 Newton Cubic -------------------------------------------')
%disp ('initial point [-1 1]')
%F1 = NewtonCubic([-1,1]',.7,10);
%disp ('F*')
%F1(end)
%disp ('initial point [2 1]')
%F2 = NewtonCubic([2,1]',.7,60);
%disp ('F*')
%F2(end)
%disp (' initial point [0 1]')
%F3 = NewtonCubic([0,1]',.1,10);
%disp ('F*')
%F3 (end)
diary off
diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\5a\5a.txt')
disp('************************************************************************************')
disp('--------------------------------------------problem 5_A Trust-------------------------------------------')
disp('initial point = [2,2]')
disp('Delta = 2')
X_star = TR([2,2]',1/32 , 5 ,2, 30)
disp('Delta = 1')
X_star = TR([2,2]',1/32 , 5 ,1, 30)
disp('Delta = 0.5')
X_star = TR([2,2]',1/32 , 5 ,.5, 30)
diary off
disp('************************************************************************************')
disp('--------------------------------------------problem 5_B DogLeg and Cauchy -------------------------------------------')
%disp('initial point = [2,2]')
%disp('\delta = 0.2')
%P_dog = dogleg ( [2,2]', .2) ;
%P_dog
%disp('\delta = 1')
%P_dog =dogleg ( [2,2]', 1) ;
%P_dog
%disp('\delta = 2')
%P_dog =dogleg ( [2,2]', 2) ;
%P_dog
%disp('\delta = 0.2')
%P_c = Cuachy ( [2,2]', .2);
%P_c
%disp('\delta = 1')
%P_c = Cuachy ( [2,2]', 1) ;
%P_c
%disp('\delta = 2')
%P_c = Cuachy ( [2,2]', 2) ;
%P_c
%diary('D:\MSC\Boyd convex optimization\MZLGH\Codes\report\6\6.txt')
disp('************************************************************************************')
disp('--------------------------------------------problem 6 A -------------------------------------------')
%steepest_backtrack_six([1,1,1]',.7,.7,500)
%X_est_steepest = steepest_backtrack_six([1,1,1]', .7, .7, 500);
%X_est_steepest
disp('************************************************************************************')
disp('--------------------------------------------problem 6 B -------------------------------------------')
%ConjugateG([1 1 1]' , 3)
disp('************************************************************************************')
disp('--------------------------------------------problem 6 C -------------------------------------------')
%X_real = inv([3 -1 0 ; -1 3 -1 ; 0 -1 3] ) * [1;2;3]