[SciPy-user] Cobyla Help part 2

Christian Kristukat ckkart at hoc.net
Sun Oct 1 18:13:47 CDT 2006


joe stano wrote:
> Thanks for the advice.
> 
> Although reshape would not work because the size was larger then 32, I am
> still able to reshape the array with loops.

? Why that? Why can't you reshape an array larger than 32 (elements, I guess) ?
If you have an NxN array with N=32 you can call
numpy.ravel(data)
to get a 1D-arrayu and
numpy.reshape(data, (N,N)
to get its original shape back.

> The script now runs, however, the constraints do not seem to be working
> (i.e., I get answers that I should not).  I have made sure that each
> constraint returns a single value (+ if constraint is met and - if not) and
> each constraint takes in the decision variable.

I think the constraints should return a continous functions, not just -1 and +1,
so the minimizer knows where to go to improve the result. I might be wrong here.

> I have attached a portion of the script (I know it is not pretty but I am
> just starting out), so that maybe someone can see if I have incorrectly
> called something?

Please send a complete example, including your input data, otherwise it is
difficult to find out what's happening.

Christain



More information about the SciPy-user mailing list