Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing things in model[:network] instead of model.ext[:network] #200

Open
chelseas opened this issue Dec 15, 2021 · 1 comment
Open

Storing things in model[:network] instead of model.ext[:network] #200

chelseas opened this issue Dec 15, 2021 · 1 comment

Comments

@chelseas
Copy link
Collaborator

See this issue: jump-dev/JuMP.jl#2828

@odow
Copy link

odow commented Dec 15, 2021

Ah so the problem is here:

model[:network] = problem.network
model[:input] = problem.input
model[:output] = problem.output

You either need to store it in model.ext[:network] and implement
https://github.com/jump-dev/JuMP.jl/blob/59752794521b8c5eddfd5a57c595bb096a4a56b2/src/copy.jl#L6-L29
or you need to implement getindex for
https://github.com/jump-dev/JuMP.jl/blob/59752794521b8c5eddfd5a57c595bb096a4a56b2/src/copy.jl#L31-L45

Or you can just accept the warnings when copy_model is used. JuMP can't do much else, because it doesn't know the type of things you are storing there.

I should add a section on copying to the documentation:
https://jump.dev/JuMP.jl/stable/developers/extensions/#The-extension-dictionary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants