test.problem-class: Class "test.problem"

Description Objects from the Class Slots Methods See Also Examples

Description

The class contains a test problem including domain definition and reference solution. Generally objects from the class facilitate easy testing of PSO with various parameters.

Objects from the Class

Objects can be created by calls of the form new("test.problem", ...), but the convenience constructer test.problem is the usual approach.

Slots

name:

The name of the test problem. Object of class "character".

f:

Function to be minimized. Object of class "function".

grad:

Gradient of f. Only used with BFGS for the local search. Object of class "function".

n:

Problem dimensionality. Object of class "integer".

maxf:

Maximal number of function evaluations to use. Object of class "integer"

objective:

The absolute tolerance when running PSO. Object of class "numeric".

ntest:

The number of tests to perform. Object of class "integer".

lower:

The lower bounds. Object of class "numeric".

upper:

The upper bounds. Object of class "numeric".

Methods

psoptim

signature(par = "test.problem", fn = "missing", gr = "missing",
lower = "missing", upper = "missing"): for running PSO on the test problem. See psoptim-methods for details.

show

signature(object = "test.problem"): descriptive information of the test problem. See show-methods for details.

See Also

test.problem.

Examples

1
2
3
4
test.problem("rast")
test.problem("rast",10) # modified for 10 repetitions.

test.problem("para")

Example output

Test problem: rastrigin
Dimension: 2
Objective: 0
Max function eval.: 3000
Number of tests: 100
Test problem: rastrigin
Dimension: 2
Objective: 0
Max function eval.: 3000
Number of tests: 10
Test problem: parabola
Dimension: 30
Objective: 1e-08
Max function eval.: 50000
Number of tests: 100

pso documentation built on May 1, 2019, 8:45 p.m.