Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: fmincon sparse constraints question
Replies: 3   Last Post: May 21, 2013 1:22 PM

 Messages: [ Previous | Next ]
 Alan Weiss Posts: 1,430 Registered: 11/27/08
Re: fmincon sparse constraints question
Posted: May 10, 2013 2:28 PM

On 5/10/2013 1:58 PM, Haemish wrote:
> When I code for fmincon, I makes a ctr.m as follows;
>
> ...
> ceq=~~
> cd=[];
> if nargout > 2
> dceq=2178*1090 matrix
> dc=[];
> ...
>
> But dceq above is too large and sparse that the calculation time is so
> long and sometimes the system stops.
>
> I think that to use sparse matrix and coding as follow seem to be the
> solution
>
> ...
> ceq=~~
> cd=[];
> if nargout > 2
> dceq=2178*1090 matrix
> dceq=sparse(dceq);
> dc=[];
> ...
>
> But the calculation is still so slow.
>
> Are there any problems on my soluation
>
> Thank you.

You should be doing sparse internal calculations for your dceq function,
not doing a nonsparse calculation and then returning a sparse solution.
What I mean is, you should not have to call sparse(dceq) because your
constraint gradient should already be sparse. And you should be sure to

You can also specify a sparse Hessian multiply function. See
http://www.mathworks.com/help/optim/ug/minimization-with-dense-structured-hessian-equality-constraints.html

Alan Weiss
MATLAB mathematical toolbox documentation

Date Subject Author
5/10/13 Haemish
5/10/13 Alan Weiss
5/21/13 Haemish
5/21/13 Alan Weiss