Items tagged with optimization optimization Tagged Items Feed

Two weeks ago i didn`t have problem with calculate and plot this pareto`s frontier. I got plot it, but if i try it now, i can´t . Why?.

Before

f1 := (1+x1^2+4/3*(x2^2+1))/(x1+x2); f2 := (1+x1^2+3/4*(x2^2+1))/(x1+x2);

with(plots); with(Optimization); ind := 1; ans := Array(); for i from 1.73205080756887853 by 0.1e-4 while i < 2.87500000000000000 do roll := i; f1max := NLPSolve(f1, {f2 = i}, x1 = 0 .. 2, x2 = 0 .. 3, method = sqp, maximize = false); ans := proc (ind) options operator, arrow; [op([1], f1max), roll] end proc; ind := ind+1 end do; ans;

 

st := time[real]();

 

               Array(%id = 18446746983952876598)

pointplot(convert(ans, list));

 After

with(plots); with(Optimization); ind := 1; ans := Array(); for i from 1.73205080756887853 by 0.1e-4 while i < 2.87500000000000000 do roll := i; f1max := NLPSolve(f1, {f2 = i}, x1 = 0 .. 2, x2 = 0 .. 3, method = sqp, maximize = false); ans := proc (ind) options operator, arrow; [op([1], f1max), roll] end proc; ind := ind+1 end do; ans;

st := time[real]();


                              ans
pointplot(convert(ans, list));
Error, (in plots:-pointplot) number of elements in list must be a multiple of 2  (????)

 

Hi,

 

Can Maple solve mathematical models? And can I use it to solve LP and NLPs?

Is there a maple routine or sequence of routines to minimize an energy functional (scalar energy with a function as an argument)?

I'd like to avoid applying calculus of variations/integration by parts by hand.

For example, I'm looking for something like:

E := int(diff(f(x),x)^2,x=0..1);
bc := f(0) = 0, f(1) = 1;
minimize(E,bc);

whose result would be:

       f(x) = x

Is there a way to use dsolve to do this?

I am trying to solve an optimization problem with several constraints and it is not working. The decision variables are the matrix entries.

 

Below is the code:

restart;
interface(displayprecision = 4): with( plots ):
with(linalg):with( Optimization );
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize,

NLPSolve, QPSolve]
f:=proc(x1,x2,x3,x4,x5,x6)
global lambda,mu,rho,Ls;
local eq,Lsq,g,P,n,IM,ImP,ImPi,c0,cb,Sol,i,j,t1,t2,fact,t3,t4,t5,Wq,W,Lq,L,Ws;
n:=7;
g:=array(1..n,[5,0,0,0,0,0,0]);
mu:=array(1..n,[10,5,5,5,5,5,5]);
P:=matrix([[0,x1,x2,0,0,0,0],[0,0,0,x3,x4,0,0],[0,0,0,0,0,x5,x6],
[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]]);
IM := array(identity, 1..n,1..n):
ImP:=evalm(IM-P):
ImPi:=inverse(ImP):
lambda:=evalm(g&*ImPi):
for i from 1 to n do
rho[i] := lambda[i]/mu[i]
od:
c0:=array(1..n,[1/2,0,0,0,0,0,0]);
cb:=array(1..n,[1/5,1/5,1/5,1/5,1/5,1/5,1/5]);
for i from 1 to n do
eq[i]:=(g[i]/lambda[i])*c0[i] + sum((lambda[j]/lambda[i])*P[j,i]*((P[j,i]*(rho[j]^2*cb[j] +(1-rho[j]^2)*cx[j] ))+ (1 -P[j,i])),j=1..n)
od:
Sol:=fsolve({eq[1]-cx[1]=0,eq[2]-cx[2]=0,eq[3]-cx[3]=0,eq[4]-cx[4]=0,eq[5]-cx[5]=0,eq[6]-cx[6]=0,eq[7]-cx[7]=0},{cx[1],cx[2],cx[3],cx[4],cx[5],cx[6],cx[7]}):
assign(Sol):cx:
for i from 1 to n do
t1:= -2*(1-rho[i])/(3*rho[i]):
t2:= ((1-cx[i])^2)/(cx[i]+cb[i]):
fact := exp(t1*t2):
if cx[i] >= 1 then
fact:=1:
else
fact:
fi:
t3:=rho[i]/(1-rho[i]):
t4:= (cx[i]+ cb[i])/2:
t5:=1/mu[i]:
Wq[i] := (t3*t4*t5*fact):
W[i] := Wq[i] + t5:
Lq[i] := lambda[i]*Wq[i]:
L[i] := lambda[i]*W[i]:
od:
Ls:=add(L[i],i=1..n);Lsq:=add(Lq[i],i=1..n):Ws:=Ls/add(g[i],i=1..n):
RETURN(Ls):
end proc:

