How to linearize a constraint including product of two binary variables in summation with different indexes?
$begingroup$
I am trying to linearize the following two expressions:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W x_{ijkt} a_{hjt} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
$sum_{k=1}^K sum_{t=p_{ijk}}^Tsum_{l=t-P_{ijk}+1}^t x_{ijkt} a_{hjl} =sum_{k=1}^K sum_{t=p_{ijk}}^T x_{ijkt} a_{hjt} p_{ijk} , iin N, j in M, h in W$
$x_{ijkt}$: binary variable
$a_{hjt}$: binary variable
$p_{ijk}$: parameter
K: parameter
I already know product of two binary variables can be linearized as follows:
ab=z
$a le z$
$b le z$
$zge a+b-1$
Accordingly I did as follows to linearized the first constraint:
$x_{ijkt} a_{hjt}=z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, a_{hjt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} + a_{hjt}-1 ge z_{ijkth}$
And finally converted the constraint as follows:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W z_{ijkth} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
However it makes the model infeasible!
optimization linear-programming linearization
$endgroup$
add a comment |
$begingroup$
I am trying to linearize the following two expressions:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W x_{ijkt} a_{hjt} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
$sum_{k=1}^K sum_{t=p_{ijk}}^Tsum_{l=t-P_{ijk}+1}^t x_{ijkt} a_{hjl} =sum_{k=1}^K sum_{t=p_{ijk}}^T x_{ijkt} a_{hjt} p_{ijk} , iin N, j in M, h in W$
$x_{ijkt}$: binary variable
$a_{hjt}$: binary variable
$p_{ijk}$: parameter
K: parameter
I already know product of two binary variables can be linearized as follows:
ab=z
$a le z$
$b le z$
$zge a+b-1$
Accordingly I did as follows to linearized the first constraint:
$x_{ijkt} a_{hjt}=z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, a_{hjt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} + a_{hjt}-1 ge z_{ijkth}$
And finally converted the constraint as follows:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W z_{ijkth} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
However it makes the model infeasible!
optimization linear-programming linearization
$endgroup$
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38
add a comment |
$begingroup$
I am trying to linearize the following two expressions:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W x_{ijkt} a_{hjt} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
$sum_{k=1}^K sum_{t=p_{ijk}}^Tsum_{l=t-P_{ijk}+1}^t x_{ijkt} a_{hjl} =sum_{k=1}^K sum_{t=p_{ijk}}^T x_{ijkt} a_{hjt} p_{ijk} , iin N, j in M, h in W$
$x_{ijkt}$: binary variable
$a_{hjt}$: binary variable
$p_{ijk}$: parameter
K: parameter
I already know product of two binary variables can be linearized as follows:
ab=z
$a le z$
$b le z$
$zge a+b-1$
Accordingly I did as follows to linearized the first constraint:
$x_{ijkt} a_{hjt}=z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, a_{hjt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} + a_{hjt}-1 ge z_{ijkth}$
And finally converted the constraint as follows:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W z_{ijkth} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
However it makes the model infeasible!
optimization linear-programming linearization
$endgroup$
I am trying to linearize the following two expressions:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W x_{ijkt} a_{hjt} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
$sum_{k=1}^K sum_{t=p_{ijk}}^Tsum_{l=t-P_{ijk}+1}^t x_{ijkt} a_{hjl} =sum_{k=1}^K sum_{t=p_{ijk}}^T x_{ijkt} a_{hjt} p_{ijk} , iin N, j in M, h in W$
$x_{ijkt}$: binary variable
$a_{hjt}$: binary variable
$p_{ijk}$: parameter
K: parameter
I already know product of two binary variables can be linearized as follows:
ab=z
$a le z$
$b le z$
$zge a+b-1$
Accordingly I did as follows to linearized the first constraint:
$x_{ijkt} a_{hjt}=z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, a_{hjt} le z_{ijkth}$
$i in N, j in M, k in K, t in T, h in w, x_{ijkt} + a_{hjt}-1 ge z_{ijkth}$
And finally converted the constraint as follows:
$sum_{k=1}^K sum_{t=1}^Tsum_{h=1}^W z_{ijkth} =sum_{k=1}^K sum_{t=1}^T x_{ijkt} k , iin N, j in M$
However it makes the model infeasible!
optimization linear-programming linearization
optimization linear-programming linearization
asked Dec 13 '17 at 2:19
araz nasirianaraz nasirian
11
11
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38
add a comment |
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
If you want to handle the sum of products
$$ sum_{i,j} x_i y_j $$
with $x_i, y_i in {0,1}$ you need to introduce a new variable $z_{i,j}in {0,1}$ and write:
$$
begin{align}
&sum_{i,j} z_{i,j}\
&z_{i,j} le x_i&forall i,j\
&z_{i,j} le y_j&forall i,j\
&z_{i,j} ge x_i+y_j-1&forall i,j\
& 0 leq z_{i,j} leq 1&forall i,j
end{align}
$$
Note that we can relax $z$ to be continuous (i.e., $zin [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.
$endgroup$
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2564249%2fhow-to-linearize-a-constraint-including-product-of-two-binary-variables-in-summa%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
$begingroup$
If you want to handle the sum of products
$$ sum_{i,j} x_i y_j $$
with $x_i, y_i in {0,1}$ you need to introduce a new variable $z_{i,j}in {0,1}$ and write:
$$
begin{align}
&sum_{i,j} z_{i,j}\
&z_{i,j} le x_i&forall i,j\
&z_{i,j} le y_j&forall i,j\
&z_{i,j} ge x_i+y_j-1&forall i,j\
& 0 leq z_{i,j} leq 1&forall i,j
end{align}
$$
Note that we can relax $z$ to be continuous (i.e., $zin [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.
$endgroup$
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
add a comment |
$begingroup$
If you want to handle the sum of products
$$ sum_{i,j} x_i y_j $$
with $x_i, y_i in {0,1}$ you need to introduce a new variable $z_{i,j}in {0,1}$ and write:
$$
begin{align}
&sum_{i,j} z_{i,j}\
&z_{i,j} le x_i&forall i,j\
&z_{i,j} le y_j&forall i,j\
&z_{i,j} ge x_i+y_j-1&forall i,j\
& 0 leq z_{i,j} leq 1&forall i,j
end{align}
$$
Note that we can relax $z$ to be continuous (i.e., $zin [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.
$endgroup$
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
add a comment |
$begingroup$
If you want to handle the sum of products
$$ sum_{i,j} x_i y_j $$
with $x_i, y_i in {0,1}$ you need to introduce a new variable $z_{i,j}in {0,1}$ and write:
$$
begin{align}
&sum_{i,j} z_{i,j}\
&z_{i,j} le x_i&forall i,j\
&z_{i,j} le y_j&forall i,j\
&z_{i,j} ge x_i+y_j-1&forall i,j\
& 0 leq z_{i,j} leq 1&forall i,j
end{align}
$$
Note that we can relax $z$ to be continuous (i.e., $zin [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.
$endgroup$
If you want to handle the sum of products
$$ sum_{i,j} x_i y_j $$
with $x_i, y_i in {0,1}$ you need to introduce a new variable $z_{i,j}in {0,1}$ and write:
$$
begin{align}
&sum_{i,j} z_{i,j}\
&z_{i,j} le x_i&forall i,j\
&z_{i,j} le y_j&forall i,j\
&z_{i,j} ge x_i+y_j-1&forall i,j\
& 0 leq z_{i,j} leq 1&forall i,j
end{align}
$$
Note that we can relax $z$ to be continuous (i.e., $zin [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.
edited Sep 27 '18 at 8:38
YukiJ
2,1112928
2,1112928
answered Dec 13 '17 at 10:21
Erwin KalvelagenErwin Kalvelagen
3,0892511
3,0892511
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
add a comment |
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
In the last constraint the direction should be $ge$.
$endgroup$
– YukiJ
Sep 27 '18 at 7:50
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
$begingroup$
@YukiJ Yes, thanks.
$endgroup$
– Erwin Kalvelagen
Sep 27 '18 at 8:40
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2564249%2fhow-to-linearize-a-constraint-including-product-of-two-binary-variables-in-summa%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
$begingroup$
Your binary multiplication $z=ab$ is not correct. The constraints $ale z$ and $b le z$ should read $z le a $ and $z le b$.
$endgroup$
– Erwin Kalvelagen
Dec 13 '17 at 2:38