XiongPengNUS/rsome

nonconvex constraints

EdwinMeriaux opened this issue · 4 comments

Hello,

I am having an issue with RSOME.
I am running a maximization SRO test but it keeps saying "nonconvex constraints"
Why doesn't this return: X = 10?

import rsome as rso
import numpy as np
from rsome import ro
from rsome import dro
from rsome import E
#from rsome import eco_solver as grb
from rsome import grb_solver as grb
model = dro.Model('test') # create an RSOME model

x = model.dvar()

model.max(rso.square(x)) #working
model.st(x >= 0)
model.st(x <= 10)

model.solve(grb)

print(x.get())

I notice I can put the requirement that I want to maximize: rso.square(x-5) in the model.st() but how can i control this in the maximization?

ie this works:
model.max(x) #working
#model.st(rso.square(x-5) <= 100)
#model.st(x <= 10)
model.st(rso.square(x-5))

model.st(x >= 0)
model.st(x <= 5)

model.solve(grb)

print(x.get())

but x is bounded by the square as a max bound and not a maximization of that eqs

Dear Edwin,
The problem is still nonconvex. The RSOME framework relies on the deterministic problem/reformulation be convex so it could be well recognized by the solver.

Hello!

Thank you for your answer. I have to admit I am new to convex problems. I am confused why this is not a convex problem. isn't a parabola of (x-5)^2 a convex problem?

Yes, (x-5)^2 is a convex function of x. However, maximizing a convex function is not a convex problem.