u = sdpvar(repmat(nu,1,N),repmat(1,1,N));
y_pred = (sdpvar(repmat(nx,1,N),repmat(1,1,N)))';
r = (sdpvar(repmat(ny,1,N),repmat(1,1,N)))';
constraints = [];
objective = 0;
for k = 1:N
%x = A*x + B*u{k};
y_pred{k} = simlssvm({input_train',output_train',type,6965.92075677792,0.0272260740857455,'RBF_kernel','orignal'},{alpha_pso,b_pso},u{k}');
objective = objective + norm(y_pred{k}-(r{k}),1) + norm(R*u{k},1);
constraints = [constraints, -1 <= u{k}<= 1 , -1 <=y_pred{k} <= 1];
end
%% Now Implementation %%
parameters_in = {[r{:}]};
solutions_out = {[u{:}], [y_pred{:}]};
controller = optimizer(constraints, objective,sdpsettings('solver','gurobi'),parameters_in,solutions_out);
%controller = optimizer(constraints, objective,[],[],[u{:}]);