|
Thanks you ! Thanks you ! Thanks you all up voters
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
modified 1-Jul-15 14:36pm.
|
|
|
|
|
Hello, everybody.
I've got next problem. There is three objects:
1. first one, with next characteristics: circular area of view, speed, drag coefficient;
2. wind (or water current, doesn't matter; some sort of resistance) with some strength and direction;
3. polygon, concave (in general case).
I need to build path of first object inside this polygon, which will:
1. cover whole polygon by view area;
2. be optimal by travel time;
3. takes into account wind direction and strength.
In other words, I need to carry out exploration in a given area on optimal trajectory while scout can be drift away.
Thanks, Viktor.
|
|
|
|
|
Do you have a question?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
My question, actually, is: what algorithms should I use to build this trajectory?.. I know, that maybe this is strange. I investigate this problem last few days and already have some sort of solution. I just want to find some people who might solve this task earlier.
|
|
|
|
|
Viktor Grabarchuk wrote: I just want to find some people who might solve this task earlier. The thing has a location, a direction (vector, some arrow) and a speed (velocity in them expensive manuals)
Once you have those three things in an oject, you can introduce "forces" like gravity.
Do keep in mind that you are asking for something rather complex; there is a huge difference in resistance between wind and water, also depending on the shape of the object it hits, any currents that form due to that shape, any contaminations and other stuff. Other stuff like temperatures of below 0 where water does not tend to flow
Start out with something fun one can easily play with; have a ball bounce on the screen and change the gravity to be equal to the moon. Once you have one force, introducing a new one should not be hard.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have a an array of values like:
array(0.2,0.0,0.4,0.7) min: 0.0 , max: 5.0
and every value represent something and I have some attributes in the database that corresponds to these values. Now what I need to do is I need to search the records from database on the bases of above mentioned array. Kindly suggest me an algorithm that would do something like this. I need something like machine learning that would be able to do this thing with flexibility. What I have found from my research that following algorithm is closer to what I am looking for:
http://www.econ.ohio-state.edu/jpeck/Econ501aL4.pdf
http://www.solver.com/k-nearest-neighbors-classification-example
For Example: Configuration array => ('attr1'=> 0.2, 'attr2'=>0.54, 'attr3'=>0.66, 'attr4'=> 0.78)
Records:
| attr1 | attr2 | attr3 | attr4 |
1) 0.45 0.33 0.55 0.66
2) 0.32 0.12 0.34 0.99
3) 0.78 0.41 0.10 0.74
4) 0.88 0.12 0.74 0.10
5) 0.72 0.02 0.00 0.55
Now I need an algorithm which can get me results (records) using the above mentioned array.
|
|
|
|
|
|
I have a quick question.
Which type of math subjects should i refresh myself on for algorithms class??
Is there any Direct recources i can find for this??
Thankyou
|
|
|
|
|
|
There's no specific math subject that would be more important than others for algorithms in general. The most important skill for developing or understanding algorithms is logical thinking and the ability to break a problem into smaller parts. Unless, of course, if you're going to deal with algorithms for a specific problem domain in particular - like graphics or sound processing - then certain math subjects will certainly be more helpful than others.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Not just for algorithms, but for Computer Science in an overall sense - Mathematics for Computer Science[^]. You'll also find video lectures there.
modified 5-Jun-15 1:48am.
|
|
|
|
|
I would say Boole Algebra.
Everywhere you have a condition, it is Boole Algebra.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Hi friends,
find the θ bound for f(n)=n2/2-n/2?
we need to find the upper bound and lower bound.
If anybody know please send the solution with explaination.
Thanks,
Arjun
|
|
|
|
|
C
modified 23-May-15 13:46pm.
|
|
|
|
|
Chaitanya Pai wrote: I have tried a lot to arrive at the solution. Show what you have tried and explain what does not work, and people will try to help you. But no one is going to hand you a complete solution.
modified 23-May-15 8:16am.
|
|
|
|
|
I am having a major 'head against wall' problem here...
Given two base 36 values ('A0ZWS0P' and 'A0ZWS9P', for example) and a third (random) value,
how would you go about determining whether the random value was 'between' the starting and ending values?
I am working in 2012 VB.Net
|
|
|
|
|
It depends on how you're (internally) representing the values.
If you're using regular .NET integer types (e.g., Int32, Int64) then just compare the values.
If you're using strings to represent the values, then
1. if necessary, pad the strings to the same length (leading spaces or zeros)
2. use a case-INsensitive string comparison.
The string representation is a very poor design for something like this!
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
My bad, I elided some details....
The values are part of numbering sequences for ticket books. Say I have a book with a number range of '9ER78Y' to 9ER79J', stored as strings ('start and 'end') (not my design, it was inherited). Now I am given a ticket number of '9ER79A' I need to find the book of tickets that contains this ticket.
The only way I can see to do it is a brute force table scan, of over 500,000 books
I am not sure an index would help, unless I added a discriminator column to represent the book start and end range
|
|
|
|
|
Do you need to do this within a DB query (SQL), or is the "search" in-memory?
Are there any other constraints on the problem space that might be used to simplify things?
(E.g., are the ranges all exactly the same size? or a multiple of some size?)
If you need to do significant numbers of checking at a time, then some pre-processing of the data while loading into memory is a good tradeoff.
If these are one-off checks against the DB, then pre-processing is probably not worth it.
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
You can implement this with a form of binary search.
- [Preparation] Sort the strings representing the first ticket in each book in ascending order:
a. zero-pad any short strings (e.g. "ABC1" should be padded to "00ABC1"
b. sort the strings using a case-insensitive sort
c. pad the list with a dummy ending value (e.g. "ZZZZZZ").
d. pad the list with a dummy starting value (e.g. "000000"). - [Eliminate low values] Use a binary search to find the location of largest value less than or equal to the target string. If the result points to the starting dummy value, then no such value exists.
- [Eliminate high values] Use a binary search to find the location of the smallest value larger than the target string. If the result points to the ending dummy value, then no such value exists.
The range [low, high) contains your result. If low != high, the range should contain a single element that is the desired ticket book. If low == high, no ticket book was found.
Note that you can handle missing books in the sequence by adding dummy book starting values to the array.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
C# (sorry; I don't do "VB")...
IsInBetween( "A0ZWS0A" );
IsInBetween( "A0ZWS0P" );
IsInBetween( "A0ZWS7P" );
IsInBetween( "A0ZWSAP" );
private static void IsInBetween( string value ) {
string s1 = "A0ZWS0P";
string s2 = "A0ZWS9P";
bool isInbetween =
value.CompareTo( s1 ) == 0 ||
value.CompareTo( s2 ) == 0 ||
( value.CompareTo( s1 ) > 0 && value.CompareTo( s2 ) < 0 );
Console.WriteLine( "Is {0} between {1} {2}? {3}", value, s1, s2, isInbetween );
}
|
|
|
|
|
I will try this....I also am a C# guy, for the last 10 years or so, but the job specced VB so, learn it I did
|
|
|
|
|
Good for you ... I've been able to avoid VB.NET thus far (though I did dabble in it back when it was called "Visual Basic 1.0").
|
|
|
|
|
And why not use >= and <= operators.
It gives something like:
bool isInbetween = ( value.CompareTo( s1 ) >= 0 && value.CompareTo( s2 ) <= 0 );
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
A base 36 numbering scheme should be the math rappresentation of a normal numer expressed with 36 different ciphers.
It should be quite an easy task to create a function that converts the strings that you have to plain binary numbers (base 2) understandable to the computer. This function is equivalent to an ascii to bin conversion, only the symbols that have top be handled are 36.
The sequence, I suppose, is: 0 1 2 3 4 5 6 7 8 9 A B C D E F G . . . . . Z
The generic rappresentation of a number expressed in base x is:
Vn*X^n + V(n-1)*X^n-1 + V(n-2)*X^n-2 + ... + V(0)
In plain the sum of all ciphers by the power of the base at the position taken as exponent.
This is sample to convert a base 36 number to a base 2 numberEDIT: This sample converts any ascii rappresentation of a number in all bases between 2 and 36. It acts as the standard atoi, atol, etc. It converts all applicable characters up to the end of string or the first non number with respect to the choosed base. If the first string char is not a valid cipher, or the string is empty it returns NULL.
long long GenRadVal(char *str, int base)
{
if (base<2 || base>36)
return 0LL;
long long val = 0;
for (int i = 0; str[i]; i++)
{
int c = toupper(str[i]);
if ((c < 0) || ((c > '9') && (c < 'A')) || (c > 'Z'))
break;
c = c > '9' ? c - 'A' + 10 : c - '0';
if (c >= base)
break;
val *= base;
val += c;
}
return val;
}
This will give you back a 64 bits number equivalent to the string. To go back to the original value you can use itoa() function in C.
Now comparisons are easy..
P.S. the reverse for this function is the stdlib function itoa() with base=36.
modified 17-May-15 12:01pm.
|
|
|
|