# Can I use Swarm Optimization to solve a constrained Linear Program?

Trying to learn a little bit about AI, and was curious
if there's a way to use the Swarm Optimization Algorithm
to solve a constrained Linear Program.

Thanks!
LVL 1
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
If you are referring to Particle Swarm Optimization and a Constrained Linear Least-Squares Problem, then I would say sure. You could solve it with PSO; however, there are other methods which are much faster, more consistent, and more guaranteed.
PSO is an optimization method and is usually used when there is no known solution and a 'close enough' solution will suffice. There is no guarantee of finding the best solution (although with a linear problem, you'd most likely hit the optimal solution). PSO also takes much longer than the direct approaches (for this particular problem).
PSO is a heuristic and is usually only used if no known (efficient) algorithm exists.
0
Author Commented:
I'm trying to set up a way to combine foods to create a "recepie"
that satisfies certain constraints and minimizes, or maxamizes an
arbitrary property.

(Say I want to combine chicken, beans, and rice, and olive oil
so that I have
50 grams of carbohydrates,
50 grams of protein,
22 grams of Fat,
a max of 12 grams of rice
minimizing the function on price)

I think that this is actually what george danzig developed the
linear programming method for. The reason I'm looking at either
PSO or GA is in part to learn it, and in part because if its not
substantially slower than simplex, it appears to be substantially
easier to code than say Mixed Integer Optimization.

Thoughts?
0
Commented:
Ah yes, Your problem is related to the knapsack problem so there is no efficient way to get a guaranteed optimal solution. (Finding the optimal solution would basically require trying every possible combination). This looks like a great problem for a particle swarm. You have a complex, multidimension problem space, but there will potentially be multiple sizeable areas with good solutions.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Way over my head, but definitely looks like some thought has gone into how to solve
this type of problem...