GithubHelp home page GithubHelp logo

jij-inc / ommx Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 0.0 670 KB

Open standard for mathematical programming interoperability

License: Apache License 2.0

Rust 38.45% Python 61.55%
mathematical-programming ommx optimization

ommx's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar ny57 avatar termoshtt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ommx's Issues

Quadratic term cannot be created by * operator

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

Clarification needed on the triangularity of the Quadratic message in OMMX

I have a question regarding the definition of the Quadratic message in OMMX.

message Quadratic {

In the current implementation, is the Quadratic message defined to be strictly an upper triangular matrix, or is it allowed to be a general square matrix?
I couldn't find a clear specification on this in the documentation, so I would appreciate if you could clarify this point.

Save/Load OMMX binaries to local filesystem

  • We have to add a metadata in addition to the protobuf binaries when storing it on local disk (this issue) or container registry #20 in order to distinguish what the binary data means.
  • TBW

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.