Research

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • hbb"sub satisfaction" in linear programming

    19 answers - 421 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I know that it's possible to implement an "R"-operation between
    variables in a single constraint using branch and bound. But what about
    having a subset of constraints which only one has to be satisfied, in
    this case there's pretty much an "R"-operation between constraints
    rather than between variables. Is it possible to use something similar
    to branch and bound in this case?
  • No.1 | | 924 bytes | |


    This can be modeled using a standard MIP formulation
    as follows. Assume only one of the following constraints
    must hold:

    blo(i) <= sum(j, a(i,j)*x(j)) <= bup(i)

    Then write:

    blo(i) - y(i)*M <= sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*M
    sum(i,y(i)) = card(i)-1
    y(i) in {0,1}

    or some variation on this.

    AXM001@gmail.com wrote:
    I know that it's possible to implement an "R"-operation between
    variables in a single constraint using branch and bound. But what about
    having a subset of constraints which only one has to be satisfied, in
    this case there's pretty much an "R"-operation between constraints
    rather than between variables. Is it possible to use something similar
    to branch and bound in this case?

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.2 | | 1305 bytes | |

    Erwin
    Shame on you <g>- incomplete advice, which is most unusual for you.

    1. Never mention BigM without the compulsory health warning.
    2. M should be M(i), i.e. different M for the different constraints. And in
    fact Mlo(i) and Mup(i) here.

    Bob

    "Erwin Kalvelagen" <erwin@gams.comwrote in message
    news:zlNfe.17322$dw1.1707@trnddc02

    This can be modeled using a standard MIP formulation
    as follows. Assume only one of the following constraints
    must hold:

    blo(i) <= sum(j, a(i,j)*x(j)) <= bup(i)

    Then write:

    blo(i) - y(i)*M <= sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*M
    sum(i,y(i)) = card(i)-1
    y(i) in {0,1}

    or some variation on this.

    AXM001@gmail.com wrote:
    I know that it's possible to implement an "R"-operation between
    variables in a single constraint using branch and bound. But what about
    having a subset of constraints which only one has to be satisfied, in
    this case there's pretty much an "R"-operation between constraints
    rather than between variables. Is it possible to use something similar
    to branch and bound in this case?
    --

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.3 | | 497 bytes | |

    , so I cleaned this up a bit and got:

    one of these constraints need to be satisfied:
    sum(j, a(i,j)*x(j)) >= blo(i)
    sum(j, a(i,j)*x(j)) <= bup(i)

    Then write:
    sum(j, a(i,j)*x(j)) >= blo(i) - y(i)*Mlo(i)
    sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*Mup(i)
    sum(i,y(i)) = card(i)-1 y(i) in {0,1}

    So what is bigM and card(i)-1?
    If you don't have the time to answer just point out some source that
    gives an explanation.

    /David

  • No.4 | | 1770 bytes | |


    Sorry about not being more specific (there were
    exonerating circumstances: actually when I wrote
    the message, someone called "lunch", and then
    I dropped everything immediately).

    As Bob indicated you should make each M value
    as small as possible (just large enough so
    that equations become non-binding if y(i)=1).
    These M constants are called "big-M" (although
    from the above discussion a better name would
    have been "tiny-m").

    I used card(i) to indicate the number of y(i)'s
    (i.e. the cardinality of set i).

    final note:

    In general I would not use:
    sum(j, a(i,j)*x(j)) >= blo(i) - y(i)*Mlo(i)
    sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*Mup(i)
    Duplication of sum(j, a(i,j)*x(j)) introduces
    many nonzero-elements. If your solver/modeling
    system can not handle "sandwich equations"
    directly, you may want to consider:
    z(i) = sum(j, a(i,j)*x(j))
    z(i) >= blo(i) - y(i)*Mlo(i)
    z(i) <= bup(i) + y(i)*Mup(i)
    This makes the model larger in terms of variables
    and equations, but may actually be more efficient
    on large models.

    AXM001@gmail.com wrote:
    , so I cleaned this up a bit and got:

    one of these constraints need to be satisfied:
    sum(j, a(i,j)*x(j)) >= blo(i)
    sum(j, a(i,j)*x(j)) <= bup(i)

    Then write:
    sum(j, a(i,j)*x(j)) >= blo(i) - y(i)*Mlo(i)
    sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*Mup(i)
    sum(i,y(i)) = card(i)-1 y(i) in {0,1}

    So what is bigM and card(i)-1?
    If you don't have the time to answer just point out some source that
    gives an explanation.

    /David

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.5 | | 162 bytes | |

    Still don't understand where the values in M(i) come from, please
    explain. (And for your information, I'm not familiar with GAMS.)
  • No.6 | | 1210 bytes | |


    Back to basics. A single "or" (you indicated you knew this)
    can be formulated as (I only do the <= case here):

    sum(j, a1(j)*x(j)) <= b1
    R
    sum(j, a2(j)*x(j)) <= b2

    ie.:

    sum(j, a1(j)*x(j)) <= b1 + M1*y
    sum(j, a2(j)*x(j)) <= b2 + M2*(1-y)
    y in {0,1}

    The values M1,M2 should be choses such that
    the equations become non-binding if y, (1-y)
    becomes one. I.e.

    sum(j, a1(j)*x(j)) <= b1 + M1
    sum(j, a2(j)*x(j)) <= b2 + M2

    should not be restrictive wrt x (it should not
    exclude any good values for x).

    values are +infinity, but that is in
    practice not good. So choose the smallest value
    such that b1+M1 is always bigger than the largest
    value sum(j, a1(j)*x(j)) can assume. Similar
    for M2. , one needs to have knowledge
    of the model to give advice on actual values
    for these constants.

    AXM001@gmail.com wrote:
    Still don't understand where the values in M(i) come from, please
    explain. (And for your information, I'm not familiar with GAMS.)

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.7 | | 1099 bytes | |

    Well, I cannot see how increasing the RHS in some of the constraints
    will help solving the problem at all.

    sum(j, a1(j)*x(j)) <= b1 + M1
    sum(j, a2(j)*x(j)) <= b2 + M2

    In case you did missunderstand my initial question, I guess I can be a
    little more specific. What I want, is to solve an MLP problem were you
    have subsets of constraints were only one constraint in each subset
    needs to be satisfied. You can solve the problem by enumerating the
    different variations of the problem.

    Let c[X,Y] be a constraint Y that belongs to subset X. Let's say that I
    have the following constraints in my problem: c[1,1] c[2,1] c[3,1]
    c[3,2] c[4,1] c[4,2] c[4,3]. To solve this problem by enumerating all
    possibillities I will have to solve 6 (2x3) LP problems in total.
    problem will include the constraints: c[1,1] c[2,1] c[3,1] c[4,1], and
    another c[1,1] c[2,1] c[3,1] c[4,2].

    So what I really want is a way to get around this enumeration, since it
    will make problems just a little bit larger pretty much intractable.

  • No.8 | | 1414 bytes | |


    Apologies for my apparently unclear explanation. I still
    believe this can be modeled directly using binary variables
    as I have shown before.

    Erwin

    AXM001@gmail.com wrote:
    Well, I cannot see how increasing the RHS in some of the constraints
    will help solving the problem at all.

    sum(j, a1(j)*x(j)) <= b1 + M1
    sum(j, a2(j)*x(j)) <= b2 + M2

    In case you did missunderstand my initial question, I guess I can be a
    little more specific. What I want, is to solve an MLP problem were you
    have subsets of constraints were only one constraint in each subset
    needs to be satisfied. You can solve the problem by enumerating the
    different variations of the problem.

    Let c[X,Y] be a constraint Y that belongs to subset X. Let's say that I
    have the following constraints in my problem: c[1,1] c[2,1] c[3,1]
    c[3,2] c[4,1] c[4,2] c[4,3]. To solve this problem by enumerating all
    possibillities I will have to solve 6 (2x3) LP problems in total.
    problem will include the constraints: c[1,1] c[2,1] c[3,1] c[4,1], and
    another c[1,1] c[2,1] c[3,1] c[4,2].

    So what I really want is a way to get around this enumeration, since it
    will make problems just a little bit larger pretty much intractable.

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.9 | | 3908 bytes | |

    AXM001@gmail.com wrote:

    Well, I cannot see how increasing the RHS in some of the constraints
    will help solving the problem at all.

    sum(j, a1(j)*x(j)) <= b1 + M1
    sum(j, a2(j)*x(j)) <= b2 + M2

    In case you did missunderstand my initial question, I guess I can be a
    little more specific. What I want, is to solve an MLP problem were you
    have subsets of constraints were only one constraint in each subset
    needs to be satisfied. You can solve the problem by enumerating the
    different variations of the problem.

    Let c[X,Y] be a constraint Y that belongs to subset X. Let's say that I
    have the following constraints in my problem: c[1,1] c[2,1] c[3,1]
    c[3,2] c[4,1] c[4,2] c[4,3]. To solve this problem by enumerating all
    possibillities I will have to solve 6 (2x3) LP problems in total.
    problem will include the constraints: c[1,1] c[2,1] c[3,1] c[4,1], and
    another c[1,1] c[2,1] c[3,1] c[4,2].

    So what I really want is a way to get around this enumeration, since it
    will make problems just a little bit larger pretty much intractable.

    What I'm about to say is functionally identical to what Erwin posted,
    although my notation may be a bit different. Perhaps a different
    phrasing will help. I'm assuming, by the way, that there is no harm in
    satisfying more than one constraint from a group.

    Using your example, we'll start by introducing five 0-1 variables
    y[3,1], y[3,2], y[4,1], y[4,2], y[4,3], where y[i,j] is 1 if you satisfy
    c[i,j] and 0 otherwise. (I'm skipping y[1,1] and y[2,1] because you
    know you have to satisfy c[1,1] and c[2,1].) To guarantee that at least
    one constraint in each group is satisfied, we will assert the following
    constraints:

    c[1,1]
    c[2,1]
    y[3,1] + y[3,2] >= 1
    y[4,1] + y[4,2] + y[4,3] >= 1

    What remains is to connect y[3,1] to c[3,1], etc. Let's assume that
    c[3,1] has the form a'x <= b (coefficient vector a, variable vector x).
    We need to find a way to express the following:

    if y[3,1] = 1, then a'x <= b;
    if y[3,1] = 0, then we don't care whether a'x <= b.

    We achieve the "we don't care part" by changing the right-hand side of
    the constraint to a'x <= b + M, where the number M is chosen so large
    that we are confident b + M is bigger than any value of a'x we're going
    to see. For example, suppose a'x represents annual spending on parts by
    a small manufacturer, and b is a budget of $100K (expressed in dollars,
    i.e. 10^5). I'm pretty sure our small manufacturer is unlikely to spend
    more than $1 trillion annually on parts, so M=10^12 should do the job,
    although it's probably overkill.

    So rather than enforce

    c[3,1]: a'x <= b,

    we enforce the following:

    a'x <= b + M(1-y[3,1]).

    If y[3,1] = 0, the right side is b + M, and we've chosen M large enough
    that this has no effect on x (every reasonable x satisfies the
    constraint). the other hand, if y[3,1] = 1, then the right side is
    b, and we have enforced the original c[3,1].

    Do the same for c[3,2], c[4,1], etc., where of course a and b change for
    each constraint, and you may need to pick different constants M for
    different constraints. You can use one really big M for all the
    constraints, but it slows solution down.

    The tricky part is in the choice of M. In each optional constraint, you
    have to make M large enough so that, when it gets multiplied by 1, it
    makes the constraint vacuous. the other hand, when you solve the
    problem by branch-and-cut, the larger M is, the weaker the bounds you
    get, and so nodes don't get fathomed as easily, and the solution process
    drags on.

    I hope that clarifies things a bit.
    -- Paul
  • No.10 | | 1359 bytes | |

    Thanks alot Paul, now I fully understand what Erwin wrote in his answer
    to my initial question, so I guess I have to thank Erwin as well :-)

    I think this will work, finding proper M values will be trivial, but
    your assumption that 'that there is no harm in satisfying more than one
    constraint from a group.' is wrong, or well the thing is that I cannot
    get rid of the dependencies between them (they are stealing resources
    from each other).

    So to fix this last issue, and instead of trying to get rid of the
    dependencies, I guess I can write the y[i,j] constraints with equal
    signs instead of bounding them. Correct me if I'm wrong.

    Another thing I was thinking about was to try using the Simplex method
    and change the objective function in phase 1. I'm still curious if that
    might work. Is it possible to have an objective function like this?

    W = (a1,1+b1,1)(a1,2+b1,2) + (a2,1+b2,1)(a2,2+b2,2)(a2,3+b2,3)

    Were each () includes sums of artificial variables from dependent
    constraints, and were each ()() product represents groups of
    constraints were only one group of dependent constraints has to be
    satisfied. I've been wondering if this might cause trouble finding a
    feasible solution using the standard simplex method, what do you think?

  • No.11 | | 2589 bytes | |

    AXM001@gmail.com wrote:
    I think this will work, finding proper M values will be trivial, but
    your assumption that 'that there is no harm in satisfying more than one
    constraint from a group.' is wrong, or well the thing is that I cannot
    get rid of the dependencies between them (they are stealing resources
    from each other).

    In other words, they are administrators. :-)

    So to fix this last issue, and instead of trying to get rid of the
    dependencies, I guess I can write the y[i,j] constraints with equal
    signs instead of bounding them. Correct me if I'm wrong.

    You can do this, and if it works then exactly one constraint from each
    group will be satisfied. The "if it works" qualifier is there because
    you might be turning a feasible problem into an infeasible problem. For
    example, suppose you have two groups of constraints, with two and three
    constraints respectively, and suppose that:

    satisfaction of C[1,1] implies satisfaction of C[2,1] and C[2,2];
    satisfaction of C[1,2] implies satisfaction of C[2,2] and C[2,3].

    Then any attempt to satisfy exactly one from each group is doomed. The
    other danger is that it is feasible to satisfy exactly one constraint
    from each group, but there are better solutions (better in objective
    terms) that satisfy more than one constraint from some groups.

    If you can rule both those cases out based on the specifics of your
    model, then changing the y constraints to equalities is fine.

    Another thing I was thinking about was to try using the Simplex method
    and change the objective function in phase 1. I'm still curious if that
    might work. Is it possible to have an objective function like this?

    W = (a1,1+b1,1)(a1,2+b1,2) + (a2,1+b2,1)(a2,2+b2,2)(a2,3+b2,3)

    Were each () includes sums of artificial variables from dependent
    constraints, and were each ()() product represents groups of
    constraints were only one group of dependent constraints has to be
    satisfied. I've been wondering if this might cause trouble finding a
    feasible solution using the standard simplex method, what do you think?

    Your notation lost me. What does (a1, 1+b1, 1) represent? From
    previous context, I'm expecting a1 to be a coefficient vector and b1 a
    scalar (rhs), but what's the 1+, 2+ ? Is the third number in a tuple
    just an index? More importantly, does ()() represent
    multiplication of something (perhaps the artificials corresponding to
    the constraints)?
    -- Paul
  • No.12 | | 1046 bytes | |

    AXM001@gmail.com wrote:
    Another thing I was thinking about was to try using the Simplex method
    and change the objective function in phase 1. I'm still curious if that
    might work. Is it possible to have an objective function like this?

    W = (a1,1+b1,1)(a1,2+b1,2) + (a2,1+b2,1)(a2,2+b2,2)(a2,3+b2,3)

    Were each () includes sums of artificial variables from dependent
    constraints, and were each ()() product represents groups of
    constraints were only one group of dependent constraints has to be
    satisfied. I've been wondering if this might cause trouble finding a
    feasible solution using the standard simplex method, what do you think?

    R-conditions introduce non-convexities to the model, and that
    usually means that one needs more heavy machinery than just
    some tinkering with the simplex method. The simplex method
    relies on a convex feasible region.

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.13 | | 976 bytes | |

    Sorry about the sloppy notation, ai,j should be a[i,j], so
    (a[1,1]+b[1,1]) includes two contstraints that are dependent of each
    other. And yes ()() is ()*(), multiplication. The goal in
    phase 1 is to get W=0, then you have a feasible solution. Now comes the
    fun, to make W=0 when

    W = (a[1,1]+b[1,1])(a[1,2]+b[1,2])

    the first R the second () clause has to be equal to 0, and to make a
    single clause equal to zero the first AND the second term have to be
    equal to 0.

    Each clause includes constraints that are dependent, if they are all
    satisfied the artificial variables will be all 0, and then also the
    clause will be 0. The product between clauses represents the fact that
    only one clause of dependent variables has to be satisfied to make us
    happy and W=0. I have not studied this en detail yet, but my gut tells
    me that messing around with the objective function like this might
    cause side effects.

  • No.14 | | 237 bytes | |

    So you are saying that it might be troublesome to use a solver based on
    the simplex method to solve:
    blo(i) - y(i)*M <= sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*M
    sum(i,y(i)) = card(i)-1
    y(i) in {0,1}
  • No.15 | | 980 bytes | |

    Sorry about the sloppy notation, ai,j should be a[i,j], so
    (a[1,1]+b[1,1]) includes two contstraints that are dependent of each
    other. And yes ()() is ()*(), multiplication. The goal in
    phase 1 is to get W=0, then you have a feasible solution. Now comes the

    fun, to make W=0 when

    W = (a[1,1]+b[1,1])(a[1,2]+b[1,2])

    the first R the second () clause has to be equal to 0, and to make a
    single clause equal to zero the first AND the second term have to be
    equal to 0.

    Each clause includes constraints that are dependent, if they are all
    satisfied the artificial variables will be all 0, and then also the
    clause will be 0. The product between clauses represents the fact that
    only one clause of dependent variables has to be satisfied to make us
    happy and W=0. I have not studied this en detail yet, but my gut tells
    me that messing around with the objective function like this might
    cause side effects.

  • No.16 | | 474 bytes | |

    AXM001@gmail.com wrote:
    So you are saying that it might be troublesome to use a solver based on
    the simplex method to solve:

    blo(i) - y(i)*M <= sum(j, a(i,j)*x(j)) <= bup(i) + y(i)*M
    sum(i,y(i)) = card(i)-1
    y(i) in {0,1}

    Well, as I said, it's a MIP, so you need a MIP solver, not just an LP
    solver.

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.17 | | 1106 bytes | |

    According to Paul's assumption:
    satisfaction of C[1,1] implies satisfaction of C[2,1] and C[2,2];
    satisfaction of C[1,2] implies satisfaction of C[2,2] and C[2,3].
    and its issues,

    a compact example of my problem can be modelled like this:

    C[1]: ax[1] + bx[2] + ex[3] >= b0
    C[2]: cx[4] + dx[5] + ex[6] >= b[1,1] - M[1]*y[1]
    C[3]: gx[7] + hx[8] + ex[9] >= b[1,2] - M[2]*y[2]

    C[4]-C[9]: x[1], x[2], x[4], x[5], x[7], x[8], all of them <= 1

    C[10]: x[3] + x[6] <= 1 + M[3]*y[1]
    C[11]: x[3] + x[9] <= 1 + M[4]*y[2]

    C[12]: y[1] + y[2] = 1, where y[j] {0,1}

    I cannot see that any of the two issues mentioned will affect me.
    You got the wanted "or" thingy between the constraints C[2] together
    with C[10] and C[3] together with C[11]. The reason why I want y[1] +
    y[2] to be equal to 1 instead of having a lowerbound of 1 is because
    C[2] and C[3] both shares the 'e' "resource". So what do you guys
    think, can I now put the model into a suitable solver and sit back and
    enjoy the show?

  • No.18 | | 1721 bytes | |

    AXM001@gmail.com wrote:
    According to Paul's assumption:
    >
    >>satisfaction of C[1,1] implies satisfaction of C[2,1] and C[2,2];
    >>satisfaction of C[1,2] implies satisfaction of C[2,2] and C[2,3].

    >

    and its issues,

    a compact example of my problem can be modelled like this:

    C[1]: ax[1] + bx[2] + ex[3] >= b0
    C[2]: cx[4] + dx[5] + ex[6] >= b[1,1] - M[1]*y[1]
    C[3]: gx[7] + hx[8] + ex[9] >= b[1,2] - M[2]*y[2]

    C[4]-C[9]: x[1], x[2], x[4], x[5], x[7], x[8], all of them <= 1

    C[10]: x[3] + x[6] <= 1 + M[3]*y[1]
    C[11]: x[3] + x[9] <= 1 + M[4]*y[2]

    C[12]: y[1] + y[2] = 1, where y[j] {0,1}

    I cannot see that any of the two issues mentioned will affect me.
    You got the wanted "or" thingy between the constraints C[2] together
    with C[10] and C[3] together with C[11]. The reason why I want y[1] +
    y[2] to be equal to 1 instead of having a lowerbound of 1 is because
    C[2] and C[3] both shares the 'e' "resource". So what do you guys
    think, can I now put the model into a suitable solver and sit back and
    enjoy the show?

    You can remove one of the y's and drop c[12]:

    C[1]: ax[1] + bx[2] + ex[3] >= b0
    C[2]: cx[4] + dx[5] + ex[6] >= b[1,1] - M[1]*y
    C[3]: gx[7] + hx[8] + ex[9] >= b[1,2] - M[2]*(1-y)

    C[4]-C[9]: x[1], x[2], x[4], x[5], x[7], x[8], all of them <= 1

    C[10]: x[3] + x[6] <= 1 + M[3]*y
    C[11]: x[3] + x[9] <= 1 + M[4]*(1-y)
    y in {0,1}

    Erwin Kalvelagen
    GAMS Development Corp., http://www.gams.com
    erwin@gams.com, http://www.gams.com/~erwin

  • No.19 | | 543 bytes | |

    You can remove one of the y's and drop c[12]:

    Yes, I know, but by writing it like that I find it easier to extend the
    model. I might have more than two constraints were only one has to be
    satisfied. For example I might have:

    C[2]: cx[4] + dx[5] + ex[6] >= b[1,1] - M[1]*y[1]
    C[3]: gx[7] + hx[8] + ex[9] >= b[1,2] - M[2]*y[2]
    C[4]: kx[10] + lx[11] + ex[12] >= b[1,3] - M[3]*y[3]

    and then (to my knowledge I must) include the constraint: y[1] + y[2] +
    y[3] = 1, y[j] in {0,1}.

Re: hbb"sub satisfaction" in linear programming


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Research"

EMSDN.COM