Ok. I'm back on the 3Sat. But its under control! At least, I haven't put any stickies on my wall. I did run out of paper. Anyway.
Ok wait, so if you are not a math person just stop reading now. Unless your name is Betsy, in which case I miss you and please un-un-friend me on facebook. Also I hope your boyfriend slips on a banana peel and gets hit by a red shell.
Anyway, I used to tell this story about how I was in graphics class, and the professor mentioned how one file format was 1 based, "so you java and c++ programmers will have to subtract 1 from the indexes" and the really annoying kid who at the time, lived in constant fear that there were people left who didn't yet know that he loved java and that java is teh best language evar, piped up with yet another braindead comment: "or you could just use a hashmap."
I was shy back then, but this put me over the edge; I turned to him and asked "WHY WOULD YOU DO THAT?" in my i-hate-your-guts-and-hope-you-die voice. The entire class laughed at him and I found myself smiling.
Anyway thats a terrible story and I don't know how anyone ever enjoyed it--maybe its because they knew who I was talking about. But I digress. I bring this up, because I'm feeling a sense of irony.
My great weeklong 3-Sat bender? The one that ended with my algorithm being defeated by the first unsatisfiabled test problem I threw at it? Well, the format those test problems are stored in has a really lame name like ".cnf" and it is one based. Yeah. Guess who forgot to subtract 1 from an index:
}else if(i < 0){
//negative numbers mean the literal is negated
literals.add(Literal.get(i*-1).getNegation());
}else{
literals.add(Literal.get(i));
}
In case you can't read Java code, the above section states that I am an idiot, and that the algorithm that I spent more than a week writing, HyperReduce, was never fully tested (the variable i is the 1-based CNF index, and Literal.get() takes 0-based indexes). For all we know it could still work. I have no interest in finding out if it does. Just thinking about it gives me a headache...and I'd have to get out all of my hypercube boxes from their hiding place under my guitar stuff. The algorithm I'm working on now is a lot simpler, and does not require trips to 7-11 to buy soap. And I've still been functioning like a normal human being this time.
In deferrence to my former classmate, who was the brunt of comments that, in light of this discovery, I now feel remorse for, I contemplated writing "maybe I should have used a hash map now." But that is still a retarded idea. With the exception of languages that are missing a subtraction operation, there is absolutely no excuse for using a hashmap to transform between 0-based and 1-based indexes ever, because anyone who even knows what a hash map is knows not to use it for that purpose! I suppose, in theory, one could use it without knowing what it is...thats a stretch though.
Anyway, I unit tested every inch of the algoritm, but didn't pay much attention to the code that opened a file and read it. And that brought the whole thing down. For all we know HyperReduce could still work. Will it? I'll find out as soon as I'm really really bored for a really long time.
This is a little like the time I stayed up all night fixing our implementation of a Pipelined MIPS processor in VHDL and at the end got stumped because I forgot what hexadecimals are.
Why did I stop to write about this? Honestly, its because I don't even want to think about how to take the index and both add -1 and multiply -1. I hate this stuff.
[Edit]
Ok I think the subtraction happens after the multiplication. Well, lets just see what happens.
[Nothing to see here]
git bundle create somefile HEAD
git pull somefile
Subscribe to:
Post Comments (Atom)

So, uh, Dave, I hope you don't mind me lurking a bit...but I thought you might want to know that somehow as a Google-Reader-subscriber to your blog I am getting posts that you seem to either have removed immediately or marked as private (not sure which). I thought you should know your feed subscribers have access to "On a Bus" and "Sky Captain and the Sum of All Forces." Maybe you already know this, maybe not.
ReplyDeleteThat being said, (1) if you ever do decide to fly to Pittsburgh I could show you around a bit (I love living in Pittsburgh!), (2) in general, you're being extremely unfair to "girls." I can tell you from firsthand experience that "boys" will pull similar mean/nonsensical stuff when it comes to ex's. Relationships and emotions are not easy and all people mess it up all.the.time., (3) have you ever thought that maybe you're overthinking the whole dating thing? That all this pressure you're putting on yourself and your dates is somehow sabotaging your efforts? (4) It's not uncommon for people to hate their jobs. I can name a few people less-than-pleased. It is common for our generation to switch jobs fairly frequently.
Best of luck :)
FML you can read those entries? That...yeah. Those entries get removed...normally the next morning when I wake up and regret what I said. Wow thanks for letting me know.
ReplyDeleteI will be flying to pittstburgh as soon as I move up to a plane that can get me there in less than 9 hours. And...you should just ignore everything I write about girls. You could be right though. Wait, am I really being unfair to girls? In half of my stories I'm the villain. I mean, in half the ones that were meant to be published.