Using ga with integer constraints: Constraints not close to being met.

1 view (last 30 days)
Hello, I am trying to run a fairly simple optimization problem.
The objective is to minimize cost. The program yields results, but does not get close at all to meeting one simple equality constraint. I know that equality constraints can't be used with IntCon, so I have implemented the constraint with two inequality constraints (less than or equal to and more than or equal to).
I have attached the code. The main thing I'm looking at is the vector "Diff" which shows the difference between each element in what would be the b_eq constraint and the sum of the corresponding A_eq element. I would prefer each element in the "Diff" vector to be zero or VERY close to zero. However, in some places the value is as high as +/- 30. This is unacceptable for me.
Is there anything I can do so that the constraint is met much better?
Thanks in advance!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!