Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SoftConstraint #72

Open
mpowelson opened this issue Apr 16, 2020 · 3 comments
Open

How to use SoftConstraint #72

mpowelson opened this issue Apr 16, 2020 · 3 comments

Comments

@mpowelson
Copy link

I'm interested in using the SoftConstraint. However, it is not apparent to me how I add it to an ifopt Problem since AddCostSet takes a CostTerm::Ptr, and this is inherits directly from Component.

To that end, I have tried to implement my own Cost in a similar fashion that takes a Constraint and converts it to a cost. However, the jacobian seems a bit problematic since GetJacobian is marked final and FillJacobianBlock is private in Constraint. It seems like my only option is to get the full constraint jacobian and then manually convert that back into something I can use inside my Cost's FillJacobianBlock. Any insight would be appreciated.

@EricWang1hitsz
Copy link

I'm interested in using the SoftConstraint. However, it is not apparent to me how I add it to an ifopt Problem since AddCostSet takes a CostTerm::Ptr, and this is inherits directly from Component.

To that end, I have tried to implement my own Cost in a similar fashion that takes a Constraint and converts it to a cost. However, the jacobian seems a bit problematic since GetJacobian is marked final and FillJacobianBlock is private in Constraint. It seems like my only option is to get the full constraint jacobian and then manually convert that back into something I can use inside my Cost's FillJacobianBlock. Any insight would be appreciated.

Hi, have you known how to use soft constraints?

@mpowelson
Copy link
Author

I never got that working. My best guess is that it was a feature that used to work and got stale. I reimplemented the idea in my project here. It takes an arbitrary constraint and converts it into a squared cost.

@EricWang1hitsz
Copy link

@mpowelson yes! It is good to help me understand them, thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants