Search Results

Search found 14553 results on 583 pages for 'shortest path'.

Page 1/583 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • get the path of moved directory/file (source path and destination path)

    - by Ghanshyam Rathod
    When one directory is moved to other destination path, then i want to log the entry of original source path and entry of the path where it moved. any command is already available ? or any other way of doing this task? Ex: D1 = /home/user/Documents/test D2 = /home/user/Documents/Data/test when i moved D1 directory to the destination path to D2 directory then i want to log, like "test" directory is moved from D1 to D2 path Thanks

    Read the article

  • Shortest Common Superstring: find shortest string that contains all given string fragments

    - by occulus
    Given some string fragments, I would like to find the shortest possible single string ("output string") that contains all the fragments. Fragments can overlap each other in the output string. Example: For the string fragments: BCDA AGF ABC The following output string contains all fragments, and was made by naive appending: BCDAAGFABC However this output string is better (shorter), as it employs overlaps: ABCDAGF ^ ABC ^ BCDA ^ AGF I'm looking for algorithms for this problem. It's not absolutely important to find the strictly shortest output string, but the shorter the better. I'm looking for an algorithm better than the obvious naive one that would try appending all permutations of the input fragments and removing overlaps (which would appear to be NP-Complete). I've started work on a solution and it's proving quite interesting; I'd like to see what other people might come up with. I'll add my work-in-progress to this question in a while.

    Read the article

  • creating the nodes for path finding during run time - more like path making and more

    - by bigbadbabybear
    i'm making my 1st game. i'm using javascript as i currently want to learn to make games without needing to learn another language but this is more of a general game dev question its a 2d turn-based tile/grid game. you can check it here http://www.patinterotest.tk/ it creates a movable area when you hover a player and it implements the A* algo for moving the player. The Problem: i want to make the 'dynamic movable area creation' already implement a limited number of steps for a player. The Questions: what is a good way to do this? is there another algorithm to use for this? the A* algorithm needs a start and destination, with what i want to do i don't have a destination or should i just limit the iteration of the A* algo to the steps variable? hopefully you understand the problem & questions easily

    Read the article

  • Apache Error Log - "Web Path" instead of Filesystem Path

    - by Craconia
    Hello everyone, I'm running Apache on Linux and I'm using OpenSSH to provide SFTP access to some customers so they can upload their pages and also look at their respective site logs (access & error). I'm using the new feature in OpenSSH to chroot their SFTP access and so far so good. My problem is that on the error_log, every reference for "File not found..." is given using the OS filesystem path as opposed to the "Web" path. I'd rather have the web path on the error log in order not to reveal the OS path. Since I'm already chrooting the users, I don't want to reveal WHERE on the OS their files are actually located... Is it possible to change this behaviour via any directive? I tried looking for it but couldn't find anything :( Thanks, Craconia

    Read the article

  • How to get absolute path from path with system path variables?

    - by The_Fox
    Is there an easy way to translate a path with system path variables to an absolute path? So %ProgramFiles%\Internet Explorer\hmmapi.dll becomes C:\Program Files\Internet Explorer\hmmapi.dll I like to know if there is an API call that can do this, or do I have to do this the hard way and detect %..% sequences and replace them with the appropriate environment variable?

    Read the article

  • Finding shortest path on a hexagonal grid

    - by Timothy Mayes
    I'm writing a turn based game that has some simulation elements. One task i'm hung up on currently is with path finding. What I want to do is, each turn, move an ai adventurer one tile closer to his target using his current x,y and his target x,y. In trying to figure this out myself I can determine 4 directions no problem by using dx = currentX - targetY dy = currentY - targetY but I'm not sure how to determine which of the 6 directions is actually the "best" or "shortest" route. For example the way its setup currently I use East, West, NE, NW, SE, SW but to get to the NE tile i move East then NW instead of just moving NW. I hope this wasn't all rambling. Even just a link or two to get me started would be nice. Most of the info i've found is on drawing the grids and groking the wierd coordinate system needed. Thanks in advance Tim

    Read the article

  • Mapping Absolute / Relative (Local) Paths to Absolute URLs

    - by Alix Axel
    I need a fast and reliable way to map an absolute or relative local path (say ./images/Mafalda.jpg) to it's corresponding absolute URL, so far I've managed to come up with this: function Path($path) { if (file_exists($path) === true) { return rtrim(str_replace('\\', '/', realpath($path)), '/') . (is_dir($path) ? '/' : ''); } return false; } function URL($path) { $path = Path($path); if ($path !== false) { return str_replace($_SERVER['DOCUMENT_ROOT'], getservbyport($_SERVER['SERVER_PORT'], 'tcp') . '://' . $_SERVER['HTTP_HOST'], $path); } return false; } URL('./images/Mafalda.jpg'); // http://domain.com/images/Mafalda.jpg Seems to be working as expected, but since this is a critical feature to my app I want to ask if anyone can spot any problem that I might have missed and optimizations are also welcome since I'm going to use this function several times per each request.

    Read the article

  • Javascript A* path finding ENEMY MOVEMENT in 3D environment

    - by faiz
    iam trying to implement pathfinding algorithm using PATHFINDING.JS in 3D world using webgl. iam have made a matrix of 200x200. and placed my enemy(swat) in it .iam confused in implmenting the path. i have tried implementing the path by compparing the value of each array value with swat's position . it works ! but ** THE ENEMY KEEPS GOING FROM THE UNWALKABLE AREA OF MY MATRIX....like the enemy should not move from 119,100(x=119,z=100) but its moving from that co-ordinate too ..... can any one help me out in this regard .. *prob facing :* enemy (swat character keeps moving from the wall /unwalkable area) wanted solution : enemy does not move from the unwalkable path.. ** function draw() { grid = new PF.Grid(200, 200); grid.setWalkableAt( 119,100, false); grid.setWalkableAt( 107,100, false); grid.setWalkableAt( 103,104, false); grid.setWalkableAt( 103,100, false); grid.setWalkableAt( 135,100, false); grid.setWalkableAt( 103,120, false); grid.setWalkableAt( 103,112, false); grid.setWalkableAt( 127,100, false); grid.setWalkableAt( 123,100, false); grid.setWalkableAt( 139,100, false); grid.setWalkableAt( 103,124, false); grid.setWalkableAt( 103,128, false); grid.setWalkableAt( 115,100, false); grid.setWalkableAt( 131,100, false); grid.setWalkableAt( 103,116, false); grid.setWalkableAt( 103,108, false); grid.setWalkableAt( 111,100, false); grid.setWalkableAt( 103,132, false); finder = new PF.AStarFinder(); f1=Math.abs(first_person_controller.position.x); f2=Math.abs(first_person_controller.position.z); ff1=Math.round(f1); ff2=Math.round(f2); s1=Math.abs(swat.position.x); s2=Math.abs(swat.position.z); ss1=Math.round(s1); ss2=Math.round(s1); path = finder.findPath(ss1,ss2,ff1,ff2, grid); size=path.length-1; Ai(); } function Ai(){ if (i<size) { if (swat.position.x >= path[i][0]) { swat.position.x -= 0.3; if(Math.floor(swat.position.x) == path[i][0]) { i=i+1; } } else if(swat.position.x <= path[i][0]) { swat.position.x += 0.3; if(Math.floor(swat.position.x) == path[i][0]) { i=i+1; } } } if (j<size) { if((Math.abs(swat.position.z)) >= path[j][1]) { swat.position.z -= 0.3; if(Math.floor(Math.abs(swat.position.z)) == path[j][1]) { j=j+1; } } else if((Math.abs(swat.position.z)) <= path[j][1]) { swat.position.z += 0.3; if(Math.floor(Math.abs(swat.position.z)) == path[j][1]) { j=j+1; } } } }

    Read the article

  • A* navigational mesh path finding

    - by theguywholikeslinux
    So I've been making this top down 2D java game in this framework called Greenfoot [1] and I've been working on the AI for the guys you are gonna fight. I want them to be able to move around the world realistically so I soon realized, amongst a couple of other things, I would need some kind of pathfinding. I have made two A* prototypes. One is grid based and then I made one that works with waypoints so now I need to work out a way to get from a 2d "map" of the obstacles/buildings to a graph of nodes that I can make a path from. The actual pathfinding seems fine, just my open and closed lists could use a more efficient data structure, but I'll get to that if and when I need to. I intend to use a navigational mesh for all the reasons out lined in this post on ai-blog.net [2]. However, the problem I have faced is that what A* thinks is the shortest path from the polygon centres/edges is not necessarily the shortest path if you travel through any part of the node. To get a better idea you can see the question I asked on stackoverflow [3]. I got a good answer concerning a visibility graph. I have since purchased the book (Computational Geometry: Algorithms and Applications [4]) and read further into the topic, however I am still in favour of a navigational mesh (See "Managing Complexity" [5] from Amit’s Notes about Path-Finding [6]). (As a side note, maybe I could possibly use Theta* to convert multiple waypoints into one straight line if the first and last are not obscured. Or each time I move back check to the waypoint before last to see if I can go straight from that to this) So basically what I want is a navigational mesh where once I have put it through a funnel algorithm (e.g. this one from Digesting Duck [7]) I will get the true shortest path, rather than get one that is the shortest path following node to node only, but not the actual shortest given that you can go through some polygons and skip nodes/edges. Oh and I also want to know how you suggest storing the information concerning the polygons. For the waypoint prototype example I made I just had each node as an object and stored a list of all the other nodes you could travel to from that node, I'm guessing that won't work with polygons? and how to I tell if a polygon is open/traversable or if it is a solid object? How do I store which nodes make up the polygon? Finally, for the record: I do want to programme this by myself from scratch even though there are already other solutions available and I don't intend to be (re) using this code in anything other than this game so it does not matter that it will inevitably be poor quality. http://greenfoot.org http://www.ai-blog.net/archives/000152.html http://stackoverflow.com/q/7585515/ http://www.cs.uu.nl/geobook/ http://theory.stanford.edu/~amitp/GameProgramming/MapRepresentations.html http://theory.stanford.edu/~amitp/GameProgramming/ http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html

    Read the article

  • How to format a dos path to a unix path on cygwin command line

    - by Jennette
    When using Cygwin, I frequently copy a Windows path and manually edit all of the slashes to Unix format. For example, if I am using Cygwin and need to change directory I enter: cd C:\windows\path then edit this to cd C:/windows/path (Typically, the path is much longer than that). Is there a way to use sed, or something else to do this automatically? For example, I tried: echo C:\windows\path|sed 's|\|g' but got the following error sed: -e expression #1, char 7: unterminated `s' command My goal is to reduce the typing, so maybe I could write a program which I could call. Ideally I would type: conversionScript cd C:/windows/path and this would be equivalent to typing: cd C:\windows\path

    Read the article

  • How to minimize total cost of shortest path tree

    - by Michael
    I have a directed acyclic graph with positive edge-weights. It has a single source and a set of targets (vertices furthest from the source). I find the shortest paths from the source to each target. Some of these paths overlap. What I want is a shortest path tree which minimizes the total sum of weights over all edges. For example, consider two of the targets. Given all edge weights equal, if they share a single shortest path for most of their length, then that is preferable to two mostly non-overlapping shortest paths (fewer edges in the tree equals lower overall cost). Another example: two paths are non-overlapping for a small part of their length, with high cost for the non-overlapping paths, but low cost for the long shared path (low combined cost). On the other hand, two paths are non-overlapping for most of their length, with low costs for the non-overlapping paths, but high cost for the short shared path (also, low combined cost). There are many combinations. I want to find solutions with the lowest overall cost, given all the shortest paths from source to target. Does this ring any bells with anyone? Can anyone point me to relevant algorithms or analogous applications? Cheers!

    Read the article

  • How to proceed on the waypoint path?

    - by Alpha Carinae
    I'm using Dijkstra algorithm to find shortest path and I'm drawing this path on the screen. As the character object moves on, path updates itself(shortens as the object approaches the target and gets longer as the object moves away from it.) I tried to visualize my problem. This is the beginning state. 'A' node is the target, path is the blue and the object is the green one. I draw this path, from object to the closest node. In this case my problem occurs. Because 'D' node is more closer to the object than 'C' node, something like this happens: So, how can i decide that the object passed the 'D' node? Path should be look like this: One thing comes to my mind is that I use some distance variables between the two closest nodes in the route path. (In this example these are 'C' and 'D' nodes.) As the object approaches 'C' and moves away from the 'D' node at the same time, this means character passed the 'D'. However, I think there are some standardized and easy ways to solve this. What approach should I take?

    Read the article

  • User directory in path in zsh: not working

    - by Yar
    I'm doing this in my .zshrc PATH="~/scripts:$PATH" and if I do echo $PATH it appears as the first thing in the path. Yet this directory isn't included in the executable path (nor for tab-completion). What am I doing wrong? ls ~/scripts shows the directory as expected. Edit: This works, though... I guess ~ doesn't work in the path? #PATH="~/scripts:$PATH" PATH="/Users/yar/scripts:$PATH"

    Read the article

  • User directory in PATH in zsh: ~ Does Not Work

    - by Yar
    I'm doing this in my .zshrc PATH="~/scripts:$PATH" and if I do echo $PATH it appears as the first thing in the path. Yet this directory isn't included in the executable path (nor for tab-completion). What am I doing wrong? ls ~/scripts shows the directory as expected. Edit: This works, though... I guess ~ doesn't work in the path? #PATH="~/scripts:$PATH" PATH="/Users/yar/scripts:$PATH"

    Read the article

  • Javascript A* path finding

    - by Veyha
    I am trying to learn A* path finding. I am using this library - https://github.com/qiao/PathFinding.js But there is one thing I don't understand how to do. To find a path from player.x/player.y (player.x and player.y are both 0) to 10/10 I use this code var path = finder.findPath(player.x, player.y, 10, 10, grid); This gives an array of where I need to move, but how do I apply this array to my player.x and player.y? The path structure looks like this path = [[0, 0], [1, 0], [1, 1], ..., [10, 10]]

    Read the article

  • A* Start path finding in HTML5 Canvas

    - by gyhgowvi
    I'm trying implement A* Start path finding in my games(which are written with JavaScript, HTML5 Canvas). Library for A* Start found this - http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html and now I'm using this library for path finding. And with this library, I'm trying write a simple test, but stuck with one problem. I'm now done when in HTML5 canvas screen click with mouse show path until my mouse.x and mouse.y. Here is a screenshot - http://oi46.tinypic.com/14qxrl.jpg (Pink square: Player, Orange squares: path until my mouse.x/mouse.y) Code how I'm drawing the orange squares until my mouse.x/mouse.y is: 'http://pastebin.com/bfq74ybc (Sorry I do not understand how upload code in my post) My problem is I do not understand how to move my player until path goal. I've tried: 'http://pastebin.com/nVW3mhUM But with this code my player is not beung drawn.(When I run the code, player.x and player.y are equals to 0 and when I click with the mouse I get the path player blink and disappear) Maybe anyone know how to solve this problem? And I'm very very very sorry for my bad English language. :)

    Read the article

  • PHP convert external relative path to absolute path

    - by CMC
    Hello, I am trying to figure out how to convert an "external relative path" to an absolute one: I'd really like a function that will do the following: $path = "/search?q=query"; $host = "http://google.com"; $abspath = reltoabs($host, $path); And have $abspath equal to "http://google.com/search?q=query" The problem is that it is not guaranteed to be in that format, and it could already be absolute, or be pointing to a different host entirely, and I'm not quite sure how to approach this. Thanks.

    Read the article

  • Finding all the shortest paths between two nodes in unweighted directed graphs using BFS algorithm

    - by andra-isan
    Hi All, I am working on a problem that I need to find all the shortest path between two nodes in a given directed unweighted graph. I have used BFS algorithm to do the job, but unfortunately I can only print one shortest path not all of them, for example if they are 4 paths having lenght 3, my algorithm only prints the first one but I would like it to print all the four shortest paths. I was wondering in the following code, how should I change it so that all the shortest paths between two nodes could be printed out? class graphNode{ public: int id; string name; bool status; double weight;}; map<int, map<int,graphNode>* > graph; int Graph::BFS(graphNode &v, graphNode &w){ queue <int> q; map <int, int> map1; // this is to check if the node has been visited or not. std::string str= ""; map<int,int> inQ; // just to check that we do not insert the same iterm twice in the queue map <int, map<int, graphNode>* >::iterator pos; pos = graph.find(v.id); if(pos == graph.end()) { cout << v.id << " does not exists in the graph " <<endl; return 1; } int parents[graph.size()+1]; // this vector keeps track of the parents for the node parents[v.id] = -1; // there is a direct path between these two words, simply print that path as the shortest path if (findDirectEdge(v.id,w.id) == 1 ){ cout << " Shortest Path: " << v.id << " -> " << w.id << endl; return 1; } //if else{ int gn; map <int, map<int, graphNode>* >::iterator pos; q.push(v.id); inQ.insert(make_pair(v.id, v.id)); while (!q.empty()){ gn = q.front(); q.pop(); map<int, int>::iterator it; cout << " Popping: " << gn <<endl; map1.insert(make_pair(gn,gn)); //backtracing to print all the nodes if gn is the same as our target node such as w.id if (gn == w.id){ int current = w.id; cout << current << " - > "; while (current!=v.id){ current = parents[current]; cout << current << " -> "; } cout <<endl; } if ((pos = graph.find(gn)) == graph.end()) { cout << " pos is empty " <<endl; continue; } map<int, graphNode>* pn = pos->second; map<int, graphNode>::iterator p = pn->begin(); while(p != pn->end()) { map<int, int>::iterator it; //map1 keeps track of the visited nodes it = map1.find(p->first); graphNode gn1= p->second; if (it== map1.end()) { map<int, int>::iterator it1; //if the node already exits in the inQ, we do not insert it twice it1 = inQ.find(p->first); if (it1== inQ.end()){ parents[p->first] = gn; cout << " inserting " << p->first << " into the queue " <<endl; q.push(p->first); // add it to the queue } //if } //if p++; } //while } //while } I do appreciate all your great help Thanks, Andra

    Read the article

  • $PATH is not updated

    - by matr0sk1n
    It seems all about this was already discussed, but I can't resolve my problem. I have all necessary strings in /etc/paths /usr/bin /bin /usr/sbin /sbin /usr/local/bin in ~/.bash_profile export PATH=$PATH:/usr/local/mysql/bin export PATH=$PATH:$HOME/.rvm/bin export PATH="$(brew --prefix php54)/bin:$PATH" export PATH="$(brew --prefix)/bin:$PATH" But every time I execute echo $PATH in terminal, I get only /usr/local/bin if I put .bash_profile strings to .profile or .bashrc I have no effect.

    Read the article

  • Discovering path through unknown territory

    - by TravisG
    Let's say all the AI knows about it's surroundings is a pixel-map that it has which clearly shows walkable terrain and obstacles. I want the AI to be able to traverse this terrain until it finds an exit point. There are some restrictions: There is always a way to the exit in the entire map that the AI walks around in, but there may be dead ends. The path to the exit is always pretty random, meaning that if you stand at crossroads, nothing indicates which direction would be the right one to go. It doesn't matter if the AI reaches a dead end, but it has to be able walk back out of it to a previously not inspected location and continue its search there. Initially, the AI starts out knowing only the starting area of the whole map. As it walks around, new points will be added to the pixel-map as the AI corresponding to the AIs range of sight (think of it like the AI is clearing the fog of war) The problem is in 2D space. All I have is the pixel map. There are no paths in the pixel map which are "too narrow". The AI fits through everything. It shouldn't be a brute force solution. E.g. it would be possible to simply find a path to each pixel in the pixel map that is yet undiscovered (with A*, for example), which will lead to the AI discovering new pixels. This could be repeated until the end is reached. The path doesn't have to be the shortest path (this is impossible without knowing the entire map beforehand), but when movements within the visible area are calculated, the shortest and from a human standpoint most logical path should be taken (e.g. if you can see a way out of your room into a hallway, you would obviously go there instead of exploring the corner of your current room). What kind of approaches to solve this problem are there?

    Read the article

  • Coordinate based travel through multi-line path over elapsed time

    - by Chris
    I have implemented A* Path finding to decide the course of a sprite through multiple waypoints. I have done this for point A to point B locations but am having trouble with multiple waypoints, because on slower devices when the FPS slows and the sprite travels PAST a waypoint I am lost as to the math to switch directions at the proper place. EDIT: To clarify my path finding code is separate in a game thread, this onUpdate method lives in a sprite like class which happens in the UI thread for sprite updating. To be even more clear the path is only updated when objects block the map, at any given point the current path could change but that should not affect the design of the algorithm if I am not mistaken. I do believe all components involved are well designed and accurate, aside from this piece :- ) Here is the scenario: public void onUpdate(float pSecondsElapsed) { // this could be 4x speed, so on slow devices the travel moved between // frames could be very large. What happens with my original algorithm // is it will start actually doing circles around the next waypoint.. pSecondsElapsed *= SomeSpeedModificationValue; final int spriteCurrentX = this.getX(); final int spriteCurrentY = this.getY(); // getCoords contains a large array of the coordinates to each waypoint. // A waypoint is a destination on the map, defined by tile column/row. The // path finder converts these waypoints to X,Y coords. // // I.E: // Given a set of waypoints of 0,0 to 12,23 to 23, 0 on a 23x23 tile map, each tile // being 32x32 pixels. This would translate in the path finder to this: // -> 0,0 to 12,23 // Coord : x=16 y=16 // Coord : x=16 y=48 // Coord : x=16 y=80 // ... // Coord : x=336 y=688 // Coord : x=336 y=720 // Coord : x=368 y=720 // // -> 12,23 to 23,0 -NOTE This direction change gives me trouble specifically // Coord : x=400 y=752 // Coord : x=400 y=720 // Coord : x=400 y=688 // ... // Coord : x=688 y=16 // Coord : x=688 y=0 // Coord : x=720 y=0 // // The current update index, the index specifies the coordinate that you see above // I.E. final int[] coords = getCoords( 2 ); -> x=16 y=80 final int[] coords = getCoords( ... ); // now I have the coords, how do I detect where to set the position? The tricky part // for me is when a direction changes, how do I calculate based on the elapsed time // how far to go up the new direction... I just can't wrap my head around this. this.setPosition(newX, newY); }

    Read the article

  • How display path ball will bounce?

    - by boolean
    I'm trying to figure out a way to show the path a ball will travel, so that the player can line up a shot before they fire the ball. I can't think of a way to calculate this path in advance and show it to the player, especially if it involves collision detection. At first I thought I would run the game at a super high speed for one update, plot the path with some dotted lines where the ball bounced, and then in the next frame hide the 'tracer' ball. This seems to have two issues - Calculating collision detection without actually updating the frames and collision detection getting less reliable at high speeds. If they were straight lines I think I could figure this out in a while loop, but trying to take into account the speed of the ball, the curve of the path, the reflecting from other objects..it all seems a bit much. I'm not looking for any code and this isn't a platform specific question, more just help trying to figure out conceptually how this would work. Can this be done? Are there techniques to achieve this?

    Read the article

  • What alternatives exist of how an agent can follow the path calculated by a path-finding algorithm?

    - by momboco
    What alternatives exist of how an agent can follow the path calculated by a path-finding algorithm? I've seen that the most easy form is go to one point and when the agent has reached this point, discard it and go to the next point. I think that this approach has problems when the game has physics with dynamic objects that can block the travel between point A and point B, then the agent is taken from his original trayectory and sometimes go to the last destiny point is not the most natural behavior. In the literature always I have read that the path is only a suggestion of where the agent has to go, but I don't know how this suggested path must be followed. Thanks.

    Read the article

  • Can I set the base path outside of my application directory when binding an image source path to a r

    - by zimmer62
    So I'm trying to display an image that is ouside the path of my application. I only have a relative image path such as "images/background.png" but my images are somewhere else, I might want to choose that base location at runtime so that the binding maps to the proper folder. Such as "e:\data\images\background.png" or "e:\data\theme\images\background.png" <Image Source="{Binding Path=ImagePathWithRelativePath}"/> Is there any way to specify either in XAML or code behind a base directory for those images?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >