フィルターのクリア

Genetic algorithm gives same result everytime

2 ビュー (過去 30 日間)
Gauri
Gauri 2024 年 2 月 21 日
コメント済み: Gauri 2024 年 2 月 21 日
Hello,
I'm trying to minimise total cost of inventory incurred by a bread retailer, by optimising the maximum inventory level. Im using genetic algorithm. The output that i need to record is the maximum inventory level and Total cost. atleast 5 entries.
My problem is that after running the genetic algorithm multiple times, it is giving the same results. Is there a problem with my code? It is attached below.
objective function is 'totalcost'. Accessory to it is 'inventoryupdate'.
Genetic algorithm is in 'check2'. It was made using optimiser task insert.
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 2 月 21 日
check2
OptimizationProblem : Solve for: maxS where: maxS integer minimize : totalCostFunction(maxS) variable bounds: 10 <= maxS <= 100 Solving problem using ga. ga stopped because the average change in the penalty function value is less than options.FunctionTolerance and the constraint violation is less than options.ConstraintTolerance.
solution = struct with fields:
maxS: 45
reasonSolverStopped =
SolverConvergedSuccessfully
objectiveValue = int32 32520
check2
OptimizationProblem : Solve for: maxS where: maxS integer minimize : totalCostFunction(maxS) variable bounds: 10 <= maxS <= 100 Solving problem using ga. ga stopped because the average change in the penalty function value is less than options.FunctionTolerance and the constraint violation is less than options.ConstraintTolerance.
solution = struct with fields:
maxS: 45
reasonSolverStopped =
SolverConvergedSuccessfully
objectiveValue = int32 32520

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2024 年 2 月 21 日
You have a single variable that is integer constrained between 10 and 100. That is only 91 different values to search, at most -- and the search is guided by the function values.
The problem is just simple enough that you always get the same answer in practice.
  1 件のコメント
Gauri
Gauri 2024 年 2 月 21 日
oh
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by