Skip to content

Commit d312e4f

Browse files
author
“jklein94”
committed
Added missing javadoc
1 parent f0c1695 commit d312e4f

File tree

10 files changed

+175
-131
lines changed

10 files changed

+175
-131
lines changed

org-tweetyproject-commons/src/main/java/org/tweetyproject/commons/QuantitativeReasoner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
/**
2222
* The general interface for objects that are able to query a belief base
2323
* with some formula and return a degree (double value) of its acceptability.
24-
*
24+
*
2525
* @author Matthias Thimm
2626
*
2727
* @param <B> the belief base type that can be queried
2828
* @param <F> the type of formulas that can be queries
2929
*/
3030
public interface QuantitativeReasoner<B extends BeliefBase,F extends Formula> extends Reasoner<Double,B,F> {
3131
/**
32-
*
32+
* Checks if the reasoner is installed.
3333
* @return if reasoner is installed
3434
*/
3535
public abstract boolean isInstalled();

org-tweetyproject-math/src/main/java/org/tweetyproject/math/examples/SimpleGeneticOptimizationSolverEx.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@
3939
* @author Sebastian Franke
4040
*/
4141
public class SimpleGeneticOptimizationSolverEx {
42+
43+
/**
44+
* Default constructor for SimpleGeneticOptimizationSolverEx.
45+
*/
46+
public SimpleGeneticOptimizationSolverEx() {
47+
// No initialization required
48+
}
4249
/**
4350
* constructor
4451
* @return problem
4552
*/
4653
public static OptimizationProblem createConstraintSatProb1() {
47-
54+
4855
FloatVariable m1 = new FloatVariable("Machine 1", -100, 100);
4956
FloatVariable m2 = new FloatVariable("Machine 2", -100, 100);
5057
Equation constr1 = new Equation(m1, new IntegerConstant(10));
5158
Equation constr2 = new Equation(m2, new IntegerConstant(12));
5259
Equation constr3 = new Equation(m1, new IntegerConstant(0));
5360
Equation constr4 = new Equation(m2, new IntegerConstant(0));
5461
Equation constr5 = new Equation(m1.add(m2), new IntegerConstant(16));
55-
62+
5663
Collection<Statement> constraints = new ArrayList<Statement>();
5764
constraints.add(constr1);
5865
constraints.add(constr2);
@@ -65,14 +72,14 @@ public static OptimizationProblem createConstraintSatProb1() {
6572
//Target funcion = (m1+1)^2+m2^2
6673
Term opt = new Sum(new Power(new Sum(m1, new IntegerConstant(1)), new IntegerConstant(2)), new Power(m2, new IntegerConstant(2)));
6774

68-
69-
70-
75+
76+
77+
7178
((OptimizationProblem)prob).setTargetFunction(opt);
7279
return prob;
73-
80+
7481
}
75-
82+
7683
/**
7784
* main method
7885
* @param args arguments
@@ -92,8 +99,8 @@ public static void main(String[] args) throws ParserException, GeneralMathExcept
9299
SimpleGeneticOptimizationSolver solver = new SimpleGeneticOptimizationSolver(100, 200, 20, 100, 0.001);
93100
Map<Variable, Term> solution = solver.solve(prob);
94101
System.out.println(solution.toString());
95-
96-
102+
103+
97104
}
98105
}
99106

org-tweetyproject-math/src/main/java/org/tweetyproject/math/examples/SimulatedAnnealingOnConstrProbEx2.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,20 @@
3838
* @author Sebastian Franke
3939
*/
4040
public class SimulatedAnnealingOnConstrProbEx2 {
41+
42+
/**
43+
* Default constructor for SimulatedAnnealingOnConstrProbEx2.
44+
*/
45+
public SimulatedAnnealingOnConstrProbEx2() {
46+
// No initialization required
47+
}
48+
4149
/**
4250
* constrcutor
4351
* @return problem
4452
*/
4553
public static OptimizationProblem createConstraintSatProb1() {
46-
54+
4755
FloatVariable m1 = new FloatVariable("Machine 1", -100, 100);
4856
FloatVariable m2 = new FloatVariable("Machine 2", -100, 100);
4957
Inequation constr1 = new Inequation(m1, new IntegerConstant(10), 3);
@@ -52,28 +60,28 @@ public static OptimizationProblem createConstraintSatProb1() {
5260
Inequation constr4 = new Inequation(m2, new IntegerConstant(0), 3);
5361

5462

55-
63+
5664
Collection<Statement> constraints = new ArrayList<Statement>();
5765
constraints.add(constr1);
5866
constraints.add(constr2);
5967
constraints.add(constr3);
6068
constraints.add(constr4);
6169

62-
70+
6371
OptimizationProblem prob = new OptimizationProblem(0);
6472
prob.addAll(constraints);
6573

6674
//Target funcion = (m1+1)^2+m2^2
6775
Term opt = new Sum(new Power(new Sum(m1, new IntegerConstant(1)), new IntegerConstant(2)), new Power(m2, new IntegerConstant(2)));
6876

69-
70-
71-
77+
78+
79+
7280
((OptimizationProblem)prob).setTargetFunction(opt);
7381
return prob;
74-
82+
7583
}
76-
84+
7785
/**
7886
7987
* main method
@@ -90,7 +98,7 @@ public static void main(String[] args) throws ParserException, GeneralMathExcept
9098
SimulatedAnnealingOnConstrProb solver = new SimulatedAnnealingOnConstrProb(1000000, 1, 10000);
9199
Map<Variable, Term> solution = solver.solve(prob);
92100
System.out.println(solution.toString());
93-
94-
101+
102+
95103
}
96104
}

org-tweetyproject-math/src/main/java/org/tweetyproject/math/examples/StochasticLocalSearchOnConstrProbEx.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,22 @@
3737
* It is natively implemented
3838
* @author Sebastian Franke
3939
*/
40+
/**
41+
* Default constructor for the StochasticLocalSearchOnConstrProbEx class.
42+
*/
4043
public class StochasticLocalSearchOnConstrProbEx {
44+
/**
45+
* Default constructor for StochasticLocalSearchOnConstrProbEx.
46+
*/
47+
public StochasticLocalSearchOnConstrProbEx() {
48+
// Default constructor
49+
}
4150
/**
4251
* constructor
4352
* @return problem
4453
*/
4554
public static OptimizationProblem createConstraintSatProb1() {
46-
55+
4756
FloatVariable m1 = new FloatVariable("Machine 1", -100, 100);
4857
FloatVariable m2 = new FloatVariable("Machine 2", -100, 100);
4958
Inequation constr1 = new Inequation(m1, new IntegerConstant(10), 3);
@@ -52,28 +61,28 @@ public static OptimizationProblem createConstraintSatProb1() {
5261
Inequation constr4 = new Inequation(m2, new IntegerConstant(0), 3);
5362

5463

55-
64+
5665
Collection<Statement> constraints = new ArrayList<Statement>();
5766
constraints.add(constr1);
5867
constraints.add(constr2);
5968
constraints.add(constr3);
6069
constraints.add(constr4);
6170

62-
71+
6372
OptimizationProblem prob = new OptimizationProblem(0);
6473
prob.addAll(constraints);
6574

6675
//Target funcion = (m1+1)^2+m2^2
6776
Term opt = new Sum(new Power(new Sum(m1, new IntegerConstant(1)), new IntegerConstant(2)), new Power(m2, new IntegerConstant(2)));
6877

69-
70-
71-
78+
79+
80+
7281
((OptimizationProblem)prob).setTargetFunction(opt);
7382
return prob;
74-
83+
7584
}
76-
85+
7786
/**
7887
7988
* main method
@@ -91,7 +100,7 @@ public static void main(String[] args) throws ParserException, GeneralMathExcept
91100
StochasticLocalSearchOnConstrProb solver = new StochasticLocalSearchOnConstrProb(5000, 1000, 0.5);
92101
Map<Variable, Term> solution = solver.solve(prob);
93102
System.out.println(solution.toString());
94-
95-
103+
104+
96105
}
97106
}

org-tweetyproject-math/src/main/java/org/tweetyproject/math/func/fuzzy/DefaultNegation.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@
2020

2121
/**
2222
* Implements the default fuzzy negation x -&gt; x-1
23-
*
23+
*
2424
* @author Matthias Thimm
2525
*/
2626
public class DefaultNegation extends FuzzyNegation{
2727

28+
29+
/**
30+
* Creates a new instance of DefaultNegation.
31+
*/
32+
public DefaultNegation() {
33+
super();
34+
}
35+
2836
/* (non-Javadoc)
2937
* @see org.tweetyproject.math.func.fuzzy.FuzzyNegation#eval(java.lang.Double)
3038
*/

org-tweetyproject-math/src/main/java/org/tweetyproject/math/opt/problem/ProblemInconsistentException.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
1-
/*
2-
* This file is part of "TweetyProject", a collection of Java libraries for
3-
* logical aspects of artificial intelligence and knowledge representation.
4-
*
5-
* TweetyProject is free software: you can redistribute it and/or modify
6-
* it under the terms of the GNU Lesser General Public License version 3 as
7-
* published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU Lesser General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU Lesser General Public License
15-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
*
17-
* Copyright 2016 The TweetyProject Team <http://tweetyproject.org/contact/>
18-
*/
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2016 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
1919
package org.tweetyproject.math.opt.problem;
2020

2121
/**
2222
* This exception is thrown when a problem cannot be solved due to its inconsistency.
23-
*
23+
*
2424
* @author Matthias Thimm
2525
*/
2626
public class ProblemInconsistentException extends RuntimeException {
2727

28+
/**
29+
* Creates a new instance of ProblemInconsistentException.
30+
*/
31+
public ProblemInconsistentException() {
32+
super();
33+
}
34+
2835
/**
2936
* For serialization.
3037
*/

org-tweetyproject-math/src/main/java/org/tweetyproject/math/opt/solver/SimpleGeneticOptimizationSolverCombinatorics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public ArrayList<ElementOfCombinatoricsProb> solve(CombinatoricsProblem prob){
216216
}
217217

218218
/**
219-
*
219+
* Checks if the solver is installed.
220220
* @return if solver is installed
221221
* @throws UnsupportedOperationException UnsupportedOperationException
222222
*/

org-tweetyproject-math/src/main/java/org/tweetyproject/math/opt/solver/SimulatedAnnealing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public SimulatedAnnealing(double startTemp, double decreasePerIt, int maxStepsWi
5454
this.maxStepsWithNoImprove = maxStepsWithNoImprove;
5555
}
5656
/**
57-
*
57+
* Solves the given combinatorics problem using simulated annealing.
5858
* @param prob: the problem
5959
* @return the best solution encountered
6060
*/

org-tweetyproject-math/src/main/java/org/tweetyproject/math/opt/solver/SimulatedAnnealingOnConstrProb.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ private Map<Variable,Term> createNewSol(Map<Variable,Term> ind){
116116
}
117117

118118
/**
119+
* Creates a neighborhood of solutions around the current solution
119120
* @param minIterations: the minimum amount of solutions to be created
120121
* @param maxIterations: the maximum amount of solutions to be created
121122
* @param threshold: if a solution with the quality of threshold is reached we do maximum 10 more tries

0 commit comments

Comments
 (0)