Script PHP with MAX value

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
landi
php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Sun Aug 10, 2014 3:20 am

Hi,

1) This sounds like a Least Cost Path problem (in your case max path) and there are solutions. However, they are not necessarily small nor simple nor cheap (in CPU time). Not my area, sorry. Try Google.

2) What answer do you want if all arrays contain the same single value?

3) Don't forget to ask if you really need the Max Cost, or just a good approximation. We often do things for intellectual stimulation that are not required by the real world. For example the least cost path for a postman is nice to calculate, but if the postman is drunk, or stops to stroke cats, the reality may differ from the theory. If you sort the arrays, and then calc the difference between elements, you might get a simple solution close to the truth.

-A

landi
php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Sun Aug 10, 2014 5:01 am

Hi,
It might help to explain WHY you need this solution, in case there are other possibilities?
-A

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 4 guests