| Issue 7: | Crash when using object methods as callbacks | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Pyipopt.create does not like being passing object methods as eval_f, etc.
Something like
class Test:
def eval_f(self, x):
return x[0] ** 2 + x[1] ** 2
...
def run(self):
nlp = pyipopt.create( ... )
opt, zl, zu, obj = nlp.solve(x_0)
nlp.close()
will illustrate the problem.
May 1, 2009
Project Member
#1
xu.mathena
Jun 14, 2010
I believe the crash can be avoided if the method is not passed directly to create(). For example:
def run(self):
f = self.eval_f
nlp = pyipopt.create(..., f,...)
...
Aug 18, 2010
This is because in OO, we need a "self" reference to use a member function. I think r.w.lincoln gives a perfect solution (where you use self explicitly). Pyipopt requires a function that is independent of the lexicon environment. It is the fundamental limitation posed by the IPOPT callback function design.
Status:
WontFix
|