Questions on the optimization functions of Mathematica such as FindMinimum/FindMaximum, Minimize/Maximize, NMinimize/NMaximize, etc.

learn more… | top users | synonyms (2)

58
votes
2answers
4k views

Shaving the last 50 ms off NMinimize

The epilogue: A paper where the below answer is used was published. The answer below is cited among the references:) The background: I have to fit an objective function for ~10 000 datasets in near ...
45
votes
4answers
9k views

How to find all the local minima/maxima in a range

I want to find : all local maxima in range all local minima in range From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the ...
35
votes
7answers
2k views

Character edge finding

The following line of code finds the edge of a character: ...
34
votes
3answers
2k views

Identifying critical points/lines of 2/3D image/cubes

Upshot I am interested in identifying critical points of a 3D field/cubes (maxima, minima, tube-like and wall-like saddle points) and 2D field/image (maxima, minima, saddle points). I.e. the ...
20
votes
4answers
4k views

Finding Local Minima / Maxima in Noisy Data

I'm trying to find local minima / maxima in noisy data, consisting of data values taken at certain time intervals. Ideally, the function should take a pair of lists (one containing time values and one ...
20
votes
1answer
352 views

How to work with Experimental`NumericalFunction?

This question is intimately connected with previous one: "How to create internally optimized expression for computing with high WorkingPrecision?" Oleksandr R. correctly states in the comment: A ...
19
votes
2answers
769 views

Optimization with assumptions

I have the following problem, when I am trying to optimize function with pre-defined assumptions. I am using Mathematica 8 and I wrote the following simple code ...
17
votes
2answers
668 views

Obtain approximate Hessian using FindMinimum

According to the documentation, when FindMinimum is told to use the method "QuasiNewton" on a unconstrained problem, it uses the ...
16
votes
2answers
533 views

Schedule programing problem with integer linear programming

I know how to model this question on paper, but I don't know how doing it in Mathematica. Imagine , there is a university student who want to choose courses for this semester and he got the ...
14
votes
2answers
597 views

How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
13
votes
3answers
857 views

Strategies to avoid LessEqual::nord in NMinimize?

When using NMinimize on functions with complex intermediate expressions (but a real end result), quite often one gets the error ...
12
votes
4answers
3k views

Minimizing a function of many coordinates

I'm trying to obtain a series of points on the unit sphere with a somewhat homogeneous distribution, by minimizing a function depending on distances (I took $\exp(-d)$). My points are represented by ...
12
votes
2answers
617 views

Is it possible to use the LevenbergMarquardt algorithm for fitting a black-box residual function?

I have a black-box multiargument multiparametric function of the type SRD[dataPoint_List,params_List] which accepts experimental data along with the parameters of ...
11
votes
4answers
194 views

Constraint syntax compaction

Is there a more compact way to represent these constraints: NMaximize[{a+b+c,...
11
votes
2answers
605 views

Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
11
votes
2answers
231 views

Rotational Averaging of Image Periodograms (FFTS)

I'm writing a code to do rotational averages of image FFT's. I have a working version but it is pretty slow. Wondering if anyone has any thoughts on a way to do this more efficiently. Data looks ...
11
votes
2answers
1k views

Maximizing a function with assumptions

Using f[s_] := Log[(s/r)^α ((α - 2) n0 r^α + 2 π Pmax ρ r^2) /((α - 2) n0 s^α + 2 π Pmax ρ s^2)]/s When I run the following line: ...
10
votes
1answer
1k views

Combined numerical minimization and maximization

I want to numerically calculate the maximum of a function defined by the minimization of another function, like the following: ...
9
votes
3answers
385 views

Strange domain dependency with Maximize

I'm using Mathematica 8 and strangely enough this code: Maximize[{x*(1-0.01 x),x>0},x,Integers] produces the result ...
9
votes
4answers
1k views

NMinimize usage

I would like to minimize functions including the following. NMinimize[{1 - (1 - 1/n)^x - x/n, n > x, x > 1}, {n, x}] However Mathematica complains about ...
9
votes
3answers
399 views

FindShortestTour for charity (or: How can I optimize meal delivery with FindShortestTour?)

I've been wondering about this for a while - but never got around to asking - until I saw faleichik's incredible answer to Mathematica Minecraft. I did some work at a not-for-profit a little while ...
9
votes
1answer
286 views

Fitting Vogel's formula for phyllotaxis to the image of a flower

After having read this question I was inspired to investigate how we could take an image of a plant displaying phyllotaxis and fit Vogel's model of phyllotaxis to the image. The theory is very simple. ...
9
votes
1answer
254 views

Efficiently filling area with disks located at certain points

Starting from a set of points, I want to fill an area using disks. Each disk's center should be one of the points and the disks should not overlap. I've managed to write a function that, given a list ...
9
votes
1answer
394 views

ParallelEvaluate for function minimization

Is there a parallelized version of a minimization routine available in Mathematica? The objective function is non-linear and the gradients have to be numerically computed. Every function evaluation ...
9
votes
1answer
878 views

Multi-objective genetic algorithm in Mathematica?

Is there any implementation of a multi-objective genetic algorithm for Mathematica?
9
votes
4answers
286 views

How can I efficiently check if a graph is unit distance?

A unit distance graph is a graph that is embeddable in the plane so that every edge has length 1. ...
9
votes
0answers
151 views

Can code optimize code?

Are there functions, programs or packages that deal with optimizing mathematica code i.e. re-writing ineffecive or convoluted code. -This question has haunted me since I joined SE. The background for ...
8
votes
8answers
957 views

Finding maximum or minimum of implicit functions

is there any built in function that can be used to find maximum or minimum of implicit functions? For example, if we have the equation $$x^2 + y^2 = (2 x^2 + 2 y^2 - x)^2,$$ then we can visualize the ...
8
votes
3answers
1k views

Which ColorFunction should I use to get such a gradient of blue-cyan-green-yellow-orange-red?

I want to get the effect in the above Figure. Here is my code: ...
8
votes
1answer
1k views

Minimization by Nelder-Mead

Finding a global minimum for this problem (non-linear optimization by the Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the ...
8
votes
1answer
832 views

How to speed up Minimum Spanning Tree algorithm?

How to speed up MST algorithm? I work with graphs and I have adopted Prim's algorithm for my needs, from here. The graphs which I use are very dense (number of vertexes: $V=500$ and every vertex is ...
8
votes
1answer
152 views

What is the difference between FindFit and NonlinearModelFit

I cannot get the difference between these two fitting functions in Mathematica. I even read in MMA that the result of these two are the same.
8
votes
3answers
430 views

How can I complete a correlation matrix with missing values?

I would like to complete a correlation matrix with missing entries, such that the resulting matrix is positive semi-definite. Say I want to find some x and some y in the next matrix that satisfy ...
8
votes
1answer
139 views

Experimental`NumericalFunction in NMinimize solution

I try to make a number of optimizations using this code: ...
8
votes
1answer
2k views

Solve Lagrange multipliers optimization problem

I have two nested solid figure, where $V(a,h,\tau)$ defines the volume and $A(a,h,t)$ defines the surface. The outer solid figure is parametrized in $a_s$,$h_s$ and $t_s$ (they share a common center). ...
8
votes
1answer
1k views

Linear programming with many variables and parameters

I am trying to reconstruct the answer that is given in this report. (page 153 in Appendix B; Section B.2.1). They are given variables, parameters, constraints, and the objective function to minimize. ...
7
votes
4answers
284 views

Finding the point of minimum distance between two parametric functions

I have two functions re and rm, for which I computed the minimum distance between them. Now I would like to add a point at the ...
7
votes
2answers
901 views

Implementation of a new Game of Life Rule

I need to implement a new "game of life" in Mathematica: I have three states — black, red and white. Black means go forward, red go back and white take no action. I would like to implement the ...
7
votes
2answers
152 views

How to Maximize[Log[n]^(1/Log[n]), n]

I am new to Mathematica and am trying to work out how to use Maximize. Maximize[Log[n]^(1/Log[n]),n] Should give a solution at $e^e$. However in Mathematica you ...
7
votes
3answers
506 views

Cannot find the maximum value of a function

Consider the following function: $a Sin(x)+b Cos(x)$ I tried to obtain the maximum value of this function using MaxValue[]: ...
7
votes
2answers
742 views
7
votes
2answers
231 views

Using least independent rectangle area to separate every point

Description I want to add vertical line and horizonal lines between data to make every point have an independent rectangle area. In addtion, every independent rectangle has a number ...
7
votes
1answer
646 views

Using Mathematica to help to determine the consistency of and numerically solve systems of non-linear equations

The formal problem The question I am about to ask is applicable to many scientific and engineering problems. In short, I am bout to ask for pointers and practical advice for Mathematica beginners who ...
6
votes
2answers
649 views

Distribution of 10 points within a unit square

Related to some packing problems, following problem arose: Distribute 10 points within a square of sides 1, so that minimal distance between them is maximized. With the help of random simulation, or ...
6
votes
3answers
203 views

How to use a compiled function in numerical optimization

I'm trying to wrap my head around function Compile. So, this is a spin-off question from: a previous question on using compile[] correctly. I have a function that ...
6
votes
2answers
198 views

Numerical Optimization Methods

I am curious if any one has comments on "specific characteristics" of a problem that will deem it to be best solved by a specific optimization method such as ...
6
votes
1answer
398 views

Defining a non-linear optimization-problem

Consider the following non-linear optimisation problem: ...
6
votes
2answers
495 views

Built-ins for discrete ArgMax or ArgMin?

Wondering whether there are discrete versions of ArgMax / ArgMin, that is, something that will find the part of an expression at ...
6
votes
1answer
275 views

What is wrong about Abs[x]-a? Is it a bug?

Why is the Out[74] not {1 - a, {x -> -1}}? ...
6
votes
1answer
282 views

Numerical problems with calculation of function

I have a problem with a calculation which I try to do with Mathematica (8.0.1). I have the following function which describes a cone (with half opening angle ...