Items tagged with optimization optimization Tagged Items Feed

Hello,

How can I get the minimum point of (sin(x+y))

plot3d(sin(x+y), x=-1..1, y=-1..1);

 

Let us consider the maximum value of the polynomial

x^4+c*x^2+x^3+d*x-c-1

on the interval x=-1..1 as a function g of the parameters c and d. General considerations suggest its continuity. However, a plot3d of g does not  confirm it.  Also the question arises "Is the function g(c,d) bounded from below?". Here is my try with the DirectSearch and NLPSolve:

 

restart;
``

g(10, -10)

9.

(1)

plot(x^4+x^3+10*x^2-10*x-10-1, x = -1 .. 1)

 

plot3d(g, -5 .. 5, -5 .. 5, grid = [100, 100], style = surface, color = "DarkOliveGreen")

 

DirectSearch:-GlobalOptima(proc (a, b) options operator, arrow; g(a, b) end proc, {a = -1000 .. 1000, b = -1000 .. 1000}, variables = [a, b])

[-167.208333252089, Vector(2, {(1) = 999.9999999975528, (2) = 166.20833325208952}, datatype = float[8]), 815]

(2)

DirectSearch:-GlobalOptima( (a, b) -> g(a, b), variables = [a, b])

DirectSearch:-GlobalOptima(proc (a, b) options operator, arrow; g(a, b) end proc, variables = [a, b])

Error, (in Optimization:-NLPSolve) invalid input: PolynomialTools:-CoefficientVector expects its 1st argument, poly, to be of type polynom(anything, x), but received HFloat(HFloat(undefined))*x^4+HFloat(HFloat(undefined))*x^3+HFloat(HFloat(undefined))*x^2+HFloat(HFloat(undefined))*x+HFloat(HFloat(undefined))

 

``

 

Download bound.mw

 

I have to use the optimization package. 

- The objective function is non linear,

- I have constrains and bounds,

- The constrains are not linear.

 

I have reading the help page on maplesoft.com

 

My question are:
Can you confirm me that the only algorithm I can use is : NLPSolve with method ''sqp''?


And if I would like to use the gradient method how can I do?

objectiveproc := proc(mmm)
...
return Trace(abs(M));
end proc:
with(Optimization):
i := 0:
t := 1:
Minimize(objectiveproc(x)-abs(Trace(abs(MA))));

Error, (in objectiveproc) invalid subscript selector

 

Hello :-),

 

How can I differentiate the follwing function:

Cq = Cao*k1*t / [(1+k1*t)*(1+k2*t)]

If want to find the maximum:

dCq/dt = 0

I can solve if of course by hand. The solution is t=1/sqrt(k1*k2)

I tried it with maple, but I got a strange result (see picture). How can I use maple to get the right result?

 

Thank you very much!

 

Hello,

I want to solve a optimization problem with maple/maplesim.

A car has to move a defined distance on a plane, straight road in a defined time. Given is the mass of the car, the maximum force to accelerate the car, the distance and the time. The rolling resistance and the drag force should be considered. At start-point speed v = 0m/s and also at the end-point speed should be v= 0m/s.

So there are the following model parameters:

mass                            m = 2000kg
distance                        d  = 1000m
time                              t_max = 120s
                                    v_0 = 0m/s
                                    v_d = 0m/s
accelerating force           -1m/s2 <= F_acc/m <= 1m/s2
resistance to rolling        F_rol = C + A*v2                      C and A are later defined
resulting force at mass   F_res = F_acc - F_rol

The energy consumption  integral F_acc(s) ds (from 0 to d) should be minimized and I want to print the graph of F_acc(s) 

How can or can Maple help me solving this optimization problem?

 

 

Salut j'ai fait un programme avec maple   pour minimiser une fonction à deux variable avec la méthode de fletcher reevers car la fonction minimize ne marche pas avec les fonction plus compliqué.
SP veuillez voir mon programmme et essayer de le corriger car la boucle while ne marche pas:
test.mwtest.mw
Cordialement:

Hi all,

I have a function f(x) and want to know at which x-value it attains its supremum.

Tried this, but it doesn't work (or at least hasn't been able to solve the equation in 10+ min):

M := maximize(f, x = 0 .. 1);

solve(f = M, x);

Does anyone know a way to do this?

Thanks,

Paul

a := 1; w0 := 1; w1 := 3; K := 10; h0 := .25; A := 3; alpha := .7; b := .6; c := .2

f := A*x^(b*alpha)*(alpha*A*x^(b*alpha)/(a+w0*h0+(x-h0)*w1))^(alpha/(1-alpha))-(alpha*A*x^(b*alpha)/(a+w0*h0+(x-h0)*w1))^(1/(1-alpha))

16.94206235*x^.42*(x^.42/(.50+3*x))^2.333333333-11.85944364*(x^.42/(.50+3*x))^3.333333333

(1)

NULL

M := maximize(f, x = 0 .. 1)

.8295280335

(2)

solve(f = M, x)

Warning,  computation interrupted

 

``

plot(f, x = 0 .. 1)

 

``

``

``



Download maximum.mw

how to do optimization for two equations in terms of two variables

 

LPSolve({eq1}, {eq2}, assume = {nonnegative});

 

