What do you think about some changes in PSGTBehavior.java?
Todor Balabanov
todor.balabanov at gmail.com
Thu Jun 10 11:37:24 UTC 2021
https://github.com/LibreOffice/core/blob/105ad5dc174d9e894b0c4f9e24d068090ca8c3aa/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java#L94
@Override
public void generateBehavior(SearchPoint trailPoint, ProblemEncoder
problemEncoder) {
DesignSpace designSpace = problemEncoder.getDesignSpace();
double[] pold_t_location = pold_t.getLocation();
double[] pbest_t_location = pbest_t.getLocation();
double[] pcurrent_t_location = pcurrent_t.getLocation();
double[] gbest_t_location = socialLib.getGbest().getLocation();
double[] trailPointLocation = trailPoint.getLocation();
int DIMENSION = designSpace.getDimension();
for (int b = 0; b < DIMENSION; b++) {
if (Math.random() < CL) {
designSpace.mutationAt(trailPointLocation, b);
continue;
}
double deltaxb = weight * (pcurrent_t_location[b] - pold_t_location[b
])
+ c1 * Math.random() * (pbest_t_location[b] -
pcurrent_t_location[b])
+ c2 * Math.random() * (gbest_t_location[b] -
pcurrent_t_location[b]);
// limitation for delta_x
double deltaxbm = 0.5 * designSpace.getMagnitudeIn(b);
if (deltaxb < -deltaxbm) {
deltaxb = -deltaxbm;
} else if (deltaxb > deltaxbm) {
deltaxb = deltaxbm;
}
trailPointLocation[b] = pcurrent_t_location[b] + deltaxb;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20210610/549713c7/attachment.htm>
More information about the LibreOffice
mailing list