Skip to content

Missing parameter_values for MTKParameters/param structureΒ #115

@aml5600

Description

@aml5600

Describe the bug 🐞

From slack thread here.

Expected behavior

MTKParameters is returned itself.

Minimal Reproducible Example πŸ‘‡

Without MRE, we would only be able to help you to a limited extent, and attention to the issue would be limited. to know more about MRE refer to wikipedia and stackoverflow.

 @mtkmodel Simple begin
    @parameters begin
        a = 1.0
        b = 1.0
    end
    @variables begin
        x(t)
    end
    @equations begin
        D(x) ~ -a * x + b
    end
end
@named model = Simple()
model = complete(model)

p = MTKParameters(model, defaults(model))
setter = ModelingToolkit.setp_oop(model, [model.a])

function loss(x)
    new_p = setter(p, [x])
    # do something with new_p and the model...
    return sum(abs2, new_p.tunable) # for example
end

Error & Stacktrace ⚠️

MethodError: no method matching parameter_values(::MTKParameters{Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions