Jump to content

solve this algorithm to PHP code, SOS


funnybenz

Recommended Posts

Hello friends,

 

I have this algorithm about estimate function and i'm one of newbie in PHP.

I wonder, if you all could help me to solve this algorithm to PHP language  :(

anyway, this algorithm works like a graph.

 

Require: Pt
oldEdges=E
for all e in Pt do
neighbors:=getNeighbors(e, Pt, r)
for all n in neighbors do
if E(e, n) = null then
E.add(e, n)
E(e, n).weight = 1/2h
else
E(e, g).weight+= 1/2h
oldEdges.remove((e,n))
end if
for all edge in oldEdges do
edge.weight-=1/h
if edge.weight = 0 then
E.remove(edge)
end if
end for
end for
end for

 

I would describe some information about the variable in algorithm on the above.

[*]variable Pt is save a table that contains the latitude and longitude of the position of the object.

[*]variable r is describe neighborhood radius, I think we could assign for some number depends on data of the Pt.

[*]getNeighbors is a function that returns measurement from Pt that are within r of object e where r is from the square wave function.

 

square wave function

 

f(x,y) -> 0, if distance(x,y) > r; else 1

 

I think that's all of information that I've know.

Dear friends, I really looking forward for any answers.

Thank you

 

Regards,

 

funnybenz

Link to comment
https://forums.phpfreaks.com/topic/242900-solve-this-algorithm-to-php-code-sos/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.