How to optimize in goal programming for a matrix using a function of multiple variables? Should I use fmincon?

Hi there, I am making a model to optimize an OR planning for studies.
With (to start with) two goals I want to assign patients to an OR. Right now I have made two functions for those goals and a third function to combine those goals. Using fmincon I tried to minimize the penalty, however this does not seem to work. I am starting to doubt if I should use fmincon or may be another function to minimize the pentalty? Anyone who can help me out?
What I have done so far:
To start of I have the following variables:
X0 = zeros(height(patients),8); %Decision variable, 1 if operation assigned to OR, 0 otherwise. Start with all 0
p = patients.Operatieduur + .25; %Duration of operation i in hours including 15 minutes clean up and set up time
T = [7.5; 7.5; 7.5; 7.5; 7.5; 7.5; 7.5; 7.5]'; %Amount of time OR is available per day in hours
Z = [height(patients):-1:1]'; %patient priority, where 1 is the most important patient.
Which results in the following sizes: npatients is the number of patients entered in the waiting list
X0 npatientsx8 double
p npatientsx1 double
T 1x8 double
Z npatientsx1 double
The following goals are applied:
function u = Goal_OR_Utilization(p, X, T)
%Calculates the underutilization of the ORs
% Compares the planned hours of OR time to the available hours of OR time
u = T - sum(p.*X);
end
and
function d = Goal_PatientPriority(X,Z)
%d is difference between patients planned and patients on the waiting list,
%should be minimized
d = sum(Z) - sum(sum(X.*Z),2);
end
The goals are combined to the following: (already not sure if this is the way to go...)
function total = Goal_SumOfAll(p,X,T,Z)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
total = Goal_OR_Utilization(p,X,T) + ...
Goal_PatientPriority(X,Z);
end
Then to apply the fmincon I did the following:
x = fmincon(@(X) Goal_SumOfAll(p,X,T,Z), X0, [],[])
Which gives me the error "Supplied objective function must return a scalar value."
However, I want to calculate the OR Utilization per OR, because when I sum it, it might plan 0 hours in one OR and 15 in another...
I tried summing the Goal_OR_Utilization, just to see if it would then work, however this gives me the following error: "Undefined function 'getIpOptions' for input arguments of type 'struct'."
Is there anyone who can help me get this to work or recommend what minimalization method to use?

Answers (0)

Products

Release

R2020b

Asked:

on 22 Oct 2020

Community Treasure Hunt

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

Start Hunting!