Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.9K Views
|
16 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Find better representations for binary variables optimization?

Posted 6 years ago
POSTED BY: Wael Al Hajailan
16 Replies
Posted 6 years ago
POSTED BY: Bill Nelson

What is being minimized? Is the goal speed, or quality of result?

POSTED BY: Daniel Lichtblau
POSTED BY: Mariusz Iwaniuk
Anonymous User
Anonymous User
Posted 6 years ago

I'm not sure i understnad. if they are all 0 or 1 then the equation x1+x2+x3==1 cannot equal one unless only one is 1 (it is a matter only of whether the equations are consistent, not of optimizing). then there is only a matter of which is one, not of minimizing, which doesn't even constitute using logic (it would be a bit search). finally - there is no way to correct the inconsistent equation if that occurs.

perhaps an example, as Daniel Lichtblau, would be good

POSTED BY: Anonymous User

For the second item, I don't need the statements for all Dxx since they will not be changed. Only Pxx will have all possible combinations.

POSTED BY: Wael Al Hajailan

For the second item, the value for D00, D11, D22, and D33 are fixed. I am only trying to have the combination for P00, P11, P22, and P33 along with the fixed Dxx. So it should have 24 possible combinations of Pxx. For the third item, I am having all the possible combinations for both Pxx and Dxx. The value of Pxx could be any and the value of Dxx could be any. So, there are 32 binary variables to govern them. For both items, Pxx should be greater than Dxx in any combination before running the optimization. But I am taking care of that in the code.

P00 > D00, P11 > D11, P22 > D22, P33 > D33
POSTED BY: Wael Al Hajailan
POSTED BY: Wael Al Hajailan
Posted 6 years ago
POSTED BY: Bill Nelson

Please see attached the optimization file.

POSTED BY: Wael Al Hajailan
Posted 6 years ago
POSTED BY: Bill Nelson
POSTED BY: Wael Al Hajailan
POSTED BY: Wael Al Hajailan

The values of all z should be either one or zero.

POSTED BY: Wael Al Hajailan

What I'd prefer to see is a complete stand-alone example.

POSTED BY: Daniel Lichtblau
Posted 6 years ago

Can you perhaps adapt this

v=Select[Tuples[{0,1},16],
  Total[Take[#,{1,4}]]==1&&Total[Take[#,{5,8}]]==1&&
  Total[Take[#,{9,12}]]==1&&Total[Take[#,{13,16}]]==1&&
  #[[1]]+#[[5]]+#[[9]]+#[[13]]==1&&#[[2]]+#[[6]]+#[[10]]+#[[14]]==1&&
  #[[3]]+#[[7]]+#[[11]]+#[[15]]==1&&#[[4]]+#[[8]]+#[[12]]+#[[16]]==1&];
r=Map[MapThread[Rule,{{z0,z1,z2,z3,z4,z5,z6,z7,z8,z9,z10,z11,z12,z13,z14,z15},#}]&,v]

which finds the 24 acceptable assignments.

And then this

{P00,P11,P22,P33} = {z0 P0+z1 P1+z2 P2+z3 P3,z4 P0+z5 P1+z6 P2+z7 P3,
  z8 P0+z9 P1+z10 P2+z11 P3,z12 P0+z13 P1+z14 P2+z15 P3}/.r[[1]]
{D00,D11,D22,D33} = {z0 D0+z1 D1+z2 D2+z3 D3,z4 D0+z5 D1+z6 D2+z7 D3,
  z8 D0+z9 D1+z10 D2+z11 D3,z12 D0+z13 D1+z14 D2+z15 D3}/.r[[1]]

uses the first such assignment to find the first set of your eight expressions

POSTED BY: Bill Nelson

I am trying to optimize an objective function by choosing the appropriate variables. So, I need a decision on each variable that is why I am using binary variables.

P00 = z0 P0 + z1 P1 + z2 P2 + z3 P3;
P11 = z4 P0 + z5 P1 + z6 P2 + z7 P3;
P22 = z8 P0 + z9 P1 + z10 P2 + z11 P3;
P33 = z12 P0 + z13 P1 + z14 P2 + z15 P3;

D00 = z0 D0 + z1 D1 + z2 D2 + z3 D3;
D11 = z4 D0 + z5 D1 + z6 D2 + z7 D3;
D22 = z8 D0 + z9 D1 + z10 D2 + z11 D3;
D33 = z12 D0 + z13 D1 + z14 D2 + z15 D3;
POSTED BY: Wael Al Hajailan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard