Daily Archives

Articles indexed Monday May 17 2010

Page 15/112 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Genetic Algorithms applied to Curve Fitting

    - by devoured elysium
    Let's imagine I have an unknown function that I want to approximate via Genetic Algorithms. For this case, I'll assume it is y = 2x. I'd have a DNA composed of 5 elements, one y for each x, from x = 0 to x = 4, in which, after a lot of trials and computation and I'd arrive near something of the form: best_adn = [ 0, 2, 4, 6, 8 ] Keep in mind I don't know beforehand if it is a linear function, a polynomial or something way more ugly, Also, my goal is not to infer from the best_adn what is the type of function, I just want those points, so I can use them later. This was just an example problem. In my case, instead of having only 5 points in the DNA, I have something like 50 or 100. What is the best approach with GA to find the best set of points? Generating a population of 100, discard the worse 20% Recombine the remaining 80%? How? Cutting them at a random point and then putting together the first part of ADN of the father with the second part of ADN of the mother? Mutation, how should I define in this kind of problem mutation? Is it worth using Elitism? Any other simple idea worth using around? Thanks

    Read the article

  • Genetics algorithms theoretical question

    - by mandelart
    Hi All! I'm currently reading "Artificial Intelligence: A Modern Approach" (Russell+Norvig) and "Machine Learning" (Mitchell) - and trying to learn basics of AINN. In order to understand few basic things I have two 'greenhorn' questions: Q1: In a genetic algorithm given the two parents A and B with the chromosomes 001110 and 101101, respectively, which of the following offspring could have resulted from a one-point crossover? a: 001101 b: 001110 Q2: Which of the above offspring could have resulted from a two-point crossover? and why? Please advise.

    Read the article

  • Tracking fitness in a genetic algorithm

    - by Chuck Vose
    I'm still hacking on my old ruby for the undead post (I know, I know, stop trying to bring the post back from the dead Chuck). But the code has gotten a little out of hand and now I'm working on a genetic algorithm to create the ultimate battle of living and dead with the fitness being how long the battle lasts. So, I've got the basics of it down; how to adjust attributes of the game and how to acquire the fitness of a solution, what I can't figure out is how to store the fitness so that I know when I've tried a combination before. I've not been able to find much genetic code to look at let alone code that I can read well enough to tell what's going on. Does anyone have an idea how this is normally done or just simply an algorithm that could help point me in the right direction?

    Read the article

  • How to structure a Genetic Algorithm class hierarchy?

    - by MahlerFive
    I'm doing some work with Genetic Algorithms and want to write my own GA classes. Since a GA can have different ways of doing selection, mutation, cross-over, generating an initial population, calculating fitness, and terminating the algorithm, I need a way to plug in different combinations of these. My initial approach was to have an abstract class that had all of these methods defined as pure virtual, and any concrete class would have to implement them. If I want to try out two GAs that are the same but with different cross-over methods for example, I would have to make an abstract class that inherits from GeneticAlgorithm and implements all the methods except the cross-over method, then two concrete classes that inherit from this class and only implement the cross-over method. The downside to this is that every time I want to swap out a method or two to try out something new I have to make one or more new classes. Is there another approach that might apply better to this problem?

    Read the article

  • Artificial Inteligence library in python

    - by João Portela
    I was wondering if there are any python AI libraries similar to aima-python but for a more recent version of python... and how they are in comparison to aima-python. I was particularly interested in search algorithms such as hill-climbing, simulated annealing, tabu search and genetic algorithms. edit: made the question more clear.

    Read the article

  • Python editor with automatic code completion?

    - by netvope
    I have seen various articles about good Python editors/IDEs, like this. However, none of them points out whether the editors support automatic code completion. I tried notepad++, PyScript and Komodo Edit, but all of these requires a hotkey to invoke the code completion dialog. Do you know any Python editors with automatic code completion?

    Read the article

  • How could I apply a genetic algorithm to a simple game that follows rollercoaster tracks?

    - by Chris
    I have free-rein over what I do on a final assignment for school, with respect to modifying a simple direct-x game that currently just has the camera follow some rollercoaster rails. I've developed an interest in genetic algorithms and would like to take this opportunity to apply one and learn something about them. However, I can't think of any way I could possibly apply one in this case. What are some options available to me?

    Read the article

  • Tomcat servlet-api.jar problem

    - by CitadelCSCadet
    I am running a web application using Tomcat and Java Servlets, JSP's, etc. I am aware that in order to use Servlets, it is dependent on the Servlet-api.jar file. Initially I placed this jar file in the WEB-INF/lib/ directory. This has worked fine for me for months during the developmental phase. When we put the application onto the server space we are using, we started seeing wierd problems showing up in the Catalina.out file telling us that there was dependency problems with the servlet-api.jar file. I am aware that tomcat has this jar file in its container, and that I should remove it from the WEB-INF/lib/ directory. I have tried this and it does not work. What do I have to do when I remove this jar file from the local files and allow it to depend on tomcats servlet-api.jar file.

    Read the article

  • C++ Type error with Object versus Object reference

    - by muddybruin
    I have the following function (which worked in Visual Studio): bool Plane::contains(Vector& point){ return normalVector.dotProduct(point - position) < -doubleResolution; } When I compile it using g++ version 4.1.2 , I get the following error: Plane.cpp: In member function âvirtual bool Plane::contains(Vector&)â: Plane.cpp:36: error: no matching function for call to âVector::dotProduct(Vector)â Vector.h:19: note: candidates are: double Vector::dotProduct(Vector&) So as you can see, the compiler thinks (point-position) is a Vector but it's expecting Vector&. What's the best way to fix this? I verified that this works: Vector temp = point-position; return normalVector.dotProduct(temp) < -doubleResolution; But I was hoping for something a little bit cleaner. I heard a suggestion that adding a copy constructor might help. So I added a copy constructor to Vector (see below), but it didn't help. Vector.h: Vector(const Vector& other); Vector.cpp: Vector::Vector(const Vector& other) :x(other.x), y(other.y), z(other.z), homogenous(other.homogenous) { }

    Read the article

  • IntPtr in 32 Bit OS, UInt64 in 64 bit OS

    - by Ngu Soon Hui
    I'm trying to do an interop to a C++ structure from C#. The structure ( in C# wrapper) is something like this [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct SENSE4_CONTEXT { public System.IntPtr dwIndex; //or UInt64, depending on platform. } The underlying C++ structure is a bit abnormal. In 32 bit OS, dwIndex must be IntPtr in order for the interop to work, but in 64 bit OS, it must be UInt64 in order for the interop to work. Any idea how to modify the above structure to make it work on both 32 and 64 bit OS?

    Read the article

  • How is this algorithm, for finding maximum path on a Directed Acyclical Graph, called?

    - by Martín Fixman
    Since some time, I'm using an algorithm that runs in complexity O(V + E) for finding maximum path on a Directed Acyclical Graph from point A to point B, that consists on doing a flood fill to find what nodes are accessible from note A, and how many "parents" (edges that come from other nodes) each node has. Then, I do a BFS but only "activating" a node when I already had used all its "parents". queue <int> a int paths[] ; //Number of paths that go to note i int edge[][] ; //Edges of a int mpath[] ; //max path from 0 to i (without counting the weight of i) int weight[] ; //weight of each node mpath[0] = 0 a.push(0) while not empty(a) for i in edge[a] paths[i] += 1 a.push(i) while not empty(a) for i in children[a] mpath[i] = max(mpath[i], mpath[a] + weight[a]) ; paths[i] -= 1 ; if path[i] = 0 a.push(i) ; Is there any special name for this algorithm? I told it to an Informatics professor, he just called it "Maximum Path on a DAG", but it doesn't sound good when you say "I solved the first problem with a Fenwick Tree, the second with Dijkstra, and the third with Maximum Path".

    Read the article

  • Implementing coroutines in Java

    - by JUST MY correct OPINION
    This question is related to my question on existing coroutine implementations in Java. If, as I suspect, it turns out that there is no full implementation of coroutines currently available in Java, what would be required to implement them? As I said in that question, I know about the following: You can implement "coroutines" as threads/thread pools behind the scenes. You can do tricksy things with JVM bytecode behind the scenes to make coroutines possible. The so-called "Da Vinci Machine" JVM implementation has primitives that make coroutines doable without bytecode manipulation. There are various JNI-based approaches to coroutines also possible. I'll address each one's deficiencies in turn. Thread-based coroutines This "solution" is pathological. The whole point of coroutines is to avoid the overhead of threading, locking, kernel scheduling, etc. Coroutines are supposed to be light and fast and to execute only in user space. Implementing them in terms of full-tilt threads with tight restrictions gets rid of all the advantages. JVM bytecode manipulation This solution is more practical, albeit a bit difficult to pull off. This is roughly the same as jumping down into assembly language for coroutine libraries in C (which is how many of them work) with the advantage that you have only one architecture to worry about and get right. It also ties you down to only running your code on fully-compliant JVM stacks (which means, for example, no Android) unless you can find a way to do the same thing on the non-compliant stack. If you do find a way to do this, however, you have now doubled your system complexity and testing needs. The Da Vinci Machine The Da Vinci Machine is cool for experimentation, but since it is not a standard JVM its features aren't going to be available everywhere. Indeed I suspect most production environments would specifically forbid the use of the Da Vinci Machine. Thus I could use this to make cool experiments but not for any code I expect to release to the real world. This also has the added problem similar to the JVM bytecode manipulation solution above: won't work on alternative stacks (like Android's). JNI implementation This solution renders the point of doing this in Java at all moot. Each combination of CPU and operating system requires independent testing and each is a point of potentially frustrating subtle failure. Alternatively, of course, I could tie myself down to one platform entirely but this, too, makes the point of doing things in Java entirely moot. So... Is there any way to implement coroutines in Java without using one of these four techniques? Or will I be forced to use the one of those four that smells the least (JVM manipulation) instead?

    Read the article

  • Saving WPF WIndow and Position

    - by moogs
    What would be the best way to save the window position and size in a WPF app? Currently, I'm saving the window size and position of a WPF App. Here are the events I handle: SourceInitialized : The saved info is loaded on to the window WindowClosing : The current info is saved to the backing store (I copied this from an example). The problem is, when the window is minimized and restored, the settings from the last WindowClosing is retrieved. Now, the StateChanged event fire AFTER the window has minimized, so it does not seem to be what i need. Thanks

    Read the article

  • [C#] RSACryptoServiceProvider Using the Public Key to decrypt Private Key encrypted Data ?

    - by prixone
    Hello, i went thru lots and lots of searchs and results and pages considering this matter but havent found the solution yet. Like i described in the title i want to decrypt data using my Public Key which is something i am able to do with my PHP code, my certificate is generated from my PHP page. Here is a sample of what i am trying: public string Decrypt(string data) { X509Certificate2 cert = new X509Certificate2(); cert.Import(Encoding.ASCII.GetBytes(webApi["PublicDefaultKey"])); RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PublicKey.Key; byte[] ciphertextBytes = Convert.FromBase64String(data); byte[] plaintextBytes = rsa.Decrypt(ciphertextBytes, false); return System.Text.Encoding.UTF8.GetString(plaintextBytes); } MessageBox.Show(Decrypt("pgcl93TpVfyHubuRlL72/PZN0nA4Q+HHx8Y15qGvUyTNpI6y7J13YG07ZVEyB7Dbgx63FSw9vEw1D1Z3bvNbI0gqalVfKTfHv5tKVc7Y6nQwQYwoODpUhVpa/K9OP1lqx4esnxqwJx95G0rqgJTdS+Yo773s5UcJrHzzbsX2z+w=")); here is the public key i am using for tests: -----BEGIN CERTIFICATE----- MIIDxDCCAy2gAwIBAgIBADANBgkqhkiG9w0BAQUFADCBozELMAkGA1UEBhMCVUsx EDAOBgNVBAgTB0VuZ2xhbmQxDzANBgNVBAcTBkxvbmRvbjESMBAGA1UEChMJTU1P Q2xldmVyMSMwIQYDVQQLExpNTU9DbGV2ZXIgRGV2ZWxvcGVyJ3MgVGVhbTESMBAG A1UEAxMJTU1PQ2xldmVyMSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QG1tb2NsZXZl ci5jb20wHhcNMTAwNTE2MTkxNDQ4WhcNMTEwNTE2MTkxNDQ4WjCBozELMAkGA1UE BhMCVUsxEDAOBgNVBAgTB0VuZ2xhbmQxDzANBgNVBAcTBkxvbmRvbjESMBAGA1UE ChMJTU1PQ2xldmVyMSMwIQYDVQQLExpNTU9DbGV2ZXIgRGV2ZWxvcGVyJ3MgVGVh bTESMBAGA1UEAxMJTU1PQ2xldmVyMSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QG1t b2NsZXZlci5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMozHr17PL+N seZyadobUmpIV+RKqmRUGX0USIdj0i0yvwvltu3AIKAyRhGz16053jZV2WeglCEj qfiewF9sYTAAoIVGtdd/sZvO4uUcng9crSzDo0CrEPs/Tn5SunmlmyFlZfdlqpAM XXLno/HMo9cza0CrcMnRokaTiu8szBeBAgMBAAGjggEEMIIBADAdBgNVHQ4EFgQU zip+3/hBIpjvdcSoWQ2rW+xDEWAwgdAGA1UdIwSByDCBxYAUzip+3/hBIpjvdcSo WQ2rW+xDEWChgamkgaYwgaMxCzAJBgNVBAYTAlVLMRAwDgYDVQQIEwdFbmdsYW5k MQ8wDQYDVQQHEwZMb25kb24xEjAQBgNVBAoTCU1NT0NsZXZlcjEjMCEGA1UECxMa TU1PQ2xldmVyIERldmVsb3BlcidzIFRlYW0xEjAQBgNVBAMTCU1NT0NsZXZlcjEk MCIGCSqGSIb3DQEJARYVc3VwcG9ydEBtbW9jbGV2ZXIuY29tggEAMAwGA1UdEwQF MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAyU6RLifBXSyQUkBFnTcI6h5ryujh+6o6 eQ1wuPOPmRdYJZuWx/5mjMpIF13sYlNorcOv5WaEnp8/Jfuwc9h/jXlcujser0UE WoaaFwK81O801Xkv2zEm2UUWiOabrGTIT4FVy3gCUXJYjaCnvfSdmkfLJOQxNHVt 4NTMp7IeF60= -----END CERTIFICATE----- by default, the PHP generates the key in PKCS as far as i know, from my C# code i can encrypt using my publick key with out any problems and decrypt it on my php page but so far i was not able to decrypt data sent from my php page encrypted with the private key which is something i can do on my php... i did like some help to understand what i am doing wrong... the error when i run the functions is "bad data" at rsa.Decrypt(ciphertextBytes, false); which i couldnt found anymore information at it... Thanks for any and all the help :)

    Read the article

  • JSP taglib with tags-appender

    - by tabdulin
    Using tiles, spring web mvc and a lot of jsp files. I need some tags with following logic: <tl:append tag="script"> ... javascript code ... </tl:append> This jsp tag would append javascript code to bottom of in the . Just wanna have javascript in one place. Also, I wanna use such taglib for css styles and so on. Are there any appropriate taglibs with such logic?

    Read the article

  • python multithreading for dummies

    - by albruno
    trying to find a simple example that clearly shows a single task being divided for multi-threading. Quite frankly... many of the examples are overly sophisticated thus.... making the flow tougher to play with... anyone care to share their breakthrough sample or point to an example? As well, what is the best docs? many google lookups are too specific (for me at this stage) Thanks in advance.

    Read the article

  • Genetic Programming Online Learning

    - by Lirik
    Has anybody seen a GP implemented with online learning rather than the standard offline learning? I've done some stuff with genetic programs and I simply can't figure out what would be a good way to make the learning process online. Please let me know if you have any ideas, seen any implementations, or have any references that I can look at.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >