Items tagged with optimization

If binary constraints are imposed on an optimization problem and LPSolve presents a solution, is it possible to extract the variables that have zero or one assigned to them? This would be most useful if there are many variables, for example...

If a solution is returned that looks like ...

[x[001]=0, x[101]=1, x[201]=0, x[301]=1, ....], how can I filter those solutions that equal zero?

Thanks for reading!

I was curious to know if one can extract a specific solution from a LPSolve routine. 

As an example, consider the following output to a constrained linear problem. The objective value is 8 and the decision variable values (binary) are given.

Sol := [8, [w[1, 1] = 1., x[0, 0, 1] = 0, x[0, 1, 1] = 1, x[0, 2, 1] = 0, x[1, 0, 1] = 0, x[1, 1, 1] = 0, x[1, 2, 1] = 1, x[2, 0, 1] = 0, x[2, 1, 1] = 0, x[2, 2, 1] = 0, y[0, 0] = 0., y[0, 1] = 0., y[1, 1] = 2.]]

I am interested to know if we can isolate any variable value from this solution. I know that Sol[1] will return 8, and Sol[2] will return the remaining terms. But what if I wanted, say, x[1,2,1] alone?

Thanks for reading!

guys, need your help. i've been trying to find 9 pamater which are psi1,psi2,psi3,m1,m2,m3,sigma1,sigma2,sigma3. I need to minimize one function. i have datas and several contraints. i will share this with you guys. Really need your help and i'll appreciate any suggestion. Thanks

data:

a(x):=qtopi[x];

this is my objective function:

fungsikerugian := sum((1-(1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3))))/a(x))^2, x = 0 .. 111);

these are my contraints

a := psi1+psi2+psi3 = 1;
         
b := 0 <= exp(-((x+1)/m1)^(m1/sigma1));
                          
c := 1 >= exp(-((x+1)/m1)^(m1/sigma1));
                       
d := 0 <= 1-exp(-((x+1)/m2)^(-m2/sigma2));
                        
e := 1 >= 1-exp(-((x+1)/m2)^(-m2/sigma2));
                 
f := 0 <= exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3));
                  
g := 1 >= exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3));
            
h := 0 <= exp(-(x/m1)^(m1/sigma1));
                        
i := 1 >= exp(-(x/m1)^(m1/sigma1));
                     
j := 0 <= 1-exp(-(x/m2)^(-m2/sigma2));
                           
k := 1 >= 1-exp(-(x/m2)^(-m2/sigma2));
                      
l := 0 <= exp(exp(-m3/sigma3)-exp((x-m3)/sigma3));
                   
m := 1 >= exp(exp(-m3/sigma3)-exp((x-m3)/sigma3));
               
n := 0 <= 1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3)));

o := 1 >= 1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3)));
 
i use this to solve that but seems to not going anywhere
NLPSolve(fungsikerugian, {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o}, assume = nonnegative);
 
Thanks

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.

VRP_IP.mw

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

with(Optimization)

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

 

Hello

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.

TSP_IP.mw

sorry its a mishmash of 1D and 2D inputs

I'm inputting an optimization problem into Maple, and somewhere along the way my code stops working.  (Code is at the bottom.)

I need to find the second derviative for my Profit statement [(p-c)d]. I know the first derivative, deriving for p is, is d. d=ap-b, so deriving that statement for p should equal −abp−b−1 . For some reason, Maple is showing my second derivative as equal to zero.

Can anybody help me? TIA!

restart;

Profit := (p-c)*d;

d;=ap-b;

print(Solution); 

dProfit1 := diff(Profit, p); 

dProfit2 := diff(dProfit1, p); 

ddProfit2 := diff(Profit, p, p); 

pOpt := solve(diff(Profit, p));

                           Profit:=(p-c)ap-b

                          d:=ap-b

                            Solution

                          dProfit1:=ap-b

                             dProfit2:=0

                           ddProfit2:=0

                         pOpt:={ap=0, b=b)

 

 

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

Hello,

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: maple_code_of_theory.mw

 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.

 

I am attempting to minimize an objective function that is related to a p-median problem (facility location). Can somebody please tell me how to impose a constraint that comprises 0 or 1? For instance, I wish to assign the condition, x[i,j] = 0 or 1; in other words, x[i,j] = 1 if the point i is assigned to facilty located at point j; 0 otherwise.

 

Thanks in advance!

Hi,

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.

pjf

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

 

 

 

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