Problem 2072. Packing Santa's Sleigh: First Layer

This Challenge is inspired by the Packing Santa's Sleigh contest at kaggle that runs until January 26, 2014.

The Bag has a 1000 x 1000 base with the contest having 1,000,000 packages.

This Challenge is to place as many of the first N Santa Presents onto the 1000 x 1000 grid. The packages have been presorted to have Z as max, not provided, thus minimizing the X*Y cross section. Only the first 240 packages are provided as package 241 busts the bag bottom making an area greater than 1,000,000. Packages out of sequence cause a severe penalty thus all packages less than the highest package used must fit on the board.

Input: Presents ; Presents(240,2)

Output: L, xyTL; L(1000,1000) of values 0:n<=240, 0 is unused space

Scoring: Unused Area


[2 2;3 3;1 2] is Presents


1 1 2 2 2 0  thru column 1000
1 1 2 2 2
3 3 2 2 2
0 0 0 0 0 0 rows 4 thru 1000 are zeros

xyTL [1 1;1 3;3 1]

Scores 1,000,000 - 15= 999985

Boxes 1:236 are possible, 97.5719% efficient pack in < 1sec.

TestSuite Sample Code:

In the TestSuite at the end is wrapper code for entering the kaggle contest. Update your SantaPack routine and execute the wrapper to see your contest score. The official presents.mat file needs to be downloaded. The wrapper has further discussion on efficient methods and current scores.

Solution Stats

40.0% Correct | 60.0% Incorrect
Last solution submitted on Apr 29, 2017

Solution Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!