cvxgrp / qcml

A Python parser for generating Python/C/Matlab solver interfaces
Other
42 stars 9 forks source link

Dimensions not recorded in QCML object? #49

Closed mageecoe closed 10 years ago

mageecoe commented 10 years ago

Dear Eric,

When I run the small example portfolio problem from the README, it seems as if not all dimensions (i.e., 'm' and 'n') are recorded into the QCML object.
For example,

p.dims set(['n']) p.program.data.dimensions set(['n'])

I expected it to return set(['m','n']) or similar. If I codegen for C from p, the resulting dimensions struct in the .h file misses the 'm' dimension, which I interpret comes from not recording all dimensions stated in the problem formulation. At the same time, the corresponding .c file that is produced contains calls to dims->m, so during the production of that file the parser must be aware of the 'm' dimension in some way.

I note at the same time that the 'box_constrained_control.py' problem records both 'm', and 'n' as dimensions. But if I add a dummy dimension, 'k', to the problem description, that dimension (that is not used) does not get recorded.

This looks like a small bug.

  1. Are you able to reproduce it?
  2. Is it fixable?
  3. What do you say, should the QCML object in general record all stated dimensions, no matter if they are used or not in the problem?

Best regards, Magnus Nilsson, Viktoria Swedish ICT

echu commented 10 years ago

Hmm. Seems like a bug. :) let me look into it. I remember trying to be smart and if dimensions are unused, then they aren't recorded. It's possible there's too much happening.

On Monday, July 14, 2014, mageecoe notifications@github.com wrote:

Dear Eric,

When I run the small example portfolio problem from the README, it seems as if not all dimensions (i.e., 'm' and 'n') are recorded into the QCML object.

For example,

p.dims set(['n']) p.program.data.dimensions set(['n'])

I expected it to return set(['m','n']) or similar. If I codegen for C from p, the resulting dimensions struct in the .h file misses the 'm' dimension, which I interpret comes from not recording all dimensions stated in the problem formulation. At the same time, the corresponding .c file that is produced contains calls to dims->m, so during the production of that file the parser must be aware of the 'm' dimension in some way.

I note at the same time that the 'box_constrained_control.py' problem records both 'm', and 'n' as dimensions. But if I add a dummy dimension, 'k', to the problem description, that dimension (that is not used) does not get recorded.

This looks like a small bug.

  1. Are you able to reproduce it?
  2. Is it fixable?
  3. What do you say, should the QCML object in general record all stated dimensions, no matter if they are used or not in the problem?

Best regards, Magnus Nilsson, Viktoria Swedish ICT

— Reply to this email directly or view it on GitHub https://github.com/cvxgrp/qcml/issues/49.

echu commented 10 years ago

okay, i just pushed a fix. i definitely intended to record all used dimensions, but i left out an important line in the parser to do so. fortunately, it wasn't breaking anything else. let me know if this works.

mageecoe commented 10 years ago

Thanks Eric, I tried it again on the simple portfolio problem, and it works. I'll close this issue then.