Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a project in which I need to create a "robot" that goes around and picks up batteries in a space (100x100 or whatever). I am stuck on the best way to hold his AI instructions. I want to create a list of some kind that has all instructions the robot would ever need. Example: if the robot is in a spot it would check the surrounding spots for a battery, empty space, or a wall. I want to create a lot of robots and give each scenario a random action (go up, down, left, right, etc) Each turn the robot does something. The robots with the best outcome (highest batteries) get to the next level.
Maybe this was too many details for my question but, would an array be the best way to hold the instructions?
Looking for a push in the correct direction. I am new to Java having gone through just 1 beginner class of it so far. Not looking for the code itself (examples are nice but I want to do my own work), of course, just ideas as to where to begin with the AI instructions.
To start with you should forget about what sort of data structures you are going to need, and start from the beginning. What are the robots legal moves - write that down, and get it crystal clear on how you want the robot to run.
You should write step by step use cases for each of the options which include what the positions are, sensors, batteries etc.
Once you have written all this down, the data structure will be much simpler to identify.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm fairly new to OpenCV Java and I've been looking for methods to do what the title asks.
So far, from what I understood, the first step should be to use a detecting edges filter like Sobel or Laplace.
Coming from https://docs.opencv.org/3.4/d2/d2c/tutorial_sobel_derivatives.html, I get the following result : glass_sobel
From now on, I don't know what to do next... What should I do to get what I want ?
Thanks for your help !
Taking the vertical edge difference (sobel) is indeed the right step. But first I suggest fixing some parameters. For instance, is the position, size and shape of the glass fixed? then take an image without fluid and use that to extrapolate the glass from the result. If not, I would take the following steps:
Try to increase edge visibility. In your image you do see a clear edge, but the computer might see this as 4 edges, therefore try to make sure edges close to each other are seen as one edge (dilate operation might do that). Depending on the liquid, you could alternatively extract a certain color from the image. Water is here the most unfortunate case, but something as orange juice is easily detected.
With the more clear edges, I would try to get a vertical line out of the glass, and classify each edge (is it part of glass or part of liquid).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am new to the image processing discipline, currently I am working on an activity to find the path in a given floor plan image using java. I could understand & implement a plain Dijkstra or A star algorithm in java to find the shortest path between nodes that can work on hard coded values for nodes & edges. But I have no idea on how to do the same with image file as input.
I could not find any much detailed or comprehensive solution for this on web surfing. Any idea on how to achieve this. Kindly help.
If the walls on your plan are black, and the space is white, then use the white pixels as the space in which you can search using your algorithms.
be aware that:
The plan images could need some preprocessing, like adjusting brightness/contrast and/or converting into lower resolution picture.
If the plans are more complicated than that, ie. you need to take into account some special signs or structures on them then you need to do more complicated conversion/preprocessing and/or image recognition, using some special tools, maybe even some AI.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Can anyone help me. Which is the best algorithm to implement a TicTacToe game. I need to write the code in a way that it should be generic and should be able to handle more complex levels in easier way (generic way) from wher can I start? I read that we can use MiniMax algorithm. I need to know the most. efficient algorithm
Thanks,
The "Best" algorithm (which always choose the best possible play) is known to be NP-Complete.
Therefore it is really hard to implement "good" one, which use some heuristic to increase performance and it is precious enough.
Minimax is basically only approach which "really" works, so start with it, then you can think and look for optimization. The idea is simple, you try every movement and you measure the "price" of that movement (e. g. creating more same "X" or "O" in row has better price than creating "X" or "O" than most things, or stopping a long line of "X" or "O" of enemy is good too).
Then for every possible movement, you try enemy to do the every possible movement and you count the price.
How "deep" you go, the more precious it is, but the more expensive for performance algorithm is.
For that example I said, for every your movement you do every enemy movement - you suppose that opponent would play as good as possible, so you from all that movement the opponent plays you get the maximum (the maximum for him).
And now for every possible movement, you have the value of best enemy play. And then you choose the minimum - it means that you want to choose the best for you and worst for enemy.
That's why they call it minimax.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How to look for a particular object in a large list(java collection) without iterating it. Assume we have a large collection and just need to check whether a object exists or not without iterating.
Ok, Let's step out of the binary world.
Think of a chest full of Lego parts. You want a 2x2 flat black piece.
How would you find it without looking in the chest?
There is no magical to find it, you need to jump into the chest and find the piece grabbing one by one and checking if it's the one you are looking for.
There are ways to speed up the process.
You can Organise (sort your collection) by colour for example and just look in the black pile.
Or you can map (Index your pieces) so you know the position of the piece and can go and retrieve from you know where the piece is.
That is, in a very simplistic way, the same idea for databases and collection.
So, summarizing, no, you can't not just find without looking. Sorry :(
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am looking into finding algorithm within the area of clustering or machine learning which will facilitate or creating a typical data reading for a group of readings. The issue is that it must facilitate time series data; thus some traditional (k-means) techniques are not as useful.
Can anyone recommend places to look or particular algorithms that would provide a typical reading and relatively simple to implement (in Java), manipulate and understand?
As an idea. Try to convert all data types into time, then you will have vectors of the same type (time), then any clustering strategy will work fine.
By converting to time I actually mean that any measurement or data type we know about has a time in its nature. Time is not a 4-th dimension, as many think! Time is actually 0-dimension. Even a point of no physical dimensions which may not exist in space, exists in time.
Distance, weight, temperature, pressure, directions, speed... all measures we do can be converted into certain functions of time.
I have tried this approach on several projects and it payed back with really nice solutions.
Hope, this might help you here as well.
For most machine learning problems in Java, weka usually works pretty well.
See, for example: http://facweb.cs.depaul.edu/mobasher/classes/ect584/weka/k-means.html