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

Mclean Edwards mcleane at math.ubc.ca
Wed Jan 30 14:13:40 EST 2008


Dear Joachim,

Thank you for the update.  I did try this agains the 0.9.2 version of 
cvxopt, and received the same error.  This error has been 
reproduced on cvxopt-0.8.1 on linux32 and linux64 machines
and cvxopt-0.9.2 on my linux32 machine.

I have not been able to compile cvxopt on the solaris server, as it 
complains about _Imaginary_I not being declared when compiling base.c. 
I've been told this might be due to a different version of gcc on that 
machine.

Awaiting the new version,

-Mclean

On Wed, 30 Jan 2008, Joachim Dahl wrote:

> Dear Mclean,
>
> I think the bug has been fixed in newer versions of CVXOPT.
> A new version will be released soon,  which will hopefully solve
> some of the problems you experienced with the QP solver.
>
> best regards
> joachim
>
> On Jan 29, 2008 11:14 PM, Mclean Edwards <mcleane at math.ubc.ca> wrote:
>
>> Joachim:
>>
>> There is indeed a problem with cvxopt matrices interfacing with numpy in
>> general.
>>
>> Here is example code:
>>
>> from cvxopt.base import matrix
>> import numpy
>>
>> a = matrix([2,3,4])
>> b = numpy.asarray(a)
>> c = matrix(b)
>>
>>
>> The last statement (c) returns an 'array not contiguous' error.
>> Changing line (b) to
>>
>> b = numpy.asarray(a, order='C')
>> #(specifies order as contiguous)
>>
>> or
>>
>> b = numpy.array(a)
>> #(copies the array instead of leaving it be)
>>
>> results in no such error.
>>
>>
>> -Mclean
>>
>> On Tue, 29 Jan 2008, Joachim Dahl wrote:
>>
>>> There might be bugs in the Scipy Array Interface in CVXOPT.   If you
>> come
>>> across dubious behaviour and believe CVXOPT is to blame, we will
>>> appreciate feedback and small code snippets to reproduce the error.
>>> CVXOPT is never supposed to crash,  so it sounds like you found a
>>> significant
>>> bug.
>>>
>>> Best regards
>>> joachim
>>>
>>> On Jan 29, 2008 8:56 AM, Mclean Edwards <mcleane at math.ubc.ca> wrote:
>>>
>>>> An additional note or two:
>>>>
>>>> The problem with 'array not contiguous' happens because I call the
>> cvxopt
>>>> solver through openopt with a cvxopt matrix instead of an array.
>>>>
>>>> Casting the cvxopt.matrix as an array beforehand works with the
>> original
>>>> openopt code.
>>>>
>>>> Comparing the results between order='C' and cvxopt matrices
>>>> and simply deleting the 'float' requirement, but using numpy arrays,
>>>> the results appear to be identical.
>>>>
>>>> This would suggest that making the change is an improvement to the
>> code.
>>>>
>>>> However, I am not getting identical results between calling cvxopt
>>>> directly and calling cvxopt through openopt.
>>>>
>>>> I have not yet been able to track down the difference, although on
>>>> inspection calling cvxopt through openopt is about 5x slower, and
>> provides
>>>> worse results.
>>>>
>>>> (I'm using QP as a subfunction to another algorithm and
>>>> the appoximate answers using openopt appear to be worse than calling
>>>> cvxopt directly.)
>>>>
>>>> The differences do not stem from using double.
>>>> (I converted to float for cvxopt direct use, and there is no perceptual
>>>> change in my graphs.)
>>>>
>>>> -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