Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98083 > unrolled thread
| Started by | amnaee@gmail.com |
|---|---|
| First post | 2015-11-01 21:30 -0800 |
| Last post | 2015-11-02 06:08 -0500 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
Problem in implementing Romania Map using Paython Script amnaee@gmail.com - 2015-11-01 21:30 -0800
Re: Problem in implementing Romania Map using Paython Script Ben Finney <ben+python@benfinney.id.au> - 2015-11-02 16:45 +1100
Re: Problem in implementing Romania Map using Paython Script Christian Gollwitzer <auriocus@gmx.de> - 2015-11-02 07:45 +0100
Re: Problem in implementing Romania Map using Paython Script Terry Reedy <tjreedy@udel.edu> - 2015-11-02 06:08 -0500
| From | amnaee@gmail.com |
|---|---|
| Date | 2015-11-01 21:30 -0800 |
| Subject | Problem in implementing Romania Map using Paython Script |
| Message-ID | <24e4a4ca-59d1-433e-a0ed-fa04fc23041d@googlegroups.com> |
Dear all;
I want to code algorithm in Python for driving from Arad to Bucharest as quickly as possible.
I formulated the problem in python as following :
1- States : Various cities.
2- Actions : Drive distances between different cities.
3- Goal : To be in Bucharest.
class Problem:
def __init__(self, initial, goal=None):
self.initial = initial
self.goal = goal
def goalTest(self, state):
return state == self.goal
But the problem now is with Roaming and Node classifications :
class RoamingProblem(Problem):
def successors(self, state):
Q1 : How I can complete the class RoamingProblem (Problem) and include action costs.
I think its related in some how in using a new city map ????...
And how I can return the cost next state ????...
list of tuples [(action1,[(action1, successor-state1, cost1, action2, successor-state2, cost2 ...)]
Q2 : For the class node
class Node:
def __init__(self, state, parent=None, action=None, pathCost=0):
self.state = state
self.parent = parent
self.action = action
self.pathCost = pathCost
update(state,parent,action,pathcost,depth)
def expand(self, problem):
return [Node(next,self,action,problem,....].
THE last line How I can return : list of Node objects, one for each successor state, parent of the created nodes is self ????....
I need a help in completing the Class Roaming problem using Euclidean function , Completing the Class Node .....
And def treesearch and graph search problem ?????
Waiting for reply ????
[toc] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2015-11-02 16:45 +1100 |
| Message-ID | <mailman.49.1446443169.4463.python-list@python.org> |
| In reply to | #98083 |
amnaee@gmail.com writes: > I need a help in completing the Class Roaming problem using Euclidean > function , Completing the Class Node ..... I think you need to research how to solve this algorithm, and only *then* think about how to code it in Python. Is this a homework assignment? > And def treesearch and graph search problem ????? > > Waiting for reply ???? You may not intend it, but adding multiple question marks communicates urgent insistence, and is rather rude in a request to a community of volunteers. -- \ “I may disagree with what you say, but I will defend to the | `\ death your right to mis-attribute this quote to Voltaire.” | _o__) —Avram Grumer, rec.arts.sf.written, 2000-05-30 | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Date | 2015-11-02 07:45 +0100 |
| Message-ID | <n170m7$gnj$1@dont-email.me> |
| In reply to | #98083 |
Am 02.11.15 um 06:30 schrieb amnaee@gmail.com: > Dear all; > > I want to code algorithm in Python for driving from Arad to Bucharest as quickly as possible. > It sounds a lot like a homework problem. If so, look into your notes for "Dijkstra algorithm", or "A* algorithm". If not, look for a library that does routing or make an API call to graphhopper, Google maps or similar. Routing (esp. fast routing) is a non-trivial problem. Christian
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2015-11-02 06:08 -0500 |
| Message-ID | <mailman.61.1446462528.4463.python-list@python.org> |
| In reply to | #98083 |
On 11/2/2015 12:45 AM, Ben Finney wrote: > amnaee@gmail.com writes: > >> I need a help in completing the Class Roaming problem using Euclidean >> function , Completing the Class Node ..... > > I think you need to research how to solve this algorithm, and only > *then* think about how to code it in Python. > > Is this a homework assignment? Norquist's AI book uses the Romania map to illustrate search problems. Whether this is a class assignment is a different matter, but OP should mention it either way. -- Terry Jan Reedy
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web