# Alan Weiss

### MathWorks

I write documentation for MATLAB mathematical toolboxes, primarily optimization. I have also written documentation for PDE, statistics, symbolic math, and econometrics.

My pre-MathWorks job was with Bell Labs, primarily in mathematical models of data traffic, with a strong interest in parallel computation and in rare events (large deviations).

I do not provide private consulting. If you have a question, please ask on a public forum such as MATLAB Answers.

**Statistics**

RANK**37**

of 281,954

REPUTATION**5,272**

CONTRIBUTIONS

**0** Questions

**2,388** Answers

ANSWER ACCEPTANCE **
0.00%
**

VOTES RECEIVED**658**

RANK**4,998** of 19,066

REPUTATION**247**

AVERAGE RATING**0.00**

CONTRIBUTIONS**3** Files

DOWNLOADS **4**

ALL TIME DOWNLOADS**2474**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Gaussian process regression - how to fit a basis function but not other parameters

I might misunderstand what you are trying to do, but perhaps you could use the OptimizeHyperparameters name-value argument to fi...

28 days ago | 0

When I use fmincon, the optimised result does not satisfy my non liner constraints

You would do better to use the default 'interior-point' algorithm, which arrives at a feasible solution. fun = @(x)4*x(1)+x(2);...

1 month ago | 0

How to use both pswplotbestf and pswplotranges for particleswarm?

The issue is that the pswplotranges output function was written incorrectly, and does not take into account that other plots mig...

2 months ago | 0

| accepted

Genetic Algorithm (ga) terminating after a few generations

Almost certainly this is because you use nonlinear constraints. When you use nonlinear constraints, there are very few major ite...

2 months ago | 0

HELP 3 variable optimization use fmincon

The short answer is you put all your variables into one variable, and call a solver on the one variable objective function. For ...

2 months ago | 0

How is genetic algorithm function's ga optimfunctions used? How do I use that? What is the difference between optimset and optimfunction? Why do I receive error in this code?

The correct function name is optimoptions: ga_opt = optimoptions('ga','Display', 'off', 'Generations', 25, 'PopulationSize',50,...

2 months ago | 1

How to obtain the optimised decision variable in the lower-layer when using genetic algorithm for a two-layer optimisation problem?

You can write these to an array, if you like. Something like this: function [DV_Up_Opt,Obj_Up_Opt,lowhistory] = myfun() lowhis...

3 months ago | 0

| accepted

fmincon non-linear optimisation: issues with sqp and interior-point

It sounds like you have done a good job in analyzing the solver behavior. There is one more thing that I have found that sometim...

3 months ago | 0

Solve linear equation optimization

You might find the examples in the linprog documentation useful. Alan Weiss MATLAB mathematical toolbox documentation

3 months ago | 0

pattern search does not perform function calculation between iterations.

I suggest that you turn on iterative display. I suspect that most of the values patternsearch samples evaluate to NaN or Inf or ...

4 months ago | 0

I want to fit my ode model to experimental data and derive parameters using lsqcurevfit and fmincon

There are some examples in the documentation of fitting ODE parameters to data: Fit ODE Parameters Using Optimization Variables...

4 months ago | 0

Can I adjust patternsearch meshsize using output function (during optimisation)?

Sorry to say, but a patternsearch output function does not allow you to change the mesh size. However, as I think you know, the ...

4 months ago | 0

| accepted

how does check gradient compare supplied gradients with finite difference gradients?

The CheckGradients option causes solvers to compare a finite-difference gradient estimate to the supplied gradient value, and if...

5 months ago | 0

Running genetic algorithm and Simulink in parallel

I am not at all sure that it is possible to run ga in parallel when the objective function is given by a Simulink model. For a ...

5 months ago | 1

optimising hybrid energy design using genetic algorithm

For an error of that type I think that you should learn to use the debugger. See Debug MATLAB Code Files and Set Breakpoints. A...

5 months ago | 0

| accepted

Fitness Scaling Options for Genetic Algorithm

The documentation says this: 'fitscalingrank' — The default fitness scaling function, 'fitscalingrank', scales the raw scores b...

5 months ago | 0

| accepted

Problems with lsqnonlin - initial parameters not changing

We don't see your ObjFunE code, so cannot be sure of what is going on. It seems that you are solving an ODE to create some outpu...

5 months ago | 0

Issue with large memory required for non-linear optimizer

You have 150^2 optimization variables. I do not see your parameterfun function, but if it is not a supported function for automa...

6 months ago | 1

| accepted

How to create a Triple Objective Genetic Algorithm establish constraints and plot 3D

I am sorry to say that I think that you need more help than we can give on this forum. If you want to have a productive interact...

6 months ago | 0

How to create a Triple Objective Genetic Algorithm establish constraints and plot 3D

OK, it seems that you have decided to use the solver-based approach, which is just fine. You set some nondefault options. I am ...

6 months ago | 0

How to prevent ga-Solver from accepting the first best solution?

It is possible that you unknowingly set some constraints that keep the solution you want from being considered. It is very hard ...

6 months ago | 0

Correct implementation of multi start option with pre-specified starters

If you read the description of MultiStart run, you see that calling run(ms,problem,k)) uses k - 1 random points in addition to t...

6 months ago | 0

| accepted

Matlab Code Assistance for Multistart or GA

Perhaps more relevant documentation is here: MultiStart with lsqnonlin, Problem-Based MultiStart Using lsqcurvefit or lsqnonli...

6 months ago | 0

Multistart apparently does not respect the supplied initial points

The only error here is your expectation that fmincon always converges to the closest local minimum. It does not. fun = @(x) x.^...

6 months ago | 0

| accepted

How to create a Triple Objective Genetic Algorithm establish constraints and plot 3D

You are confusing many things here. The first thing you have to do is decide if you are using optimization variables, meaning t...

6 months ago | 1

Unrecognized function or variable 'options'. for simulannealbnd, but works for fminunc

optimoptions requires that the first argument be the name of the solver. Something like options = optimoptions('simulannealbnd'...

6 months ago | 0

| accepted

When the genetic algorithm has integer constraint issues, how to customize the variogram to eliminate the ignored warning

I am not sure what you mean by "variogram." But I think that I know the reason for your difficulty. As the Release Notes state, ...

6 months ago | 0

| accepted

Optimization terminated: maximum number of generations exceeded.

ga exceeded 200 generations. If you want more, increase the MaxGenerations option. options = optimoptions('ga','ConstraintToler...

6 months ago | 1

| accepted

How to output additional variables from objective function using ga optimization?

I am not sure what you are trying to do. You might be trying to pass intermediate values calculated within ga to reuse, for exam...

6 months ago | 0

Multiple initial points in fmincon optimization

fmincon takes the size of the x0 input as determining the number of input variables. Your x0 has 6 elements, so fmincon thinks t...

6 months ago | 0

| accepted