Forum Discussion

FICO's avatar
FICO
Community Manager
2 years ago

Best way to specify lower bound in xprsmip when only some variables need lower bound

I am using xprsmip with a combination of continuous and binary variables. The continuous variables need a lower bound of 0.

If all variables were binary, I could set lb = [], but that is not the case here. I can specify a lower bound of zero for all variables including the binaries, but that seems redundant and maybe not a good idea for the binary variables. Or I can use lb to set lower bound of zero for the continuous variables and -Inf for the binaries. Or I could set lb = [], and put the lower bound of zero on the continuous variables by adding inequality constraints to A and b.

What is the best thing to do from a solver performance perspective?

Thanks.

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    The xprsmip function allows passing a single scalar in case all variables have the same lower bound (see the documentation). So passing lb=0 should do the trick and also seems the most efficient thing to do - even though it duplicates information for binary variables.

    Setting a lower of 0 for binaries should not hurt performance in any way. I am not clear why you would set a lower bound of -inf for binary variables?

  • FICO's avatar
    FICO
    Community Manager

    Thanks,

    I have no desire to set -Inf as a lower bound on binary variables. I was wondering whether -Inf might be interpreted the same as no lower bound provided, and therefore eliminate the redundancy of zero as a lower bound on the binary variables.

  • FICO's avatar
    FICO
    Community Manager

    Ah, I see. Setting lb=-inf for binaries won't help. Internally, the Xpress matlab connector has to call a C function that in turn requires passing a lower bound for every variable. Given that a dense array is required anyway, it should not hurt to pass dense information to the function. Passing lb=0 could allow the code to take some shortcuts, though: see the comments about passing NULL as lower bound to the C function.