Tho Nguyen

Greenhorn

Posts: 1

posted 1 year ago

I have the problem describe below

http://i.stack.imgur.com/RGGum.png

I need to find value of x1', x2', x3', x4', x5' that make

(x1-x1')^2+(x2-x2')^2+(x3-x3')^2+(x4-x4')^2+(x5-x5')^2 = mininum value

and

x1' + x2' + x3' + x4' + x5' = 1

x1 + x2 + x3 + x4 + x5 = 1

Note: we know value of a, b, c, d, e, x1, x2, x3, x4, x5

Would anyone help me in this case?

I have tried with google/or-tools library but can't add condition to find minimum value.

http://i.stack.imgur.com/RGGum.png

I need to find value of x1', x2', x3', x4', x5' that make

(x1-x1')^2+(x2-x2')^2+(x3-x3')^2+(x4-x4')^2+(x5-x5')^2 = mininum value

and

x1' + x2' + x3' + x4' + x5' = 1

x1 + x2 + x3 + x4 + x5 = 1

Note: we know value of a, b, c, d, e, x1, x2, x3, x4, x5

Would anyone help me in this case?

I have tried with google/or-tools library but can't add condition to find minimum value.

Campbell Ritchie

Marshal

Posts: 56518

172

Stephan van Hulst

Saloon Keeper

Posts: 7962

143

posted 1 year ago

Welcome to CodeRanch!

I'm with Campbell. Don't think about code yet. This is a mathematical problem, and you first need to do the calculations on paper before you can hope to write a line of correct code.

How would you tackle this without a computer?

I'm with Campbell. Don't think about code yet. This is a mathematical problem, and you first need to do the calculations on paper before you can hope to write a line of correct code.

How would you tackle this without a computer?

*The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.*