• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Division clustering algorithm

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I am making the [title] algorithm and I have ran into some problems I can't really understand. It's nothing too complicated, one class reads a file and passes it as a linked list to the main algorithm method(table ->divison). From there, one cluster is created from the start table, the distance matrix is calculated. The highest distance is found and the cluster is split into two. And so on, till some kind of ending, iteration count etc. The algorithm works well for one iteration only, afterwards... I can't see where the possible error is, any help would be greatly appreciated. It's my whole days work, probably can't think straight anymore. Thanks in advance!

One row in the table:



One cell in the matrix:



The cluster class:


Algorithms main running class:


The file reader:

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Janis Strautins wrote:I can't see where the possible error is, any help would be greatly appreciated.


Well, I hate to say, but the minute I see anything like:
if(clusterList.get(k).matrix.get(i).distances.get(j).value>max.value) ...
my brain just shuts down.

My suggestion: refactor your code to rationalise all these horrible method chains. You (and we) will be in a much better position to then read your code and understand what it's trying to do.

PS: DontWriteLongLines (←click). I've tried to break yours up as best I can, but you're hamstringing yourself by
(a) Aggressive indentation. (Tip: DON'T use tabs).
(b) The number of layers you're handling at a time.

Winston
reply
    Bookmark Topic Watch Topic
  • New Topic