Moderators: phlip, Larson, Moderators General, Prelates
pollywog wrote:I want to learn this smile, perfect it, and then go around smiling at lesbians and freaking them out.Wikihow wrote:* Smile a lot! Give a gay girl a knowing "Hey, I'm a lesbian too!" smile.
pollywog wrote:I want to learn this smile, perfect it, and then go around smiling at lesbians and freaking them out.Wikihow wrote:* Smile a lot! Give a gay girl a knowing "Hey, I'm a lesbian too!" smile.
Actually, I assume saving with a fixed period (every L steps). This may not be quite optimal if L doesn't divide evenly into X (but if X is large it doesn't matter much).ConMan wrote:NINJA'd by Goplat - but he seems to be working solely from a "Save once and once only" standpoint, whereas I'm assuming an arbitrary number of saves. See below:
Goplat wrote:Actually, I assume saving with a fixed period (every L steps). This may not be quite optimal if L doesn't divide evenly into X (but if X is large it doesn't matter much).ConMan wrote:NINJA'd by Goplat - but he seems to be working solely from a "Save once and once only" standpoint, whereas I'm assuming an arbitrary number of saves. See below:
pollywog wrote:I want to learn this smile, perfect it, and then go around smiling at lesbians and freaking them out.Wikihow wrote:* Smile a lot! Give a gay girl a knowing "Hey, I'm a lesbian too!" smile.
freakish777 wrote:@Goplat, that policy is non-optimal. The closer you are to the destination, the less often you should make your current location the save point.
If you get sent back, the probability that you won't go back any more isn't 0.5, it's 0.95100 ~ 0.006. Most likely you will go back many times.Say you have no save point, and are at position 99 (as per the initial post's numbers). Your chance of being sent back is 5%. You have:
- 0.95 * 1 Second +
- 0.05 *
- 0.5 * 100 seconds + //go back only once
Goplat wrote:There's no difference between e.g. a 0-to-20 segment and an 80-to-100 segment.
If you get sent back, the probability that you won't go back any more isn't 0.5, it's 0.95100 ~ 0.006. Most likely you will go back many times.
.95^100~=.5%
Talking about the expected value of creating a save point at a particular node is not a useful concept - it depends on both the previous save point you created and the next one you're going to create, so you can't consider nodes independently. If you've only decided you're going to save at 20, adding a save point at 10 is beneficial. If you've decided you're going to save at 9 and 11, adding a save point at 10 is a waste.freakish777 wrote:Goplat wrote:There's no difference between e.g. a 0-to-20 segment and an 80-to-100 segment.
Sure there there is. The 80-100 segment is closer to the overall goal, making the expected value of creating a save point on any node in it less than the expected value of creating a save point on any node in the earlier segment.
import random
# Problem parameters
Y = 0.05
Z = 5
steps = 100
# Strategy
savepts = set((11, 22, 33, 44, 56, 67, 78, 89)) # Uniform spacing
#savepts = set((5, 10, 15, 20, 30, 40, 60, 80)) # More saves near beginning
#savepts = set((20, 40, 60, 70, 80, 85, 90, 95)) # More saves near end
trials = 1000
time = 0
for _ in xrange(trials):
pos = 0
save = 0
while pos < steps:
if pos > save and pos in savepts:
save = pos
time += Z
time += 1
pos += 1
if random.random() < Y:
pos = save
print "Average time:", time * 1.0 / trials
it depends on both the previous save point you created and the next one you're going to create, so you can't consider nodes independently. If you've only decided you're going to save at 20, adding a save point at 10 is beneficial. If you've decided you're going to save at 9 and 11, adding a save point at 10 is a waste.
That's not a statistically significant difference. The standard deviation for individual trials is about 21, so for the average of 100000 trials it's about 21/sqrt(100000) = .066. The results deviate from my prediction (178.30626) by only -0.7 and 1.2 sigmas respectively.freakish777 wrote:Then there shouldn't be any difference between the following?
savepts = set((12, 23, 34, 45, 56, 67, 78, 89)) # Uniform spacing, first point at 12, last point 11 away
savepts = set((11, 22, 33, 44, 55, 66, 77, 88)) # Uniform spacing, first point at 11, last point 12 away
When I increase the number of trials to 100,000 (really 100,000,000 would be nice for confidence in the results, but I don't have all day to let it run), I get 178.26135 for the second, and 178.3827 for the first.
It depends on how much farther you have until the next save point, not your overall progress towards the goal.freakish777 wrote:it depends on both the previous save point you created and the next one you're going to create, so you can't consider nodes independently. If you've only decided you're going to save at 20, adding a save point at 10 is beneficial. If you've decided you're going to save at 9 and 11, adding a save point at 10 is a waste.
Correct, it depends on the last time you saved, and how much farther you have to go. Like I said, start at your current position, calculate the average time it takes to get to the end from your current position (which is dependent on where you last saved), and compare it to the average time it takes to get to the goal if you create a save point at your current location.
Yakk wrote:Now, costs of a save at a given location are fixed.
import random
import itertools
# Problem parameters
Y = 0.05
Z = 5
steps = 100
i = 0
stepsActual = []
while i < steps:
i+=1
stepsActual.append(i)
j = 0
allCombinations5 = []
#At 12 save points, we have 160 seconds minimum, so the average can't possibly get better than the 178ish we're looking for
for L in range(0,12):
for savepts in itertools.combinations(stepsActual, L):
trials = 1000
time = 0
for _ in range(trials):
pos = 0
save = 0
while pos < steps:
if pos > save and pos in savepts:
save = pos
time += Z
time += 1
pos += 1
if random.random() < Y:
pos = save
if ((time * 1.0 / trials) < 179):
print(str(savepts) + '\t' + str(time * 1.0 / trials))
j += 1
if (j % 100000 == 0):
print(str(j) + ' combinations checked' + str(savepts))
I was doing a cost benefit analysis. The opportunity cost is factored in with the benefits.freakish777 wrote:I think your view of this as being a fixed cost only, may be skewing things. While the fixed cost is the same, there's an opportunity cost you end up paying later by not hedging your bets early.Yakk wrote:Now, costs of a save at a given location are fixed.
Yakk wrote:I was doing a cost benefit analysis. The opportunity cost is factored in with the benefits.
Opportunity cost is the "cost" of "benefits forgone by the choice". If I calculate the benefits for each possible decision, and the costs of each possible decision, then find the one with the highest (benefits)-(costs), opportunity costs have been factored in already.
Do you have a valid objection to my reasoning? There are quite possibly flaws, but this doesn't look like one of them.
Yakk wrote:The time it takes to win, on average, is the sum of the average time in each save game!
That possibility only exists if the proof sketched above isn't valid for some reason.I think there exists the possibility of that being the optimal solution.
Goplat wrote:the average number of attempts made for the segment is (1-Y)-L, and the average time taken for the segment is ((1-Y)-L - 1)/Y + Z.
DaBigCheez wrote:Because I totally think Snark's the kind of guy who could pull off a stunt like "let teammate get vigkilled by your drone D1, to make yourself a "confirmed town" for not going against it, then pick off everyone while laughing about it."
Yakk wrote:No, you still aren't pointing out a flaw in my argument. I'll formalize it if it might help.
First, a simple lemma:
Lemma 1: Suppose you have two save points. When you add an additional save point, the optimal spot to place it (to minimize travel time between the two original save points) is the half way point.
I believe I sketched out why this is true in a previous post. Do you disagree with it?
Snark wrote:Goplat wrote:the average number of attempts made for the segment is (1-Y)-L, and the average time taken for the segment is ((1-Y)-L - 1)/Y + Z.
First, I'm going to steal this. Average time to go S steps without saving (assuming you start on a save) is ((1-Y)-S - 1)/Y
For simplicity, let's let X be arbitrarily large.
Then assume that we went S steps from our closest save point.
Expected time to get to S+1 if you save at step S = Z + 1/(1-Y)
Expected time to get to S+1 without saves = (1-Y)*1 + Y*(((1-Y)-S-1 - 1)/Y) = (1-Y)-S-1 - Y
For Y = .05 and Z = 5, expected time with saving = Z + 1/(1-Y) = 5 + 1/.95 = 6.0526 seconds
For Y = .05 and Z = 5 and S = 34, expected time without saving = (1-Y)-S-1 - Y = .95-35 - .05 = 5.9711 seconds
For Y = .05 and Z = 5 and S = 35, expected time without saving = (1-Y)-S-1 - Y = .95-36 - .05 = 6.2880 seconds
So the optimal solution is to save every 35 steps if you're going forever. But the optimal steps when X = 100 seem to be close to 10/11. Can anyone spot an error in my math? Because I sure can't.
freakish777 wrote:Snark wrote:Goplat wrote:the average number of attempts made for the segment is (1-Y)-L, and the average time taken for the segment is ((1-Y)-L - 1)/Y + Z.
First, I'm going to steal this. Average time to go S steps without saving (assuming you start on a save) is ((1-Y)-S - 1)/Y
For simplicity, let's let X be arbitrarily large.
Then assume that we went S steps from our closest save point.
Expected time to get to S+1 if you save at step S = Z + 1/(1-Y)
Expected time to get to S+1 without saves = (1-Y)*1 + Y*(((1-Y)-S-1 - 1)/Y) = (1-Y)-S-1 - Y
For Y = .05 and Z = 5, expected time with saving = Z + 1/(1-Y) = 5 + 1/.95 = 6.0526 seconds
For Y = .05 and Z = 5 and S = 34, expected time without saving = (1-Y)-S-1 - Y = .95-35 - .05 = 5.9711 seconds
For Y = .05 and Z = 5 and S = 35, expected time without saving = (1-Y)-S-1 - Y = .95-36 - .05 = 6.2880 seconds
So the optimal solution is to save every 35 steps if you're going forever. But the optimal steps when X = 100 seem to be close to 10/11. Can anyone spot an error in my math? Because I sure can't.
Assuming equal spacing is in fact optimal, it doesn't make sense that there should be a difference for how many nodes to travel between "going for set distance X" and "going forever." Going forever can logically be broken up into optimizing "going for set distance X" over and over again (if 11 is the optimal number, then X should be a multiple of 11, to avoid small inaccuracies of accidentally stretching (to 12)/compressing (to 10) a section in between 2 save points).
DaBigCheez wrote:Because I totally think Snark's the kind of guy who could pull off a stunt like "let teammate get vigkilled by your drone D1, to make yourself a "confirmed town" for not going against it, then pick off everyone while laughing about it."
freakish777 wrote:Why is this obviously true?Yakk wrote:No, you still aren't pointing out a flaw in my argument. I'll formalize it if it might help.
First, a simple lemma:
Lemma 1: Suppose you have two save points. When you add an additional save point, the optimal spot to place it (to minimize travel time between the two original save points) is the half way point.
I believe I sketched out why this is true in a previous post. Do you disagree with it?
Essentially I'm not seeing how this is so obvious that we can assume it to be true and base the rest of an argument off of that.
I can make this sketch of a proof explicit if you'd like.Suppose our next save is going to be at location y, and we are at location x (a save point). We are only allowed one save point between x and y.
If we put a save at location z, we can work out the cost-benefit of this save point relative to others.
Now, costs of a save at a given location are fixed. So other than deciding if we want that intermediate point, we can ignore costs to determine where the ideal point is between two given save points.
The argument from symmetry is pretty decent that it should be at the half-way point. The game of "get to the middle save point" and "get from the middle save point to the end point" are only determined by the length between the points. We'd need to throw in a convexity/concavity argument or something to prove that the average point is ideal.
Users browsing this forum: GuetraGma and 4 guests