Questions tagged [mathematical-optimization]

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

495 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
12 votes
0 answers
288 views

Linear programming with lazy constraints

Does Mathematica offer any means for solving linear programming problems with "lazy constraints", as described e.g. here? While I am not very familiar with linear programming, my understanding of the ...
Szabolcs's user avatar
  • 235k
11 votes
0 answers
355 views

Customized StepSize control in unconstrained gradient-descent optimization

I have a type of minimization problem I frequently solve that involves warping a large 2D triangle-mesh (~25,000 vertices) to fit a model. In the mesh, vertices carry the empirical measurements (each ...
nben's user avatar
  • 2,148
10 votes
0 answers
467 views

Is there an analogue of Evaluated->False (in FindRoot) for FindMinimum?

I guess functions like FindRoot, FindMinimum, etc puts the estimation number into the expression, and then do other calculations....
vapor's user avatar
  • 7,901
10 votes
0 answers
6k views

Precision and accuracy in NDSolve and NMinimize

I use NDSolve quite a lot and have noticed that setting values for AccuracyGoal and ...
indigoblue's user avatar
9 votes
0 answers
140 views

LinearProgramming returns an invalid null solution that apparently doesn't satisfy constraints without any warning

Bug introduced in 9.0 or earlier and persisting through 11.0.1 or later While searching to answer the question Solving the magic backyard puzzle with MMA at some time I composed a set of arguments ...
unlikely's user avatar
  • 7,103
8 votes
0 answers
204 views

FindShortestTour causes kernel crash

I have contacted support, CASE:4075709 UPDATE I have received reply from wolfram support. They have confirmed that this is indeed a bug. There are lots of sets of data that can cause the Kernel to ...
t-smart's user avatar
  • 2,031
8 votes
0 answers
1k views

Visualizing the Lagrange Multiplier Solution

This question is based on work in Susan Colley's Vector Calculus, 4th ed. The question is to find and classify critical points of $f(x,y,z)=3xy-4yz+5xz$ subject to the constraint $g(x,y,z)=3x+y+2z=13$...
David's user avatar
  • 14.9k
8 votes
0 answers
482 views

How to determine reason for kernel crash? -> Nelder Mead optimisation

I am making use of the Nelder Mead algorithm inside Mathematica's NMaximize to find a parameter set by solving the Schrodinger equation for a given system. (see ...
Lukas's user avatar
  • 2,702
7 votes
0 answers
2k views

When using NMinimize[...,Method->"DifferentialEvolution"] is an "iteration" different than a "step"?

Hopefully this question has a simple answer. I have the following bit of code: ...
Adam's user avatar
  • 91
6 votes
0 answers
148 views

Caveats of LinearProgramming on Integers domain

When using LinearProgramming with the Integers domain, Mathematica issues the following warning: ...
Szabolcs's user avatar
  • 235k
6 votes
0 answers
1k views

How to find the a minimum cost perfect matching

Crossposted on Wolfram Community A a minimum cost perfect matching is very useful tool.This three links about this demand just related me,let alone all MMA.SE. How to get some pairing with smallest ...
yode's user avatar
  • 26.5k
6 votes
0 answers
614 views

Custom Methods for NMinimize/NonLinearModelFit

Is there a way to write custom methods for NonLinearModelFit or NMinimize? To give background, I currently have a batch of code ...
Guyondowy's user avatar
6 votes
0 answers
397 views

Problems extending NelderMeadMinimize into 2D

Update The eventual route I followed was to adapt a version of the NM-simplex written in C and link to it with MathLink. Once I've tested this out fully I'll post it here. I've been playing around ...
dr.blochwave's user avatar
  • 8,768
6 votes
0 answers
232 views

Issue with FindCurvePath

I have a problem with the function FindCurvePath. In some cases it crashes the Mathematica 9 Kernel. Here an example, where it crashes the kernel: ...
Bimmel's user avatar
  • 573
5 votes
0 answers
121 views

How to write down and check the Karush-Kuhn-Tucker conditions?

This is a simple touchstone for a serious matter. I try to solve with Mathematica 13.3.1 on Windows 10 problem 1278 from "The Kvant". Let real numbers $x_1,x_2,\dots,x_n$ satisfy the ...
user64494's user avatar
  • 25.7k
5 votes
0 answers
65 views

Memory leak in FindMinValue?

I was running some geometric optimisation code today using FindMinValue and for some reason at one point the memory usage goes upwards of 14GB, making the kernel ...
Liam Baker's user avatar
5 votes
0 answers
150 views

How to train each layer in a Neural Network so they optimize different loss functions in an adversarial network?

Example NetGraph to illustrate the idea (Input is an online signal with a value between -1 and 1, Noise is Gaussian Centered at 0 and standard deviation 0.1, EvilNet is constrained to output a value ...
Dropped Bass's user avatar
5 votes
0 answers
105 views

Effectivelly using Compile for calculate a Unitary transformation

I am new to Mathematica, and this is my first post, so if my question is not clear enough, I would be glad to read the comments and edit my question to add more information. The problem I need to ...
LUCAS FREITAS's user avatar
5 votes
0 answers
67 views

What does the PerformanceGoal option of FindMinimum do?

FindFit and FindMinimum both have a PerformanceGoal option. It is not documented. What does ...
Szabolcs's user avatar
  • 235k
5 votes
0 answers
156 views

What's BayesianMinimization and related functions based on?

Is it specified anywhere what the backend is for the Bayesian optimization related functionality in Mathematica v11? I'm specifically referring to the Bayesian* ...
Mohammed AlQuraishi's user avatar
5 votes
0 answers
149 views

How to do parallel computation when using LinearProgramming function?

I have a LP problem which contains 2n+3 variables with 4n+6 inequality constraints. I was trying to use Mathematica's LinearProgramming function. When n is small, like less than 30, it gives outcome ...
fred's user avatar
  • 71
5 votes
0 answers
483 views

Amelioration of a Karush-Kuhn-Tucker nice code

In what concerns the resolution of a Karush-Kuhn-Tucker condition, this wonderful code borrowed to Parreiras (The Mathematica Journal 16 2014) which is a correction of another code by Kampas (The ...
cyrille.piatecki's user avatar
5 votes
0 answers
472 views

Softmax Regression Classification Algorithm

I'm following the Stanford Machine Learning course while simultaneously developing my Mathematica abilities. I'm having issues with my Softmax Classifier implementation (for ref, have a look at these ...
Frederik Brinck Jensen's user avatar
5 votes
0 answers
177 views

Improving the speed of an optimization algorithm via compilation and parallellization

I have written an implementation of eight variants of the PSO-algorithm and I want to test them over a set of test functions. I am using parallelization as it improves the speed a lot and I have also, ...
Valtteri's user avatar
  • 265
5 votes
0 answers
308 views

NMinimize seems to call function with the same values multiple times

I have to minimize a function where the evaluation of one parameter set takes very long (around 5sec) and discovered alongside, that NMinimize seems to call this ...
Frederik Ziebell's user avatar
4 votes
0 answers
184 views

Integer optimization problem with very many constraints

Let us consider an integer three-dimensional cube $\{0,1,\dots,100\}^3$. A point $P$ with nonnegative integer coordinates is said to be a radar point if all the distances (its number equals $101^3$) ...
user64494's user avatar
  • 25.7k
4 votes
0 answers
112 views

General hyperparameter searching?

I typically use naive random or grid search to choose them, but I'd like to ask if there are built-in or paclet-based methods that can help perform more principled general hyperparameter searches? For ...
user5601's user avatar
  • 3,613
4 votes
0 answers
104 views

NMinimize/NMaximize: How to specify additional options to the "PostProcess"->FindMinimum option

I would like to pass FindMinimum Options to the PostProcess Option of NMinimize. Here is minimal working example of using NMinimize from the documentation at (see tutorial/...
Craig Carter's user avatar
  • 4,250
4 votes
0 answers
132 views

Solving or Minimizing the Norm of the matrix equation $M^TAM - M^TB - B^TM =C$

I am trying to solve the matrix equation $M^TAM - M^TB - B^TM=C$ where I know A, B and C. My unknown matrix is M which has the special form that all the rows and columns sum to zero. i.e. I have four ...
1729taxi's user avatar
  • 767
4 votes
0 answers
239 views

Numerical backward induction -- Solving sequential Cournot

I'd like to numerically solve a sequential Cournot competition in which supplier 1 moves before supplier 2, then the manufacturer sources from them, and finally sells the item at market clearing price....
user34047's user avatar
  • 335
4 votes
0 answers
237 views

NMinimize differential evolution: how do search points and initial points really work?

I am puzzled by the settings of a specific method for NMinimize called DifferentialEvolution, given for example here. The ...
Kiro's user avatar
  • 1,521
4 votes
0 answers
271 views

Legendre–Fenchel Convex Conjugate

What is the easiest way to compute the convex conjugagte of a real convex function $f: \mathbb{R} \to \mathbb{R}$, defined by $f^*(s) = \sup_{x} \{ s x - f(x) \}$ I know I can compute the derivative ...
Alex Shtoff's user avatar
4 votes
0 answers
108 views

Plotting gradient and newton directions for parametric system of nonlinear ODEs

I have a bucket (system) of chemical kinetics models, a nonlinear dynamical system given by: where kf >= 0 and kr >= 0 are the parameters. The initial conditions are A(0) = B(0) = 1 and C(0) = 0. I'...
Sterling's user avatar
  • 543
4 votes
0 answers
103 views

NMaximize not finding initial points within simple constraints

I'm trying to do an optimization, but Mathematica seems not to be able to find starting coordinates within a simple rectangular region. When I run this code: ...
dotdashdashdash's user avatar
4 votes
0 answers
364 views

Problem with the accuracy of the real-coded Genetic algorithm

Since there is no Genetic algorithm implemented in the Mathematica i tried to write a very simple genetic algorithm myself. The accuracy of the results depend upon rounding up the obtained parameters. ...
user49047's user avatar
  • 781
4 votes
0 answers
95 views

Optimization`FindFit`ObjectiveFunction and PenaltyFunction

Consider the following toy example: model = a Cos[w t]; data = Table[{t, Cos[2.1 t]}, {t, 0, 10, .25}] + RandomReal[.1, 41]; as both an unconstrained problem: <...
Sascha's user avatar
  • 8,409
4 votes
0 answers
244 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
BetterEnglish's user avatar
4 votes
0 answers
333 views

Symbolically Minimizing a Max function

I'm having a tough time with seemingly simple symbolic Minimization/Maximization in Mathematica. I would like to use the Maximize function to work on some unknown random variables and so use min/max ...
Kyle's user avatar
  • 41
4 votes
0 answers
134 views

Efficient processing of Special Ordered Sets with LinearProgramming

I'm playing with integer linear programming, especially problems involving lots of constraints which would appear to be special ordered sets. Below is a toy example, three last rows of the matrix ...
kirma's user avatar
  • 19k
4 votes
0 answers
1k views

Speeding up NDSolve for system of differential equations

I am wondering if there is a way to speed up this function that solves a system of ordinary differential equations with NDSolve? Thus far I've tried specifying a few different methods such as LSODA, ...
tarhawk's user avatar
  • 769
4 votes
0 answers
616 views

Travel time sweet spot using: Mathematica and Google Maps API

I want to use Mathematica to do some time minimisation calculations calling on Google Maps API for travel time data. I'm concerned with travel time, e.g. along roads (by car or walk) and not linear ...
PeteCog's user avatar
  • 41
4 votes
0 answers
644 views

Minimizing a functional takes forever

I need help with minimizing a functional in Mathematica. I have a function $V(\xi)=\sum_{i=1}^\infty C_{3_i}J_0(\xi/C_i)+C_{4_i}Y_0(\xi/C_i),~~~\Sigma\leq\xi\leq\xi_1$, and want to find such $\{C_{...
ApplMath's user avatar
3 votes
0 answers
124 views

How to estimate Lake area and volume in Mathematica?

I have a satellite image of the lake and I want to estimate its area and volume. Actual volume:1.49*10e8 m^3 Actual Area:36.9 km^2 I did the following command to find the volume, but it is not very ...
Erfan's user avatar
  • 159
3 votes
0 answers
46 views

Performing Tobit Regression in Mathematica by Maximum LogLikelihood

I am trying to estimate a tobit model by maximum likelihood method in Mathematica. I can not find the build-in function. So I try to perform it manually. Here is the log likelihood function of Tobit ...
Xiaoge Zhang's user avatar
3 votes
0 answers
107 views

Placing shapes along a square spiral

Proposed code example is inspired by the main idea of this challenge. Wolfram Language provides great opportunities in computational geometry. But not all of them are equal in terms of speed and ...
lesobrod's user avatar
  • 1,501
3 votes
0 answers
167 views

Can Mathematica's Minimize() function be called inside Python code using Python data?

Summary: I would like to use the Wolfram Client Library for Python to invoke Mathematica's Minimize function directly from within Python, passing to it Python data structures. Details: I have a Python ...
Neil Fazel's user avatar
3 votes
0 answers
77 views

Using a compiled function in NMinimize

I can get NMinimize to work with compiled functions in simple cases. This works with a constraint: ...
Craig Carter's user avatar
  • 4,250
3 votes
0 answers
62 views

Supply gradient to FindMinimum subject to constraints

FindMinimum supports explicitly supplying the gradient (as well as the Hessian) via the Gradient (resp. Hessian) option. However,...
Math Gaudium's user avatar
3 votes
0 answers
150 views

Approximate integer factorization

Suppose we would like to compute an approximate prime factorization of a large integer x in the sense that the difference between ...
Math Gaudium's user avatar
3 votes
1 answer
317 views

In NMinimize, how to incorporate constraints on positive semidefiniteness of a matrix which is not the matrix variable being optimised?

The problem I want to solve the following problem for symmetric matrix $X$: $$ \begin{aligned} \min_{X\succ 0} \; & -\log(\det(X)) & \\ \text{subject to} \; & \begin{pmatrix} X &...
ModCon's user avatar
  • 235

1
2 3 4 5
10