Skip to content

Parametrize GenericModel with objective/variable sub-model#1521

Merged
odow merged 7 commits intomasterfrom
bl/versatile_model
Aug 11, 2021
Merged

Parametrize GenericModel with objective/variable sub-model#1521
odow merged 7 commits intomasterfrom
bl/versatile_model

Conversation

@blegat
Copy link
Copy Markdown
Member

@blegat blegat commented Aug 10, 2021

Closes #1261
Closes #1502
Closes #1470

@odow
Copy link
Copy Markdown
Member

odow commented Aug 10, 2021

Not sure why ci didn't start?

Ah actions are down: https://www.githubstatus.com

@odow odow closed this Aug 10, 2021
@odow odow reopened this Aug 10, 2021
Copy link
Copy Markdown
Member

@odow odow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the test failures.

@odow
Copy link
Copy Markdown
Member

odow commented Aug 11, 2021

Actually I should be able to handle this.

@odow odow force-pushed the bl/versatile_model branch from fcadb67 to 021e9f2 Compare August 11, 2021 05:07
@odow
Copy link
Copy Markdown
Member

odow commented Aug 11, 2021

That type printing is now pretty terrible...

@blegat
Copy link
Copy Markdown
Member Author

blegat commented Aug 11, 2021

That type printing is now pretty terrible...

It shouldn't be an issue thanks to JuliaLang/julia#36107.
It's not visible in the docs since it's using Julia v1.0. We probably also need to export Model for it to work :/

@blegat
Copy link
Copy Markdown
Member Author

blegat commented Aug 11, 2021

With the added export, you now have on Julia v1.6:

julia> Model
ERROR: UndefVarError: Model not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:26
 [2] top-level scope
   @ REPL[3]:1
julia> Base.show(IOContext(stdout, :compact => true), MathOptInterface.Utilities.Model)
Model{T} where T
julia> Base.show(MathOptInterface.Utilities.Model)
MathOptInterface.Utilities.Model{T} where T
julia> print(MathOptInterface.Utilities.Model)
MathOptInterface.Utilities.Model{T} where T
julia> MathOptInterface.Utilities.Model
MathOptInterface.Utilities.Model{T} where T (alias for MathOptInterface.Utilities.GenericModel{T, MathOptInterface.Utilities.ObjectiveFunctionContainer{T}, MathOptInterface.Utilities.SingleVariableConstraints{T}, MathOptInterface.Utilities.ModelFunctionConstraints{T}} where T)

julia> using MathOptInterface.Utilities

julia> Model
Model{T} where T (alias for MathOptInterface.Utilities.GenericModel{T, MathOptInterface.Utilities.ObjectiveFunctionContainer{T}, MathOptInterface.Utilities.SingleVariableConstraints{T}, MathOptInterface.Utilities.ModelFunctionConstraints{T}} where T)

@odow
Copy link
Copy Markdown
Member

odow commented Aug 11, 2021

My main issue is that it's going to cause issues with JuMP's printing of a model. Perhaps we could modify the printing on the JuMP-side though.

@odow odow merged commit 9e79136 into master Aug 11, 2021
@odow odow deleted the bl/versatile_model branch August 11, 2021 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Parametrize GenericModel with variable constraints Parametrize GenericModel with objective type Versatile model type

2 participants