Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Negative value of cost function(objective function)
Posted:
Jan 2, 2014 8:34 AM


On 1/1/2014 11:30 PM, Rubayet wrote: > Hello every one, > > I am developing my cost function as objective function .this function > is nonlinear & my optimization model is unconstrained nolinear > model.While i use fminsearch as solver i am gettting negative value > for my cost function & one of my decision variable among two decision > variable is also negative. May be fminsearch solver search from its > default Inf to Inf. I dont know whats going on? Can any body help me > to figure out this problem. Please be informed that while i consider > fixed value for my decision variables & put it into my objective > function then i get the positive value.So there is no problem in my > cost(objective) function.But while i run this by using fminsearch > solver then i found negative value. I guess this is very basic > problem. Does fminsearch has any default value for search area like > Inf to Inf .?.... so that its start taking negative value of my > decision variable & giving me negative result in final iteration. So i > am really looking for fruitful solution regarding this problem.. > > Regards > Rubayet
You say that a decision variable is negative in the fminsearch solution, and you imply that you don't want that to happen. Unconstrained means any value of a decision variable is OK. So fminsearch is doing what it is supposed to do.
If you want your decision variables to remain positive, then I suggest that you use fmincon (assuming that you have Optimization Toolbox), or else use abs(x) as your decision variables, which keeps the values positive.
Alan Weiss MATLAB mathematical toolbox documentation



