Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
> "real matrix is 50000*50000" HaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHaHa

It's not that impossible if the approach was mathematical.

Of course this would require cleanly defined rules and not these "oh good point I forgot to mention that ..." dialogs.°

How this?

  • I could imagine proving that a path covering n-x points is maximal possible and exists.
  • One would identify the x minimal points to be excluded.
  • I expect x to be just the non positive weight cells in most cases anyway.
  • There are most likely many equally short paths possible, which could be proven, too.
  • Now picking one minimal path should be sufficient.

In short, no need to brute force all possible paths if there are plenty optimal ones and picking one is sufficient.

Of course I might have misunderstood the "rules", but why should I risk to invest more efforts for vain ? ;)

For instance:

  • is it really allowed to slide back a way you just slid forward? (Like your first two moves a0-up9-down3)
  • is it allowed to slide over positive weights? (Like your third move -left1 ignoring 3 positive cells in between)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) read "I have no real clue what I need"

update

Your solution demonstrates my approach pretty well:

  • you are visiting all positive cells
  • the only non positive one is your starting point
  • the shortest path must have the same amount of moves when you avoid revisiting a cell.
  • There are certainly many paths meeting that criterion
  • most probably automatically constructed from smaller segments like: "finish a column/line before switching to the next one"

In reply to Re^2: Highest total sum path problem by LanX
in thread Highest total sum path problem by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found