Jump to content

Help in translating pseudo code of algorithm to PHP from a research paper.


-franciskane-

Recommended Posts

I'm helping a friend in developing a project for our alma mater. And its based on this paper: An Enhanced Indoor Positioning Method Based on Wi-Fi RSS Fingerprinting

So far 80% of the web app is finished except for the algorithm (We have no experience with algorithms to source code translations) that needs to be implemented in the website. Inside this paper there is this algorithm that the proponents of the research used. (attached as screenshot).

The algorithm was converted to code by using MATLAB, but we are trying to use PHP with our project. Based on the pseudo code the calculation of the Euclidean Distance is the core of it. Can anyone help us with the translation just to get it started. 

 

 

algo1.png

Link to comment
Share on other sites

1 and 2 would presumably be input from the web page. The rest would be something like:

for ($m=1; $m<=$M; $m++) {
   for ($l=1; $l<=$L; $l++) {
      for ($j=1; $j<=$N; $j++) {
         #do calculation here storing it in a 2D array
      }
      # select minimum here (perhaps min() function)
   }
}
# use array sort
# use PHP vector class
# compute distance from vectors
# echo results in desired format

 

  • Like 2
Link to comment
Share on other sites

12 hours ago, gw1500se said:

1 and 2 would presumably be input from the web page. The rest would be something like:


for ($m=1; $m<=$M; $m++) {
   for ($l=1; $l<=$L; $l++) {
      for ($j=1; $j<=$N; $j++) {
         #do calculation here storing it in a 2D array
      }
      # select minimum here (perhaps min() function)
   }
}
# use array sort
# use PHP vector class
# compute distance from vectors
# echo results in desired format

 

In our project the input will be coming from a mobile app that my friend made that scans a room. I don't if its needed but I can provide the documentation of the project here.

Link to comment
Share on other sites

The way that the client/mobile app and the serverside routines will work, need to implement some sort of standard.  My suggestion would be that you utilize json.  So the webapp should send it's data to the web app in json format.  In PHP it is then simply a function call (json_decode) in order to convert the data into either php objects or a php array.

 

Link to comment
Share on other sites

4 minutes ago, gizmola said:

The way that the client/mobile app and the serverside routines will work, need to implement some sort of standard.  My suggestion would be that you utilize json.  So the webapp should send it's data to the web app in json format.  In PHP it is then simply a function call (json_decode) in order to convert the data into either php objects or a php array.

 

Hello! The php script that you sent. is there anything to add there or can we use that as is? and that will be incorporated into json? did I get that right?

Link to comment
Share on other sites

3 minutes ago, gw1500se said:

I think you need to start on the mobile side and, as gizmola suggested, create the json formatted data. Post a sample of that so we get a better idea of what it looks like and then we can help you go from there with the PHP side.

Ok. I'll get the source code of the mobile app from my friend (because she's the one that developed it.) thanks!
and we haven't yet tested how the mobile app and the web app will 'meet'

Edited by -franciskane-
Link to comment
Share on other sites

22 hours ago, gw1500se said:

I think you need to start on the mobile side and, as gizmola suggested, create the json formatted data. Post a sample of that so we get a better idea of what it looks like and then we can help you go from there with the PHP side.

Hello my friend said the she wrote the mobile app's source code in unity

Link to comment
Share on other sites

4 hours ago, gw1500se said:

Language doesn't matter. What I want to see is the JSON output or whatever she programmed to be passed to the PHP script. It would be preferable if she programmed it to output it in JSON.

To elaborate a bit, talk to your clientside developer and ask her for some test output.  If she is not already outputting the collected data in json, then you want to ask her to modify that.  She will need to change the app eventually to send output to the domain/url of the production server anyway.  Ideally the url to send data would be configurable in the client so that you can have multiple server side environments   (dev, test, prod).  Development is the one you are currently working on now.  Test would be for automated testing, and prod is of course production.  

 

Link to comment
Share on other sites

On 8/15/2020 at 11:34 PM, gw1500se said:

Language doesn't matter. What I want to see is the JSON output or whatever she programmed to be passed to the PHP script. It would be preferable if she programmed it to output it in JSON.

Hello I have the c# files. but I cant upload them here. and from browsing those files I can't find any json file so maybe that she hasn't finished that part. I thought that I can finish first this algorithm then try to connect the website to the mobile app. but I guess my reasoning is wrong.

Edited by -franciskane-
Additional information
Link to comment
Share on other sites

20 hours ago, gw1500se said:

No, we need to see the actual output and how it plans to call the PHP script. However, it does look like JSON was the intention.

Ohh. Ok I get it. We aren't on that phase yet because of the pandemic. My friend can't go to our alma mater yet to test the QR Scanner. We are hoping to finish everything first before she can test the mobile app and the website. then debug.

Link to comment
Share on other sites

On 8/19/2020 at 9:18 PM, gw1500se said:

She can't make up test data?

The only part the we can make test data for (that I know of) is the login credentials from the db of the website that will also be used by the mobile app. And I wouldn't know how would you test a qr scanner without being there.

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.