Skip to content

How to express “if y=1 then 0<=x<=u, if y=0 then x=0”? #121

@abcdvvvv

Description

@abcdvvvv

Hi,

I want to model the following typical GDP logic:

  • If y = 1, then 0<=x<=u;
  • If y = 0, then x == 0.

How should I write this pattern in DisjunctiveProgramming.jl syntax?
I did not find an example of this in the documentation.

A minimal example of what I want:

using DisjunctiveProgramming
model = GDPModel()
@variable(model, y, Logical)
@variable(model, x >= 0)
u = 10.0

# How to write the following two branches?
# (y = 1) --> 0<=x<=u
# (y = 0) --> x == 0

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