bump product version to 4.1.6.2
[LibreOffice.git] / nlpsolver / ThirdParty / EvolutionarySolver / src / net / adaptivebox / knowledge / SearchPoint.java
blob0085ff7e481ecc7b638218c5fc7c1e5f3195be65
1 /**
2 * Description: provide the location and encoded goodness information
4 * @ Author Create/Modi Note
5 * Xiaofeng Xie Mar 1, 2003
6 * Xiaofeng Xie May 11, 2004
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * Please acknowledge the author(s) if you use this code in any way.
20 package net.adaptivebox.knowledge;
22 import net.adaptivebox.global.*;
23 import net.adaptivebox.space.*;
24 import net.adaptivebox.encode.*;
26 public class SearchPoint extends BasicPoint implements IEncodeEngine {
27 //store the encode information for goodness evaluation
28 //encodeInfo[0]: the sum of constraints (if it equals to 0, then be a feasible point)
29 //encodeInfo[1]: the value of objective function
30 private double[] encodeInfo = new double[2];
31 private double objectiveValue;
33 public SearchPoint(int dim) {
34 super(dim);
35 for(int i=0; i<encodeInfo.length; i++) {
36 encodeInfo[i] = BasicBound.MAXDOUBLE;
40 public double[] getEncodeInfo() {
41 return encodeInfo;
44 private void importEncodeInfo(double[] info) {
45 for(int i=0; i<encodeInfo.length; i++) {
46 encodeInfo[i] = info[i];
50 private void importEncodeInfo(IEncodeEngine point) {
51 importEncodeInfo(point.getEncodeInfo());
54 //Replace self by given point
55 public void importPoint(SearchPoint point) {
56 importLocation(point);
57 importEncodeInfo(point);
58 setObjectiveValue(point.getObjectiveValue());
61 public double getObjectiveValue() {
62 return objectiveValue;
65 public void setObjectiveValue(double objectiveValue) {
66 this.objectiveValue = objectiveValue;
69 public boolean isFeasible() {
70 return encodeInfo[0] == 0; //no constraint violations
73 public void outputSelf() {
74 System.out.println("#--> Location:");
75 OutputMethods.outputVector(getLocation());
76 System.out.println("#--> (CON & OPTIM):");
77 OutputMethods.outputVector(getEncodeInfo());