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

Request for support for inequality constraint equations #156

Open
Peter230655 opened this issue May 12, 2024 · 10 comments
Open

Request for support for inequality constraint equations #156

Peter230655 opened this issue May 12, 2024 · 10 comments

Comments

@Peter230655
Copy link
Contributor

Peter230655 commented May 12, 2024

As I was told, opty can handle algebraic constraint equations.
Can it also handle alegebraic inequalities? What I mean is this:
Say, $a, b \in R, a < b$. Let $f (q_i)$ be a scalar function of the generalized coordinates.
Would $a < f(q_i) < b \longleftrightarrow$
$f(q_i) - b < 0$
$a - f(q_i) < 0$ be possible?

Thanks for any help!

@moorepants
Copy link
Member

moorepants commented May 12, 2024

No, that is currently not supported, but opty could support anything that fits an NLP problem that IPOPT can solve. See the definition here: https://coin-or.github.io/Ipopt/

Someone would have to implement inequality algebraic constraints in opty. It only constructs equality constraints at the moment.

@Peter230655
Copy link
Contributor Author

Clear thanks!
Should I close the issue, my question was answered!, or leave it open for possible future activity by someone?

@moorepants moorepants changed the title Question concerning algebraic constraints for the generalized coordinates. Request for support for inequality constraint equations May 12, 2024
@moorepants
Copy link
Member

I changed the title and we can leave it as an open issue.

@moorepants
Copy link
Member

moorepants commented Jun 16, 2024

I think this should be relatively easy to implement. We just need a flag to Problem that lets you change:

$$ 0 < g(x) < 0 $$

to

$$ lower < g(x) < upper $$

Maybe something like:

Problem(..., inequalities=((3, -1.2, 5.0), (8, 0.0, np.inf)))

Where the first number in each tuple corresponds to the index in the equations of motion that holds $g(x)$ and the next two numbers are lower and upper bounds for that equation.

@Peter230655
Copy link
Contributor Author

Peter230655 commented Jun 17, 2024

I guess, you meant $0 \leq g(x) \leq 0$
The situation I wanted to model would certainly be covered by this!
Unfortunately, I would have no idea how to implement it. :-(

@moorepants
Copy link
Member

Unfortunately, I would have no idea how to implement it. :-(

I don't believe that. :)

@Peter230655
Copy link
Contributor Author

Easier than GitHub / PRs ? :-)

@Peter230655
Copy link
Contributor Author

Peter230655 commented Aug 22, 2024

If I wanted to have a look at this, would I have to have a full understanding of Ipopt?
Where would I start to look in opty?
Presumably I would have to fix this "windows issue" first?
(This should be solvable, Timo uses windows and does not have these problems)
Thanks!

@moorepants
Copy link
Member

moorepants commented Aug 23, 2024

If I wanted to have a look at this, would I have to have a full understanding of Ipopt?

You wouldn't have to have a full understanding, but you will have to understand the relevant parts.

Where would I start to look in opty?

The ConstraintCollocator class will need to handle extra equations. I think that it only allows # equations equal to the # of states at the moment. And the Problem class will have to be modified to allow a user to specify which equations are inequalities and whether >= or <=. We should try carefully think about the API design for specifying this, so that it isn't clunky.

@Peter230655
Copy link
Contributor Author

This sounds beyond my capabilities.

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

No branches or pull requests

2 participants