# here are the constraint procedures to ensure the probability pairs sum to one

p1 := proc (x1, x2) x1+x2-1 end proc;
proc(x1, x2) ... end;
p2 := proc (x3, x4) x3+x4-1 end proc;
proc(x3, x4) ... end;
p3 := proc (x5, x6) x5+x6-1 end proc;
proc(x5, x6) ... end;

sol := Optimization:-NLPSolve(f, {p1}, {p2}, {p3}, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, initialpoint = [.5, .5, .5, .5, .5, .5]);


Error, (in Optimization:-NLPSolve) unexpected parameters: {p3}

It seems to say that the problem are the constraints but this seems odd.

 

 

I am trying to find the optimal routing probabilities in a Maple procedure where the Mean Value Analysis is used to compute the queueing values. The Maple code is below. It first tries to compute the visit ratios where the probability routing values are the decision variables. There is one specified constraint on the sum of the probability decision variables.

 

restart;
interface(warnlevel=0): interface(displayprecision = 4): with( plots ):
with(linalg):with( Optimization ); with(Student[NumericalAnalysis]):
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize,

NLPSolve, QPSolve]
f:=proc(x1,x2,x3)
global T,lambda,nq,u;
local i,j,pop,Sum;
n:=3;N:=2;M:=3;
#
# Gauss-Seidel iterations
#
A:=Matrix([[1,-x1,-x2],[0,1,-x3],[0,0,1]]);
b:= Vector([1,0,0]);
v := IterativeApproximate(LinearAlgebra:-Transpose(A), b, initialapprox = Vector([1, 3/4, 3/4]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);
mu:=array(1..n,[2.0,1.0,1.0]);
nq:=array(1..M,[0,0,0]);# must initialize queue lengths
for i from 1 to N do

pop:=i;
for j from 1 to M do # mean waiting times
T[j]:=t[j]*(1 + nq[j]) od;
Sum := 0.0;
for j from 1 to M do # mean cycle time
Sum := Sum + v[j]*T[j] od;
for j from 1 to M do #compute the throughputs
lambda[j] := (v[j]*pop)/Sum od;
for j from 1 to M do #compute the queue lengths
nq[j]:= lambda[j]*T[j] od;
for j from 1 to M do #compute the utilizations
u[j]:= lambda[j]*t[j] od;
od;
RETURN(lambda[1]);
end proc;


proc(x1, x2, x3) ... end;

 

sol := Optimization:-NLPSolve(f, {}, {proc (x1, x2, x3) options operator, arrow; x1+x2+x3-5/3 end proc}, 0 .. 1, 0 .. 1, 0 .. 1, initialpoint = [.75, .25, .6667], assume = nonnegative); 1;


Error, (in Optimization:-NLPSolve) non-numeric result encountered

 

I am not sure why I get the error message

 

 

I am trying to solve an optimization problem but I am getting an error message which does not make sense.

 

I have a procedure file called f. The decsiion vector is x[1..4]. and returns the objective function value Ls.

I then specify the constraints as a set and ask it to optimize

constraints:={x[1]+x[2]+x[3]+x[4]=65,x[1]<=20,x[2]<=15,x[3]<=20,x[4]<=15};

sol := NLPSolve( f,constraints, assume=nonnegative,minimize);

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of procedures

 

This error makes no sense to me. Can anyone help?

with(Optimization):

theta := Complex(1,1);
Minimize(theta^3-3*(A*theta^2+B), {0 <= theta^3-3*(A*theta^2+B)}, assume = nonnegative)

Error, (in Optimization:-NLPSolve) complex value encountered

Example 6 from Maple Help.

 

restart:

with(Optimization):

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

 

Kernel crash the same with Maple 2015.

 

Does anyone can confirm?

Mariusz Iwaniuk

I am unable to solve the attached optimal control problem,please any one who many help  me in guideing .tnx

restart:
unprotect('gamma');

L:=b[1]*c(t)+b[2]*i(t)+w[1]*(u[1])^2/2+w[2]*(u[2])^2/2+w[3]*(u[3])^2/2;
1 2 1 2 1 2
b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3]
2 2 2
H:=L+lambda[1](t)*((1-p*Psi)*tau+phi* v + delta *r-lambda*(1-u[3])*s-u[1]*varphi*s -mu*s ) +lambda[2](t)*(p*Psi*tau + u[1]*vartheta*s -gamma*lambda* (1-u[3])*v-(mu+phi)*v ) +lambda[3](t)*( (1-u[3])*rho*lambda* (s +gamma*v)+(1-q)* u[2]*eta*i -(mu +beta +chi)*c ) +lambda[4](t)* ((1-rho)*(1-u[3])*lambda*( s +gamma*v) +chi*c - u[2]*eta*i - (mu +alpha )*i) +lambda[5](t)*( beta*c + u[2]*q*eta*i -(mu +delta)*r);
1 2 1 2 1 2
b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3] + lambda[1](t
2 2 2

) ((1 - p Psi) tau + phi v + delta r - lambda (1 - u[3]) s - u[1] varphi s

- mu s) + lambda[2](t) (p Psi tau + u[1] vartheta s

- gamma lambda (1 - u[3]) v - (mu + phi) v) + lambda[3](t) ((1 - u[3]) rho

lambda (s + gamma v) + (1 - q) u[2] eta i - (mu + beta + chi) c) + lambda[4](t

) ((1 - rho) (1 - u[3]) lambda (s + gamma v) + chi c - u[2] eta i

- (mu + alpha) i) + lambda[5](t) (beta c + u[2] q eta i - (mu + delta) r)
du1:=diff(H,u[1]);

