Ideas of procedural algorithms for generating a grid-based town - algorithm

Hope you're alright.
For the last two weeks, I'm trying to find one algorithm for generating procedural cities/towns on a grid system. I'm more focused on the road network than buildings, nature etc.
I've tried L-System (following this tutorial series on YouTube: https://www.youtube.com/playlist?list=PLcRSafycjWFcbaI8Dzab9sTy5cAQzLHoy) and some modifications of maze algorithms (explained here: http://weblog.jamisbuck.org/2011/2/7/maze-generation-algorithm-recap), but no success to react what I want.
Searching more, I found this old thread Generating a city/town on a grid (Simply my approach) where that guy created an algorithm that makes exactly what I want. Now I'm trying to understand (and, maybe, simplify) that algorithm to rewrite it on Unity game engine.
So now, I want to know if someone knows other algorithm(s) that makes something next to this: a city/road network based on a grid.
Thank you for your help and for sharing your knowledge! This project is part of my graduate thesis and, if you can help me, I will be very thankful!

Related

behaviour or pattern recognition?

I am getting the gps position and time of a voluntary person which moves around. I am acquiring the position every second with Matlab and save it in a matrix.
Now I would like to be able to say if the person is moving normal or not. For example running in circles is not normal for a person who usually only walks around.
I am not looking for a complete solution because I would like to learn through my project and understand every aspect. I would be very grateful if you could show me the right direction. Good literature, tutorials and simple catchwords would also be very helpful for me because at the moment I dont know how to approach my problem.
Thank you very much in advance!
Kind regards,
Tom
What you're looking for is anomaly detection. The primary commercial application of this technology is in fraud detection. As for pointing to resources any books that cover data mining should have a section about anomaly detection.
Something to for warn you about, it sounds from your description that you will be working with time series data which is its own branch of data mining.
Catchwords: Anomaly Detection, and Time Series Data.
Books: ISBN-13 978-0321321367 Introduction to Data Mining (This is a good starting point if you don't have a lot of background in the subject)

Understanding figures in the algorithm design manual

I want to start learning about algorithms so I began reading The Algorithm Design Manual by Steven Skiena because it is recommended in some threads I read in SO. However, I just stopped here
and can't understand most of it because many explanations are represented in figures or images and my screen reader recognize but can't read them.
For example,
"The nearest neighbor rule is very efficient, for it looks at each pair of points
tex2html_wrap_inline23349 //That's how my screen reader read it, I asume it's an image.
at most twice, once when adding
tex2html_wrap_inline23351 //image
to the tour, the other when adding
tex2html_wrap_inline23353 //another image
Against all these positives there is only one problem. This algorithm is completely wrong."
This is really frustrating for me because I'm beginning to enjoy this though I can understand why those images help a lot of readers.
So is their a way to understand this thing without seeing the figures? Or should I read another book?
Thanks in advance and happy new year everyone.
Considering these algorithms are dealing with geometrical analysis, I am afraid it would be difficult to understand them without the images, and even more difficult to replace these images with an equivalent textual description.

Cut optimisation algorithm

Me and some of my friends at college were assigned a practical task of developing a net application for optimization of cutting rectangular parts from some kind of material. Something like apps in this list, but more simplistic. Basically, I'm interested if there is any source code for this kind of optimization algorithms available on the internet. I'm planning to develop the app using Adobe Flex framework. The programming part will be done in Actionscript 3, ofc. However, I doubt that there are any optimization samples for this language. There may be some for Java, C++, C#, Ruby or Python and other more popular languages, though(then I'd just have to rewrite it in AS). So, if anyone knows any free libs or algorithm code samples that would suit me, I'd like to hear your suggestions. :)
This sounds just like the stock cutting problem which is extermely hard! The best solutions use linear programming (typically based on the simplex method) with column generation (which, even after years on a constraint solving research project I feel unequipped to give a half decent explanation). In short, you won't want to try this approach in Actionscript; consequently, with whatever you do implement, you shouldn't expect great results on anything other than small problems.
The best advice I can offer, then, is to see if you can cut the source rectangle into strips (each of the width of the largest rectangles you need), then subdivide the remainder of each strip after the "head" rectangle has been removed.
I'd recommend using branch-and-bound as your optimisation strategy. BnB works by doing an exhaustive tree search that keeps track of the best solution seen so far. When you find a solution, update the bound, and backtrack looking for the next solution. Whenever you know your search takes you to a branch that you know cannot lead to a better solution than the best you have found, you can backtrack early at that point.
Since these search trees will be very large, you will probably want to place a time limit on the search and just return your best effort.
Hope this helps.
I had trouble finding examples when I wanted to do the same for the woodwoorking company I work for. The problem itself is NP-hard so you need to use an approximation algorithm like a first fit or best fit algorithm.
Do a search for 2d bin-packing algorithms. The one I found, you sort the panels biggest to smallest, then add the to the sheets in in order, putting in the first bin it will fit. Sorry don't have the code with with me and its in vb.net anyway.

Scheduling Students to Classes

I am making a website for a side project at school where students enter the classes they need to take, what days they want or don't want classes, and when they cant have or don't want classes. The basics are there are classes, and each class has many sections at different times with different professors that a student can choose from. With the freshman level classes, there can be over 30 different sections for each class. I have the classes and sections in a mysql database and I have been coding in php.
So far I have it working but I want to make it faster. I have been reading about other scheduling problems but I am looking for specifics to what I am doing. This isn't making schedules from scratch. It is making schedules from what sections are available and ranking them based on what the students inputs. Currently for few possible sections, it runs fast. But when the possible schedules get to about 300,000, it takes around 30 seconds to compare and rank everything. I have been improving it by changing how schedules are generated but I want to faster. I switched from brute force generating to using a tree based method.
I'm not asking for homework help or for someone to do this for me. I just want to be pointed in the right direction with already existing problems and algorithms that I can learn about.
Remember the eight queens puzzle? I sure hope you do, if not, go and solve it first, then come back to your scheduling task.
You have already moved from brute force to a tree structure. Now it's time for branch and bound. Whatever you mean by "good schedules", 170000 is too much — you do not prune your tree enough. I do not think that there could be more than 20-50 really good schedules for each student, unless they take very few classes and are extremely flexible.
Try metaheuristics such as tabu search or simulated annealing.
Brute force and branch and bound don't scale up enough.
Take a look at my curriculum course example in drools planner, as defined by ITC2007.
Its probably an advanced form of your use case (not counting gui/db).
Have a look at this. It may not be exactly what you want but you can get some design ideas.

How to design an approximate solution algorithm

I want to write an algorithm that can take parts of a picture and match them to another picture of the same object.
For example, If I gave the computer a picture of a vase and a picture of a scene with the vase in it, I'd expect it to determine where in the image the vase is.
How would I begin to develop an algorithm like this?
The final usage for this algorithm will be an application that for example with a picture of somebody's face could tell if they were in a crowd of people. This algorithm would eventually be applied to video streams.
edit: I'm not expecting an actual solution to this problem as I don't hope to solve it anytime soon. The real question was how do you define something like this to a computer so that you could make an algorithm to do it.
Thanks
A former teacher of mine wrote his doctorate thesis on a similar sort of problem, except his input was a detailed 3D model of something, which he would use to find that object in 2D images. This is a VERY non-trivial problem, there is no single 'answer', certainly nothing that would fit the Stack Overflow format.
My best answer: gather a ton of money and hire a very experienced programmer.
Best of luck to you.
The first problem you describe and the second are both quite different.
A major part of each is solved by the numerous machine vision libraries available. You may need a combination of techniques to achieve any success at either task.
In the first one, you would need something that generically recognizes objects. Probably i'd use a number of algorithms in concert to identify the foreground object in the model image and then do some kind of weighted comparison of the partitioned target image.
In the second case, examining faces, is a much more difficult problem relative to the general recognizer above. Faces all look the same, or nearly so. The things that a general recognizer would notice aren't likely to be good for differentiating faces. You need an algorithm already tuned to facial recognition. Fortunately this is a rapidly maturing field and you can probably do this as well as the first case, but with a different set of functions.
The simple answer is, find a mathematical way to describe faces, that can account for angles and partial missing data, then refine and teach it.
Apparently apple has done something like this, however, it still makes mistakes and has to be taught as it moves forward.
I expect it will be more about the math, than about the programming.
I think you will find this to be quite a challenge. This is an extremely difficult problem and is one of the many areas of computing that fall under the domain of artificial intelligence (AI). Facial recognition would certainly be the most popular variant of this problem and in spite of what you may read in the media, any claimed success are not what they are made out to be. I think the closest solutions involve neural nets and they require very clear and carefully selected images usually.
You could try reading here though. Good luck!

Resources