New answers tagged

1

The following comment is about the application of the PMP, not about Mathematica per se. The Pontryagin maximum principle (PMP) is not designed for application on an infinite interval. The PMP provides a set of first-order necessary conditions for optimality in an optimal control problem, which in turn leads to a set of well-posed boundary value problems. ...


1

$Version (* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *) Clear["Global`*"] SeedRandom[1234]; dimuncertset = 3; numsamples = 5; sampinposcube = RandomVariate[UniformDistribution[dimuncertset], numsamples]; sampincube = 2*sampinposcube + ConstantArray[-1, {numsamples, dimuncertset}]; Define a helper function f[t_, x_]...


7

Pontryagin's minimum principle means that we have to use Euler-Lagrange equations. Therefore code looks like this ClearAll["Global`*"] f = Exp[-x[t]^2]; (*Origin ODE *) eqn = D[f, x[t]] + u[t]; J = Integrate[D[f, x[t]]^2 + u[t]^2, {t, 0, tf}]; H = D[f, x[t]]^2 + u[t]^2 + \[Lambda][t] eqn; (*Costate-Equation*) cseqn = Derivative[1][\[Lambda]][t] ...


0

To avoid roundoff errors in the functional change Log[p[k]] to Log[RealAbs[p[k]]] n = 10; Table[ NMaximize[{-Sum[p[k]*Log[RealAbs[p[k]]], {k, 1, n}],Sum[p[k], {k, 1, n}] == 1 && Sum[k*p[k], {k, 1, n}] == 2 && p[1] > 0 && p[2] > 0,p[3] > 0 && p[4] > 0 && p[5] > 0 && p[6] > 0 && p[7] &...


0

Let us look at the result of Reduce[((2 x + 1)/(3 x - 2))^(4 x - 3) <= 10^-10, x, Reals] x==0||x==1/2||2/3<x<=0.667[Ellipsis]||x>=17.7[Ellipsis] Then FindMinimum does its best by FindMinimum[{x,Reduce[((2 x + 1)/(3 x - 2))^(4 x - 3) <= 10^-10, x, Reals]}, {x,2}] {0.666667, {x -> 0.666667}} and Minimize does its best by Minimize[{x, ...


1

Try NMinimize mini=NMinimize[{x, ((2 x + 1)/(3 x - 2))^(4 x - 3) <= 10^-10, x > 2 }, x ] (*{17.7168, {x -> 17.7168}}*) ((2 x + 1)/(3 x - 2))^(4 x - 3) /. mini[[2]] (*1.*10^-10*) To make FindMinimum work the constraint has to be modified( don't know why): FindMinimum[{x, Log[10, ((2 x + 1)/(3 x - 2))^(4 x - 3)] <= -10,2 < x < 20}, {x, ...


13

It seems (clearly!) to be a bug in the preprocessing for the new convex optimizer. Use one of the other methods (e.g. "DifferentialEvolution"): Trace[ NMaximize[E^(-x^2) - 1, x], _Optimization`MinimizationProblem, TraceForward -> True, TraceInternal -> True ] Workaround: NMaximize[E^(-x^2) - 1, x, Method -> "...


6

Robust PCA seems to handle this problem well, but the value for missing data might be tricky. For Robust PCA the optimization problems is $ \min {|| L ||}_{*} + \lambda {|| S ||}_{1}$ s.t. $M = L + S$, where $M$ is an input matrix, $L$ is a low rank matrix and $S$ is a sparse matrix. ${||~||}_{*}$ stands for nuclear norm and ${||~||}_{1}$ is $L_1$ norm. ...


5

First make S into a proper function like this (clear kernel first): S[ϕ1_?NumericQ, ϕ2_?NumericQ, θ1_?NumericQ, θ2_?NumericQ, c2_?NumericQ] := ... Then write: cx[a_] := 0 <= a <= 2 π f[c2_] := NMinimize[{Re@S[ϕ1, ϕ2, θ1, θ2, c2], cx[ϕ1], cx[ϕ2], cx[θ1], cx[θ2]}, {ϕ1, ϕ2, θ1, θ2}][[1]] //Re It only considers the real part as there's a very ...


2

With the constraints provide in the OP's comment below, theta[x], maximized over {x, a, b, c, d, thetaa}, can be obtained as follows. s = ParametricNDSolveValue[{(Exp[2*alpha*x]*D[theta[x], {x, 2}] + (2*alpha + a)*Exp[2*alpha*x]*D[theta[x], x] - b^2*(theta[x] - thetaa) - c*(theta[x] - thetaa)^2 + d*Exp[2*alpha*x] == 0) /. alpha -> -1/2, ...


2

Not an answer, but to long for a comment: Here is "my" result evaluated with Mathematica v12.2 and the approach from @cvgmt reg = Rectangle[]; n = 3; sol = NMaximize[{r, SignedRegionDistance[RegionBoundary@reg] /@ Table[{x[i], y[i]}, {i, n}] >= r, Table[{x[i], y[i]} \[Element] reg, {i, 1, n}], Table[EuclideanDistance[{x[i], y[...


6

Edit It seems that RegionWithin is better than the original method. reg = Rectangle[]; n = 5; sol = NMaximize[{r, r > 0, Table[RegionWithin[reg, Disk[{x[i], y[i]}, r]], {i, n}], Table[SignedRegionDistance[RegionBoundary@reg]@{{x[i], y[i]}} >= r, {i, n}], Table[{x[i], y[i]} \[Element] reg, {i, 1, n}], Table[EuclideanDistance[{x[i], y[i]...


Top 50 recent answers are included