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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.