Question to the solution of “Indicator Variable if x is in specific range”












1












$begingroup$


This question is to query the solution provided by Erwin Kalvelagen to the post




Indicator Variable if x is in specific range




and




conditional constraint: if $x in [a,b]=> z=1$




(Sorry for not adding comments under the original posts since I don't have enough reputations to do so ...)



In Erwin Kalvelagen's solution, we can observe that $z = 0$ does guarantee that either $x<a$ or $x>b$. However, it does not guarantee that $z = 1$ leads to $x in [a, b]$.



For example, considering when $x<a$, $z=1$, $delta = 1$, the first inequality is $$x leq a - 0.001 + M + M $$ which is correct.



The second inequality :
$$
x geq b + 0.001 - 0 - M
$$



which is also correct (since $b - M$ is a very big negative number)



However, now the $x$ does NOT belong to the interval $[a, b]$, hence $z = 1$ is NOT an indicator to its belongingness.



Could someone help to address it?
Or let me know where I am wrong?



Thank you very much!










share|cite|improve this question









$endgroup$

















    1












    $begingroup$


    This question is to query the solution provided by Erwin Kalvelagen to the post




    Indicator Variable if x is in specific range




    and




    conditional constraint: if $x in [a,b]=> z=1$




    (Sorry for not adding comments under the original posts since I don't have enough reputations to do so ...)



    In Erwin Kalvelagen's solution, we can observe that $z = 0$ does guarantee that either $x<a$ or $x>b$. However, it does not guarantee that $z = 1$ leads to $x in [a, b]$.



    For example, considering when $x<a$, $z=1$, $delta = 1$, the first inequality is $$x leq a - 0.001 + M + M $$ which is correct.



    The second inequality :
    $$
    x geq b + 0.001 - 0 - M
    $$



    which is also correct (since $b - M$ is a very big negative number)



    However, now the $x$ does NOT belong to the interval $[a, b]$, hence $z = 1$ is NOT an indicator to its belongingness.



    Could someone help to address it?
    Or let me know where I am wrong?



    Thank you very much!










    share|cite|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      This question is to query the solution provided by Erwin Kalvelagen to the post




      Indicator Variable if x is in specific range




      and




      conditional constraint: if $x in [a,b]=> z=1$




      (Sorry for not adding comments under the original posts since I don't have enough reputations to do so ...)



      In Erwin Kalvelagen's solution, we can observe that $z = 0$ does guarantee that either $x<a$ or $x>b$. However, it does not guarantee that $z = 1$ leads to $x in [a, b]$.



      For example, considering when $x<a$, $z=1$, $delta = 1$, the first inequality is $$x leq a - 0.001 + M + M $$ which is correct.



      The second inequality :
      $$
      x geq b + 0.001 - 0 - M
      $$



      which is also correct (since $b - M$ is a very big negative number)



      However, now the $x$ does NOT belong to the interval $[a, b]$, hence $z = 1$ is NOT an indicator to its belongingness.



      Could someone help to address it?
      Or let me know where I am wrong?



      Thank you very much!










      share|cite|improve this question









      $endgroup$




      This question is to query the solution provided by Erwin Kalvelagen to the post




      Indicator Variable if x is in specific range




      and




      conditional constraint: if $x in [a,b]=> z=1$




      (Sorry for not adding comments under the original posts since I don't have enough reputations to do so ...)



      In Erwin Kalvelagen's solution, we can observe that $z = 0$ does guarantee that either $x<a$ or $x>b$. However, it does not guarantee that $z = 1$ leads to $x in [a, b]$.



      For example, considering when $x<a$, $z=1$, $delta = 1$, the first inequality is $$x leq a - 0.001 + M + M $$ which is correct.



      The second inequality :
      $$
      x geq b + 0.001 - 0 - M
      $$



      which is also correct (since $b - M$ is a very big negative number)



      However, now the $x$ does NOT belong to the interval $[a, b]$, hence $z = 1$ is NOT an indicator to its belongingness.



      Could someone help to address it?
      Or let me know where I am wrong?



      Thank you very much!







      optimization linear-programming mixed-integer-programming






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 6 '18 at 23:00









      Yu WangYu Wang

      84




      84






















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          You seem to additionally want $z=1 Rightarrow x in [a,b]$. This can be linearized as:
          $$begin{align}
          & x ge a - M(1-z)\
          & x le b + M(1-z)
          end{align}
          $$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
            $endgroup$
            – Yu Wang
            Dec 7 '18 at 0:13












          • $begingroup$
            @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
            $endgroup$
            – LinAlg
            Dec 7 '18 at 0:26













          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3029175%2fquestion-to-the-solution-of-indicator-variable-if-x-is-in-specific-range%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1












          $begingroup$

          You seem to additionally want $z=1 Rightarrow x in [a,b]$. This can be linearized as:
          $$begin{align}
          & x ge a - M(1-z)\
          & x le b + M(1-z)
          end{align}
          $$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
            $endgroup$
            – Yu Wang
            Dec 7 '18 at 0:13












          • $begingroup$
            @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
            $endgroup$
            – LinAlg
            Dec 7 '18 at 0:26


















          1












          $begingroup$

          You seem to additionally want $z=1 Rightarrow x in [a,b]$. This can be linearized as:
          $$begin{align}
          & x ge a - M(1-z)\
          & x le b + M(1-z)
          end{align}
          $$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
            $endgroup$
            – Yu Wang
            Dec 7 '18 at 0:13












          • $begingroup$
            @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
            $endgroup$
            – LinAlg
            Dec 7 '18 at 0:26
















          1












          1








          1





          $begingroup$

          You seem to additionally want $z=1 Rightarrow x in [a,b]$. This can be linearized as:
          $$begin{align}
          & x ge a - M(1-z)\
          & x le b + M(1-z)
          end{align}
          $$






          share|cite|improve this answer









          $endgroup$



          You seem to additionally want $z=1 Rightarrow x in [a,b]$. This can be linearized as:
          $$begin{align}
          & x ge a - M(1-z)\
          & x le b + M(1-z)
          end{align}
          $$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 6 '18 at 23:24









          LinAlgLinAlg

          9,4611521




          9,4611521












          • $begingroup$
            Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
            $endgroup$
            – Yu Wang
            Dec 7 '18 at 0:13












          • $begingroup$
            @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
            $endgroup$
            – LinAlg
            Dec 7 '18 at 0:26




















          • $begingroup$
            Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
            $endgroup$
            – Yu Wang
            Dec 7 '18 at 0:13












          • $begingroup$
            @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
            $endgroup$
            – LinAlg
            Dec 7 '18 at 0:26


















          $begingroup$
          Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
          $endgroup$
          – Yu Wang
          Dec 7 '18 at 0:13






          $begingroup$
          Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M delta + M z$$ $$x> b - M (1 - delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right?
          $endgroup$
          – Yu Wang
          Dec 7 '18 at 0:13














          $begingroup$
          @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
          $endgroup$
          – LinAlg
          Dec 7 '18 at 0:26






          $begingroup$
          @YuWang that's right. Note that you need non-strict inequalities in linear optimization.
          $endgroup$
          – LinAlg
          Dec 7 '18 at 0:26




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3029175%2fquestion-to-the-solution-of-indicator-variable-if-x-is-in-specific-range%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          Puebla de Zaragoza

          Musa