artofscience / SAOR

Sequential Approximate Optimization Repository
GNU General Public License v3.0
5 stars 1 forks source link

Removal of alpha, beta in subproblem #90

Closed artofscience closed 2 years ago

artofscience commented 2 years ago

Now subproblem and problem both have similar bound structure: x_min, x_max. alpha,beta is removed. Would be nice if the subproblem "automatically" takes the bounds of the problem. (this was and is currently not the case)

aatmdelissen commented 2 years ago

Maybe you could construct with Problem, then copying all MoveLimits and Bounds? Might be a little dirty tho

artofscience commented 2 years ago

Maybe you could construct with Problem, then copying all MoveLimits and Bounds? Might be a little dirty tho

Not sure. Then you force subproblem to always depend on a problem. maybe some cases you dont have a problem but still want to generate a subproblem.

MaxvdKolk commented 2 years ago

Maybe we can have all of them as optional arguments and assert only one is present?

def foo(self, problem=None, x_min=None, x_max=None):
    assert problem is None ^ (x_min is None or x_max is None)
    self.x_min = problem.x_min if problem else x_min
    self.x_max = problem.x_max if problem else x_max
artofscience commented 2 years ago

Maybe we can have all of them as optional arguments and assert only one is present?


def foo(self, problem=None, x_min=None, x_max=None):

    assert problem is None ^ (x_min is None or x_max is None)

    self.x_min = problem.x_min if problem else x_min

    self.x_max = problem.x_max if problem else x_max

If both are present, both the bounds provided by xmin, xmax and by problem should be considered imo