w[1] u[1] - lambda[1](t) varphi s + lambda[2](t) vartheta s
du2:=diff(H,u[2]);du3:=diff(H,u[3]);
w[2] u[2] + lambda[3](t) (1 - q) eta i - lambda[4](t) eta i

+ lambda[5](t) q eta i
w[3] u[3] + lambda[1](t) lambda s + lambda[2](t) gamma lambda v

- lambda[3](t) rho lambda (s + gamma v)

- lambda[4](t) (1 - rho) lambda (s + gamma v)

ddu1 := -A[1] u[1] + psi[1](t) beta x[1] x[3] - psi[2](t) beta x[1] x[3]

ddu2 := -A[2] u[2] - psi[3](t) k x[2]
sol_u1 := solve(du1, u[1]);
s(t) (lambda[1](t) varphi - lambda[2](t) vartheta)
--------------------------------------------------
w[1]
sol_u2 := solve(du2, u[2]);sol_u3 := solve(du3, u[3]);
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
----------------------------------------------------------------------
w[2]
1
---- (lambda (-lambda[1](t) s - lambda[2](t) gamma v + lambda[3](t) rho s
w[3]

+ lambda[3](t) rho gamma v + lambda[4](t) s + lambda[4](t) gamma v

- lambda[4](t) rho s - lambda[4](t) rho gamma v))
Dx2:=subs(u[1]= s*(lambda[1](t)*varphi-lambda[2](t)*vartheta)/w[1] ,u[2]= eta*i*(-lambda[3](t)+lambda[3](t)*q+lambda[4](t)-lambda[5](t)*q)/w[2], u[3]=-lambda*(lambda[1](t)*s+lambda[2](t)*gamma*v-lambda[3](t)*rho*s-lambda[3](t)*rho*gamma*v-lambda[4](t)*s-lambda[4](t)*gamma*v+lambda[4](t)*rho*s+lambda[4](t)*rho*gamma*v)/w[3] ,H );
2 2
s (lambda[1](t) varphi - lambda[2](t) vartheta)
b[1] c(t) + b[2] i(t) + -------------------------------------------------
2 w[1]

2 2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
+ ------------------------------------------------------------------------- +
2 w[2]

1 / 2
------ \lambda (lambda[1](t) s + lambda[2](t) gamma v - lambda[3](t) rho s
2 w[3]

- lambda[3](t) rho gamma v - lambda[4](t) s - lambda[4](t) gamma v

/
\ |
+ lambda[4](t) rho s + lambda[4](t) rho gamma v)^2/ + lambda[1](t) |(1
\

/ 1
- p Psi) tau + phi v + delta r - lambda |1 + ---- (lambda (lambda[1](t) s
\ w[3]

+ lambda[2](t) gamma v - lambda[3](t) rho s - lambda[3](t) rho gamma v

- lambda[4](t) s - lambda[4](t) gamma v + lambda[4](t) rho s

\
+ lambda[4](t) rho gamma v))| s
/

2 \
s (lambda[1](t) varphi - lambda[2](t) vartheta) varphi |
- ------------------------------------------------------- - mu s| +
w[1] /

/
|
lambda[2](t) |p Psi tau
\

2
s (lambda[1](t) varphi - lambda[2](t) vartheta) vartheta /
+ --------------------------------------------------------- - gamma lambda |1 +
w[1] \

1
---- (lambda (lambda[1](t) s + lambda[2](t) gamma v - lambda[3](t) rho s
w[3]

- lambda[3](t) rho gamma v - lambda[4](t) s - lambda[4](t) gamma v

\
\ |
+ lambda[4](t) rho s + lambda[4](t) rho gamma v))| v - (mu + phi) v| +
/ /

// 1
lambda[3](t) ||1 + ---- (lambda (lambda[1](t) s + lambda[2](t) gamma v
\\ w[3]

- lambda[3](t) rho s - lambda[3](t) rho gamma v - lambda[4](t) s

\
- lambda[4](t) gamma v + lambda[4](t) rho s + lambda[4](t) rho gamma v))|
/

1 / 2 2
rho lambda (s + gamma v) + ---- \(1 - q) eta i (-lambda[3](t)
w[2]

\ \
+ lambda[3](t) q + lambda[4](t) - lambda[5](t) q)/ - (mu + beta + chi) c| +
/

/
| / 1
lambda[4](t) |(1 - rho) |1 + ---- (lambda (lambda[1](t) s
\ \ w[3]

+ lambda[2](t) gamma v - lambda[3](t) rho s - lambda[3](t) rho gamma v

- lambda[4](t) s - lambda[4](t) gamma v + lambda[4](t) rho s

\
+ lambda[4](t) rho gamma v))| lambda (s + gamma v) + chi c
/

2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
- ------------------------------------------------------------------------
w[2]

\ /
| |
- (mu + alpha) i| + lambda[5](t) |beta c
/ \

+

2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q) q
--------------------------------------------------------------------------
w[2]

\
|
- (mu + delta) r|
/
ode1:=diff(lambda[1](t),t)=-diff(H,s);ode2:=diff(lambda[2](t),t)=-diff(H,v);ode3:=diff(psi[3](t),t)=-diff(H,c);ode4:=diff(lambda[4](t),t)=-diff(H,i);ode5:=diff(lambda[5](t),t)=-diff(H,r);
d
--- lambda[1](t) = -lambda[1](t) (-lambda (1 - u[3]) - u[1] varphi - mu)
dt

- lambda[2](t) u[1] vartheta - lambda[3](t) (1 - u[3]) rho lambda

- lambda[4](t) (1 - rho) (1 - u[3]) lambda
d
--- lambda[2](t) = -lambda[1](t) phi
dt

- lambda[2](t) (-gamma lambda (1 - u[3]) - mu - phi)

- lambda[3](t) (1 - u[3]) rho lambda gamma

- lambda[4](t) (1 - rho) (1 - u[3]) lambda gamma
d
--- psi[3](t) = -lambda[3](t) (-mu - beta - chi) - lambda[4](t) chi
dt

