Home
Tobin's Lab Notebook [entries|archive|friends|userinfo]
Tobin Fricke's Lab Notebook

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

matlab programming contest [Nov. 4th, 2009|02:58 pm]
[Tags|, ]

The 20th MATLAB Online Programming Contest is currently underway.
Link1 comment|Leave a comment

rocket science [Jun. 28th, 2009|03:01 am]
[Tags|, , ]

ICFP programming contest 2009

This year's ICFP programming contest involves planning an optimal sequence of rocket burns to cause an orbiting spacecraft to visit a collection of other orbiting spacecraft. It's a cool problem—orbital mechanics is quite unfamiliar!

Fortunately, the contest contains three warm-up problems. The simplest is to just move from one circular orbit to another, which can be accomplished via the Hofmann transfer orbit (as suggested by the contest specification). The next requires that you meet up with another orbiting spacecraft in circular orbit. I've solved those two. The final warm-up problem is to leave one elliptical orbit to rendezvous with a spacecraft in another elliptical orbit.

The final problem that these warm-up problems lead to is to find an optimal procedure for visiting a collection of other spacecraft in various orbits—here's where the clever searching and optimization will come in.

As an added twist, the individual problems come packaged as binaries for a virtual machine that you have to implement. Unlike prior years, this virtual machine is quite simple. In fact, it has no branching instructions whatsoever, so it's hard to even call it a virtual machine. You could translate it directly into C, for example.

I think my approach is quite slick: I implemented the virtual machine in C, but then wrote a Matlab (.mex) interface to it, so I can implement the rest of my solutions in Matlab, employing all of Matlab's mathematics and visualization and interactiveness while still coupled to this physics engine implemented in the virtual machine.

However, I think it's time for one-man team "tensor" to get some sleep. (-:

EDIT: 24 hours into the contest, they added a moon!
Link1 comment|Leave a comment

ICFP Programming Contest [Jun. 22nd, 2009|11:31 pm]
[Tags|]

The 12th ICFP Programming Contest will take place next weekend, Friday 26 to Monday 29 June 2009.
LinkLeave a comment

Matlab programming contest: gene splicing [Nov. 7th, 2007|08:26 pm]
[Tags|, ]

Apparently bioinformatics is a hot topic these days; during the summer we had to transform Endo's DNA for the ICFP contest, and now the task of the currently-running Matlab programming contest is to transform one "DNA" string to another by relocating and transposing (reversing) substrings. Anyone participating?
LinkLeave a comment

Matlab programming contest [Nov. 5th, 2007|08:51 pm]
[Tags|, ]

The 16th semi-annual Matlab Programming Contest will start on Wednesday, November 7th. A peculiarity of the Matlab contest is that everyone can view everyone else's contest entries, and you are explicitly encouraged to submit derivative works. Entries are scored according to some metric that usually incorporates both the entry's ability to solve some task as well as some measure of the entry's length, complexity, or runtime (with overly large, complex, or slow entries being penalized).
Link1 comment|Leave a comment

ICFP call graph [Oct. 27th, 2007|11:50 pm]
[Tags|, ]

Remember the ICFP programming contest? I finally had some time to look at it again. The "RNA" contains seven-letter codes which produce an image. However, lots of the codes present don't code for image operations; we're instructed to ignore them. However, page 2181889 of the instruction manual implies that these codes can be used to produce a call-graph:
"When a Fuun has suffered a severe crash abnormal RNA may be produced. This 'hiccup' RNA is nothing to worry about and doesn't serve any purpose for morphing. It's not entirely clear what the real purpose of the RNA is, but it does seem to be related to the morphing process, because peculiar patterns have been observed. For example, the RNA code CFPICFP occurs very often and seems to indicate a small part of the morphing process is done. There are also other RNA codes, all starting with a C, that most likely indicate the start of a morphing process. Their exact meaning hasn't been figured out, though."
My first check was to cause the RNA interpreter to increment a counter every time it sees an unknown RNA code other than CFPICFP, and to decrement that counter every time CFPICFP is seen. This counter doesn't run away, so it seems that the entry-points are identified by single seven-letter RNA codes and not multiple consecutive codes.

Six characters are too few to represent even the number of items listed in the gene (symbol) table in the usual number representation (binary, LSB first, I=0, C=1). Besides, three symbols appear in the "junk RNA": I, C, and P. Perhaps the representation is trinary? That would let us represent 3^7-1=2186 unique quantities, plenty enough to cover the approximately 400 items listed in the symbol table. Assuming that these numbers code for indexes into the symbol table, looking at the distribution of codes tells me that the numbers are coded MSB last and P=2, since "P" never appears in the last position. This leaves two possibilities: (I=0, C=1) and (I=1, C=0). If we choose the latter, then all of the coded numbers fall into the range [0, 256]. This seems auspicious, but my interpretation must still be not quite right, since with this interpretation the most commonly called function is number 111, cow-body. Seems unlikely.
LinkLeave a comment

ICFP contest 2007: report from the organizers [Oct. 10th, 2007|10:26 pm]
[Tags|, ]

The final report on the ICFP 2007 programming contest was presented last weekend at the International Conference on Functional Programming in Freiburg, Germany. I have so far avoided looking at it, with the idea that maybe I'll still eventually solve their puzzles (in my infinite spare time, of course). Also perhaps interesting is the blog titled rlwinm ([info]rlwinm) written by the guy who got the Judges' Prize in the contest.
LinkLeave a comment

Berkeley Programming Contest 2007 [Oct. 7th, 2007|09:19 pm]
[Tags|, ]

#descriptionnumber of solutionsmy code
1soundex22* 1.cc
2word edit chains12*2.cc
3formula checker4
4planner1
5circular grid shortest path0
6patch applier2
7multiplier state machine generator77.cc
8whist card game scoring4*8.cc

(There were 34 participants.)

It seems like last year's contest was just yesterday, but it turns out a whole year has passed. This year's Berkeley Programming Contest was held last weekend and I again participated. It didn't feel like a very eventful contest, but I did learn the origin of the phrase "[to] follow suit." (Apparently it comes from card games in which one is required to play a card of the same suit as some other card.)

I wonder whether problem number five was inspired by Burning Man, whose city is laid out on such a circular grid. I believe the crux of the solution to that one is that you're better off going through the city center if your destination is more than 2 radians away; otherwise you should just go around.

My C/C++ programming has gotten pretty rusty!

LinkLeave a comment

Cult of the Bound Variable -- improved codex and dev kit [Jul. 23rd, 2007|11:31 pm]
[Tags|, ]

In case you're not all tuckered out from this year's ICFP Programming Contest, the creators of last year's contest have just released a new version of the Codex "with bug fixes, harder problems, and easter eggs." They've also released the tools they used to create the Codex, including "the entire source code for the Codex, and most of the tools... used to build the contest, including an ML to UM compiler, a UM assembler, puzzle generators for some of the problems, a graphical Antomaton simulator, etc." They've published a technical report (complete spoiler!) and the slides and video of a talk.
Link1 comment|Leave a comment

ICFP contest over now -- time for sleep [Jul. 23rd, 2007|03:20 am]
[Tags|, ]



[info]evan_tech has a nice writeup of the contest.

[originally posted at [info]nibot]
LinkLeave a comment

ICFP contest [Jul. 21st, 2007|02:00 pm]
[Tags|, ]

The ICFP Programming Contest is well under way. Recall that last year we were given an alien codex that turned out to be executable code. After we wrote a virtual machine for the alien codex, we were plopped into a sort of unix hacking text-adventure, filled with various puzzles. This year we're given a huge strand of alien DNA, and instructions on how to interpret the DNA!

The DNA turns out to be a strange pattern-matching language that ultimately spits out another code--RNA!--which in turn gets translated into an image. The goal is to come up with new strands of DNA that we can prepend to the alien DNA to transform the image in various ways. [info]evan, [info]four, and I have been working on it since about 3am PDT on Friday. The Task hints at one DNA prefix that will "do something interesting;" it turns out to invoke a self-check:



Well, we apparently still have some bugs in our virtual machine, somewhere--hence the corruption in the self-check... And we have only barely scratched the surface of figuring out how the DNA codex actually works.

[originally posted at [info]nibot]
LinkLeave a comment

Berkeley Programming Contest 2006 [Sep. 30th, 2006|07:03 pm]
[Tags|, ]

#descriptionnumber of solutionsmy code
1edit distance9
2marbles game1
3sorting tree16*
4longest common subsequence114.c
5parsing/unification0
6bouncing projectile5*
7swapping offices6*
8maze2

The Berkeley Programming Contest was today and I participated from my secret underground lair. Overall people seemed to do very well. In particular cs61a-nq—whose account name indicates that he or she is probably a freshman—solved six problems, which is very impressive.

I think the relative frequency of solutions may be indicative of the Berkeley CS curriculum. The most-solved problem, number 3, has a simple recursive solution of the sort you're likely to see in CS 61A. I'm surprised that the "longest common subsequence of five strings" problem—which has a standard solution, but one somewhat annoying to code up—had nearly twice as many solutions as number seven, which was fairly trivial.

I submitted acceptable solutions to the three problems indicated with asterisks, which is good enough for something like 10th place. (haha)

Link4 comments|Leave a comment

Contest Problem 1999-08 in C++ [Aug. 5th, 2006|10:42 am]
[Tags|, ]

On Wednesday I posted about a problem from the 1999 Berkeley Programming Contest which asked us to find the next higher permutation of a sequence of base36 digits, and I posted a solution in 54 lines of C. Last night, looking at functions available in C++'s algorithms library, I saw next_permutation. That's right: a solution to this contest problem is essentially one standard library function away:

#include <algorithm>
#include <string>
#include <iostream>

int main(int argc, char **argv) {
  using namespace std; 
   string x;
   while (cin >> x) {
    cout << x << " -> ";
    next_permutation(x.begin(),x.end());
    cout << x << "\n";
  }
  return 0;
}


The Berkeley contest allows the use of the C++ headers string, vector, iostream, iomanip, sstream, fstream, map, and algorithms, the C standard libraries including the math library, and, in Java, the standard packages java.lang, java.io, java.text, java.math, and java.util. I'm quite familiar with what's available in C (other than a few gems, not too much); familiarity with the other languages' standard libraries could be very advantageous.
Link1 comment|Leave a comment

ICFP2006: Decrypting the Codex [Aug. 4th, 2006|08:19 pm]
[Tags|, ]

From the sound of [info]evan_tech's descriptions, this year's ICFP programming contest was downright surreal. The premise: You're given an archaeological find from an ancient yet computer-using civilization. You have a description of a virtual machine called the "Universal Machine" and you have the Codex. The rest is up to you. This leads to a series of puzzles, an elaborate programmer's Zork game, a console-mode Myst if you will. The contest is over, but the problem sounds fun, so I thought I'd give it a try.

a few details )

The code, with no optimizations: http://web1.pas.rochester.edu/~tobin/contest/icfp/2006/um-0.c (Clearly some optimizations are necessary, since it takes seven and a half minutes to run the SandMark benchmark/test, while others on the icfp-discuss list are reporting times of about a minute.)

[tobin@eagle icfp]$ ./um codex.umz
self-check succeeded!
enter decryption key:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
decrypting...
ok
LOADING: 9876543210

== CBV ARCHIVE ==
VOLUME ID 8

Choose a command:

p) dump UM data
x) exit

?
?


Aha! Executing the codex, I'm given the option of dumping some UM data. I assume that's another program to execute with the UM?
Link8 comments|Leave a comment

Contest Problem 1999-08 [Aug. 2nd, 2006|04:23 pm]
[Tags|]

If I remember correctly, the first programming contest problem I attempted was number eight on the 1999 Berkeley Programming Contest. The problem reads:

You are given a base-36 numeral (the digits are 0-9, a-z, with a worth 10, b 11, etc.) and told that it comes from the set of all numbers having the same digits (that is, the same number of each digit the given number has). We allow leading 0s. You are to print out the next number from that set (in ascending order). For example, given 03snd3fk5ee2, you should print 03snd3fke25e.

"I can do that," I thought, and proceeded to implement the naïvest of naïve algorithms: my program iterated through base36 numbers, counting up from the number given as input, each time checking whether the digits of the current number were a permutation of the input digits.

My program worked on the example input. I submitted it, waited expectantly for a "success!" email to come back, and was crestfallen at the response: "failure! time limit exceeded." Lesson number one: while the sample inputs are often simple, the testing inputs may be complex or even pathological, exercising special cases not observed with the sample inputs.

The input leading to failure was, if I recall correctly, "xylophone." And that, in a flash, is how I learned about algorithmic complexity. Brute-force guess-and-check is just not a tractable approach for most problems.

A moment with paper and pencil working out the problem reveals a simple, elegant algorithm. This is a good lesson for the programming contests: before rushing to write code, solve some sample cases by hand. I think this is a nice little problem, a fun thing to try implementing in novel languages.

a solution )
Link6 comments|Leave a comment

Contest Problems 2005-02 and 2005-07 [Jul. 21st, 2006|02:41 pm]
[Tags|]

Nobody solved problems two or seven in the 2005 Berkeley Programming Contest (pdf with problem descriptions). There were 24 correct solutions to problem eight (which has a simple closed-form solution), 13 solutions to each of problems one and five, eight correct solutions to each of three and six, and two solutions to problem number four. The two unsolved problems were, in brief:

  1. Given a description of a circuit consisting of N outputs connected to N inputs via a collection of XOR gates with some inputs inverted, and a set of outputs of that circuit, find a consistent set of inputs that will produce this output.

  2. Reduce a set of ordered pairs by finding subsets that may be written as cartesian products.

I believe I have a good algorithm for number (2), but not yet for number (7). I will post about (2) in another post. In the meantime, I'm curious if anyone else has ideas about these two problems. (I enjoy working on these contest problems because they are so nicely bite-sized. After thinking up an algorithm you have the other fun task of implementing it as succinctly as possible.)

LinkLeave a comment

navigation
[ viewing | most recent entries ]

Advertisement