which optimization function/algorithm do i use?

1) I have an objective function which gives heat extracted for a given borehole heat exchange geometry.
2) It has three variables geometry, length and distance
3)geometry variable can be chosen from 1:20 scenarios (only integers)
4)length variable has bonds [50,400];
5)distance has to be optimized
6)Objective function gives the amount of heat extracted for period of time
7)General behavior is that the larger the distance inefficient is the heat storage in given geometry.
Aim is to iterate as soon as possible to a the geometry which give maximum heat storage for an optimized distance between the boreholes.
could anyone please help.
Best wishes, Swarup

Respuestas (1)

Alan Weiss
Alan Weiss el 23 de Jul. de 2014

0 votos

I suggest that you do 20 optimizations, one for each value of geometry. The optimizations are over the variable x = [length, distance], where length has bounds. You can use fmincon to perform this optimization, as long as you have a function that maps x and geometry to the heat extracted. If you want to maximize this function, then minimize the negative of the function.
Alan Weiss
MATLAB mathematical toolbox documentation

6 comentarios

Swarup
Swarup el 25 de Jul. de 2014
Thanks Alan.
Hi Alan,
can you please explain what is going wrong here.
my inline objective functions is the following.
@(x) fem3d_optis2(4,x(1),x(2))
i get an error
-----------------------------
Optimization running. Error running optimization. The following error occurred converting from double to function_handle: Error using ==> function_handle Too many output arguments.
----------------------
This is my constraint function.
function [ c, ceq ] = confun(x)
Qbedarf = 55;
%geom = 1:1:20;
%nonlinear inequlity constraints
%for i = size(geom,2)
c = @(x) deal(Qbedarf - fem3d_optis2(4, x(1), x(2)), 0);
% Nonlinear equality constraints
ceq = 0;
%end
end
You seem to have a mistake in the c = @(x) line. I would get rid of the ceq = 0 line and write
nonlinfcn = @(x)deal...
See the documentation for ways to include nonlinear constraints correctly.
Alan Weiss
MATLAB mathematical toolbox documentation
Hi, is this correct?
function [ c, ceq ] = confunQ(x)
%c = @(x) deal(Qbedarf - fem3d_optis2(4, x(1), x(2)), 0);
c = @(x)fem3d_optis(4, x(1), x(2));
nonlinfcn = @(x)deal(c(x),0);
% Nonlinear equality constraints
ceq = [];
end
No, or at least I do not understand the nonlinfcn statement. Try this:
function [c,ceq] = confunQ(x)
c = @(x)fem3d_optis(4, x(1), x(2));
ceq = [];
Alan Weiss
MATLAB mathematical toolbox documentation
Swarup
Swarup el 28 de Ag. de 2014
:) Ok. Thanks.

La pregunta está cerrada.

Etiquetas

Preguntada:

el 23 de Jul. de 2014

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by