📄 saimpl.java
字号:
package test;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public abstract class SAImpl
implements SAInterface {
double leakRate = .001;
double potentialEnergy = 0; //势能
double kineticEnergy = 100000; //动能
public SAImpl(double lRate, double kEnergy) {
this.leakRate = lRate;
this.kineticEnergy = kEnergy;
}
/**
* disturb
*
* @return boolean
* @todo Implement this test.SAInterface method
*/
public abstract boolean disturb(int range);
/**
* weight
*
* @return boolean
* @todo Implement this test.SAInterface method
*/
public abstract double weight();
/**
* optimize
*
* @param limit int
* @todo Implement this test.SAInterface method
*/
public void optimize(int range, int limit) {
int count = 0;
long tcount = 0;
while (count < limit) {
if (disturb(range)) {
count = 0;
}
else {
count += 1;
}
if (tcount++ % 1000000 == 0) {
System.out.println("tpower = " + (potentialEnergy + kineticEnergy) +
"; Potential Energy = " +
potentialEnergy + "; Kinetic Energy = " + kineticEnergy);
}
}
System.out.println("");
System.out.println("Potential Energy = " + potentialEnergy);
System.out.println("weight = " + weight());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -