[SciPy-user] openopt vs. cvxopt, 'f' vs. 'd','z'

Mclean Edwards mcleane at math.ubc.ca
Tue Jan 29 17:25:05 EST 2008


The cvxopt/numpy problem is detailed more precisely in my response to 
Joachim. (also on SciPy-user)

My remaining complaint with openopt-cvxopt is that arrays (or matrices) 
are required to be floating point (float) in QP.py.  Why is this the case,
especially since cvxopt itself handles double, complex, and integer 
matrices?

Also, I'm getting slightly different numbers when using openopt.  I'm in 
the process of tracking this problem down.  I'll send the problem code 
when I isolate it.

Cheers,

Mclean

On Tue, 29 Jan 2008, dmitrey wrote:

> I haven't understood all that you've written in your messages, however,
> I guess sending the code to me could be helpful. However, I use CVXOPT
> 0.9, and I haven't any problems with CVXOPT QP solver (despite I had
> never used CVXOPT 0.8.x).
>
> On the other hand, fixing the bug is more up to numpy-cvxopt binding,
> not OpenOpt-CVXOPT: doing only latter will not suppress the bug
> coplitely, sometimes others will encounter the one as well.
>
> So, I guess it's better either for you to control more thoroughly your
> fortran<->numpy<->CVXOPT matrix conversions, or for numpy developers to
> fix the one.
>
> Regards, D.
>
> Mclean Edwards wrote:
>> Dmitrey:
>>
>> There seems to be a problem with openopt/cvxopt working together.
>>
>> I am using double ('d') for my cvxopt.base.matrix matrices, and so the
>> line 27 in QP.py:
>>
>> kwargs[fn] = asarray(kwargs[fn], float)
>>
>> caused the program to crash since it tried to treat the double values as
>> floating point.
>>
>> Removing the 'float' and recompiling led to
>> 'Array not contiguous' error.
>>
>> I admit I'm not too such what this means exactly, and was only able to
>> discover that arrays can be ordered in a contiguous fashion or in a
>> FORTRAN fashion.
>>
>> Replacing the above line (27 in QP.py in Rev 166) with:
>>
>> kwargs[fn] = asarray(kwargs[fn], order='C')
>>
>> fixes this problem (by forcing the new array to be contiguous).
>> However errors eventually occur with the other
>> values, so the for loop initial line (25) needed to be changed to:
>>
>> for fn in ('H', 'f', 'A', 'b', 'Aeq', 'beq', 'lb', 'ub'):
>>
>> Recompiling openopt with these changes
>> results in no more errors in my code.
>> I have not tested this for matrix(*, 'z') formats,
>> but it seems to work for the standard floating point format.
>>
>> I do not understand the note:
>> #TODO: handle the case in runProbSolver()
>> but perhaps the original reason for casting to float has now disappeared
>> with more recent changes to runProbSolver().
>> (I am running off of Subversion's most recent code base.)
>>
>> I am running cvxopt version 0.8.1 (there is a problem with the QP solver
>> in the most recent version 0.9.2).
>>
>> Cheers,
>>
>> Mclean
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user at scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>
>>
>>
>>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list