Revision fc46ca7f88d6f91ec43bb77f0d8809df2eb73ee8 authored by Art Kuo on 14 February 2023, 22:04:04 UTC, committed by Art Kuo on 14 February 2023, 22:04:04 UTC
extra readme cloning and downloading
1 parent a2ac444
setInitialParamsNBoundsForRW_v2.m
function [params, lb, ub] = setInitialParamsNBoundsForRW_v2(numSteps, nominalP_RW, runNonLinModel, stepTimeNomRW, boundPushOffBegin, boundPushOffEnd)
%This function generates params; the initial guess of the push off impulse
%trajectory and upper and lower bound of the trajectory ub and lb,
%respectively.
%Currently, I use 4 times the nominal push off impulse whihc generally
%works but depending on the optimization you can change it. lb and ub are
%set to infinity and zero unless they are bounded with boundPushOffBegin
%and boundPushOffEnd
if ~runNonLinModel %no nonlinear model in this script so this will always be 1 for now
lb = [ ones(1,numSteps)*0];
ub = [ ones(1,numSteps)*inf];
params(1,:) = ones(1,numSteps)*nominalP_RW*4; %<----this is the nominal initial guess
if ~isempty(boundPushOffBegin)
params(1:boundPushOffBegin) = nominalP_RW;
lb(1:boundPushOffBegin) = nominalP_RW;
ub(1:boundPushOffBegin) = nominalP_RW;
end
if boundPushOffEnd ~= 0
params(boundPushOffEnd+1:end) = nominalP_RW;
lb(boundPushOffEnd+1:end) = nominalP_RW;
ub(boundPushOffEnd+1:end) = nominalP_RW;
end
else
lb = [ ones(1,numSteps)*0; ones(1,numSteps)*stepTimeNomRW/50];
ub = [ ones(1,numSteps)*inf*nominalP_RW ; ones(1,numSteps)*stepTimeNomRW*50];
params = [ones(1,numSteps)*nominalP_RW*4; ones(1,numSteps)*stepTimeNomRW];
if ~isempty(boundPushOffBegin)
params(:,1:boundPushOffBegin) = [ones(1,boundPushOffBegin)*nominalP_RW; ones(1,boundPushOffBegin)*stepTimeNomRW];
lb(:,1:boundPushOffBegin) = [ones(1,boundPushOffBegin)*nominalP_RW; ones(1,boundPushOffBegin)*stepTimeNomRW];
ub(:,1:boundPushOffBegin) = [ones(1,boundPushOffBegin)*nominalP_RW; ones(1,boundPushOffBegin)*stepTimeNomRW];
end
if boundPushOffEnd ~= 0
% params(boundPushOffEnd+1:end,:) = [nominalP_RW; stepTimeNomRW];
% lb(boundPushOffEnd+1:end,:) = [nominalP_RW; stepTimeNomRW];
% ub(boundPushOffEnd+1:end,:) = [nominalP_RW; stepTimeNomRW];
% keyboard;%just to check
temp = length(params)-boundPushOffEnd;
params(:,boundPushOffEnd+1:end) = [ ones(1,temp)*nominalP_RW; ones(1,temp)*stepTimeNomRW];
% lb(:, boundPushOffEnd+1:end) = [ones(1,temp)*nominalP_RW; ones(1,temp)*stepTimeNomRW];
% ub(:, boundPushOffEnd+1:end) = [ones(1,temp)*nominalP_RW; ones(1,temp)*stepTimeNomRW];
lb(1, boundPushOffEnd+1:end) = [ones(1,temp)*nominalP_RW; ];
ub(1, boundPushOffEnd+1:end) = [ones(1,temp)*nominalP_RW; ];
end
end
Computing file changes ...