How should I manage the input on fmincon function?

Hi there,
I am using the fmincon function in order to minimize an image registration problem.
After preprocessing and several Gaussian reductions I obtain two data volumes/matrix (100,100,400 every one).
To optimize the result, every slice of the matrix can be moved in three axis (x, y, z). So, I need a 3(x,y,z)x400=1200 variables for every volume as initial guess. I pass them as a vector, InitialVector. The data volumes are passed as global variables. I am using the limited memory BFGS.
My problem is with respect the A and b variables of input.
How should I configure them? What size?
options = optimset('Algorithm','interior-point','Hessian',{'lbfgs',1000}); [FinalValue,fval,exitflag,output]=fmincon(@Optimizer,InitialVector,A,b,[],[],[],[],[],options);
Any suggestion will be truly appreciated!

Antworten (2)

Shashank Prasanna
Shashank Prasanna am 30 Jan. 2013

0 Stimmen

A and b are linear constraints, if you don't have any linear constraints just use empty brackets. If you do then see the doc on how to phrase them. A has coefficients for the linear combination of x to be less than b:
Also I'd advise against global variables and passing extra parameters through anonymous variables as follows:
Michael
Michael am 31 Jan. 2013
Bearbeitet: Michael am 31 Jan. 2013

0 Stimmen

Thanks for the answer.
If I use empty brackets for A,b appears the following problem:
Error using fmincon (line 218) FMINCON is for constrained problems. Use FMINUNC for unconstrained problems.
the matter is I need use the Limited Memory Broyden-Fletcher-Goldfarb-Shannon (LBFGS).
Is there any way to use this method (LBFGS) with the FMINUNC funtion?
About the global variables, I dont think so it is possible to pass them as extra parameters. My funtion is like this:
MAIN Function ...
options = optimset('Algorithm','interior-point','Hessian',{'lbfgs',1000}); [FinalValue,fval,exitflag,output]=fmincon(@Optimizer,InitialVector,A,b,[],[],[],[],[],options);
My fun
function [FinalValue]=Optimizer(InitialVector)
[BScanCubeX BScanCubeY]=VectorDisplacement(InitialVector); FinalValue=IterativeMeritFunction(BScanCubeX,BScanCubeY);
end
In VectorDisplacement funtion there are (with every iteration) changes in the position of the voxels in order to minimize the subtraction between BScanCubeX and BScanCubeY data sets.
NumberKX=InitialVector(1,:);
NumberKY=InitialVector(2,:);
IndexX=find(NumberKX>0);
IndexY=find(NumberKY>0);
NumberImagX=length(IndexX);
NumberImagY=length(IndexY);
NumberImag=NumberImagX+NumberImagY;
for k=1:NumberImag %%Positive Displacement Counter
if NumberImagY-k>=0 BScanCubeYY(:,IndexY(k)),:)=zeros(DimensionsVector(2,3,2),DimensionsVector(3,3,2)); BScanCubeYY(1:DimensionsVector(1,3,2)-(NumberKY(IndexY(k)))+1,IndexY(k),:)=CY3(NumberKY(IndexY(k)):DimensionsVector(1,3,2),IndexY(k),:); %
end
if NumberImagX-k>=0
BScanCubeXX(IndexX(k),:,:)=zeros(DimensionsVector(2,3,1),DimensionsVector(3,3,1)); BScanCubeXX(IndexX(k),1:DimensionsVector(2,3,1)-(NumberKX(IndexX(k)))+1,:)=CX3(IndexX(k),NumberKX(IndexX(k)):DimensionsVector(2,3,1),:);
end
So, any help, please?

Kategorien

Tags

Gefragt:

am 30 Jan. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by