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

minor change in view of #199 #204

Merged
merged 5 commits into from Jul 15, 2020
Merged

minor change in view of #199 #204

merged 5 commits into from Jul 15, 2020

Conversation

akshay326
Copy link
Contributor

struct VariableInfo has is_fixed variable. confused it earlier with fixed

@akshay326
Copy link
Contributor Author

added a few more attributes, as I wasn't able to get all of them using

MOI.instantiate(Ipopt.Optimizer, with_bridge_type=Float64)

model::Ipopt.Optimizer,
::MOI.ListOfConstraintIndices{MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}}
)
indices = MOI.ConstraintIndex{MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}}[]
Copy link
Member

Choose a reason for hiding this comment

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

You can do MOI.ConstraintIndex{MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}}.(eachindex(model.linear_eq_constraints))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@blegat
Copy link
Member

blegat commented Jul 1, 2020

Please add a test as suggested in #200 (review)

@akshay326
Copy link
Contributor Author

trying to add but it breaks at this test. will it require adding methods to support vector constraints in Ipopt?

@blegat
Copy link
Member

blegat commented Jul 3, 2020

will it require adding methods to support vector constraints in Ipopt?

No just use MOIB.instantiate(Ipopt.Optimizer, with_bridge_type=Float64) instead of optimizer

@akshay326
Copy link
Contributor Author

works now!

MOI.get(model::Optimizer, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{Float64}, MOI.LessThan{Float64}}) = length(model.linear_le_constraints)
MOI.get(model::Optimizer, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}}) = length(model.linear_eq_constraints)
MOI.get(model::Optimizer, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{Float64}, MOI.GreaterThan{Float64}}) = length(model.linear_ge_constraints)
MOI.get(model::Optimizer, ::MOI.NumberOfConstraints{MOI.SingleVariable, MOI.LessThan{Float64}}) = length(filter(e -> e.has_upper_bound, model.variable_info))
Copy link
Member

Choose a reason for hiding this comment

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

Use count instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to count

@@ -95,3 +95,7 @@ MOI.empty!(optimizer)
@testset "MOI NLP tests" begin
MOIT.nlptest(optimizer, config)
end

@testset "Testing attributes" begin
Copy link
Member

Choose a reason for hiding this comment

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

Testing getters would better describe it imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Copy link
Member

@blegat blegat left a comment

Choose a reason for hiding this comment

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

Good stuff, thanks!

@blegat blegat merged commit 50560a3 into jump-dev:master Jul 15, 2020
@blegat blegat mentioned this pull request Jul 15, 2020
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.

None yet

2 participants