cvxgrp/qcml

bug? scalar parameter offset

steve3141 opened this issue · 3 comments

Clearly this is a minor issue since it involves a "pointless" constant added to the objective function, which can simply be removed. But I came across it when doing some "automated" problem generation, and it should be simple to fix.
Minimal example:

variable x(2)
parameter aconst
minimize norm(x) + aconst

Generates the error:

  File "U:\python\lib\python\qcml\qc_lang.py", line 144, in solve_func
    result['objval'] = multiplier * sol['info']['pcost'] + offset
TypeError: unsupported operand type(s) for +: 'float' and 'str'

By debugging I see that 'offset' has been left as the string aconst rather than the value params['aconst']

Thanks,
Steve

echu commented

Oh, awesome. :) Thanks for catching that.

On Wed, Jul 16, 2014 at 8:26 AM, steve3141 notifications@github.com wrote:

Clearly this is a minor issue since it involves a "pointless" constant
added to the objective function, which can simply be removed. But I came
across it when doing some "automated" problem generation, and it should be
simple to fix.
Minimal example:

variable x(2)
parameter aconst
minimize norm(x) + aconst

Generates the error:

File "U:\python\lib\python\qcml\qc_lang.py", line 144, in solve_func
result['objval'] = multiplier * sol['info']['pcost'] + offset
TypeError: unsupported operand type(s) for +: 'float' and 'str'

By debugging I see that 'offset' has been left as the string aconst
rather than the value params['aconst']

Thanks,
Steve


Reply to this email directly or view it on GitHub
#50.

echu commented

Give it a shot now.

Thanks for the quick response. Sorry I haven't had a chance to try this yet, will let you know if there is still any problem.