Items tagged with optimization

Feed
Also available: optimization

Hi

I have two equations as follows:

The goal is finding the parameter 'phi'. This parameter is a positive real numeric constant.

I uploaded two files that they are included two methods to solve the problem.

1.mw

2.mw

Is method in the first file mathematically logical? If it is a correct method, why the command fsolve dosent work?

In file 2, we have 2 equations with further indeterminantes. The constant 'phi' must be minimum possible amount. How we can use the commands like the Minimize in Optimization? Please hint me.

Moreover, if there is a method to solve this problem please help me to know.

Thank you very much 

 

 

Let be the number z so that |z+3-2*I| + |z-3-8*I| = 6*sqrt(2). Find min and max of the modulus of z. How can I find min and max of modulus of z with Maple.

Thank for your help!

I posted my question at here https://math.stackexchange.com/questions/2314488/how-can-i-find-maximum-and-minimum-modulus-of-a-complex-number.
With Mathematica, I got min is 22/5. This result is different from my solution by hand.

Repeat my problem. Let be the number z so that $|z+1| + 4|z-1| = 25$. Find the greastest and the least of the modulus of $z$. How can I find greastest and the least of modulus of z with Maple.

i have an optimization problem, i want to maximize an expression using assumption, what should i do?


 

restart:with(Optimization):

M1:=Matrix((1,4),[sqrt(p),0,0,sqrt(1-p)]);

M1 := Matrix(1, 4, {(1, 1) = p^(1/2), (1, 2) = 0, (1, 3) = 0, (1, 4) = (1-p)^(1/2)})

(1)

M2:=Matrix((1,4),[cos(theta[1])*cos(theta[2]),exp(I*phi[1])*sin(theta[1])*cos(theta[2]),exp(I*phi[2])*sin(theta[2])*cos(theta[1]),exp(I*(phi[1]+phi[2]))*sin(theta[1])*sin(theta[2])])^+;

M2 := Matrix(4, 1, {(1, 1) = cos(theta[1])*cos(theta[2]), (2, 1) = exp(I*phi[1])*sin(theta[1])*cos(theta[2]), (3, 1) = exp(I*phi[2])*sin(theta[2])*cos(theta[1]), (4, 1) = exp(I*(phi[1]+phi[2]))*sin(theta[1])*sin(theta[2])})

(2)

#Real:=rhs(op(op(2,Re(M1.M2))));

PP:=Re(M1.M2)(1,1);

Re(p^(1/2)*cos(theta[1])*cos(theta[2])+(1-p)^(1/2)*exp(I*(phi[1]+phi[2]))*sin(theta[1])*sin(theta[2]))

(3)

maximize(PP) assuming 0<p ,p<1;

Error, (in assuming) when calling 'maximize'. Received: 'invalid input: `minimize/continuous` expects its 2nd argument, yFP, to be of type {name, list(name)}, but received `theta[1]` = -infinity'

 

 


 

Download optimize.mw

   It’s that time of year again for the University of Waterloo’s Submarine Racing Team – international competitions for their WatSub are set to soon begin. With a new submarine design in place, they’re getting ready to suit up, dive in, and race against university teams from around the world.

 

   The WatSub team has come a long way from its roots in a 2014 engineering project. Growing to over 100 members, students have designed and redesigned their submarine in efforts to shave time off their race numbers while maintaining the required safety and performance standards. Their submarine – “Bolt,” as it’s named – was officially unveiled for the 2017 season on Thursday, June 1st.

 

 

   As the WatSub team says, "Everything is simple, until you go underwater."

 

 

    Designing a working submarine is no easy task, and that’s before you even think about all the details involved. Bolt needs to accommodate a pilot, be transported around the world, and cut through the water with speed, to name a few of the requirements if the WatSub team is to be a serious competitor.

 

    To help squeeze even more performance out of their design, the team has been using Maple to fine tune and optimize some of their most important structural components. At Maplesoft, we’ve been excited to maintain our sponsorship of the WatSub team as they continue to find new ways to push Bolt’s performance even further.

 

 

   The 2017 design unveiling on June 1st. After adding decals and final touches, Bolt will soon be ready to race.

 

   This year, the WatSub team has given their sub a whole new design, machining new body parts, optimizing the weight distribution of their gearbox, and installing a redesigned propeller system. Using Maple, they could go deep into design trade-offs early, and come away knowing the optimal gearbox design for their submarine.

 

   In just over a month, the WatSub team will take Bolt across the pond and compete in the European International Submarine Races (eISR). Many teams competing have been in existence for well over a decade, but the leaps and strides taken by the WatSub team have made them a serious competitor for this year.

  Best of luck to the WatSub team and their submarine, Bolt – we’re all rooting for you!

Hi,

this forum has helped me a lot since I'm quite new at maple. There are lot of questions about the solution of _Z in roots but I still can't figure it out.

Here my problem:

f(x,y)= x*y - (V^(alpha)*W)/(V-a*x-b*y)^alpha

x>0, y>0, a>0, b>0, alpha>0, V>0, W>0, V-a*x-b*y>0

I need to find the maximum values for x and y. But all the solutions have got _Z.

How can I eliminate _Z? Thanks!

Best regards,

Won

 

Experts.

I'm trying to solve a Truck Routing Problem. I set in up in Maple and Excel, but I get a smaller minimum in the spreadsheet, than in Maple. Its like as if I havn't generated enough possible routes, even though i feel i've done an exaustive search. I realise the distance matrix violates the triangle inequality.  Any suggestions....

TRP_14x3.mw

Given

Tour2:=[[[1, 2, 3, 4]], [[1, 2], [1, 3, 4]], [[1, 3], [1, 2, 4]], [[1, 4], [1, 2, 3]], [[1, 2], [1, 3], [1, 4]]]:

Kitonums code

seq(max(seq(add(d[s[i]]*x[s[i],s[i+1]], i=1..nops(s)-1) , s=t))<=K, t=Tour2); produces

18*x[1, 2]+26*x[2, 3]+11*x[3, 4] <= K, max(18*x[1, 2], 26*x[1, 3]+11*x[3, 4]) <= K, max(26*x[1, 3], 18*x[1, 2]+11*x[2, 4]) <= K, max(11*x[1, 4], 18*x[1, 2]+26*x[2, 3]) <= K, max(18*x[1, 2], 26*x[1, 3], 11*x[1, 4]) <= K

correctly. The problem is I want to pass this through LPSolve and it doesn't like it. So what I need is to convert it to a constraint it will accept. I found a method on stackexchange,

http://stackoverflow.com/questions/10792139/using-min-max-within-an-integer-linear-program

i'm not sure it even works.i would be great if a procedure could could convert the max's in the above expression, or change the code in bold.

max(6*x[1, 4],4*x[1, 2]+3*x[2, 3]), where x[i,j] are binary vars.
x4 >= 6*x[1, 4];
x4 >= 4*x[1, 2]+3*x[2, 3];
Objective:= x4;

 

Sirs.

Probably a brain fade, but I cant seem to code what i want.

constraints.mw
 

Tour2:=[[[1, 2, 3, 4]], [[1, 2], [1, 3, 4]], [[1, 3], [1, 2, 4]], [[1, 4], [1, 2, 3]], [[1, 2], [1, 3], [1, 4]]];M:=nops(Tour2):

[[[1, 2, 3, 4]], [[1, 2], [1, 3, 4]], [[1, 3], [1, 2, 4]], [[1, 4], [1, 2, 3]], [[1, 2], [1, 3], [1, 4]]]

(1)

interface(rtablesize=M):
  maxEnt:=max([seq(nops(Tour2[i]),i=1..M)]):
  Tours_Distances := Matrix
                     ( maxEnt,
                       M,
                       [ seq
                         ( [ seq
                             ( `if`( numelems(Tour2[i])>=j,
                                     d[i]*x[op(Tour2[i,j])]<=K,
                                    0
                                   ),
                               i=1..M
                             )
                           ],
                           j=1..maxEnt
                         )
                       ]
                     );

Tours_Distances := Matrix(3, 5, {(1, 1) = d[1]*x[1, 2, 3, 4] <= K, (1, 2) = d[2]*x[1, 2] <= K, (1, 3) = d[3]*x[1, 3] <= K, (1, 4) = d[4]*x[1, 4] <= K, (1, 5) = d[5]*x[1, 2] <= K, (2, 1) = 0, (2, 2) = d[2]*x[1, 3, 4] <= K, (2, 3) = d[3]*x[1, 2, 4] <= K, (2, 4) = d[4]*x[1, 2, 3] <= K, (2, 5) = d[5]*x[1, 3] <= K, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = d[5]*x[1, 4] <= K})

(2)

convert( (2), 'list', 'nested' );

[[d[1]*x[1, 2, 3, 4] <= K, d[2]*x[1, 2] <= K, d[3]*x[1, 3] <= K, d[4]*x[1, 4] <= K, d[5]*x[1, 2] <= K], [0, d[2]*x[1, 3, 4] <= K, d[3]*x[1, 2, 4] <= K, d[4]*x[1, 2, 3] <= K, d[5]*x[1, 3] <= K], [0, 0, 0, 0, d[5]*x[1, 4] <= K]]

(3)

 

But what I want is:

d[1]*x[1,2]+d[2]*x[2,3]+d[3]*x[3,4]<=K,d[1]*x[1,2]<=K,d[1]*x[1,3]+d[3]*x[3,4]<=K;      #.....etc.

 

 

 

 

 

d[1]*x[1, 2]+d[2]*x[2, 3]+d[3]*x[3, 4] <= K, d[1]*x[1, 2] <= K, d[1]*x[1, 3]+d[3]*x[3, 4] <= K

(4)

NULL


 

Download constraints.mw

 

i use optimization package with constraint hello >= 0

Minimize(xx=0, {hello >= 0})

but solution only return the case when hello = 0

how about hello > 0?

i would like to find all possible set of solutions using this constraint

do i need to set upper bound, such as {hello <= 7, hello >=0}

can it return solution when hello = 1.1, 1.2, ...2, 2.1, 2.2, 2.3, ....7

hello, i have problem here.

> restart;
> with(linalg);
> NULL;
> fungsi1 := sum(d1[h]+b1[h], h = 1 .. 7);
> fungsi2 := sum(sum(d2[h, t]+b2[h, t], t = 1 .. 23), h = 1 .. 7);
> fungsi3 := sum(sum(d3[h, t]+b3[h, t], t = 1 .. 23), h = 1 .. 7);
> fungsi4 := sum(d4[k]+b4[k], k = 1 .. 3);
> fungsi := fungsi1+fungsi2+fungsi3+fungsi4;
> NULL;
> NULL;
> k1 := seq(sum(X[h, t], t = 1 .. 23) >= 9, h = 1 .. 6);
> k2 := seq(sum(Y[h, t], t = 1 .. 23) >= 2, h = 1 .. 6);
> k3 := seq(sum(Z[h, t], t = 1 .. 23) >= 2, h = 1 .. 6);
> NULL;
> k4 := seq(seq(X[h, t]+Y[h, t]+Z[h, t] <= 1, h = 1 .. 6), t = 1 .. 23);
> NULL;
> k5 := seq(seq(Z[h, t]+Z[h+1, t] <= 1, h = 1 .. 6), t = 1 .. 23);
> NULL;
> k6 := seq(sum(X[h, t]+Y[h, t]+Z[h, t], t = 1 .. 23) >= 5, h = 1 .. 7);
> k7 := seq(sum(X[h, t]+Y[h, t]+Z[h, t], t = 1 .. 23) <= 6, h = 1 .. 7);
> NULL;
> k8 := seq(sum(X[h, t], t = 1 .. 23)+b1[h]-d1[h] <= 15, h = 1 .. 6);
> k9 := seq(sum(Y[h, t], t = 1 .. 23)+b1[h]-d1[h] <= 4, h = 1 .. 6);
> k10 := seq(sum(Z[h, t], t = 1 .. 23)+b1[h]-d1[h] <= 4, h = 1 .. 6);
> NULL;
> k11 := seq(seq(Y[h, t]+Y[h+1, t]+b2[h, t]-d2[h, t] <= 1, t = 1 .. 23), h = 1 .. 6);
> NULL;
> k12 := seq(seq(Z[h, t]+Z[h+1, t]+b3[h, t]-d3[h, t] <= 1, t = 1 .. 23), h = 1 .. 6);
> NULL;
> k13 := sum(X[7, t], t = 1 .. 23)+b4[1]-d4[1] = 2;
> k14 := sum(Y[7, t], t = 1 .. 23)+b4[1]-d4[1] = 2;
> k15 := sum(Z[7, t], t = 1 .. 23)+b4[1]-d4[1] = 2;
> with(Optimization);
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize, 

  NLPSolve, QPSolve]
> CodeTools:-Usage(LPSolve(fungsi, {k1, k10, k11, k12, k13, k14, k15, k2, k3, k4, k5, k6, k7, k8, k9}, assume = {integer, nonnegative}));
Error, (in Optimization:-LPSolve) no feasible point found for LP subproblem

why it can be? please i need help. 

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!

 

 

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