DerThorsten/nifty

LiftedMulticutObjectiveUndirectedGraph: No constructor defined!

Closed this issue · 2 comments

Hi, Thanks for the awesome library!

When defining a lifted multicut objective, for instance:

Graph = nifty.graph.UndirectedLongRangeGridGraph2D

LiftedMulticutObjective = Graph.LiftedMulticutObjective
objective = LiftedMulticutObjective(g, weights)

I'm getting the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-629-572870f259de> in <module>
----> 1 objective = LiftedMulticutObjective(g, weights)

TypeError: nifty.graph.opt.lifted_multicut._lifted_multicut.LiftedMulticutObjectiveUndirectedGraph: No constructor defined!

Note that the same code works for a MulticutObjective. Is this related to a missing exported class via pybind?
Thanks for your help!

I am not at my machine atm but i think on the python side there is a factory function, 'liftedMulticutObjective' if i remember correctly. The benefit of the factory function approach is that the factory function has the same name for different graph types (send from mobile device)

Thanks for your quick response! You were right, using the liftedMulticutObjective factory function worked perfectly! I was initially confused since this function only takes the graph as argument (and not the weights), but found out setGraphEdgesCosts enables to define the weights afterwards. Thanks 👍 👍