Herb-AI / HerbBenchmarks.jl

Benchmarks and problems for Herb.jl
https://herb-ai.github.io/
MIT License
1 stars 0 forks source link

Add IOPExample to HerbBenchmarks from HerbData #14

Closed THinnerichs closed 8 months ago

THinnerichs commented 9 months ago
"""
    struct IOPExample <: Example

An input-output example with an associated program.
`ex` is an [`IOExample`](@ref).
`program` is a program of arbitrary form. Please note that this is a pure container, and thus does not guarantee any checks on the validity of the program.
"""
struct IOPExample <: Example
    in::Dict{Symbol, Any}
    out::Any
    program::Any
end

was in HerbData, but should not be there. Add it to here.

THinnerichs commented 9 months ago

Also adding reading and writing for these:

"""
    read_IOPexamples(filepath::AbstractString)::Vector{Tuple{IOPExample}

Reads serialized IO + program examples from disk after type checking.
"""
function read_IOPexamples(filepath::AbstractString)::Vector{IOPExample}
    @assert endswith(filepath, ".xiop")
    return deserialize(filepath)
end

"""
    write_IOPexamples(filepath::AbstractString, examples::Vector{Tuple{IOExample, Any}})

Writes IO examples and the corresponding programs to disk by serializing them into a file using HDF5 checking for and appending the `.xiop`.
"""
function write_IOPexamples(filepath::AbstractString, examples::Vector{IOPExample})
    serialize(filepath * (endswith(filepath, ".xiop") ? "" : ".xiop"), examples)
end
THinnerichs commented 8 months ago

Do we actually still want this?

sebdumancic commented 8 months ago

I would say no because it is not a problem specification, just some handy structure

On Sun, 11 Feb 2024 at 15:07, Tilman Hinnerichs @.***> wrote:

Do we actually still want this?

— Reply to this email directly, view it on GitHub https://github.com/Herb-AI/HerbBenchmarks.jl/issues/14#issuecomment-1937764753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVLHQUINWQVV2RNYIJY7OTYTDGBVAVCNFSM6AAAAABCAESPICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXG43DINZVGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Sebastijan Dumancic, Assistant Professor Delft University of Technology | Algorithmics group https://sebdumancic.github.io/ https://people.cs.kuleuven.be/~sebastijan.dumancic