-
Notifications
You must be signed in to change notification settings - Fork 2
Allow printing of OptiNodes and OptiGraphs #38
Copy link
Copy link
Open
Description
During development, I often find it useful to print the model in the REPL, When developing a Plasmo model incrementally, I got errors when doing this for specific OptiNodes and OptiGraphs. It seems just to be some missing pieces of the JuMP interface that is missing.
For e.g. getting OptiNodes printed, I needed to add the following two missing functions:
# Ensure that nodes can be printed as a normal JuMP problem
function JuMP.objective_function_string(mode, model::OptiNode)
return JuMP.function_string(mode, objective_function(model))
end
function JuMP.constraints_string(mode, model::OptiNode)
strings = String[
constraint_string(mode, cref; in_math_mode = true) for
(F, S) in list_of_constraint_types(model) for
cref in all_constraints(model, F, S)
]
return strings
endIs this something worth including? I could probably find time to do a PR if you like.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels