0
FOSSEE Optimization Toolbox: Least squares problem call to fmincon does not work

Hello,
I am having problems with the below code. It is a variation of an example listed in the optimization chapter of the Modelling and Simuation in Scilab-Scicos book (pages 109-110 & 114). I can configure the code to work for leastsq and lsqrsolve, but not fmincon from the FOSSEE Optimization toolbox.

All worked examples that call fmincon listed on the FOSSEE site run without problem. These include all 7 examples in 'documentation' plus the spring and circular tank design problems in 'examples'.

The problem has been presented to the Scilab.org comminity and the code syntax checked for potential problems. It complies with the FOSSEE toolbox syntax in both a short and long call with derivative.

How may i configure the least-squares problem to be solved with a call to fmincon?
Any help to resolve the matter would be greatly appreciated.

My system is: Windows 10 Home 64-bit OS, Intel core i5 x64-based processor, Scilab 5.5.2

Regards, Dave

function z=fun(p)
z=DAT(:,2)-p(1)*exp(p(2)*DAT(:,1))-p(3)*ones(DAT(:,1))
endfunction
function dz=dfun(p)
var=exp(p(2)*DAT(:,1))
dz=[-var..
-p(1)*DAT(:,1).*var..
-ones(var)]
endfunction
function f=costf(p)
f = norm(fun(p))^2;
endfunction
function g=grad(p)
g = 2*dfun(p)'*fun(p);
endfunction

DAT=[0 0;0 1;1 1;2 1.5;2 2];
p0=[0 0 0];

xopt = fmincon(costf,p0,[],[])
options = list("GradObj",grad)
xopt = fmincon(costf,p0,[],[],[],[],[],[],[],options)


Scilab Toolbox Optimization Toolbox 14-01-20, 8:27 p.m. brant
0


Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well.
I wanted to thank you for this websites! Thanks for sharing. Great websites!

https://shareits.xyz

Oops! Looks like spam! Waiting for moderator approval
17-01-20, 7:31 p.m. sunny0106

Login to add comment
Oops! Looks like spam! Waiting for moderator approval


0

https://shareits.xyz

Oops! Looks like spam! Waiting for moderator approval
17-01-20, 7:32 p.m. sunny0106

Login to add comment
Oops! Looks like spam! Waiting for moderator approval


0

I solved a set of differential equations for an SIR epidemic model using ode45. If I wanted to minimize the least squares distance between the model and the data that I have, how would I go about doing this? I know that I need to use the fminsearch function because it's stated in the assignment, but I'm not sure how to implement it. Here's what I have so far: Function file:

speed test vidmate 123movies
Oops! Looks like spam! Waiting for moderator approval
22-01-20, 9:29 a.m. Arsoy

Login to add comment
Oops! Looks like spam! Waiting for moderator approval


Log-in to answer to this question.