MANUTTM

30 Reputation

4 Badges

1 years, 48 days

MaplePrimes Activity


These are questions asked by MANUTTM

I have to maximize my non linear objective function TBCI (given in attached worksheet) with 4 inequality constraints. The decision variables are i and q.The range of i is 0 to 1 and of q is 0 to 76.

When i tru to solve it using NLP solve it is showing error-"Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of equalities and inequalities".

Please help me to solve it. please find attached the maple file

restart

with(plots); with(DEtools); with(LinearAlgebra); with(Student[VectorCalculus]); with(linalg); with(Optimization); with(student)

TC := proc (Q) options operator, arrow; O1*(1-beta)*D/Q+(1/2)*h1*Q+(1/2)*h2*(gamma-beta)*Qr/gamma+O2*beta*D/Qr+r*beta*D-q*beta*D-P*(1-i)*beta*D end proc

proc (Q) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(beta))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h2, Student:-VectorCalculus:-`+`(gamma, Student:-VectorCalculus:-`-`(beta))), Qr), Student:-VectorCalculus:-`*`(2, gamma)^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O2, beta), Student:-VectorCalculus:-D), Qr^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, beta), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, beta), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), beta), Student:-VectorCalculus:-D))) end proc

(1)

diff(TC(Q), Q)

-O1*(1-beta)*Student:-VectorCalculus:-D/Q^2+(1/2)*h1

(2)

simplify(isolate(%, Q))

Q = RootOf(2*Student:-VectorCalculus:-D*O1*beta+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(3)

diff(TC(Q), Qr)

(1/2)*h2*(gamma-beta)/gamma-O2*beta*Student:-VectorCalculus:-D/Qr^2

(4)

simplify(isolate(%, Qr))

Qr = RootOf((beta*h2-gamma*h2)*_Z^2+2*gamma*O2*beta*Student:-VectorCalculus:-D)

(5)

diff(TC(Q), `$`(Q, 2))

2*O1*(1-beta)*Student:-VectorCalculus:-D/Q^3

(6)

diff(TC(Q), `$`(Qr, 2))

2*O2*beta*Student:-VectorCalculus:-D/Qr^3

(7)

TC1 := proc (Q, Qr) options operator, arrow; O1*(-beta*i+1)*D/Q+(1/2)*h1*Q+(1/2)*h2*(-beta*i+gamma)*Qr/gamma+O2*i*beta*D/Qr+r*i*beta*D-q*i*beta*D-P*(1-i)*i*beta*D end proc

proc (Q, Qr) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(i, beta)))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h2, Student:-VectorCalculus:-`+`(gamma, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(i, beta)))), Qr), Student:-VectorCalculus:-`*`(2, gamma)^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O2, i), beta), Student:-VectorCalculus:-D), Qr^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, i), beta), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, i), beta), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), i), beta), Student:-VectorCalculus:-D))) end proc

(8)

diff(TC1(Q, Qr), Q)

-O1*(-beta*i+1)*Student:-VectorCalculus:-D/Q^2+(1/2)*h1

(9)

a1 := isolate(-O1*(-beta*i+1)*D/Q^2+(1/2)*h1, Q)

Q = RootOf(2*Student:-VectorCalculus:-D*O1*beta*i+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(10)

diff(TC1(Q, Qr), Qr)

(1/2)*h2*(-beta*i+gamma)/gamma-O2*i*beta*Student:-VectorCalculus:-D/Qr^2

(11)

a2 := isolate(diff(TC1(Q, Qr), Qr), Qr)

Qr = RootOf((beta*h2*i-gamma*h2)*_Z^2+2*gamma*O2*i*beta*Student:-VectorCalculus:-D)

(12)

TC2 := proc (Q) options operator, arrow; O1*(1-gamma)*D/Q+(1/2)*h1*Q+r*gamma*D-q*gamma*D-P*(1-i)*gamma*D end proc

proc (Q) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(gamma))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, gamma), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, gamma), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), gamma), Student:-VectorCalculus:-D))) end proc

(13)

b1 := isolate(diff(TC2(Q), Q), Q)

