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 ????

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to