Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–184 unchanged (184 lines)
185 final ConvergenceChecker<PointValuePair> checker
186 = getConvergenceChecker();
187
188 double[] x = guess;
189 double fVal = computeObjectiveValue(x);
190 double[] x1 = x.clone();
191 int iter = 0;
192 while (true) {
193 ++iter;
194
195 double fX = fVal;
196 double fX2 = 0;
197 double delta = 0;
198 int bigInd = 0;
199 double alphaMin = 0;
…lines 200–220 unchanged (21 lines)
221 absoluteThreshold);
222
223 final PointValuePair previous = new PointValuePair(x1, fX);
224 final PointValuePair current = new PointValuePair(x, fVal);
225 if (!stop) { // User-defined stopping criteria.
226 if (checker != null) {
227 stop = checker.converged(iter, previous, current);
228 }
229 }
230 if (stop) {
231 if (goal == GoalType.MINIMIZE) {
232 return (fVal < fX) ? current : previous;
233 } else {
…lines 234–382 unchanged (149 lines)

After

…lines 1–184 unchanged (184 lines)
185 final ConvergenceChecker<PointValuePair> checker
186 = getConvergenceChecker();
187
188 double[] x = guess;
189 double fVal = computeObjectiveValue(x);
190 double[] x1 = x.clone();
191 while (true) {
192 incrementIterationCount();
193
194 double fX = fVal;
195 double fX2 = 0;
196 double delta = 0;
197 int bigInd = 0;
198 double alphaMin = 0;
…lines 199–219 unchanged (21 lines)
220 absoluteThreshold);
221
222 final PointValuePair previous = new PointValuePair(x1, fX);
223 final PointValuePair current = new PointValuePair(x, fVal);
224 if (!stop) { // User-defined stopping criteria.
225 if (checker != null) {
226 stop = checker.converged(getIterations(), previous, current);
227 }
228 }
229 if (stop) {
230 if (goal == GoalType.MINIMIZE) {
231 return (fVal < fX) ? current : previous;
232 } else {
…lines 233–381 unchanged (149 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration (+25 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "util"
. "."
identifier "FastMath"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "util"
. "."
identifier "MathArrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "analysis"
. "."
identifier "UnivariateFunction"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "NumberIsTooSmallException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "NotStrictlyPositiveException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "MathUnsupportedOperationException"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+25 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "MaxEval"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "PointValuePair"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "ConvergenceChecker"
; ";"
import_declaration (+25 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
block_comment "/**\n * Powell's algorithm.\n * This code is translated and ad"...
class_declaration
modifiers
public "public"
class "class"
identifier "PowellOptimizer"
superclass
extends "extends"
type_identifier "MultivariateOptimizer"
class_body
{ "{"
block_comment "/**\n * Minimum relative tolerance.\n */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * Relative threshold.\n */"
field_declaration
modifiers
private "private"
final "final"
floating_point_type
double "double"
variable_declarator
identifier "relativeThreshold"
; ";"
block_comment "/**\n * Absolute threshold.\n */"
field_declaration
modifiers
private "private"
final "final"
floating_point_type
double "double"
variable_declarator
identifier "absoluteThreshold"
; ";"
block_comment "/**\n * Line search.\n */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "LineSearch"
variable_declarator
identifier "line"
; ";"
block_comment "/**\n * This constructor allows to specify a user-defined"...
constructor_declaration (+57 nodes collapsed)
block_comment "/**\n * This constructor allows to specify a user-defined"...
constructor_declaration (+120 nodes collapsed)
block_comment "/**\n * The parameters control the default convergence ch"...
constructor_declaration (+30 nodes collapsed)
block_comment "/**\n * Builds an instance with the default convergence c"...
constructor_declaration (+44 nodes collapsed)
block_comment "/** {@inheritDoc} */"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
type_identifier "PointValuePair"
identifier "doOptimize"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "checkParameters"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
type_identifier "GoalType"
variable_declarator
identifier "goal"
= "="
method_invocation
identifier "getGoalType"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "guess"
= "="
method_invocation
identifier "getStartPoint"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
integral_type
int "int"
variable_declarator
identifier "n"
= "="
field_access
identifier "guess"
. "."
identifier "length"
; ";"
local_variable_declaration (+27 nodes collapsed)
for_statement (+37 nodes collapsed)
local_variable_declaration
modifiers
final "final"
generic_type
type_identifier "ConvergenceChecker"
type_arguments
< "<"
type_identifier "PointValuePair"
> ">"
variable_declarator
identifier "checker"
= "="
method_invocation
identifier "getConvergenceChecker"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "x"
= "="
identifier "guess"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fVal"
= "="
method_invocation
identifier "computeObjectiveValue"
argument_list
( "("
identifier "x"
) ")"
; ";"
local_variable_declaration
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "x1"
= "="
method_invocation
identifier "x"
. "."
identifier "clone"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "iter"
= "="
decimal_integer_literal "0"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
true "true"
) ")"
block
{ "{"
expression_statement
update_expression
++ "++"
identifier "iter"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fX"
= "="
identifier "fVal"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fX2"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "delta"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "bigInd"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "alphaMin"
= "="
decimal_integer_literal "0"
; ";"
for_statement (+164 nodes collapsed)
line_comment "// Default convergence check."
local_variable_declaration (+48 nodes collapsed)
local_variable_declaration
modifiers
final "final"
type_identifier "PointValuePair"
variable_declarator
identifier "previous"
= "="
object_creation_expression
new "new"
type_identifier "PointValuePair"
argument_list
( "("
identifier "x1"
, ","
identifier "fX"
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
type_identifier "PointValuePair"
variable_declarator
identifier "current"
= "="
object_creation_expression
new "new"
type_identifier "PointValuePair"
argument_list
( "("
identifier "x"
, ","
identifier "fVal"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "stop"
) ")"
block
{ "{"
line_comment "// User-defined stopping criteria."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "checker"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "stop"
= "="
method_invocation
identifier "checker"
. "."
identifier "converged"
argument_list
( "("
identifier "iter"
, ","
identifier "previous"
, ","
identifier "current"
) ")"
; ";"
} "}"
} "}"
if_statement (+58 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
for_statement (+68 nodes collapsed)
expression_statement
assignment_expression
identifier "x1"
= "="
method_invocation
identifier "x"
. "."
identifier "clone"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "fX2"
= "="
method_invocation
identifier "computeObjectiveValue"
argument_list
( "("
identifier "x2"
) ")"
; ";"
if_statement (+209 nodes collapsed)
} "}"
} "}"
block_comment "/**\n * Compute a new point (in the original space) and a"...
method_declaration (+206 nodes collapsed)
block_comment "/**\n * Class for finding the minimum of the objective fu"...
class_declaration (+359 nodes collapsed)
block_comment "/**\n * @throws MathUnsupportedOperationException if boun"...
method_declaration (+50 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration (+25 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "util"
. "."
identifier "FastMath"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "util"
. "."
identifier "MathArrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "analysis"
. "."
identifier "UnivariateFunction"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "NumberIsTooSmallException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "NotStrictlyPositiveException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "exception"
. "."
identifier "MathUnsupportedOperationException"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+25 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "MaxEval"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "PointValuePair"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math3"
. "."
identifier "optim"
. "."
identifier "ConvergenceChecker"
; ";"
import_declaration (+25 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
block_comment "/**\n * Powell's algorithm.\n * This code is translated and ad"...
class_declaration
modifiers
public "public"
class "class"
identifier "PowellOptimizer"
superclass
extends "extends"
type_identifier "MultivariateOptimizer"
class_body
{ "{"
block_comment "/**\n * Minimum relative tolerance.\n */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * Relative threshold.\n */"
field_declaration
modifiers
private "private"
final "final"
floating_point_type
double "double"
variable_declarator
identifier "relativeThreshold"
; ";"
block_comment "/**\n * Absolute threshold.\n */"
field_declaration
modifiers
private "private"
final "final"
floating_point_type
double "double"
variable_declarator
identifier "absoluteThreshold"
; ";"
block_comment "/**\n * Line search.\n */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "LineSearch"
variable_declarator
identifier "line"
; ";"
block_comment "/**\n * This constructor allows to specify a user-defined"...
constructor_declaration (+57 nodes collapsed)
block_comment "/**\n * This constructor allows to specify a user-defined"...
constructor_declaration (+120 nodes collapsed)
block_comment "/**\n * The parameters control the default convergence ch"...
constructor_declaration (+30 nodes collapsed)
block_comment "/**\n * Builds an instance with the default convergence c"...
constructor_declaration (+44 nodes collapsed)
block_comment "/** {@inheritDoc} */"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
type_identifier "PointValuePair"
identifier "doOptimize"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "checkParameters"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
type_identifier "GoalType"
variable_declarator
identifier "goal"
= "="
method_invocation
identifier "getGoalType"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "guess"
= "="
method_invocation
identifier "getStartPoint"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
integral_type
int "int"
variable_declarator
identifier "n"
= "="
field_access
identifier "guess"
. "."
identifier "length"
; ";"
local_variable_declaration (+27 nodes collapsed)
for_statement (+37 nodes collapsed)
local_variable_declaration
modifiers
final "final"
generic_type
type_identifier "ConvergenceChecker"
type_arguments
< "<"
type_identifier "PointValuePair"
> ">"
variable_declarator
identifier "checker"
= "="
method_invocation
identifier "getConvergenceChecker"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "x"
= "="
identifier "guess"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fVal"
= "="
method_invocation
identifier "computeObjectiveValue"
argument_list
( "("
identifier "x"
) ")"
; ";"
local_variable_declaration
array_type
floating_point_type
double "double"
dimensions
[ "["
] "]"
variable_declarator
identifier "x1"
= "="
method_invocation
identifier "x"
. "."
identifier "clone"
argument_list
( "("
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
true "true"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "incrementIterationCount"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fX"
= "="
identifier "fVal"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "fX2"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "delta"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "bigInd"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "alphaMin"
= "="
decimal_integer_literal "0"
; ";"
for_statement (+164 nodes collapsed)
line_comment "// Default convergence check."
local_variable_declaration (+48 nodes collapsed)
local_variable_declaration
modifiers
final "final"
type_identifier "PointValuePair"
variable_declarator
identifier "previous"
= "="
object_creation_expression
new "new"
type_identifier "PointValuePair"
argument_list
( "("
identifier "x1"
, ","
identifier "fX"
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
type_identifier "PointValuePair"
variable_declarator
identifier "current"
= "="
object_creation_expression
new "new"
type_identifier "PointValuePair"
argument_list
( "("
identifier "x"
, ","
identifier "fVal"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "stop"
) ")"
block
{ "{"
line_comment "// User-defined stopping criteria."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "checker"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "stop"
= "="
method_invocation
identifier "checker"
. "."
identifier "converged"
argument_list
( "("
method_invocation
identifier "getIterations"
argument_list
( "("
) ")"
, ","
identifier "previous"
, ","
identifier "current"
) ")"
; ";"
} "}"
} "}"
if_statement (+58 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
for_statement (+68 nodes collapsed)
expression_statement
assignment_expression
identifier "x1"
= "="
method_invocation
identifier "x"
. "."
identifier "clone"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "fX2"
= "="
method_invocation
identifier "computeObjectiveValue"
argument_list
( "("
identifier "x2"
) ")"
; ";"
if_statement (+209 nodes collapsed)
} "}"
} "}"
block_comment "/**\n * Compute a new point (in the original space) and a"...
method_declaration (+206 nodes collapsed)
block_comment "/**\n * Class for finding the minimum of the objective fu"...
class_declaration (+359 nodes collapsed)
block_comment "/**\n * @throws MathUnsupportedOperationException if boun"...
method_declaration (+50 nodes collapsed)
} "}"