Daily Archives

Articles indexed Monday May 17 2010

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

  • manage.py runserver not working

    - by Dan Appleyard
    I am new to django and python in general, so pardon me for any simple mistakes I may be doing. I am trying to setup my first django project on my local windows vista machine. I have created the project successfully with no problems. The issue I am coming across is when my settings.py has values for my database keys, the manage.py runserver command is failing. If I have values in settings before I run the command, as soon as I run it I get errors. If I have already run the command and the server is running, as soon as I edit the settings file with values, the errors show up in my still open command prompt. The inner most exception seems to "Error loading MySQLdb module: No module named MYSQLdb". If I leave the settings.py blank, the command executes with no problems. Any advice would be greatly appreciated! Thanks

    Read the article

  • Sparse parameter selection using Genetic Algorithm

    - by bgbg
    Hello, I'm facing a parameter selection problem, which I would like to solve using Genetic Algorithm (GA). I'm supposed to select not more than 4 parameters out of 3000 possible ones. Using the binary chromosome representation seems like a natural choice. The evaluation function punishes too many "selected" attributes and if the number of attributes is acceptable, it then evaluates the selection. The problem is that in these sparse conditions the GA can hardly improve the population. Neither the average fitness cost, nor the fitness of the "worst" individual improves over the generations. All I see is slight (even tiny) improvement in the score of the best individual, which, I suppose, is a result of random sampling. Encoding the problem using indices of the parameters doesn't work either. This is most probably, due to the fact that the chromosomes are directional, while the selection problem isn't (i.e. chromosomes [1, 2, 3, 4]; [4, 3, 2, 1]; [3, 2, 4, 1] etc. are identical) What problem representation would you suggest? P.S If this matters, I use PyEvolve.

    Read the article

  • AStar in a specific case in C#

    - by KiTe
    Hello. To an intership, I have use the A* algorithm in the following case : the unit shape is a square of height and width of 1, we can travel from a zone represented by a rectangle from another, but we can't travel outside these predifined areas, we can go from a rectangle to another through a door, represented by a segment on corresponding square edge. Here are the 2 things I already did but which didn't satisfied my boss : 1 : I created the following classes : -a Door class which contains the location of the 2 separated squares and the door's orientation (top, left, bottom, right), -a Map class which contains a door list, a rectangle list representing the walkable areas and a 2D array representing the ground's squares (for additionnal infomations through an enumeration) - classes for the A* algorithm (node, AStar) 2 : -a MapCase class, which contains information about the case effect and doors through an enumeration (with [FLAGS] attribute set on, to be able to cummulate several information on each case) -a Map classes which only contains a 2D array of MapCase classes - the classes for the A* algorithm (still node an AStar). Since the 2 version is better than the first (less useless calculation, better map classes architecture), my boss is not still satisfied about my mapping classes architecture. The A* and node classes are good and easily mainainable, so I don't think I have to explain them deeper for now. So here is my asking : has somebody a good idea to implement the A* with the problem specification (rectangle walkable but with a square unit area, travelling through doors)? He said that a grid vision of the problem (so a 2D array) shouldn't be the correct way to solve the problem. I wish I've been clear while exposing my problem .. Thanks KiTe

    Read the article

  • Android: How to invalidate multiple parts of screen

    - by user342731
    I need to be able to selectively invalidate multiple (about 20) rectangles on the screen for performance reasons, so tried the following: Vector<Rect> myRects = new Vector<Rect>(); // ... add some Rects to myRects for (Rect r : myRects) { invalidate(r); } However this seems to invalidates a union of all the Rect's, forming one large rectangle which covers all of small ones I'm trying to invalidate. How can one invalidate multiple areas on the screen, and only those areas?

    Read the article

  • How to avoid that the robot gets trapped in local minimum?

    - by nesmoht
    Hi, I have some time occupying myself with motion planning for robots, and have for some time wanted to explore the possibility of improving the opportunities as "potential field" method offers. My challenge is to avoid that the robot gets trapped in "local minimum" when using the "potential field" method. Instead of using a "random walk" approach to avoid that the robot gets trapped I have thought about whether it is possible to implement a variation of A* which could act as a sort of guide for precisely to avoid that the robot gets trapped in "local minimum". Is there some of the experiences of this kind, or can refer to literature, which avoids local minimum in a more effective way than the one used in the "random walk" approach.

    Read the article

  • Searching in graphs trees with Depth/Breadth first/A* algorithms

    - by devoured elysium
    I have a couple of questions about searching in graphs/trees: Let's assume I have an empty chess board and I want to move a pawn around from point A to B. A. When using depth first search or breadth first search must we use open and closed lists ? This is, a list that has all the elements to check, and other with all other elements that were already checked? Is it even possible to do it without having those lists? What about A*, does it need it? B. When using lists, after having found a solution, how can you get the sequence of states from A to B? I assume when you have items in the open and closed list, instead of just having the (x, y) states, you have an "extended state" formed with (x, y, parent_of_this_node) ? C. State A has 4 possible moves (right, left, up, down). If I do as first move left, should I let it in the next state come back to the original state? This, is, do the "right" move? If not, must I transverse the search tree every time to check which states I've been to? D. When I see a state in the tree where I've already been, should I just ignore it, as I know it's a dead end? I guess to do this I'd have to always keep the list of visited states, right? E. Is there any difference between search trees and graphs? Are they just different ways to look at the same thing?

    Read the article

  • SQL Selects on subsets

    - by Adam
    I need to check if a row exists in a database; however, I am trying to find the way to do this that offers the best performance. This is best summarised with an example. Let's assume I have the following table: dbo.Person( FirstName varchar(50), LastName varchar(50), Company varchar(50) ) Assume this table has millions of rows, however ONLY the column Company has an index. I want to find out if a particular combination of FirstName, LastName and Company exists. I know I can do this: IF EXISTS(select 1 from dbo.Person where FirstName = @FirstName and LastName = @LastName and Company = @Company) Begin .... End However, unless I'm mistaken, that will do a full table scan. What I'd really like it to do is a query where it utilises the index. With the table above, I know that the following query will have great performance, since it uses the index: Select * from dbo.Person where Company = @Company Is there anyway to make the search only on that subset of data? e.g. something like this: select * from ( Select * from dbo.Person where Company = @Company ) where FirstName = @FirstName and LastName = @LastName That way, it would only be doing a table scan on a much narrower collection of data. I know the query above won't work, but is there a query that would? Oh, and I am unable to create temporary tables, as the user will only have read access.

    Read the article

  • Visual Studio and TFS for Test manager

    - by bisjom
    Hi I have Visual Studio test manager installed in my machine, I have TFS Server installed on another server, I want to connect to that TFS server with new VS 2010. Do I need to install the Visual studio 2010 full version or just the test manager? I installed test manager and its asking a URL to add and I added the one we already have , but its not connecting to that site. Do I need to isntall Full version and TFS on same machine?? Please help Thanks

    Read the article

  • Neural Net Optimize w/ Genetic Algorithm

    - by ServAce85
    Is a genetic algorithm the most efficient way to optimize the number of hidden nodes and the amount of training done on an artificial neural network? I am coding neural networks using the NNToolbox in Matlab. I am open to any other suggestions of optimization techniques, but I'm most familiar with GA's.

    Read the article

  • method for specialized pathfinding?

    - by rlbond
    I am working on a roguelike in my (very little) free time. Each level will basically be a few rectangular rooms connected together by paths. I want the paths between rooms to be natural-looking and windy, however. For example, I would not consider the following natural-looking: B X X X XX XX XX AXX I really want something more like this: B X XXXX X X X X AXXXXXXXX These paths must satisfy a few properties: I must be able to specify an area inside which they are bounded, I must be able to parameterize how windy and lengthy they are, The lines should not look like they started at one path and ended at the other. For example, the first example above looks as if it started at A and ended at B, because it basically changed directions repeatedly until it lined up with B and then just went straight there. I was hoping to use A*, but honestly I have no idea what my heuristic would be. I have also considered using a genetic algorithm, but I don't know how practical that method might end up. My question is, what is a good way to get the results I want? Please do not just specify a method like "A*" or "Dijkstra's algorithm," because I also need help with a good heuristic.

    Read the article

  • Using GA in GUI

    - by AlexT
    Sorry if this isn't clear as I'm writing this on a mobile device and I'm trying to make it quick. I've written a basic Genetic Algorithm with a binary encoding (genes) that builds a fitness value and evolves through several iterations using tournament selection, mutation and crossover. As a basic command-line example it seems to work. The problem I've got is with applying a genetic algorithm within a GUI as I am writing a maze-solving program that uses the GA to find a method through a maze. How do I turn my random binary encoded genes and fitness function (add all the binary values together) into a method to control a bot around a maze? I have built a basic GUI in Java consisting of a maze of labels (like a grid) with the available routes being in blue and the walls being in black. To reiterate my GA performs well and contains what any typical GA would (fitness method, get and set population, selection, crossover, etc) but now I need to plug it into a GUI to get my maze running. What needs to go where in order to get a bot that can move in different directions depending on what the GA says? Rough pseudocode would be great if possible As requested, an Individual is built using a separate class (Indiv), with all the main work being done in a Pop class. When a new individual is instantiated an array of ints represent the genes of said individual, with the genes being picked at random from a number between 0 and 1. The fitness function merely adds together the value of these genes and in the Pop class handles selection, mutation and crossover of two selected individuals. There's not much else to it, the command line program just shows evolution over n generations with the total fitness improving over each iteration. EDIT: It's starting to make a bit more sense now, although there are a few things that are bugging me... As Adamski has suggested I want to create an "Agent" with the options shown below. The problem I have is where the random bit string comes into play here. The agent knows where the walls are and has it laid out in a 4 bit string (i.e. 0111), but how does this affect the random 32 bit string? (i.e. 10001011011001001010011011010101) If I have the following maze (x is the start place, 2 is the goal, 1 is the wall): x 1 1 1 1 0 0 1 0 0 1 0 0 0 2 If I turn left I'm facing the wrong way and the agent will move completely off the maze if it moves forward. I assume that the first generation of the string will be completely random and it will evolve as the fitness grows but I don't get how the string will work within a maze. So, to get this straight... The fitness is the result of when the agent is able to move and is by a wall. The genes are a string of 32 bits, split into 16 sets of 2 bits to show the available actions and for the robot to move the two bits need to be passed with four bits from the agent showings its position near the walls. If the move is to go past a wall the move isn't made and it is deemed invalid and if the move is made and if a new wall is found then the fitness goes up. Is that right?

    Read the article

  • How do you avoid an invalid search space in a genetic algorithm?

    - by Dave
    I am developing a GA for a school project and I've noticed that upon evaluating my functions for fitness, an individual is equivalent to its inverse. For example, the set (1, 1, -1, 1) is equivalent to (-1, -1, 1, -1). To shrink my search space and reach a solution more efficiently, how can I avoid my crossovers from searching in this second half of the search space?

    Read the article

  • how to work with strings and integers as bit strings in python?

    - by Manuel
    Hello! I'm developing a Genetic Algorithm in python were chromosomes are composed of strings and integers. To apply the genetic operations, I want to convert these groups of integers and strings into bit strings. For example, if one chromosome is: ["Hello", 4, "anotherString"] I'd like it to become something like: 0100100100101001010011110011 (this is not actual translation). So... How can I do this? Chromosomes will contain the same amount of strings and integers, but this numbers can vary from one algorithm run to another. To be clear, what I want to obtain is the bit representation of each element in the chromosome concatenated. If you think this would not be the best way to apply genetic operators (such as mutation and simple crossover) just tell me! I'm open to new ideas. Thanks a lot! Manuel

    Read the article

  • Understanding pattern matching with cons operator

    - by Mathias
    In "Programming F#" I came across a pattern-matching like this one (I simplified a bit): let rec len list = match list with | [] -> 0 | [_] -> 1 | head :: tail -> 1 + len tail;; Practically, I understand that the last match recognizes the head and tail of the list. Conceptually, I don't get why it works. As far as I understand, :: is the cons operator, which appends a value in head position of a list, but it doesn't look to me like it is being used as an operator here. Should I understand this as a "special syntax" for lists, where :: is interpreted as an operator or a "match pattern" depending on context? Or can the same idea be extended for types other than lists, with other operators?

    Read the article

  • No scrolling occurs when UITableView scrollToRowAtIndexPath is invoked

    - by theactiveactor
    My view contains a simple TableView with 6 rows and a button that invokes doScroll when clicked. My objective for doScroll() is simply scroll to the 5th cell such that it's at top of the table view. - (void)doScroll: (id)sender { NSIndexPath *index = [NSIndexPath indexPathForRow:4 inSection: 1]; [m_tableView scrollToRowAtIndexPath:index atScrollPosition:UITableViewScrollPositionTop animated:YES]; } However when doScroll is invoked, the tableview scrolls only slightly. I suspect this has something to do with the size of the scroll view. So I tried increasing the height of m_tableview.contentsize before scrolling. After I do this however, no scrolling occurs at all... The view controller is a simple UIViewController and refers to the table view via IBOutlet. For some reason, scrolling works as expected for the default Navigation Based Application, where the controller is a UITableViewController

    Read the article

  • Special scheduling Algorithm (pattern expansion)

    - by tovare
    Question Do you think genetic algorithms worth trying out for the problem below, or will I hit local-minima issues? I think maybe aspects of the problem is great for a generator / fitness-function style setup. (If you've botched a similar project I would love hear from you, and not do something similar) Thank you for any tips on how to structure things and nail this right. The problem I'm searching a good scheduling algorithm to use for the following real-world problem. I have a sequence with 15 slots like this (The digits may vary from 0 to 20) : 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 (And there are in total 10 different sequences of this type) Each sequence needs to expand into an array, where each slot can take 1 position. 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 The constraints on the matrix is that: [row-wise, i.e. horizontally] The number of ones placed, must either be 11 or 111 [row-wise] The distance between two sequences of 1 needs to be a minimum of 00 The sum of each column should match the original array. The number of rows in the matrix should be optimized. The array then needs to allocate one of 4 different matrixes, which may have different number of rows: A, B, C, D A, B, C and D are real-world departments. The load needs to be placed reasonably fair during the course of a 10-day period, not to interfere with other department goals. Each of the matrix is compared with expansion of 10 different original sequences so you have: A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 D1, D2, D3, D4, D5, D6, D7, D8, D9, D10 Certain spots on these may be reserved (Not sure if I should make it just reserved/not reserved or function-based). The reserved spots might be meetings and other events The sum of each row (for instance all the A's) should be approximately the same within 2%. i.e. sum(A1 through A10) should be approximately the same as (B1 through B10) etc. The number of rows can vary, so you have for instance: A1: 5 rows A2: 5 rows A3: 1 row, where that single row could for instance be: 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 etc.. Sub problem* I'de be very happy to solve only part of the problem. For instance being able to input: 1 1 2 3 4 2 2 3 4 2 2 3 3 2 3 And get an appropriate array of sequences with 1's and 0's minimized on the number of rows following th constraints above.

    Read the article

  • very large string in memory

    - by bushman
    Hi, I am writing a program for formatting 100s of MB String data (nearing a gig) into xml == And I am required to return it as a response to an HTTP (GET) request . I am using a StringWriter/XmlWriter to build an XML of the records in a loop and returning the stringWriter.ToString() during testing I saw a few --out of memory exceptions-- and quite clueless on how to find a solution? do you guys have any suggestions for a memory optimized delivery of the response? is there a memory efficient way of encoding the data? or maybe chunking the data -- I just can not think of how to return it without building the whole thing into one HUGE string object thanks

    Read the article

  • GA Framework for Virtual Machines

    - by PeanutPower
    Does anyone know of any .NET genetic algorithm frameworks for evolving instructions sets in virtual machines to solve abstract problems? I would be particularly interested in a framework which allows virtual machines to self propagate within a pool and evolve against a fitness function determined by a data set with "good" outputs given expected inputs.

    Read the article

  • Sending SMS using Java ME application

    - by iamrohitbanga
    I want to a Java ME application that transfers any SMS received to a PC using bluetooth. The PC can then direct the Java ME application via bluetooth to send a response SMS. Is there library available for this architecture or I have to design it myself? Is this approach correct or a better one exists? I want to use bluetooth as then I will not have dependency on the cable.

    Read the article

  • How to optimize neural network by using genetic algorithm?

    - by Billy Coen
    I'm quite new with this topic so any help would be great. What i need is to optimize a neural network in MATLAB by using GA. My network has [2x98] input and [1x98] target, i've tried consulting matlab help but im still kind of clueless about what to do :( so, any help would be appreciated. Thanks in advance. edit: i guess i didn't say what is there to be optimized as Dan said in the 1st answer. I guess most important thing is number of hidden neurons. And maybe number of hidden layers and training parameters like number of epochs or so. Sorry for not providing enough info, i'm still learning about this.

    Read the article

  • Creating a "crossover" function for a genetic algorithm to improve network paths

    - by Dave
    Hi, I'm trying to develop a genetic algorithm that will find the most efficient way to connect a given number of nodes at specified locations. All the nodes on the network must be able to connect to the server node and there must be no cycles within the network. It's basically a tree. I have a function that can measure the "fitness" of any given network layout. What's stopping me is that I can't think of a crossover function that would take 2 network structures (parents) and somehow mix them to create offspring that would meet the above conditions. Any ideas? Clarification: The nodes each have a fixed x,y coordiante position. Only the routes between them can be altered.

    Read the article

  • Testing for the presence of a character in an string in C

    - by Prab
    What's wrong with this? #include <stdio.h> void main(){ char *s="some text"; printf("%d",is_in(s,'t')); } int is_in(char *s, char c){ while(*s){ if(*s==c) return 1; s++; } return 0; } I get the following compile time error with GCC: test.c:9: error: conflicting types for ‘is_in’ test.c:9: note: an argument type that has a default promotion can’t match an empty parameter name list declaration test.c:5: note: previous implicit declaration of ‘is_in’ was here

    Read the article

  • Using c#,c/c++ or java to improve BBN with GA

    - by madicemickael
    I have a little problem in my little project , I wish that someone here could help me! I am planning to use a bayesian network as a decision factor in my game AI and I want to improve the decision making every step of the way , anyone knows how to do that ? Any tutorials / existing implementations will be very good,I hope some of you could help me. I heard that a programmer in this community did a good implementation of this put together for poker game AI.I am planning to use it like him ,but in another poker(Texas) or maybe Rentz. Looking for C/c++ or c# or java code. Thanks , Mike

    Read the article

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