comparison scripts/optimization/qp.m @ 5310:2fbcdc356fc7

[project @ 2005-04-27 15:38:53 by jwe]
author jwe
date Wed, 27 Apr 2005 15:38:53 +0000
parents 4c8a2e4e0717
children 34f96dd5441b
comparison
equal deleted inserted replaced
5309:15031c6fab31 5310:2fbcdc356fc7
164 bin = [bin; -A_ub]; 164 bin = [bin; -A_ub];
165 endif 165 endif
166 endif 166 endif
167 endif 167 endif
168 endif 168 endif
169 n_in = length (bin);
170 169
171 ## Now we should have the following QP: 170 ## Now we should have the following QP:
172 ## 171 ##
173 ## min_x 0.5*x'*H*x + x'*q 172 ## min_x 0.5*x'*H*x + x'*q
174 ## s.t. A*x = b 173 ## s.t. A*x = b
177 ## Discard inequality constraints that have -Inf bounds since those 176 ## Discard inequality constraints that have -Inf bounds since those
178 ## will never be active. 177 ## will never be active.
179 idx = isinf (bin) & bin < 0; 178 idx = isinf (bin) & bin < 0;
180 bin(idx) = []; 179 bin(idx) = [];
181 Ain(idx,:) = []; 180 Ain(idx,:) = [];
181
182 n_in = length (bin);
182 183
183 ## Check if the initial guess is feasible. 184 ## Check if the initial guess is feasible.
184 rtol = sqrt (eps); 185 rtol = sqrt (eps);
185 186
186 eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b))); 187 eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b)));