Bound on algorithm for stopping-car-engine-at-RR. You drive around houston, and sometimes have to stop at train interesections. To minimize gas, do you turn your engine off, or do you idle? (Starting a car costs, say, 1min worth of gas.)
One answer: what is the expected time remaining for the train? We don't know for sure, but we do have some idea about the distribution of train lengths, and might be able to leverage that.
But Suppose Loki were controlling trains: he can change train-length instantaneously. E.g., if you leave your car running, he makes the train long. The momemt you shut off your engine, he shortens the train to none-left, hahaha very funny, loki. Question: faced with a malicious adversary, can we still do not-too-bad?
Clearly, the algorithm of "always keep idling" is no good; Loki will keep adding cars to the train as long as you idle. On the other hand, the algorithm of "always turn off engine immediately" is wasteful — Loki will send lots of one-car trains, which needn't use up much gas, but it will.
Our algorithm:
For comparison: consider Odin, driving around town. [Type of car?]
Odin still has to wait for trains, but Loki can't fool with them.
Furthermore, Odin is omniscient:
he knows how long the train is, when he reaches it.
[Odin sends up his ravens Huginn and Muninn (thought and memory) to
measure the train and remember its length irrevocably.]
(All Loki can do is set up the initial timetables to delay Odin's commute.
What train-lenghts might Loki choose, to maximize Odin's annoyance?)
So, how well can we do against Loki, as compared to Odin (who doesn't face Loki and is omniscient)? Surprisingly: we can guarantee we'll never use more than twice as much gas than Odin! How:
Translating back to a laptop computer OS, and the problem of seeing a user not making disc accesses, and wondering whether to stop spinning the disk (to conserve battery power).
Loki corresponds to a capricious user who accesses the disk just when you least want it to, while Odin corresponds to a scheduler which is so smart it can actually predict when the user will next access the disk. The result translates to, a simple algorithm which even when facing a ill-behaved user, will only use twice as much battery-power (on disc spin-up) than the omniscient scheduler.
Compare against:
Doing user studies and measuring real-life
distributions on disc spinning (and agreeing on
what your distribution of "typical" users is),
and then being able to come up with an algorithm for
that distribution and then proving that it's worst-
or average-case performance isn't much worse than optimal/average.
For such a simple algorithm, the simple approach isn't so bad!
(in a quantified, provable sense)
How to play poker over the phone (or email), agreeing on what cards are being drawn (w/o th other side knowing), and be satisfied they're not cheating?
Sounds impossible. Of course, it seemed unlikely we could make a code where, w/o pre-arrangement, I could securely broadcast my encrypted credit card over the net, and only amazon could easily decode it.
Review public-key cryptography:
public key e,n; private key d, such that ed=1 mod (..) well, Med ≡ M1.
Encrypted message is Me (mod n);
to decrypt look at (Me)d (mod n) = M1 (mod n) [through math].
Observe: If M encrypted by two different codes e1,e2, it can be unlocked
via d1,d2 in either order:
(((Me1)e2)d2)d1 = (((Me1)e2)d1)d2
(We say that the encrypting and decrypting functions are associative.)
[What about the order mod is applied in? Chinese Remainder Th'm?]
Okay, now to our poker game: Two players, A and B.
Background: A tough problem (the 10-coloring problem): Admissions has an entering class of 600, and is aware of exactly which students know which others (via same high school, or state competitions, or whatever). They would like to assign the students to 10 colleges, so that no two incoming students already know each other. The big question is:
This is known as the 10-coloring problem — equivalent to: given a graph can you color each node one of 10 colors, such that any nodes with an edge between them are different colors.
[Brainstorm for a second: what are a couple of conditions that would make this impossible? What is a brute-force solution? What is its running time?]
No algorithm for this is known beyond brute force.
(Even 3-coloring is hard; 2-coloring becomes trivial.)
The registrar might be running their program all summer long without
finding a solution as the deadline draws nigh….
We won't solve the problem either.
But we'll daydream about what happens if I happen to stumble upon
a solution…
Suppose I happen to know a way to allocate the students, and want to sell my solution to the registrar in exchange for an A+ in LPAP. But we don't trust each other:
It turns out, there is a clever way to prove to the registrar that I have a solution with high probability, w/o revealing even a hint as to what the solution should be. (Strangely: they'll become convinced there is a solution, but they won't be able to convince others that there is a solution!)
Here's a way for the registrar try to trip me up, if I'm cheating:
How to make them more sure? Repeat this. Uh-oh: while it was okay for them to find out that I put A,B into brown,sid resp.; but I don't want them to then ask about A,C and thereby learn whether my solution as B,C together or not (supposing B,C don't know each other.) Solution: I'll re-name the colleges in my sol'n every round, to avoid giving away actual assignments. (Think of mapping each college to a color, and using different colors on successive trials — chartreuse, lemon chiffon, ….)
How many times needed to repeat, to inspire confidence that I have correct solution? We can easily compute this.
Question:
Why do we need to try more than |E| times? — after all, isn't registrar
happy after verifying each edge isn't violated?
Well, if were cheating,
I might have two different false almost-but-not-quite solutions.
If I realize the registrar is only asking about each edge once, then
after they ask about the edge that one of my solutions is wrong on
[hopefully I was using my other solution when they asked that],
I'll start using the solution which I know to be good on all remaining
edges, and I would convince the registrar even w/o a solution.
So the registrar had better go back randomly and re-ask about edges,
to keep me honest!
Note:
If the registrar takes two names who don't have an edge between
them, and repeatedly asks you whether your assignment put them in the
same college, they might collect strong evidence about your solution!
Solution: Only answer (provide keys) for the registrar if they
ask about students who went to high school together.
Target audiences: Me; My boss; (selectively:) TA/labbies.
Feel free to comment on: