Items tagged with lpsolve

Feed

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!

Greetings

How can I get LPSolve to output the unique subsets of {3,1,1,2,2,1} which sum to 5 (no recycling of set values)

partition.mw

(the code is a Yury/Love hybrid).

When I try the example from Maple Help for LPSolve (I use Windows)

with(Optimization);
LPSolve(-4*x-5*y, {0 <= x, 0 <= y, x+2*y <= 6, 5*x+4*y <= 20});

I do not get the same solution like in the example: [-19., [x = 2.66666666666667, y = 1.66666666666667]]
Instead I get

Warning, problem appears to be unbounded
            [0., [x = HFloat(0.0), y = HFloat(0.0)]]


My Professor uses the same version, but with Linux and do not have such problems. Why my installation does not solve the standart Help example?

Thank you

how to do optimization for two equations in terms of two variables

 

LPSolve({eq1}, {eq2}, assume = {nonnegative});

 

eq1 is a rational function and eq2 is a very large rational function

after run , it return error, objective function must be specified as a linear polynomial or vector

 

da := [LengthSplit(Flatten([[1,m],[2,m2],[seq([i+1,close3[i][1]], i=2..4)]]),2)];
f := PolynomialInterpolation(da, z):
solution := solve(f=-z, z, explicit);
zz := [x1,x2,x3,x4];
sigma := symMonomial(zz); #sigma := [x1+x2+x3+x4, x1*x2+x1*x3+x1*x4+x2*x3+x2*x4+x3*x4, x1*x2*x3+x1*x2*x4+x1*x3*x4+x2*x3*x4, x1*x2*x3*x4]
sys1 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[1]):
sys2 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[2]):
sys3 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[3]):
sys4 := subs([x1=solution[1],x2=solution[2],x3=solution[3],x4=solution[4]], sigma[4]):
da := [seq([i,close3[i][1]], i=1..5)];

with(Optimization):
LPSolve(sys1, {sys2}, assume = {nonnegative});

 

Hi all,

I have some "boolean variable" constraint equation like this:

a1*x1+a2*x2+...+an*xn>=b1*y1+b2*y2+...+bn*yn

where a1,a2,...,an and b1, b2, ..., bn are 1 or -1

These equations will be used in LPSolve or the other command to find a group of parameters which can fit them.

Now I used for-loop to deal with this kind of question, for example:

But there are more than 10 boolean variables in my case and It's very inefficient. On the other hand, using for-loop to determine the equation we solve in the command will lead to great confusion.

I think there should be some ways able to solve this kind of "boolean variables" question in Maple, such as, through assume command to define the type of "boolean variable".

But I have no idea how to do it.

helo to all i want to know how to solve a lp model having 4 decision variables and 4 constraints means how to solve them to get  optimal solution . Plz guide me ,thanks  : )

Page 1 of 1