Problem 107

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
mynameisalreadytaken
Posts: 20
Joined: Sun Sep 25, 2011 11:20 pm

Re: Problem 107

Post by mynameisalreadytaken »

It doesn't matter how the nodes and connections are positioned.
Image
Fogmeister
Posts: 27
Joined: Mon Aug 22, 2011 11:20 am

Re: Problem 107

Post by Fogmeister »

Cool, thanks, realised that as I was typing the question :D

Solved it now though and all on my own. I came up with the algorithm myself and it works in around 15ms :D

Just looking up the different names and it appears I used a reverse-delete algorithm :D

Very pleased with this one :D
Image
amidar1
Posts: 8
Joined: Tue Dec 20, 2011 12:37 am

Re: Problem 107

Post by amidar1 »

Can anyone verify some results concerning the network that daniel.is.fischer posted a while ago?

I'm getting an initial weight of 219 and a reduced weight of 119 for his network. Hopefully this is wrong and will help me figure out why I'm not getting the right answer to the problem. (I do get the right answer for the example, though.)

Thanks!
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 107

Post by thundre »

amidar1 wrote:Can anyone verify some results concerning the network that daniel.is.fischer posted a while ago?

I'm getting an initial weight of 219 and a reduced weight of 119 for his network.
That is correct, according to my algorithm. You must have a different problem than the one he was trying to illustrate.
Image
amidar1
Posts: 8
Joined: Tue Dec 20, 2011 12:37 am

Re: Problem 107

Post by amidar1 »

Oh well, I'll have to dig deeper then. Thanks for confirming the result about the test case.

Cheers

EDIT
Found the "bug." I was reading the question wrong. Very frustrating, but at least I have the answer now.
Yfke
Posts: 2
Joined: Wed Aug 10, 2011 9:05 pm

Re: Problem 107

Post by Yfke »

I'm really stuck on this one.

I first thought that maybe the algorithm that I came up with was wrong since I just tried it for the example graph and it seemed to work, but then after some googling I found that it had a name and is a 'real' algorithm. As it turns out, I'm using the same one as the Fogmeister (not sure if the name of that algorithm should be posted in this topic though? It's quite a big giveaway).

Anyway, my program runs correctly on the example (returning 150 as the answer) and the extra example posted in this topic (returning 100 as the answer). I am quite sure that it reads the file correctly, as the original sum of the edges is computed as 261832, as verified to be correct in an earlier post here.

The (wrong) answer my program comes up with is a maximum saving of 208399. Does anyone maybe recognize from this answer what my mistake could be? I already tried typing it in three times today, so I'm positive it isn't just a typo or something ;)

Edit: I've run my algorithm on the left 12x12 corner of the given matrix and it returns 17199. Can anyone verify whether this is correct?
User avatar
mpiotte
Administrator
Posts: 1961
Joined: Tue May 08, 2012 5:40 pm
Location: Montréal, Canada

Re: Problem 107

Post by mpiotte »

Yfke wrote:...
Edit: I've run my algorithm on the left 12x12 corner of the given matrix and it returns 17199. Can anyone verify whether this is correct?
Correct for 12x12.
Last edited by mpiotte on Fri May 17, 2013 1:08 pm, edited 1 time in total.
Image
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 107

Post by thundre »

One way to check your algorithm is to count the number of edges that remain. It's very easy to calculate what the final edge count should be.
Image
Yfke
Posts: 2
Joined: Wed Aug 10, 2011 9:05 pm

Re: Problem 107

Post by Yfke »

Thanks thundre and mpiotte! I have finally been able to identify my problem. Something went wrong when two edges had the same weight, it's just bad luck that I didn't come across that when running my program on the example problems... ah well. Next stop: problem 108 :)
User avatar
yourmaths
Posts: 47
Joined: Mon Aug 25, 2014 11:00 am

Re: Problem 107

Post by yourmaths »

amidar1 wrote: Wed May 23, 2012 2:09 am Found the "bug." I was reading the question wrong. Very frustrating, but at least I have the answer now.
Indeed. Those of us getting the test answer of 93 are fundamentally misunderstanding the question being asked. :lol:
level = lambda number_solved: number_solved // 25
Image
Post Reply