Items tagged with optimization


Ive been trying to use the global optimization toolbox to optimize a model I extract from the maplesim environment.
It works fine with the regular Optimization toolbox. but when I run the optimization on the Global toolbox I get this error:

Warning, Error at t=0.0000000000000000e+000: index-1 and derivative evaluation failure

to explain a little,
I use the getCompiledProc command to turn the maplesim model into a module to be used in maple.


Im trying to solve 12 equations with 12 variables but I can't solve. Please help and advise me to solve this problem.




I'm trying solve a problem with NLPSolve using procedures like constraints, but it say: Error, (in Optimization: -NLPSolve) constraints must be specified as a set or list of procedures. Theses constraints are inequality and equality.  How i can get procedures as a list or set?. Is there anyone to give a example of it?. Thanks!


I am taking an intermediate mathematics course. Now we are heading towards the finals and I have started to review all the topics we have been visiting during this semester.

Now I came across an excercise I cannot solve, taking into consideration what our lectures looks like and topics on the list my best bet is using lagrange multiplie method to optimize a multivariable function with constraints.

The task gives a shape that is drawn within the circle given by the equation: x^2+y^2=2.

The shape is a hexagon with 2 vertecies on the y-axsis +- the radius 2, the other 4 vertecies are the following [+-x,+-y].

I´m told that this hexagon is spinned around the y-axis to form a solid sylinder with 2 cones. The problem is to choose both radius and hight of the cylinder in order to maximize the volume.

The first problem that I dont know how i can plot this in maple, I would like to plot both the 2d hexagon and the solid spinned around the y-axsis

Also I´m not to confident what the constraint should look like.

I know how to use the lagrange multiplier by hand and can apply that inside maple, however I would like to use this opportunity to get to know the power of maple functionality more in detail.

The link provoided is an image of the hexagon, i didnt find out how to use image tags.

The origin of this problem is that I want to bound a norm below. After som assigning of variables etc it boils down to minimizing;


I first treat the x,y,z,w as coefficents and optimize over them( these are real and imaginary parts of complex parameters of my norm which on paper is a sum).
I use standard way to get the minia w.r.t these 4 variables via "solve". Then I put the solution into the a new function N(A,B,E,F,G,H) and try to optimize that with NLP and get one solution, but this is only local and it has the following message attached to it;

"Warning, no iterations performed as initial point satisfies first-order conditions"

I want a global minima for my polynomial N in 6 variables and I have some constarints on them aswell. Furthermore I put all variables to be real.

What command or package can I use to get this?

Dear all!.       

I have an expression with ramdom variables. Can i use NLP to optimize it?. In this case, does Maple take the histogram of theses ramdom variables?. Thank!!!

I want to plot and otherwise use the value of the parameter I'm minimizing w.r.t. Mimimize only provides me with the solution l]ike this:


ans := Minimize(dChisq);
     [-64.4156340847187, [x = HFloat(0.9455666933532977)]]


Help does not indicate how to get at the value of x which in this case I want to plot and might want to input to further calculations. Indded I don't now what to do with above ... other than I can extract the value of the 'chisq' at the minimum. But I can't get at the important number which is where the minimum is.

No way to get the uncertainty on x is evident either. I could do this myself but need to know the value at the minimum to do it.




I'm currently writing my thesis and actually haven't used Maple before.

I've got the following problem with converting the results of a sequence:

seq(Optimization:-Maximize(function with 2 variables), parameter:0..1,0.1)

The results are ok, but I can't convert the values to a spreadsheet with 4 columns (parameter value, maximum value, value of variable 1, value of variable 2).

Thank you!

Best regards

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?.


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));


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]();

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




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;

whose result would be:

       f(x) = x

Is there a way to use dsolve to do this?

Hello, I run Maple to solve Binary Integer Programming problem which contain about 1340 constraint and its goal to maximize the objective function.

At first, it's running for 2 hours and said that the iteration limit was reached. So I try to add 'iterationlimit' at LPSolve opts and set it to 10000, but after 3 or 4 hours it said that the iteration limit was reached. So I set 'iterationlimit' to 100000000 and now Maple keep evaluating more than 12 hours.

I run Maple at my notebook with these spesification:

Processor: Intel Corei3-5005U 2.0 GHz

Memory: 4GB RAM

Windows 10


It is normal? Or I must run Maple in higher notebook spesification?

Thank you in advance.


Below is my Maple file, hope you can help me.

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:

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

NLPSolve, QPSolve]
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;
IM := array(identity, 1..n,1..n):
for i from 1 to n do
rho[i] := lambda[i]/mu[i]
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)
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
t4:= (cx[i]+ cb[i])/2:
Wq[i] := (t3*t4*t5*fact):
W[i] := Wq[i] + t5:
Lq[i] := lambda[i]*Wq[i]:
L[i] := lambda[i]*W[i]:
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.


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

NLPSolve, QPSolve]
global T,lambda,nq,u;
local i,j,pop,Sum;
# Gauss-Seidel iterations
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);
nq:=array(1..M,[0,0,0]);# must initialize queue lengths
for i from 1 to N do

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;
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


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?

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