Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need to maximize the equation below which is subjected to some nonlinear constraints

   Maximize  hsum + isum + jsum + ksum + lsum + msum + nsum + osum

constraints are:

   0 < hsum,isum,jsum,ksum,lsum,msum,nsum < 10000
  -5000 < osum < 0

   a*x1 + b*x2 + d*x4 - h*(x1 + x2 + x4) = hsum
   a*x1 + b*x2 + d*x4 - i*(x1 + x2 + x4) = isum
   a*x1 + b*x2 + e*x5 - j*(x1 + x2 + x5) = jsum
   a*x1 + b*x2 + e*x5 - k*(x1 + x2 + x5) = ksum
   a*x1 + c*x3 + f*x6 - l*(x1 + x3 + x6) = lsum
   a*x1 + c*x3 + f*x6 - m*(x1 + x3 + x6) = msum
   a*x1 + c*x3 + g*x7 - n*(x1 + x3 + x7) = nsum 
   a*x1 + c*x3 + g*x7 - o*(x1 + x3 + x7) = osum      

X1,X2,X3....X7 are integers

a=100

b = (a + u1) && c = (a - u2) && d = (b + u3) && e = (b - u4) && 
f = (c + u5) && g = (c - u6) && h = (d + u7) && i = (d - u8) && 
j = (e + u9) && k = (e - u10) && l = (f + u11) && M = (f - u12) &&
n = (g + u13) && o = (g - u14) 


0.1 <= u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14 <= 3

I have tried to solve this but sadly my input maximization eq. is displayed as output
But when i remove the integer constrain for x1,x2...x7 code runs indefinitely.

Also some one said mathematica is unable to solve non linear equations where variables are constrained by integers values is that so?

Anyways here is my mathematica equation to check out if there is any problem with the code

Maximize[
{
   hsum + isum + jsum + ksum + lsum + msum + nsum + osum, 
   a*x1 + b*x2 + d*x4 - h*(x1 + x2 + x4) == hsum && 
   a*x1 + b*x2 + d*x4 - i*(x1 + x2 + x4) == isum && 
   a*x1 + b*x2 + e*x5 - j*(x1 + x2 + x5) == jsum && 
   a*x1 + b*x2 + e*x5 - k*(x1 + x2 + x5) == ksum && 
   a*x1 + c*x3 + f*x6 - l*(x1 + x3 + x6) == lsum && 
   a*x1 + c*x3 + f*x6 - m*(x1 + x3 + x6) == msum && 
   a*x1 + c*x3 + g*x7 - n*(x1 + x3 + x7) == nsum && 
   a*x1 + c*x3 + g*x7 - o*(x1 + x3 + x7) == osum && 

   a == 100&&

   b == (a + u1) && c == (a - u2) && d == (b + u3) && e == (b - u4) && 
   f == (c + u5) && g == (c - u6) && h == (d + u7) && i == (d - u8) && 
   j == (e + u9) && k == (e - u10) && l == (f + u11) && m == (f - u12) &&
   n == (g + u13) && o == (g - u14)

   && 0.1<=u1<=3 && 0.1<=u2<=3 && 0.1<=u3<=3 && 0.1<=u4<=3 && 0.1<=u5<=3 && 0.1<=u6<=3 
   && 0.1<=u7<=3 && 0.1<=u8<=3 && 0.1<=u9<=3 && 0.1<=u10<=3 && 0.1<=u11<=3 
   && 0.1<=u12<=3 && 0.1<=u13<=3 && 0.1<=u14<=3 &&  


   0.1 <= hsum <= 10000 && 0.1 <= isum <= 10000 && 0.1 <= jsum <= 10000 && 
   0.1 <= ksum <= 10000 && 0.1 <= lsum <= 10000 && 0.1 <= msum <= 10000 &&
   0.1 <= nsum < 10000 && -5000 <= osum <= -0.1 

   &&Element[x1 | x2 | x3 | x4 | x5 | x6 | x7, Integers]
}, 

{a, b, c, d, e, f, g, h, i, j, k, l, m, n, 
o, x1, x2, x3, x4, x5, x6, x7, hsum, isum, jsum, ksum, lsum, msum,
nsum, osum,u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14}]

thanks for reading till here

share|improve this question
    
I find that the system of equalities, a subset of your constraints, has no solution. If you can confirm this, then that's where I'd start from. –  b.gatessucks Jun 16 '13 at 19:39
    
yes equality values contradicts with inequalities! correcting them lets see –  Michio kaku Jun 16 '13 at 20:22
    
@b.gatessucks i have corrected the equalities now they have solution But still output values are not as per the constraints!! May be because they have not been correctly implemented? –  Michio kaku Jun 16 '13 at 21:37
    
NMinimize will give a result for this in around 25 seconds on my desktop (albeit not guaranteed to be a global optimum). I changed inequalities to all be weak because it's otherwise impossible to handle situations where an extremal value is on a region boundary. –  Daniel Lichtblau Jun 16 '13 at 22:04
    
@DanielLichtblau all equalities are now weak type but solution is not global maxima in the output it is taking x1,x2,x3,x4,x5..x7 -->0 However x1,x2,x3,x4...x7 should be taken such that hsum,isum,jsum...nsum move towards 10000 –  Michio kaku Jun 17 '13 at 14:04
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.