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

Fix failed MOI tests #434

Merged
merged 7 commits into from
Nov 13, 2021
Merged

Fix failed MOI tests #434

merged 7 commits into from
Nov 13, 2021

Conversation

metab0t
Copy link
Contributor

@metab0t metab0t commented Nov 12, 2021

I applied the same tricks used in Xpress.jl here to fix 3 failed MOI tests.
The test_solve_conflict_feasible fails because Gurobi cannot compute IIS on a feasible model

@odow
Copy link
Member

odow commented Nov 12, 2021

Can you fix the format-check please?

If the objective isn't set, getting MOI.ObjectiveFunctionType doesn't have a valid return, so it can return anything.
We should check whether objective is set instead of check return value of get `MOI.ObjectiveFunctionType`.
@metab0t
Copy link
Contributor Author

metab0t commented Nov 13, 2021

I think objective_type should be a nullable type like objective_sense.

is_objective_set can be discarded and objective_type = nothing represents no objective function is set.

The complicated thing is here. We need to check the corresponding variable of changed coefficient and set objective_type if objective_type = _SINGLE_VARIABLE currently.

function MOI.modify(
    model::Optimizer,
    ::MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}},
    chg::MOI.ScalarCoefficientChange{Float64},
)
    ret = GRBsetdblattrelement(
        model,
        "Obj",
        Cint(column(model, chg.variable) - 1),
        chg.new_coefficient,
    )
    _check_ret(model, ret)
    model.is_objective_set = true
    _require_update(model)
    return
end

@odow odow merged commit b20d76a into jump-dev:master Nov 13, 2021
@odow
Copy link
Member

odow commented Nov 13, 2021

I think this is okay for now.

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.

2 participants