Items tagged with optimization

I wish to apply several i-j constraints to an optimization problem that involves minimizing a function x[i,j]. 

Does anyone know of a simple way to exclude values for i and j? For instance, how do we specify the conditions, i not equal to j, i is not equal to 1, etc.?

Thanks in advance!



Can somebody suggest an efficient way to specify / input a large list of binary variables in the LPSolve command, for example:

> LPSolve(objective function, constraints, binaryvariables={ x[0,0,1], .x[0,0,2], ...., x[i,j,k]}

Is it possible to assign a name to the set rather than input each element, x[i,j,k], manually?

Thanks in advance!

Friends in Maple

I have a Vehicle Routing Problem I wish to cast as a integer model. VRP is a kind of TSP and knapsack problem hybrid  I would be grateful if someone can finish it. answers included. This isn't homework BTW.

Dear all

I would like to minimuze the following function 4 x ^2 + 4 x y  under constraint  16=x^2 y  and both x , y  nonnegative real number 

this is my code


Minimize(4*x^2+4*x*y, {x^2*y = 16}, assume = nonnegative)


The result obtained from this code is strange

because when i do directly the computation without maple by substituting y =16/x^2 and simple derivation i get the minimum is at x=2 and so y=4 and therefore the minimum is 48

But as i say using my code I obtained a different solution

whats is the problem occurs in this situation

Many thanks



I know there are other methods to solve this classic probem, but I wanted to cast it as a linear program. I wonder if an expert can look at my IP coding and please correct my error.

sorry its a mishmash of 1D and 2D inputs

I'm curious to know if anyone has written a procedure to optimize the VRP with time windows / constraints.


I have a optimization question in the following picture.


Question: find matrix T(t). 


I writed a maple code. Could you view it ? You think that it is right?

The code file I writed:

 It is really very important for me. Can you help me?

Thank you. 


I am working to minimize an objective function concerning a facility location problem (p-median technique).

Can somebody explain how to formulate the constraint equation that involves  1 or 0?

For instance, the constraint x[i,j]  is an element of {0,1}; namely, x[i,j] = 1 if a point is assigned to a facility located at the point j; 0 otherwise.

Thanks in advance.



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.



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