[SciPy-user] cobyla help

joe stano jstano at interchange.ubc.ca
Sat Sep 30 17:01:02 EDT 2006


Hi there

I am very new to python but have found myself in way over my head.  I am
trying to perform a constrained optimization using fmin_cobyla and am
running into some problems.

I was wondering if you may have some examples that I could review.
Especially examples that use a list of constraint functions that take inputs
from the function that is being optimized.

 

I am a novice who is just trying to learn about python and programming in
general.  I am working with numpy arrays and when I run my program without
the optimization everything seems to run ok.  However, when I include the
optimization, when I multiply 2 arrays together (element wise not using
dot()), I get a (ValueError: shape mismatch: objects cannot be broadcast to
a single shape) error message that confuses me as I don't get it when I
simply run the program and print out the results.

When I exclude the optimization, and print just the array that I pass to the
function, it looks like how I define it (N x N array).  But when I include
the optimization and print what I pass from the function before the code
crashes, it no longer looks like how I define it (i.e., 1 x more then N
array).  Which is why I think I get the shape error.

 

I know that I am calling the optimization wrong so I figured I would give
you a snapshot of what I am trying to do, and maybe you can tell what I am
doing wrong in calling the optimization.

I have attached some of the code with a description of the arrays.  

 

Any advice or help you could give would be greatly appreciated.

 

Thanks either way,

joe

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20060930/f1690688/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try_optimize_help.py
Type: application/octet-stream
Size: 2532 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20060930/f1690688/attachment.obj>


More information about the SciPy-User mailing list