FrancescoRuscelli / horizon

an intuitive optimization tool tailored to robotics, based on CasADi
7 stars 9 forks source link

Default bounds for a constraint #7

Closed alaurenzi closed 3 years ago

alaurenzi commented 3 years ago

I propose the following in order to simplify the interface as much as possible:

EnricoMingo commented 3 years ago

Solved in a77bb6e3ea0ee5290ba07806925de0aab0774eaa. Can be cherry-picked.

alaurenzi commented 3 years ago

This should also be implemented inside StateVariable.setBounds I guess

alaurenzi commented 3 years ago

Maybe a centrailized utility would be best @FrancescoRuscelli

EnricoMingo commented 3 years ago

I only did for the function indeed. I'll check the StateVariable.setBounds

EnricoMingo commented 3 years ago

The def setBounds(self, lb, ub, nodes=None) method follows slightly different rules infact lb and ub are separated input and not inside a dict. This method calls internally: self.setLowerBounds(lb, nodes) self.setUpperBounds(ub, nodes)

We can implement the same behavior adding defaults in the setBounds(lb=None, ub=None), what do you think? @FrancescoRuscelli @alaurenzi

EnricoMingo commented 3 years ago

I would not change the actual behavior of the state variable. In fact, it makes sense that when a variable is created is considered unbounded (-inf, inf) while a constraint is initialized to be equal to 0. The state variables already have the set upper and lower bound methods which should be used when only one of the two is set (while setBounds is used for both).

FrancescoRuscelli commented 3 years ago

This should also be implemented inside StateVariable.setBounds I guess

StateVariables should be initialized with -inf, inf bounds, right? Only constraints should be initialized at 0, 0. I believe this can be closed.