Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect @info format #4864

@Shizcow

Description

@Shizcow

@info "The solver terminated but not from a limit and the actual limit is LIMIT_UNSPECIFIED, which is used as a null. " \
"However, LIMIT_UNSPECIFIED is not associated with a MOI.LIMIT_* hence the returned LIMIT is MOI.OTHER_LIMIT."

When solving, I ran into an issue pointing at the above lines. The issue is:

┌ Error: Exception while generating log record in module ORTools at /home/<my_user>/.julia/packages/ORTools/TNxxp/src/moi_wrapper/MOI_wrapper.jl:1996
│   exception =
│    MethodError: no method matching adjoint(::String)
│    The function `adjoint` exists, but no method is defined for this combination of argument types.

I understand I may have an issue with configuration (not specifying limit), but the error should be handled gracefully. A minimal repro:

import MathOptInterface as MOI
using ORTools

model = ORTools.Optimizer(solver_type=ORTools.SolverType.SOLVER_TYPE_CP_SAT)

x = MOI.add_variable(model)
MOI.add_constraint(model, x, MOI.Integer())

# Contradictory constraints:
MOI.add_constraint(model, 
                   MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0), 
                   MOI.LessThan(0.0))
MOI.add_constraint(model, 
                   MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0), 
                   MOI.GreaterThan(2.0))

MOI.optimize!(model)
status = MOI.get(model, MOI.TerminationStatus())

if status == MOI.OPTIMAL || status == MOI.FEASIBLE_POINT
    println("SAT: ", Int(round(MOI.get(model, MOI.VariablePrimal(), x))))
else
    println("UNSAT")
end

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions