Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Consistency in linear constraint convention #860

Closed
CatchemAL opened this issue Sep 11, 2017 · 3 comments · Fixed by #932
Closed

Consistency in linear constraint convention #860

CatchemAL opened this issue Sep 11, 2017 · 3 comments · Fixed by #932
Assignees
Milestone

Comments

@CatchemAL
Copy link
Collaborator

Hi @cesarsouza,

Sorry if this is not clear. I just wanted to make a note of this before I forget it completely. I'll revert tomorrow if it's not clear. This isn't a bug (well...). Just an inconsistency I thought I'd feedback.

The LinearConstraintCollection and GoldfarbIdnani are inconsistent in their approach to constraints.
GoldfarbIdnani uses assumes a matrix-vector constraint set where the first n are equality constraints and the remainder are GreaterThanOrEqualTo.

However the LinearConstraintMatrix.FromMatrix() method has an identical API, takes the first n to be equality constraints BUT takes the remainder to be LessThanOrEqualTo.

This behaviour is not consistent and not documented so it's very difficult for a user to spot this inconsistency (it took me a long time to figure out where my code was going wrong today). I haven't checked the repercussions of this but my instinct tells me the FromMatrix() method should change to be consistent with the convention of GoldfarbIdnani. If they're not self-consistent then I'm not really clear what purpose the FromMatrix method is serving.

Thanks,
Alex

@cesarsouza
Copy link
Member

Hi Alex,

Almost sure this is a bug, and thank you very much for catching that. According to QuadProg's documentation, the constraints are indeed in the form A^T b >= b0 and therefore should have been interpreted as such.

The FromMatrix method was mostly being used to check constant violations from the existing unit tests, and they are not used in the main body of any of the optimization methods. I think it should be safe to change them directly.

Thanks,
Cesar

@CatchemAL
Copy link
Collaborator Author

CatchemAL commented Sep 13, 2017

Ok happy to change this - I hope no one is currently using it! I imagine it will prove useful once I get #820 working.

@CatchemAL CatchemAL self-assigned this Sep 13, 2017
@CatchemAL CatchemAL added the bug label Sep 13, 2017
CatchemAL added a commit that referenced this issue Oct 3, 2017
…e convention is inconsistent with GoldfarbIdnani.

Unit tests which previously showed (but ignored) a violation now work!
cesarsouza added a commit that referenced this issue Oct 4, 2017
GH-860: Consistency in linear constraint convention
@cesarsouza
Copy link
Member

Fixed in 3.8.0.

@cesarsouza cesarsouza added this to the 3.8 milestone Oct 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants