fgoalattain with external code: x does not change

1 view (last 30 days)
Dear All,
I am a student and this is the first time I use fgoalattain. I would like to use this approach before using genetic algorithm to compare results. I searched for already answered question but did not find any solution.
My problem is based on an equivalent model with non-linear equations that is run externally to matlab: I write on a .txt file the project variables (to be varied by the algorith), call a .exe solver by "!solver" command with dedicated options and then read results from an other .txt file.
I take some of the observed magnitudes (let's say two temperatures T1 and T2) and then pass them as values for objective function, to be minimized. I am searching for a pareto front.
This is how I set the problem:
weight = [1 1]
goals [0 0]
My objective function assume only positive value so: minimize gamma so that:
T1 - gamma <= 0
T2 - gamma <= 0
I tested the functions that I wrote: I can say that they work well with genetic algorithms, like NSGA-II.
My problem is: with fgoalattain I see x is always equal to x0. If I use x0 out of costraints (lower or higher than lb or ub) I see fgoalattain acts on them, reducing to limit values but that's all: then x is always the same along iterations.
In the end fgoalattain stops:
No feasible solution found.
fgoalattain stopped because the size of the current search direction is less than twice the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.
criteria details
I am really struggling on it.
I ask for your help, I hope to solve this problem soon.

Accepted Answer

Alan Weiss
Alan Weiss on 3 Sep 2014
It is possible that you are running into an issue described in Optimizing a Simulation or ODE. In particular, you might want to set larger-than-default finite differences.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Andrea
Andrea on 3 Sep 2014
Thank you Alan, I solved it in the meanwhile doing exactly what you suggested. cheers

Sign in to comment.

More Answers (1)

Andrea
Andrea on 2 Sep 2014
up

Community Treasure Hunt

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

Start Hunting!