source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/dev/tests-mbg/bmibnb/bmibnb_mpc1.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 833 bytes
Line 
1function algebraicmpc
2
3% Test bilinearization functionality
4N = 2;
5x = sdpvar(2*ones(1,N),ones(1,N));
6u = sdpvar(  ones(1,N),ones(1,N));
7
8F = set(-5 < [x{:}] <5) + set(-10 < [u{:}] < 10);
9obj = 0;
10Q = eye(2);R = 1/10;
11h = 0.05;
12
13A = [1 h;-h 1-2*0.3*h];
14B = [0;h];
15dd = binvar(2,N-1);
16bounds([x{:}],-5,5);
17bounds([u{:}],-10,10);
18for i = 1:N-1
19    obj = obj + x{i+1}'*Q*x{i+1} + u{i}'*R*u{i}; 
20     F = F + set(x{i+1} == A*x{i} + B*u{i} + [0;-h*x{i}(1)^3]);   
21end
22       
23xk = [2.5;1];
24uk = [];
25cost = 0;
26ops =sdpsettings('solver','bmibnb','bmibnb.lpreduce',0,'bmibnb.maxiter',10,'debug',1,'bmibnb.upper','fmincon','bmibnb.root',1);
27         
28obj = obj + ([x{2}]'*[x{2}])^2;
29sol = solvesdp(F+set(-10 < x{1} < 10) + set(x{1} == xk(:,end)),obj,ops)
30
31mbg_asserttolequal(sol.problem,0);
32mbg_asserttolequal(double(obj), 48.8272, 1e-3);
Note: See TracBrowser for help on using the repository browser.