eq1 is a rational function and eq2 is a very large rational function

after run , it return error, objective function must be specified as a linear polynomial or vector

 

da := [LengthSplit(Flatten([[1,m],[2,m2],[seq([i+1,close3[i][1]], i=2..4)]]),2)];
f := PolynomialInterpolation(da, z):
solution := solve(f=-z, z, explicit);
zz := [x1,x2,x3,x4];
sigma := symMonomial(zz); #sigma := [x1+x2+x3+x4, x1*x2+x1*x3+x1*x4+x2*x3+x2*x4+x3*x4, x1*x2*x3+x1*x2*x4+x1*x3*x4+x2*x3*x4, x1*x2*x3*x4]
sys1 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[1]):
sys2 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[2]):
sys3 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[3]):
sys4 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[4]):
da := [seq([i,close3[i][1]], i=1..5)];

with(Optimization):
LPSolve(sys1, {sys2}, assume = {nonnegative});

 

I'm having trouble with using constrained optimization to solve a problem.

The problem is set up as:

Max: w=x1/2 y1/4

Subject to: K=x+4. K is a constant.

 

I'm not sure where to start.

I know how to use Maple for an optimization problem contaning continous variables but I couldn't find anything in help of Maple related to use boolean variables in optimization. So assume I want to minimize a function that one of its variables only can take 0 and 1 as its value. Anyone knows how to introduce those to the Maple? For example you can look at this link that Matlab can do many of these kind of optimizations.

Hi everybody i've to minimize a function of about 5-6 variables so i tried some of maple functions like: 'Minimize', 'minimize', 'NLPSolve' but with 'minimize' my pc goes in loop and it eats a lot of ram without giving some results, while with the Optimization package i got the error :'

Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments

'

code :

 

restart;
L := 1:
b := 1.1:
p := 1.8:
xa := 0:
xd := -b/2:
ya := -p+z:
yd := 0:


quadrilatero := proc(q,xa,ya,xd,yd,l1,l2,l3,modo,alpha0,alpha1)
local xb,yb,l5,c,alpha,theta5,theta2,xc,yc,theta3,xm,ym:

xb := xa+l1*cos(q + alpha0 + pi/2):
yb := ya+l1*sin(q + alpha0 + pi/2):
l5 := sqrt((xd-xb)^2+(yd-yb)^2):
c := (l2^2+l5^2-l3^2)/(2*l2*l5):
if modo = 1 then alpha := arccos(c) else alpha := -arccos(c) end if:
theta5 := arctan(yd-yb,xd-xb):
theta2 := theta5 + alpha:
xc := xb + l2*cos(theta2 + pi):
yc := yb + l2*sin(theta2 + pi):
theta3 := arctan(yd-yc,xd-xc):
return (theta3 - pi - alpha1):
end proc:
#funione sterzo
f := proc(q,ya,l1,l2,l3,yd,alpha0,alpha1)
local theta;
theta := quadrilatero(q, 0, ya,-b/2,0, l1, l2, l3, -1,alpha0,alpha1) - pi/2;
if theta < Pi and Im(theta) = 0 then theta := theta + 2*pi end if;
return theta;
end proc:
#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));
arctan(tan(q), 1 - 0.3055555556 tan(q))

#Definisco procedura dei minimi quadrati:
n := 1: i := 0:
q := Vector[n]: rms := 0:
for i from 0 by 1 to (n-1) do
q[i] := Pi*(i/(4*n)):
rms := rms + abs(f(q[i],ya,l1,l2,l3,yd,alpha0,alpha1) - yd(q[i])^2):
end do:
rms := sqrt(rms / n):
#MIN := (minimize(rms, z = -0.4..0,alpha0 = 0..Pi/3,alpha1 = Pi/2..5*Pi/4,l1 = 0.3..1,l2 = 0.001..0.3,l3 = 0.01..0.3,iterationlimit = 100));
with(Optimization):
Optimization[NLPSolve](((rms)));
Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments

 

thanks in advance for your help !

 

When I use the option assume = nonnegint or integervariables = {...} in Optimization[Minimize], or Optimization[LPSolve] I've got the message "kernel connection lost'. 

 

Thie even happens when I use the simple example from the Maple help:

with(Optimization):
LPSolve(2*x+5*y,{3*x-y=1,x-y<=5},assume={nonnegative,integer});

 

It says; mserver.exe has stopped working. 

What's wrong? 

I've got this huge chunk of code which leads to an optimiazation at the very last line (Bestangles:=minimize(maximize()-minimize))). This minization is taking a very long time (havent solved it yet) and I would very much like to reduce that time. As I've understood maple does optimization by differentiating and then finding all extremes and comparing. Would this mean that since I minimize and optimize within a minimization command, it differentiates a ton of times? And if this is the case, can I somehow do the differentiation beforehand, since it is the same function being differentiate all the time? Or is there some other way I can improve the code? 
Thanks alot!

Heres the full code:

Hello,

I would like to know how to do the following. If I received a plot of a graph, but I did not know it function, how could I get an accurate value for its maximum and minum points? Any help is greatly appreciated! Thank you in advance!

Kind regards,

Gambia Man

1 2 3 4 5 6 7 Last Page 1 of 14