- lambda[5](t) beta
d
--- lambda[4](t) = -lambda[3](t) (1 - q) u[2] eta
dt

- lambda[4](t) (-u[2] eta - mu - alpha) - lambda[5](t) u[2] q eta
d
--- lambda[5](t) = -lambda[1](t) delta - lambda[5](t) (-mu - delta)
dt
restart:
#Digits:=10:


unprotect('gamma');
lambda:=0.51:
mu:=0.002:
beta:=0.0115:
delta:=0.003:
alpha:=0.33:
chi:=0.00274:
k:=6.24:
gamma:=0.4:
rho:=0.338:;tau=1000:;Psi:=0.1:;p:=0.6:;phi:=0.001:;eta:=0.001124:q:=0.6:varphi:=0.9:;vatheta:=0.9:
b[1]:=2:;b[2]:=3:;w[1]:=4:;w[2]:=5:;w[3]:=6:
#u[1]:=s(t)*(lambda[1](t)*varphi-lambda[2](t)*vartheta)/w[1]:
#u[2]:=eta*i*(-lambda[3](t)+lambda[3](t)*q+lambda[4](t)-lambda[5](t)*q)/w[2]:;u[3]:=lambda*(-lambda[1](t)*s-lambda[2](t)*gamma*v+lambda[3](t)*rho*s+lambda[3](t)*rho*gamma*v+lambda[4](t)*s+lambda[4](t)*gamma*v-lambda[4](t)*rho*s-lambda[4](t)*rho*gamma*v)/w[3]:
ics := s(0)=8200, v(0)=2800,c(0)=1100,i(0)=1500,r(0)=200,lambda[1](20)=0,lambda[2](20)=0,lambda[3](20)=0,lambda[4](20)=0,lambda[5](20)=0:
ode1:=diff(s(t),t)=(1-p*Psi)*tau+phi* v(t) + delta *r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t) -mu*s(t),
diff(v(t), t) =p*Psi*tau + u[1]*vartheta*s(t) -gamma*lambda* (1-u[3])*v(t)-(mu+phi)*v(t) ,
diff(c(t), t) =(1-u[3])*rho*lambda* (s(t) +gamma*v(t))+(1-q)* u[2]*eta*i(t) -(mu +beta +chi)*c(t),
diff(i(t), t) =(1-rho)*(1-u[3])*lambda*( s(t) +gamma*v(t)) +chi*c(t) - u[2]*eta*i(t) - (mu +alpha )*i(t),
diff(r(t), t) = beta*c(t) + u[2]*q*eta*i(t) -(mu +delta)*r(t),
diff(lambda[1](t), t) = -lambda[1](t)*(-lambda*(1-u[3])-u[1]*varphi-mu)-lambda[2](t)*u[1]*vartheta-lambda[3](t)*(1-u[3])*rho*lambda-lambda[4](t)*(1-rho)*(1-u[3])*lambda,diff(lambda[2](t),t)=-lambda[1](t)*phi-lambda[2](t)*(-gamma*lambda*(1-u[3])-mu-phi)-lambda[3](t)*(1-u[3])*rho*lambda*gamma-lambda[4](t)*(1-rho)*(1-u[3])*lambda*gamma,diff(lambda[3](t),t)=-lambda[3](t)*(-mu-beta-chi)-lambda[4](t)*chi-lambda[5](t)*beta,diff(lambda[4](t),t)=-lambda[3](t)*(1-q)*u[2]*eta-lambda[4](t)*(-u[2]*eta-mu-alpha)-lambda[5](t)*u[2]*q*eta,diff(lambda[5](t),t)=-lambda[1](t)*delta-lambda[5](t)*(-mu-delta);
d
--- s(t) = (1 - p Psi) tau + phi v(t) + delta r(t) - lambda (1 - u[3]) s(t)
dt

d
- u[1] varphi s(t) - mu s(t), --- v(t) = p Psi tau + u[1] vartheta s(t)
dt

d
- gamma lambda (1 - u[3]) v(t) - (mu + phi) v(t), --- c(t) = (1 - u[3]) rho lambda
dt

