scipopt / JSCIPOpt

Java interface for the SCIP Optimization Suite
MIT License
62 stars 35 forks source link

Logarithmic expression on a decision variable #30

Open diegorossit opened 2 years ago

diegorossit commented 2 years ago

Hi!

I would like to implement a constraint that has a logarithmic expression applied on a decision variable. I think we should be able to this follwoing instructions in https://github.com/scipopt/JSCIPOpt#readme but this is quite complex for beginners. Any suggestion? I see that in the Python PySCIPOpt is already implemented.

Thanks in advance for your time.

ambros-gleixner commented 2 years ago

Agreed, but this would be the only way to do so via JSCIPOpt. If you are motivated to build this extension, it is a good idea to look at the PySCIPOpt implementation.

diegorossit commented 2 years ago

Hi!

Considering I implement the logarithmic expression, do you know if I would be able to optimize a mixed-integer problem with an objective function of the form x1 * log(1 + x2)? in which x1 and x2 are two continuous positive variables. This would imply building the logarithmic expression "log(1 + x2)" and then adding it in the "createConsQuadratic" function as an element to multiply the term "x1".

Thanks in advance for your kind time.

ambros-gleixner commented 2 years ago

Yes, that is possible, but you would not add the log to a quadratic constraint, but formulate the entire expression in one nonlinear constraint.

diegorossit commented 2 years ago

Thanks for your help. I looked at the files and PySCIPOpt has a type SCIP_EXPR which is not implemented in JSCIPOpt. This type is used in both SCIPcreateExprLog and SCIPcreateConsNonlinear. So it's harder than I thought.
I think I'll wait that more skilled collaborators can extend it.

Anyway, thanks for your kind help and time. Regards!