Algorithm to find integer combinations satisfying a set of inequalities
up vote
0
down vote
favorite
I have an engineering problem that is reduced to finding a set of positive integer combinations satisfying several inequalities and some other properties.
Specially, let $mathcal{S}$ be the set of all positive integer combinations $(M, K, W, Q)$ satisfying the following $3$ inequalities:
$$
WQ+Kleq N,
$$
$$
Wleq M,
$$
$$
MKgeq F,
$$
where $F$ and $N$ are known positive integers. I need an algorithm to obtain a subset of $mathcal{S}$. The elements of the subset should be obtained according to the following conditions:
1, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
2, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
3, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
Is there an efficient algorithm to achieve this? And is that possible to count the number of combinations in the subset, as a function of $F$ and $N$?
combinatorics optimization algorithms combinations integer-programming
add a comment |
up vote
0
down vote
favorite
I have an engineering problem that is reduced to finding a set of positive integer combinations satisfying several inequalities and some other properties.
Specially, let $mathcal{S}$ be the set of all positive integer combinations $(M, K, W, Q)$ satisfying the following $3$ inequalities:
$$
WQ+Kleq N,
$$
$$
Wleq M,
$$
$$
MKgeq F,
$$
where $F$ and $N$ are known positive integers. I need an algorithm to obtain a subset of $mathcal{S}$. The elements of the subset should be obtained according to the following conditions:
1, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
2, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
3, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
Is there an efficient algorithm to achieve this? And is that possible to count the number of combinations in the subset, as a function of $F$ and $N$?
combinatorics optimization algorithms combinations integer-programming
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have an engineering problem that is reduced to finding a set of positive integer combinations satisfying several inequalities and some other properties.
Specially, let $mathcal{S}$ be the set of all positive integer combinations $(M, K, W, Q)$ satisfying the following $3$ inequalities:
$$
WQ+Kleq N,
$$
$$
Wleq M,
$$
$$
MKgeq F,
$$
where $F$ and $N$ are known positive integers. I need an algorithm to obtain a subset of $mathcal{S}$. The elements of the subset should be obtained according to the following conditions:
1, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
2, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
3, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
Is there an efficient algorithm to achieve this? And is that possible to count the number of combinations in the subset, as a function of $F$ and $N$?
combinatorics optimization algorithms combinations integer-programming
I have an engineering problem that is reduced to finding a set of positive integer combinations satisfying several inequalities and some other properties.
Specially, let $mathcal{S}$ be the set of all positive integer combinations $(M, K, W, Q)$ satisfying the following $3$ inequalities:
$$
WQ+Kleq N,
$$
$$
Wleq M,
$$
$$
MKgeq F,
$$
where $F$ and $N$ are known positive integers. I need an algorithm to obtain a subset of $mathcal{S}$. The elements of the subset should be obtained according to the following conditions:
1, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
2, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
3, For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same $(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
Is there an efficient algorithm to achieve this? And is that possible to count the number of combinations in the subset, as a function of $F$ and $N$?
combinatorics optimization algorithms combinations integer-programming
combinatorics optimization algorithms combinations integer-programming
edited 12 hours ago
asked 19 hours ago
Ye Li
486
486
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago
add a comment |
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Combine the inequalities into two: $$W le M \ frac FM le K le N-WQ$$
Firstly I note that the constraint filters effectively treat $Q$ as a free variable in the same way as $F$ and $N$.
Consider constraint 3:
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
This implies $K = N - WQ$ and we can eliminate and ignore it.
$$W le M \ F le M(N-WQ)$$
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
So maximise $W$ as a function of $M$. We have $W le M$ and $W le frac{N - FM}Q$, so this implies $W = minleft(M, leftlfloorfrac{N - FM}Qrightrfloorright)$.
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
If $M le leftlfloorfrac{N - FM}Qrightrfloor$, we can't reduce $M$ because that would reduce $W$.
If $M > leftlfloorfrac{N - FM}Qrightrfloor$, decreasing $M$ by one cannot violate $W le M$ and it increases the other bound on $W$. Therefore we must decrease $M$ until $M = W$.
So we have the following constraints: $$ W = M \ frac FM le K = N - WQ $$ Substituting the first into the second we have $$F le M(N - MQ)$$ or $$Q M^2 - MN + F le 0$$ Since $Q > 0$, $$frac{N - sqrt{N^2 - 4QF}}{2Q} le M le frac{N + sqrt{N^2 - 4QF}}{2Q}$$
Since we need real roots to have any solutions, $Q$ isn't entirely free: we require $Q le frac{N^2}{4F}$.
Given a value of $Q$, the number of values of $M$ is approximately $frac{sqrt{N^2 - 4QF}}{Q}$, so the total number of solutions is approximately $$int_{1}^{frac{N^2}{4F}} frac{sqrt{N^2 - 4QF}}{Q} dQ$$
Subst $c = frac{N^2}{4F}$ to get $2sqrt{F} int_1^c frac{sqrt{c - Q}}{Q} dQ$, and if I haven't messed up the substitutions and the use of Wolfram Alpha to cheat on the core integral, you get $4sqrt{F} left(sqrt{c-1} - sqrt{c} tanh^{-1}sqrt{1-frac{1}{c}}right)$
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Combine the inequalities into two: $$W le M \ frac FM le K le N-WQ$$
Firstly I note that the constraint filters effectively treat $Q$ as a free variable in the same way as $F$ and $N$.
Consider constraint 3:
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
This implies $K = N - WQ$ and we can eliminate and ignore it.
$$W le M \ F le M(N-WQ)$$
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
So maximise $W$ as a function of $M$. We have $W le M$ and $W le frac{N - FM}Q$, so this implies $W = minleft(M, leftlfloorfrac{N - FM}Qrightrfloorright)$.
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
If $M le leftlfloorfrac{N - FM}Qrightrfloor$, we can't reduce $M$ because that would reduce $W$.
If $M > leftlfloorfrac{N - FM}Qrightrfloor$, decreasing $M$ by one cannot violate $W le M$ and it increases the other bound on $W$. Therefore we must decrease $M$ until $M = W$.
So we have the following constraints: $$ W = M \ frac FM le K = N - WQ $$ Substituting the first into the second we have $$F le M(N - MQ)$$ or $$Q M^2 - MN + F le 0$$ Since $Q > 0$, $$frac{N - sqrt{N^2 - 4QF}}{2Q} le M le frac{N + sqrt{N^2 - 4QF}}{2Q}$$
Since we need real roots to have any solutions, $Q$ isn't entirely free: we require $Q le frac{N^2}{4F}$.
Given a value of $Q$, the number of values of $M$ is approximately $frac{sqrt{N^2 - 4QF}}{Q}$, so the total number of solutions is approximately $$int_{1}^{frac{N^2}{4F}} frac{sqrt{N^2 - 4QF}}{Q} dQ$$
Subst $c = frac{N^2}{4F}$ to get $2sqrt{F} int_1^c frac{sqrt{c - Q}}{Q} dQ$, and if I haven't messed up the substitutions and the use of Wolfram Alpha to cheat on the core integral, you get $4sqrt{F} left(sqrt{c-1} - sqrt{c} tanh^{-1}sqrt{1-frac{1}{c}}right)$
add a comment |
up vote
0
down vote
Combine the inequalities into two: $$W le M \ frac FM le K le N-WQ$$
Firstly I note that the constraint filters effectively treat $Q$ as a free variable in the same way as $F$ and $N$.
Consider constraint 3:
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
This implies $K = N - WQ$ and we can eliminate and ignore it.
$$W le M \ F le M(N-WQ)$$
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
So maximise $W$ as a function of $M$. We have $W le M$ and $W le frac{N - FM}Q$, so this implies $W = minleft(M, leftlfloorfrac{N - FM}Qrightrfloorright)$.
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
If $M le leftlfloorfrac{N - FM}Qrightrfloor$, we can't reduce $M$ because that would reduce $W$.
If $M > leftlfloorfrac{N - FM}Qrightrfloor$, decreasing $M$ by one cannot violate $W le M$ and it increases the other bound on $W$. Therefore we must decrease $M$ until $M = W$.
So we have the following constraints: $$ W = M \ frac FM le K = N - WQ $$ Substituting the first into the second we have $$F le M(N - MQ)$$ or $$Q M^2 - MN + F le 0$$ Since $Q > 0$, $$frac{N - sqrt{N^2 - 4QF}}{2Q} le M le frac{N + sqrt{N^2 - 4QF}}{2Q}$$
Since we need real roots to have any solutions, $Q$ isn't entirely free: we require $Q le frac{N^2}{4F}$.
Given a value of $Q$, the number of values of $M$ is approximately $frac{sqrt{N^2 - 4QF}}{Q}$, so the total number of solutions is approximately $$int_{1}^{frac{N^2}{4F}} frac{sqrt{N^2 - 4QF}}{Q} dQ$$
Subst $c = frac{N^2}{4F}$ to get $2sqrt{F} int_1^c frac{sqrt{c - Q}}{Q} dQ$, and if I haven't messed up the substitutions and the use of Wolfram Alpha to cheat on the core integral, you get $4sqrt{F} left(sqrt{c-1} - sqrt{c} tanh^{-1}sqrt{1-frac{1}{c}}right)$
add a comment |
up vote
0
down vote
up vote
0
down vote
Combine the inequalities into two: $$W le M \ frac FM le K le N-WQ$$
Firstly I note that the constraint filters effectively treat $Q$ as a free variable in the same way as $F$ and $N$.
Consider constraint 3:
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
This implies $K = N - WQ$ and we can eliminate and ignore it.
$$W le M \ F le M(N-WQ)$$
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
So maximise $W$ as a function of $M$. We have $W le M$ and $W le frac{N - FM}Q$, so this implies $W = minleft(M, leftlfloorfrac{N - FM}Qrightrfloorright)$.
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
If $M le leftlfloorfrac{N - FM}Qrightrfloor$, we can't reduce $M$ because that would reduce $W$.
If $M > leftlfloorfrac{N - FM}Qrightrfloor$, decreasing $M$ by one cannot violate $W le M$ and it increases the other bound on $W$. Therefore we must decrease $M$ until $M = W$.
So we have the following constraints: $$ W = M \ frac FM le K = N - WQ $$ Substituting the first into the second we have $$F le M(N - MQ)$$ or $$Q M^2 - MN + F le 0$$ Since $Q > 0$, $$frac{N - sqrt{N^2 - 4QF}}{2Q} le M le frac{N + sqrt{N^2 - 4QF}}{2Q}$$
Since we need real roots to have any solutions, $Q$ isn't entirely free: we require $Q le frac{N^2}{4F}$.
Given a value of $Q$, the number of values of $M$ is approximately $frac{sqrt{N^2 - 4QF}}{Q}$, so the total number of solutions is approximately $$int_{1}^{frac{N^2}{4F}} frac{sqrt{N^2 - 4QF}}{Q} dQ$$
Subst $c = frac{N^2}{4F}$ to get $2sqrt{F} int_1^c frac{sqrt{c - Q}}{Q} dQ$, and if I haven't messed up the substitutions and the use of Wolfram Alpha to cheat on the core integral, you get $4sqrt{F} left(sqrt{c-1} - sqrt{c} tanh^{-1}sqrt{1-frac{1}{c}}right)$
Combine the inequalities into two: $$W le M \ frac FM le K le N-WQ$$
Firstly I note that the constraint filters effectively treat $Q$ as a free variable in the same way as $F$ and $N$.
Consider constraint 3:
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, W, Q)$, only keep the $(M, K, W, Q)$ with the largest $K$.
This implies $K = N - WQ$ and we can eliminate and ignore it.
$$W le M \ F le M(N-WQ)$$
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(M, Q)$, only keep the $(M, K, W, Q)$ with the largest $W$;
So maximise $W$ as a function of $M$. We have $W le M$ and $W le frac{N - FM}Q$, so this implies $W = minleft(M, leftlfloorfrac{N - FM}Qrightrfloorright)$.
- For combinations $(M, K, W, Q)$ of $mathcal{S}$ having the same
$(W, Q)$, only keep the $(M, K, W, Q)$ with the smallest $M$;
If $M le leftlfloorfrac{N - FM}Qrightrfloor$, we can't reduce $M$ because that would reduce $W$.
If $M > leftlfloorfrac{N - FM}Qrightrfloor$, decreasing $M$ by one cannot violate $W le M$ and it increases the other bound on $W$. Therefore we must decrease $M$ until $M = W$.
So we have the following constraints: $$ W = M \ frac FM le K = N - WQ $$ Substituting the first into the second we have $$F le M(N - MQ)$$ or $$Q M^2 - MN + F le 0$$ Since $Q > 0$, $$frac{N - sqrt{N^2 - 4QF}}{2Q} le M le frac{N + sqrt{N^2 - 4QF}}{2Q}$$
Since we need real roots to have any solutions, $Q$ isn't entirely free: we require $Q le frac{N^2}{4F}$.
Given a value of $Q$, the number of values of $M$ is approximately $frac{sqrt{N^2 - 4QF}}{Q}$, so the total number of solutions is approximately $$int_{1}^{frac{N^2}{4F}} frac{sqrt{N^2 - 4QF}}{Q} dQ$$
Subst $c = frac{N^2}{4F}$ to get $2sqrt{F} int_1^c frac{sqrt{c - Q}}{Q} dQ$, and if I haven't messed up the substitutions and the use of Wolfram Alpha to cheat on the core integral, you get $4sqrt{F} left(sqrt{c-1} - sqrt{c} tanh^{-1}sqrt{1-frac{1}{c}}right)$
answered 8 hours ago
Peter Taylor
8,20112240
8,20112240
add a comment |
add a comment |
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
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2997893%2falgorithm-to-find-integer-combinations-satisfying-a-set-of-inequalities%23new-answer', 'question_page');
}
);
Post as a guest
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
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
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
To clarify: any or all of the values could be negative?
– Peter Taylor
14 hours ago
All values are positive. Sorry for missing the information.
– Ye Li
12 hours ago