(s(t) + gamma v(t)) + (1 - q) u[2] eta - (mu + beta + chi) c(t), 0 = (1

- rho) (1 - u[3]) lambda (s(t) + gamma v(t)) + chi c(t) - u[2] eta - mu

d d
- alpha, --- r(t) = beta c(t) + u[2] q eta - (mu + delta) r(t), ---
dt dt

lambda[1](t) = -lambda[1](t) (-lambda (1 - u[3]) - u[1] varphi - mu)

- lambda[2](t) u[1] vartheta - lambda[3](t) (1 - u[3]) rho lambda

d
- lambda[4](t) (1 - rho) (1 - u[3]) lambda, --- lambda[2](t) =
dt
-lambda[1](t) phi - lambda[2](t) (-gamma lambda (1 - u[3]) - mu - phi)

- lambda[3](t) (1 - u[3]) rho lambda gamma

d
- lambda[4](t) (1 - rho) (1 - u[3]) lambda gamma, --- lambda[3](t) =
dt
d
-lambda[3](t) (-mu - beta - chi) - lambda[4](t) chi - lambda[5](t) beta, ---
dt

lambda[4](t) = -lambda[3](t) (1 - q) u[2] eta

- lambda[4](t) (-u[2] eta - mu - alpha) - lambda[5](t) u[2] q eta,

d
--- lambda[5](t) = -lambda[1](t) delta - lambda[5](t) (-mu - delta)
dt

sol := dsolve({c(0) = 0, i(0) = 0, r(0) = .1, s(0) = 0, v(0) = 0, diff(c(t), t) = (1-u[3])*rho*lambda*(s(t)+gamma*v(t))+(1-q)*u[2]*eta*i(t)-(mu+beta+chi)*c(t), diff(i(t), t) = (1-rho)*(1-u[3])*lambda*(s(t)+gamma*v(t))+chi*c(t)-u[2]*eta*i(t)-(mu+alpha)*i(t), diff(r(t), t) = beta*c(t)+u[2]*q*eta*i(t)-(mu+delta)*r(t), diff(s(t), t) = (1-p*Psi)*tau+phi*v(t)+delta*r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t)-mu*s(t), diff(v(t), t) = p*Psi*tau+u[1]*vartheta*s(t)-gamma*lambda*(1-u[3])*v(t)-(mu+phi)*v(t), diff(lambda[1](t), t) = -lambda[1](t)*(-lambda*(1-u[3])-u[1]*varphi-mu)-lambda[2](t)*u[1]*vartheta-lambda[3](t)*(1-u[3])*rho*lambda-lambda[4](t)*(1-rho)*(1-u[3])*lambda, diff(lambda[2](t), t) = -lambda[1](t)*phi-lambda[2](t)*(-gamma*lambda*(1-u[3])-mu-phi)-lambda[3](t)*(1-u[3])*rho*lambda*gamma-lambda[4](t)*(1-rho)*(1-u[3])*lambda*gamma, diff(lambda[3](t), t) = -lambda[3](t)*(-mu-beta-chi)-lambda[4](t)*chi-lambda[5](t)*beta, diff(lambda[4](t), t) = -lambda[3](t)*(1-q)*u[2]*eta-lambda[4](t)*(-u[2]*eta-mu-alpha)-lambda[5](t)*u[2]*q*eta, diff(lambda[5](t), t) = -lambda[1](t)*delta-lambda[5](t)*(-mu-delta), lambda[1](20) = 0, lambda[2](20) = 0, lambda[3](20) = 0, lambda[4](20) = 0, lambda[5](20) = 0}, type = numeric);
Error, (in dsolve/numeric/process_input) invalid specification of initial conditions, got 1 = 0

sol:=dsolve([ode1,ics],numeric, method = bvp[midrich],maxmesh=500);

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

dsolve[':-interactive']({});
Error, `:=` unexpected
sol:=dsolve([ode1,ics],numeric, method = bvp[midrich],maxmesh=500);
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

