Skip to content

Add support for nonlinear sign(x) #2448

Closed
@odow

Description

@odow

This has come up a few times.

It occurs in GasModels.jl, where they want signpower(x, p) = sign(x) * abs(x)^p, and a variant appeared in https://discourse.julialang.org/t/nonlinear-optimization-with-many-constraints-autodifferentiation-which-julia-solution/110678

We could either define Base.sign(x::AbstractJuMPScalar) = op_ifelse(op_strictly_greater_than(x, 0), 1, -1), or we could add direct support to JuMP and MOI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions