How to Solve a Machine Learning Challenge? - algorithm

There is a container, for example lets say which has a volume of "V". The container needs to be filled with various types of boxes, where each type has a unique size (volume), for example lets say
Box Type A - has a volume of K
Box Type B - has a volume of L
Now the problem is that there is a requirement to find out whats the maximum number of boxes of both types which could be fit into the container (combination of both boxes)
To simplify lets say that "W" and "R" are quantities, then we get
(K * W) + (L * R) = V
AND how the cartons(boxes) should be stacked up in the container.
For example the first row (by row I mean when the boxes are laid x co-ordinate wise) of boxes in the container should contain 4 stacks (starting from the floor of the container) of "Box Type A" and the topmost two stacks (nearing the top ceiling of the container) with "Box Type B" (By stacks I mean when the boxes are laid on top of each other [z co-ordinate wise]).Thereafter a new row is laid after the previous one is complete till the whole container is full.
The problem is what is the best way to layout these boxes in the container as to utilize all (or most) of the space in the container, and pack in the maximum possible number of boxes which can be a combination of 1 or more (max around 5 type of boxes in one container).
The program should simply take the inputs of the types and details of the boxes, the container and voilĂ  you get a full detailed analysis.
The problem is that I have not touched the area of machine learning or solving this kind of problem. I would appreciate if I was given advice on as what algorithm/s to use, where to start learning to solving this problem and such, whats the best way to approach this, any helpful machine learning libraries to use, etc.

This problem is a variant of linear optimization called integer linear optimization link at wikipedia. This problem is known to be NP-hard in general, so most solutions out there are iterative. See the references in the article for further discussion
EDIT: I would suggest to look at LPSOLVE which already offers a lgpl solver library

You might want to have a look at the answer to this question:
Box stacking problem

If you really mean machine learning, rather than pre-programming an algorithm then I think that's really difficult. Simple trial and error approaches are going to perform really badly when the number of boxes becomes large.
I wonder whether it's worth looking at the approaches taken in programming computers to play Go. There's been a lot of progress in applying Monte Carlo methods especialy in the end-game, which is a similar kind of combinatorial problem to your packing problem. See This reference.

To solve this purely with machine learning is a bad idea. The reason being this is a deterministic problem, and other forms of AI are better suited for this. But, if your only option is machine learning I would look into reinforcement learning using a least-square error Gradient to Optimize with. It is one of the easier ways to understand machine learning, and applies to your problem, since it is deterministic. If at all possible use other algorithms to supplement the machine learning.

Related

How to make a neural net give position?

I understand how to do classification problems and starting to understand convolution networks which I think is the answer to some extent. I'm a bit confused on how to setup a network to give me the output position.
Let's say you have the position of the end point of noses for a data set with faces. To find the end point do you just do a 'classification' type problem where your output layer is something like 64x64 = 4096 points but if the nose is at point row 43 and column 20 of your grid you just set the output as all zero's except for at element 43*64 + 20 = 2772 where you set it equal to 1? Then just map it back to your image dimensions.
I can't find much info on how this part of identification works and this is my best guess. I'm working towards a project at the second with this methodology, but it is going to be a lot of work and want to know if I'm at least on the right track. This seems to be a solved problem, but I just can't seem to find how people do this.
Although what you describe could feasibly work, generally neural networks (convolutional and otherwise) are not used to determine the position of a feature in an image. In particular, Convolutional Neural Networks (CNNs) are specifically designed to be translation invariant so that they will detect features regardless of their position in the input image - this is sort of the inverse of what you're looking for.
One common and effective solution for the kind of problem you're describing is a cascade classifier. They have some limitations, but for the kind of application you're describing, it would probably work quite well. In particular, cascade classifiers are designed to provide good performance owing to the staged approach in which most sections of the input image are very quickly dismissed by the first couple stages.
Don't get me wrong, it may be interesting to experiment with using the approach you described; just be aware that it may prove difficult to get it to scale well.

Tiling Algorithm

I'm faced with a problem where I have to solve puzzles.
E.g. I have an (variable) area of 20x20 (meters for example). There are a number of given set pieces having variable sizes. Such as 4x3, 4x2, 1x5 pieces etc. These pieces can also be turned to add more pain to my problem. The point of the puzzle is to fill the entire area of 20x20 with the given pieces.
What would be a good starting algorithm to achieve such a feat?
I'm thinking of using a heuristic that calculates the open space (for efficiency purposes).
Thanks in advance
That's an Exact Cover problem, with a nice structure too, usually, depending on the pieces. I don't know about any heuristic algorithms, but there are several exact options that should work well.
As usual with Exact Covers, you can use Dancing Links, a way to implement Algorithm X efficiently.
Less generally, you can probably solve this with zero-suppressed decision diagrams. It depends on the tiles though. As a bonus, you can represent all possible solutions and count them or generate one with some properties, all without ever explicitly storing the entire (usually far too large) set of solutions.
BDDs would work about as well, using more nodes to accomplish the same thing (because the solutions are very sparse, as in, using few of the possible tile-placements - ZDDs like that but BDDs like symmetry better than sparseness).
Or you could turn it into a SAT problem, then you get less information (no solution count for example), but faster if there are easy solutions.

trouble with recurrent neural network algorithm for structured data classification

TL;DR
I need help understanding some parts of a specific algorithm for structured data classification. I'm also open to suggestions for different algorithms for this purpose.
Hi all!
I'm currently working on a system involving classification of structured data (I'd prefer not to reveal anything more about it) for which I'm using a simple backpropagation through structure (BPTS) algorithm. I'm planning on modifying the code to make use of a GPU for an additional speed boost later, but at the moment I'm looking for better algorithms than BPTS that I could use.
I recently stumbled on this paper -> [1] and I was amazed by the results. I decided to give it a try, but I have some trouble understanding some parts of the algorithm, as its description is not very clear. I've already emailed some of the authors requesting clarification, but haven't heard from them yet, so, I'd really appreciate any insight you guys may have to offer.
The high-level description of the algorithm can be found in page 787. There, in Step 1, the authors randomize the network weights and also "Propagate the input attributes of each node through the data structure from frontier nodes to root forwardly and, hence, obtain the output of root node". My understanding is that Step 1 is never repeated, since it's the initialization step. The part I quote indicates that a one-time activation also takes place here. But, what item in the training dataset is used for this activation of the network? And is this activation really supposed to happen only once? For example, in the BPTS algorithm I'm using, for each item in the training dataset, a new neural network - whose topology depends on the current item (data structure) - is created on the fly and activated. Then, the error backpropagates, the weights are updated and saved, and the temporary neural network is destroyed.
Another thing that troubles me is Step 3b. There, the authors mention that they update the parameters {A, B, C, D} NT times, using equations (17), (30) and (34). My understanding is that NT denotes the number of items in the training dataset. But equations (17), (30) and (34) already involve ALL items in the training dataset, so, what's the point of solving them (specifically) NT times?
Yet another thing I failed to get is how exactly their algorithm takes into account the (possibly) different structure of each item in the training dataset. I know how this works in BPTS (I described it above), but it's very unclear to me how it works with their algorithm.
Okay, that's all for now. If anyone has any idea of what might be going on with this algorithm, I'd be very interested in hearing it (or rather, reading it). Also, if you are aware of other promising algorithms and / or network architectures (could long short term memory (LSTM) be of use here?) for structured data classification, please don't hesitate to post them.
Thanks in advance for any useful input!
[1] http://www.eie.polyu.edu.hk/~wcsiu/paper_store/Journal/2003/2003_J4-IEEETrans-ChoChiSiu&Tsoi.pdf

Is there a well known algorithm fill in the grid given a set of points?

I saw this game here Flow, it looks quite interesting.
Connect matching colors with pipe to create a flow. Pair all colors,
and cover the entire board to solve each puzzle. But watch out, pipes
will break if they cross or overlap.
Given a set of pairs (x, y), is there an algorithm to solve the puzzle, i.e. fill in the whole grid (assuming there is a solution) that I'm not aware of?
This is a very specific instance of the global routing problem. Global routing is a well studied problem in VLSI CAD (where one needs to route millions of nets in an integrated circuit). The problem is NP-complete and can be solved in many ways depending upon the tradeoff you need between runtime and quality. Following wiki is a good starting point:
https://en.wikipedia.org/wiki/Routing_(electronic_design_automation)
Paper here gives a survey of various techniques:
http://dropzone.tamu.edu/~jhu/publications/HuIntegration01.pdf
Bear in mind that the pointers I had given typically try to solve a far more complex version of the problem you had stated. Never-the-less, the mathematical concepts remain the same.

Looking for an algorithm that will show how to fit the most boxes in a container

I've been interested in writing an application that will show how to fit boxes (of random dimensions) in a container so there is as little space as possible left. A real life example would be something that would tell you how to use the most space in a UPS truck. Does anyone know of a good place to start for something like this? Is there an existing algorithm that does something similar to what I'm talking about?
What you are referring to is a classic computer science problem known as bin packing, it is an NP-Hard defined problem with well known research and heuristics, but ultimately the only way of calculating it absolutely is via computation of every combination possible.
Read up on http://en.wikipedia.org/wiki/Bin_packing_problem

Resources