Optimisation application: how do I create the fitness function?
Show older comments
I have two functions: EndCarb and EndCost.
These functions use inputs of: ID [1 2] and Q [0.000001:0.000001:0.01], and give an output of carbon quantity and cost respectively. (EndCarb [ID,Q]; EndCost[ID,Q])
I want to use the gamultiobj tool to optimise the inputs of ID and Q to give the pareto optimal cost and carbon. So far I have been attempting to write a script along the lines of:
fun(1) = @(ID,Q) EndCost(ID,Q);
%parameterised function
Q=0.000001:0.000001:0.01;
%parameter
fun1a=@(ID) fun(1)(ID,Q);
%function of ID alone
ID=[1,2];
fun(2) = @(ID,Q) EndCarbon(ID,Q);
%parameterised function
Q=0.000001:0.000001:0.01;
%parameter
fun2a=@(ID) fun(2)(ID,Q);
%function of ID alone
ID=[1,2];
% Combine two objectives 'fun1' and 'fun2'
fun1and2 = @(ID,Q) [fun(1)(ID,Q) fun(2)(ID,Q)];
I'm not sure if this is the right track, as I am unable to get it to work. Can anybody advise anything?
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!