jij-inc / ommx Goto Github PK
View Code? Open in Web Editor NEWOpen standard for mathematical programming interoperability
License: Apache License 2.0
Open standard for mathematical programming interoperability
License: Apache License 2.0
#68 only added API for linear function.
There are three labels for PR
each of which corresponds to the API changes. I'd like to set these labels automatically by Action based on the diff of PR.
TBW
In ommx version 1.1.0, the following code raises a RecursionError:
import ommx.v1 as ommx
def qubo_to_ommx(qubo: dict[tuple[int, int], float]):
spins = {}
def get_spin(i):
if i not in spins:
spins[i] = ommx.DecisionVariable.binary(i)
return spins[i]
objective = 0
for (i, j), value in qubo.items():
spin_i = get_spin(i)
spin_j = get_spin(j)
objective += value * spin_i * spin_j
return objective
qubo_to_ommx({(0, 1): 1, (1, 2): 1, (2, 0): -1})
Upon execution, a RecursionError occurs:
---------------------------------------------------------------------------
RecursionError Traceback (most recent call last)
Cell In[29], line 14
11 objective += value * spin_i * spin_j
12 return objective
---> 14 qubo_to_ommx({(0, 1): 1, (1, 2): 1, (2, 0): -1})
Cell In[29], line 11
9 spin_i = get_spin(i)
10 spin_j = get_spin(j)
---> 11 objective += value * spin_i * spin_j
12 return objective
File ~/.venv/lib/python3.10/site-packages/ommx/v1/__init__.py:496, in DecisionVariable.__rmul__(self, other)
495 def __rmul__(self, other) -> Linear:
--> 496 return self * other
File ~/.venv/lib/python3.10/site-packages/ommx/v1/__init__.py:588, in Linear.__rmul__(self, other)
587 def __rmul__(self, other) -> Linear:
--> 588 return self * other
File ~/.venv/lib/python3.10/site-packages/ommx/v1/__init__.py:496, in DecisionVariable.__rmul__(self, other)
495 def __rmul__(self, other) -> Linear:
--> 496 return self * other
...
583 constant=self.raw.constant * other,
584 )
585 return NotImplemented
RecursionError: maximum recursion depth exceeded while calling a Python object
Requires #18
I have a question regarding the definition of the Quadratic
message in OMMX.
ommx/proto/ommx/v1/quadratic.proto
Line 11 in 621a64a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.