eq1:=diff(s(t), t)=(1-p*Psi)*tau+phi* v(t) + delta *r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t) -mu*s(t);
eq2:diff(v(t), t) =p*Psi*tau + u[1]*vartheta*s(t) -gamma*lambda* (1-u[3])*v(t)-(mu+phi)*v(t);
eq3:=diff(c(t), t) =(1-u[3])*rho*lambda* (s(t) +gamma*v(t))+(1-q)* u[2]*eta*i(t) -(mu +beta +chi)*c(t);
eq4:=diff(i(t), t) =(1-rho)*(1-u[3])*lambda*( s(t) +gamma*v(t)) +chi*c(t) - u[2]*eta*i(t) - (mu +alpha )*i(t);
eq5:=diff(r(t), t) = beta*c(t) + u[2]*q*eta*i(t) -(mu +delta)*r(t);

d
--- s(t) = (1 - p Psi) tau + phi v(t) + delta r(t) - lambda (1 - u[3]) s(t)
dt

- u[1] varphi s(t) - mu s(t)
d
--- v(t) = p Psi tau + u[1] vartheta s(t) - gamma lambda (1 - u[3]) v(t)
dt

- (mu + phi) v(t)
d
--- c(t) = (1 - u[3]) rho lambda (s(t) + gamma v(t)) + (1 - q) u[2] eta i(t)
dt

- (mu + beta + chi) c(t)
d
--- i(t) = (1 - rho) (1 - u[3]) lambda (s(t) + gamma v(t)) + chi c(t)
dt

- u[2] eta i(t) - (mu + alpha) i(t)
d
--- r(t) = beta c(t) + u[2] q eta i(t) - (mu + delta) r(t)
dt
eq6:=diff(Q(t),t)=b[1]*c(t)+b[2]*i(t)+w[1]*(u[1])^2/2+w[2]*(u[2])^2/2+w[3]*(u[3])^2/2;
d 1 2 1 2 1 2
--- Q(t) = b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3]
dt 2 2 2
ics:=s(0)=8200, v(0)=2800,c(0)=1100,i(0)=1500,r(0)=200,Q(0)=6700;
s(0) = 8200, v(0) = 2800, c(0) = 1100, i(0) = 1500, r(0) = 200, Q(0) = 6700
sol0:=dsolve({eq1,eq2,eq3,eq4,eq5,eq6,ics},type=numeric,stiff=true,'parameters'=[u[1],u[2],u[3]],abserr=1e-15,relerr=1e-12,maxfun=0,range=0..50):
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations
with(plots):
Q0:=6700;
6700
obj:=proc(u)
global sol0,Q0;
local ob1;
try
sol0('parameters'=[u[1],u[2],u[3]]):
ob1:=subs(sol0(20.),Q(t)):
catch :
ob1:=0;
end try;
#ob1:=subs(sol0(20.),Q(t));
if ob1>Q0 then Q0:=ob1;print(Q0,u);end;
ob1;
end proc;
proc(u) ... end;
obj([1,1,1]);
0
obj([3,2.5],4);
0
u0:=Vector(3,[0.,0.,0.],datatype=float[8]);
Vector[column](%id = 85973880)

Q0:=0;
Q0 := 0
with(Optimization);
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize, NLPSolve,

QPSolve]
sol2:=NLPSolve(3,obj,initialpoint=u0,method=nonlinearsimplex,maximize,evaluationlimit=100):
sol0('parameters'=[3.18125786060723, 2.36800986932868]);
sol0(parameters = [3.18125786060723, 2.36800986932868])
for i from 1 to 3 do odeplot(sol0,[t,x[i](t)],0..20,thickness=3,axes=boxed);od;
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

I have a nonlinear function Q(a,b,c,d,x,y) and I'd like to get the optimum (x*,y*) for different values of (a,b,c,d). The usual sintax:

NLPSolve(Q(10, 1, 5, 2, x,y), x= 0 .. 50, y = 0 .. 50, initialpoint = {x = 2,y= .5}, assume = nonnegative) does not work when Q contains numerical integration, that is evalf (Int). I have no problem with the definite integral evalf(int). The problem is that most of the cases required numerical integration so I need the former expression.

I'd appreciate very much if someone could help me.

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!

 

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