Q = RootOf(2*Student:-VectorCalculus:-D*O1*gamma+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(14)

E1 := eval(a1, [P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

Q = RootOf(76.5*_Z^2-20354080.50)

(15)

simplify(E1)

Q = 515.8162578

(16)

E2 := eval(a2, [P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

Qr = RootOf(.57375*_Z^2-6958.66000)

(17)

simplify(E2)

Qr = 110.1289401

(18)

Totcost := eval(TC1(Q, Qr), [Q = 516, Qr = 110, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

-25502.577

(19)

TB1 := B1*D*P*beta*i-D*beta*i*q

B1*Student:-VectorCalculus:-D*P*beta*i-Student:-VectorCalculus:-D*beta*i*q

(20)

TBC := eval(TB1, [B1 = 3.36, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, r = 382.5])

-17396.65*q*i+44716349.16*i

(21)

Totincent := P*i^2*beta*D

P*i^2*beta*Student:-VectorCalculus:-D

(22)

TI := eval(Totincent, [B1 = 3.36, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, r = 382.5])

13308437.25*i^2

(23)

NULL

simplify(subs(P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1, Q = sqrt((2*(-beta*i+1))*O1*D/h1))); simplify(subs(P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1, Qr = sqrt(2*i*beta*gamma*O2*D/((gamma-beta)*h2))))

Q = 3230.787830*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)

 

Qr = 190.7489196*(-i)^(1/2)

(24)

TCo := eval(TC1(Q, Qr), [Q = 3230.787830*sqrt(-0.1307189542e-2*i+0.2614379084e-1), Qr = 190.7489196*sqrt(-i), P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1])

3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)+912.0182718*i/(-i)^(1/2)+6521134.252*i-13308437.25*(1-i)*i

(25)

eq1 := TCo <= 0

3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)+912.0182718*i/(-i)^(1/2)+6521134.252*i-13308437.25*(1-i)*i <= 0

(26)

eq2 := 0 <= q/P and q/P <= 1

0 <= q/P and q/P <= 1

(27)

eq3 := 0 <= i and i <= gamma/beta

0 <= i and i <= gamma/beta

(28)

eq4 := TBC >= 0

0 <= -17396.65*q*i+44716349.16*i

(29)

``

TBCI := TBC-TCo+TI

-17396.65*q*i+38195214.91*i-3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)-123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)-91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)-912.0182718*i/(-i)^(1/2)+13308437.25*(1-i)*i+13308437.25*i^2

(30)

NLPSolve(TBCI, {eq1, eq2, eq3, eq4}, assume = nonnegative)

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

 

``

To get optimum value (maximum) of 3 variable p, q and w. Where p and q are from the function E1(p,q) and w from the function M1(p,q). The algorithm to obtain the optimum value is described below:-
step 1: Initialize w = c = 20

step2: Evaluate E1(p,q) by substituting w in it.

step3: Find optimum value of p and q from function E1(p,q) using NLPsolve or any other optimiztion method.

step 4: Substitute q optimum value into function M1(p,q) and evaluate it.

step 5: find optimum value of w from optimizing function M1(p,q).

step 6: substitute optimum value of w to E1(p,q) and evaluate it.

step 7: do step 3

step 8: do step 5 and 6

step 9: stop the loop when (w final - w previous) <0.05

I have done this through NLPsolve but it is showing error "Error, (in int) integration range or variable must be specified in the second argument, got 5000 = -3500 .. 1500*p+q-100000"

I am attaching the worksheet below. Please see the numerical analysis part below in the sheet. maple_question.mw

How should I draw a 2D graph for which one parameter in x axis and 3 parameters in y axis change with respect to x axis parameter in same graph. To be exact in my problem for changing β value (in x axis) what will be the optimum value for p, q and e. I had obtained the optimum p (named as ptemp in file), optimum q (named as qtemp in file), optimum e (named as etemp in file) for different values of β. But I don’t know how to plot it? Whether to give plot command inside the loop or not? Please help me. I am attaching the file with code and a sample graph. ( Find the problem in Numerical analysis - below in file)                                        new_assignment.mw

What is the procedure to add global optima package in maple?

Maple code for finding optimum maximum value of function TOTP given below when D is kept in the range of 300 to 2000?Also give maple code to find 3Dplot to determine the convexity of function TOTP with respect to y and Sr?

1 2 Page 2 of 2