Main Content

CustomStartPointSet

Custom start points

Description

A CustomStartPointSet is an object wrapper of a matrix whose rows represent start points for MultiStart.

Creation

Description

tpoints = CustomStartPointSet(ptmatrix) generates a CustomStartPointSet object from the ptmatrix matrix. Each row of ptmatrix represents one start point.

example

Input Arguments

expand all

Start points, specified as a matrix. Each row of ptmatrix represents one start point.

Example: randn(40,3) creates 40 start points of 3 dimensions.

Data Types: double

Properties

expand all

This property is read-only.

Number of start points, specified as a positive integer. NumStartPoints is the number of rows in ptmatrix.

Example: 40

Data Types: double

This property is read-only.

Dimension of each start point, specified as a positive integer. StartPointsDimension is the number of columns in ptmatrix.

StartPointsDimension is the same as the number of elements in problem.x0, the problem structure you pass to run.

Example: 5

Data Types: double

Object Functions

listList start points

Examples

collapse all

Create a CustomStartPointSet object with 64 three-dimensional points.

[x,y,z] = meshgrid(1:4);
ptmatrix = [x(:),y(:),z(:)] + [10,20,30];
tpoints = CustomStartPointSet(ptmatrix);

tpoints is the ptmatrix matrix contained in a CustomStartPointSet object.

Extract the original matrix from the tpoints object by using list.

tpts = list(tpoints);

Check that the tpts output is identical to ptmatrix.

isequal(ptmatrix,tpts)
ans = logical
   1

To create a set of pseudorandom start points that have different ranges than the problem bounds, create the points explicitly. For example, consider this problem with two-dimensional points:

sixmin = @(x)(4*x(1)^2 - 2.1*x(1)^4 + x(1)^6/3 ...
    + x(1)*x(2) - 4*x(2)^2 + 4*x(2)^4);
lb = [-6,-12];
ub = [20,40];
x0 = [1,2];
problem = createOptimProblem("fmincon",...
    x0=x0,lb=lb,ub=ub,objective=sixmin);

Suppose that you want your start points to be in the range

-5x15-4x24,

which is much smaller than the problem bounds. Generate 20 points in this range:

rng default % For reproducibility
N = 20; % Number of points
lbcustom = [-5,-4];
ubcustom = [5,4];
ptmatrix = lbcustom + rand(N,2).*repmat((ubcustom - lbcustom),N,1);

View the ranges of the pseudorandom points:

[minpt,maxpt] = bounds(ptmatrix)
minpt = 1×2

   -4.0246   -3.7453

maxpt = 1×2

    4.7059    3.6018

The points extend to nearly the entire range.

Place the points in a CustomStartPointSet object.

tpoints = CustomStartPointSet(ptmatrix);

Solve the problem using the custom start points.

ms = MultiStart;
[x,fval, exitflag,output] = run(ms,problem,tpoints)
MultiStart completed the runs from all start points. 

All 20 local solver runs converged with a positive local solver exitflag.
x = 1×2

   -0.0898    0.7127

fval = 
-1.0316
exitflag = 
1
output = struct with fields:
                funcCount: 952
         localSolverTotal: 20
       localSolverSuccess: 20
    localSolverIncomplete: 0
    localSolverNoSolution: 0
                  message: 'MultiStart completed the runs from all start points. ↵↵All 20 local solver runs converged with a positive local solver exitflag.'

Compare to solving the problem using 20 pseudorandom points from the bounds.

[x2,fval2,exitflag2,output2] = run(ms,problem,20)
MultiStart completed the runs from all start points. 

All 20 local solver runs converged with a positive local solver exitflag.
x2 = 1×2

    0.0898   -0.7127

fval2 = 
-1.0316
exitflag2 = 
1
output2 = struct with fields:
                funcCount: 1558
         localSolverTotal: 20
       localSolverSuccess: 20
    localSolverIncomplete: 0
    localSolverNoSolution: 0
                  message: 'MultiStart completed the runs from all start points. ↵↵All 20 local solver runs converged with a positive local solver exitflag.'

In this case, the solutions have the same objective function value to display precision, but the solution using the custom start point set uses many fewer function evaluations.

Version History

Introduced in R2010a