-
Notifications
You must be signed in to change notification settings - Fork 18
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
Make Model
a Python class by moving Cython parts into a new _Graph
class
#179
Conversation
A few things left to do:
|
Thereby making Model a Python class rather than a Cython one. Co-authored-by: William Bernoudy <[email protected]>
6657fb0
to
66e3ac3
Compare
Upon reflection, I think it makes sense to keep |
from dwave.optimization.symbols import BinaryVariable # avoid circular import | ||
return BinaryVariable(self, shape) | ||
|
||
def constant(self, array_like: numpy.typing.ArrayLike) -> Constant: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and maybe to_networkx
are the only methods I believe that we'll want to have on the future Expression
class that we would duplicate. Considering how short this is and that to_networkx
is not necessary for now (if ever) seems fine to me.
See also #174
Some highlights:
Model
rather that_Graph
_Graph
doesn't hold ontoStates
,Model
does.lock
,.unlock
,.minimize
) have "basic" features implemented in Cython but some bits are implemented in Python.cimport
-ability ofModel
via some aliasing tricks (need to contemplate how much I like this one a little more)