# Weiszfeld’s Algorithms Help PLS

Printable View

• December 11th, 2012, 06:45 PM
shafak
Weiszfeld’s Algorithms Help PLS
Please help me. Where is wrong ?

Code java:

```package Sezgisel;   public class SezgiselAlgoritma1 {   public static void main(String[] args) {   double a[]={40.78,40.75,40.71,40.72,40.69,40.93,40.51,40.80,40.64, 41.07,41.03,41.05,40.51,40.69,40.88,40.40}; double b[]={30.40,30.40,30.36,30.38,30.62,30.48,30.29,30.75,30.54, 30.78,30.31,30.85,30.17,30.27,30.45,30.49}; //Rastgele değerler x=50 ve y=50 olarak verildi. int x=50; int y=50; int literasyon=0; double m,l; double J=0;//Amaç fonksiyonu J fonksiyonudur. do { double Toplam=0; for ( int i=0; i<16; i++){ m(i)=1/sqrt(((x-a[i]))^2+((y-b[i]))^2); Toplam=Toplam+ m(i); }// 1. for end for (int i=0; i<16; i++){ l(i)=m(i)/Toplam ; }//2. for end x=0; y=0;//Formüldeki ilk x ve y değerleri sıfırdır. for (int i=0; i<16; i++){ x= x+ (l(i)*a[i]); y= y+ (l(i)*b[i]); }//3. for end   for (int i=0; i<16; i++){ J=J+ sqrt(((x-a[i]))^2+((y-b[i]))^2);   literasyon=literasyon+1; }while (literasyon!=50); System.out.println("Tesisin enlem değeri X=" + x + "ve boylam değeri Y=" + y + "'dir." );   } System.out.println("Amaç fonksiyonumuzun değeri Z=" + J);   }   }```
• December 11th, 2012, 07:04 PM
Norm
Re: Weiszfeld’s Algorithms Help PLS
If you are getting error messages. copy the full text and paste it here.

Please edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
• December 11th, 2012, 07:18 PM
shafak
Re: Weiszfeld’s Algorithms Help PLS
thanx. i edited it...
• December 11th, 2012, 07:23 PM
Norm
Re: Weiszfeld’s Algorithms Help PLS
Quote:

Where is wrong ?
Can you explain what the problem is?
Post the program's output, explain what is wrong with it and show what it should be.
• December 11th, 2012, 07:35 PM
shafak
Re: Weiszfeld’s Algorithms Help PLS
Here is a output errors...

Attachment 1620
• December 11th, 2012, 07:55 PM
Norm
Re: Weiszfeld’s Algorithms Help PLS
Please copy and post the error messages NOT an image.

To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.
• December 11th, 2012, 07:58 PM
shafak
Re: Weiszfeld’s Algorithms Help PLS
Quote:

Originally Posted by Norm
Please copy and post the error messages NOT an image.

To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

like this ? sorry for misunderstood, i'm at very beginning for java programming

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The left-hand side of an assignment must be a variable
The method m(int) is undefined for the type SezgiselAlgoritma1
The left-hand side of an assignment must be a variable
The method l(int) is undefined for the type SezgiselAlgoritma1
The method l(int) is undefined for the type SezgiselAlgoritma1
The operator ^ is undefined for the argument type(s) double, double
Syntax error, insert "while ( Expression ) ;" to complete DoStatement

at SezgiselAlgoritma1.main(depo.java:19)
• December 11th, 2012, 08:04 PM
Norm
Re: Weiszfeld’s Algorithms Help PLS
Quote:

at SezgiselAlgoritma1.main(depo.java:19)
The error messages do NOT show what lines they happened on. I don't think all those error messages are for the code at line 19. What code is on line 19?
Can you use the javac compiler to compile the program to get compiler error messages?
Your IDE's error messages don't say where the errors are.