Ich versuche Subset Sum Problem mit dem Nachbarschaftsalgorithmus zu implementieren. Hier ist der Pseudo-Code: 1. Generate a random solution for the problem and call it S 2. Compute the neighborhood of S and choose S' as the best solution in the neighborhood 3. If S' is better than S then go to step 4, else go to step 6 4. S = S' 5. Go to step 2 6. Return S as the best solution encountered
Angesichts einer Menge X von 10 Elementen (+ ve und -ve), muss ich eine Teilmenge von X so finden, dass die Summe so nahe wie möglich 0 ist.Subset Summe mit Nachbarschaftssuche - Java
Nach dem Pseudo-Code, habe ich eine zufällige Lösung S erzeugt, aber ich habe einige Schwierigkeiten beim Aufbau der Nachbarschaft anzutreffen S.
Wie kann ich die Nachbarschaft von S berechnen? Was ist die Nachbarschaft von S?
z.
X = [x0, x1, x2, x3, x4, x5, x6, x7, x8, x9]
S = [x1, X7, x2, x3]
Was die Nachbarschaft ist von S?