decaying fractions and make them closer
$begingroup$
My problem is actually algorithmic. I have two request queues, each holding its average wait time. For each queue I am holding x = total_wait_time, y = number_of_requests.
Let a = x/y the average of queue one
and b = w/z the average of queue two
Every second I would like to decay the queue so old request will have less effect on the average wait time. One simple way to achieve this will be:
Let $0 < C < 1$
$x' = C * x$
$y' = C * y$
this will keep the same average (C is reduced), but in the same time when a new update happens it will have more affect because it was not multiplied by 0.9 yet.
In addition I would like the averages to go towards each other. This is done in case no requests will enter one of the queues for a long time. To achieve this I can do the following every second:
a' = $frac{a + b} {2}$
Two achive both I thought about doing 90% of the first and 10% of the second:
$a' = frac{x'}{y'} = 0.9 * frac{C*x}{C*y} + 0.1 * frac{a + b}{2} = frac{...}{2*c*y}$
To reduce the history effect I need y' < y. this only happens when C < 0.5, but I do not want to rid the history so rapidly. What am I missing? Why doesn't it act as I expect? How can I fix the formula?
I hope it was understandable and thank you
algebra-precalculus algorithms fractions
$endgroup$
add a comment |
$begingroup$
My problem is actually algorithmic. I have two request queues, each holding its average wait time. For each queue I am holding x = total_wait_time, y = number_of_requests.
Let a = x/y the average of queue one
and b = w/z the average of queue two
Every second I would like to decay the queue so old request will have less effect on the average wait time. One simple way to achieve this will be:
Let $0 < C < 1$
$x' = C * x$
$y' = C * y$
this will keep the same average (C is reduced), but in the same time when a new update happens it will have more affect because it was not multiplied by 0.9 yet.
In addition I would like the averages to go towards each other. This is done in case no requests will enter one of the queues for a long time. To achieve this I can do the following every second:
a' = $frac{a + b} {2}$
Two achive both I thought about doing 90% of the first and 10% of the second:
$a' = frac{x'}{y'} = 0.9 * frac{C*x}{C*y} + 0.1 * frac{a + b}{2} = frac{...}{2*c*y}$
To reduce the history effect I need y' < y. this only happens when C < 0.5, but I do not want to rid the history so rapidly. What am I missing? Why doesn't it act as I expect? How can I fix the formula?
I hope it was understandable and thank you
algebra-precalculus algorithms fractions
$endgroup$
add a comment |
$begingroup$
My problem is actually algorithmic. I have two request queues, each holding its average wait time. For each queue I am holding x = total_wait_time, y = number_of_requests.
Let a = x/y the average of queue one
and b = w/z the average of queue two
Every second I would like to decay the queue so old request will have less effect on the average wait time. One simple way to achieve this will be:
Let $0 < C < 1$
$x' = C * x$
$y' = C * y$
this will keep the same average (C is reduced), but in the same time when a new update happens it will have more affect because it was not multiplied by 0.9 yet.
In addition I would like the averages to go towards each other. This is done in case no requests will enter one of the queues for a long time. To achieve this I can do the following every second:
a' = $frac{a + b} {2}$
Two achive both I thought about doing 90% of the first and 10% of the second:
$a' = frac{x'}{y'} = 0.9 * frac{C*x}{C*y} + 0.1 * frac{a + b}{2} = frac{...}{2*c*y}$
To reduce the history effect I need y' < y. this only happens when C < 0.5, but I do not want to rid the history so rapidly. What am I missing? Why doesn't it act as I expect? How can I fix the formula?
I hope it was understandable and thank you
algebra-precalculus algorithms fractions
$endgroup$
My problem is actually algorithmic. I have two request queues, each holding its average wait time. For each queue I am holding x = total_wait_time, y = number_of_requests.
Let a = x/y the average of queue one
and b = w/z the average of queue two
Every second I would like to decay the queue so old request will have less effect on the average wait time. One simple way to achieve this will be:
Let $0 < C < 1$
$x' = C * x$
$y' = C * y$
this will keep the same average (C is reduced), but in the same time when a new update happens it will have more affect because it was not multiplied by 0.9 yet.
In addition I would like the averages to go towards each other. This is done in case no requests will enter one of the queues for a long time. To achieve this I can do the following every second:
a' = $frac{a + b} {2}$
Two achive both I thought about doing 90% of the first and 10% of the second:
$a' = frac{x'}{y'} = 0.9 * frac{C*x}{C*y} + 0.1 * frac{a + b}{2} = frac{...}{2*c*y}$
To reduce the history effect I need y' < y. this only happens when C < 0.5, but I do not want to rid the history so rapidly. What am I missing? Why doesn't it act as I expect? How can I fix the formula?
I hope it was understandable and thank you
algebra-precalculus algorithms fractions
algebra-precalculus algorithms fractions
asked Dec 11 '18 at 9:24
EpicEpic
11
11
add a comment |
add a comment |
0
active
oldest
votes
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%2f3035102%2fdecaying-fractions-and-make-them-closer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f3035102%2fdecaying-fractions-and-make-them-closer%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