Code Monkey home page Code Monkey logo

Comments (2)

pedromxavier avatar pedromxavier commented on August 16, 2024 1

Hi @Jullija. Please try using QUBOTools.write_model instead of the regular write function.

I think the problem is with the docs.

from qubotools.jl.

pedromxavier avatar pedromxavier commented on August 16, 2024

Just tried with QUBOTools 0.8.1:

julia> model = QUBOTools.read_model("problem.json")
QUBO Model [Min, 𝔹]
 Variables ……… 3

Density:
 Linear ……………… 66.67%
 Quadratic ……… 66.67%
 Total ………………… 66.67%

There are no solutions available.


julia> write("problem.qubo", model)
ERROR: MethodError: no method matching write(::IOStream, ::QUBOTools.Model{Int64, Float64, Int64})

Closest candidates are:
  write(::Union{AbstractString, IO}, ::QUBOTools.AbstractModel, ::QUBOTools.AbstractFormat)
   @ QUBOTools C:\Users\pedroxavier\.julia\packages\QUBOTools\gdvpc\src\model\abstract.jl:370
  write(::IO, ::Any)
   @ Base io.jl:674
  write(::IO, ::Any, ::Any...)
   @ Base io.jl:675
  ...

Stacktrace:
 [1] write(io::IOStream, x::QUBOTools.Model{Int64, Float64, Int64})
   @ Base .\io.jl:674
 [2] (::Base.var"#414#415"{QUBOTools.Model{Int64, Float64, Int64}, Tuple{}})(io::IOStream)
   @ Base .\io.jl:459
 [3] open(::Base.var"#414#415"{QUBOTools.Model{Int64, Float64, Int64}, Tuple{}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base .\io.jl:395
 [4] open(::Function, ::String, ::String)
   @ Base .\io.jl:392
 [5] write(::String, ::QUBOTools.Model{Int64, Float64, Int64})
   @ Base .\io.jl:459
 [6] top-level scope
   @ REPL[16]:1

julia> QUBOTools.write_model("problem.qubo", model)

julia> print(stdout, read("problem.qubo", String))
2 2 0.4
3 3 -4.4
1 2 -0.8
1 3 6.0

Link for file: https://github.com/psrenergy/QUBOTools.jl/blob/main/docs/data/problem.json

from qubotools.jl.

Related Issues (20)

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.