# Binary solutions with GA

6 Ansichten (letzte 30 Tage)
Loic Wilfried Biakeu Njia am 20 Jun. 2017
Kommentiert: Brendan Hamm am 30 Sep. 2017
Hi
I am currently working with GA on resource allocation and the goal is to find binary solutions with a non linear objective and linear constraints.
At the beginning of the project, I had a problem with more than 700 variables with many constraints and the solutions that I had from GA were very irrelevant. I thought the size of the problem was the issue.
So I broke down the problem into many models in order to have less that hundreds variables (in occurrence 30 variables for the current model I am building) and around hundreds constraints too for each model (in occurrence 95 linear constraints for the same current model). Besides, some of the constraints are normally equality constraints that I transformed into inequality constraints to help GA to find a solution. BUT at the end I still have solutions that don't correspond to the constraints. For the instance, for example if we want to allocate 30 bags in 5 cabinets so that each bag is allocated only in one cabinet, I got some results where one bag is allocated in many cabinets, even though the inequality constraints that I wrote seem totally correct.
I have this report at the end "Optimization terminated: average change in the penalty fitness value less than options.FunctionTolerance and constraint violation is less than options.ConstraintTolerance".
I don't really know what to do with this problem and I am quite in a need of a solution for an industrial (confidential) problem after having purchased GA weeks ago (the trials for smaller sizes seemed to work previously). Please could you give any support for that?
Thanks,
Loic
##### 8 Kommentare6 ältere Kommentare anzeigen6 ältere Kommentare ausblenden
Loic Wilfried Biakeu Njia am 28 Jun. 2017
"Are there maximums? Is the requirement that each cabinet receive exactly 6 bags?"
The objective is to balance the repartition of bags into the cabinet. The maximum a cabinet can receive is ceil(number of bags/number of cabinets), because we can have some cases where the number of bags is not even. For the second question, I didn't write exactly that requirement as an equality constraints. However, to avoid equality constraints, I wrote that each cabinet could receive more than floor(number of bags/number of cabinets) and less than ceil(number of bags/number of cabinets).
For your suggestion about custom creation and mutation function, I don't know more about. I will probably have a look on that.
Thanks,
Walter Roberson am 28 Jun. 2017
Ah, good point about the number sometimes having to vary.

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Brendan Hamm am 20 Sep. 2017
This will be a bit length to answer this question again, but I have provided a way you can solve this problem in a previous post:
This does use a multiobjective problem, but the idea of writing the population, crossover and mutation functions is the same.
##### 2 KommentareKeine anzeigenKeine ausblenden
Loic Wilfried Biakeu Njia am 27 Sep. 2017
Thanks Brendan for your answer! I like the way you took on the issue.
I have tried your solution but unfortunately it doesn't work for my case. It get stuck in the popFun function and indefinitely computes but I think never finds a Population that conforms all the constraints.
Brendan Hamm am 30 Sep. 2017
If you post it on here I will take a look when I have some time and suggest some possible alternatives.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Choose a Solver finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by