# Sample average approximation (SAA)

Hello everyone,

I have a problem with stochastic optimization.
I have created a patient scheduling model. It is analogous to a dual bin-packing problem. The model assigns patients to OR by surgical specialties.
My objective function tries to maximize number of assigned patients.
// Decision variable
dvar boolean X[Patient][ORooms][Specialty][Day];
// Objective function
maximize sum(p in Patient, r in ORooms, s in Specialty, d in Day) X[p][r][s][d];
And I have several constraints. All parameters are discrete.  It is wroking fine.

In the next step, I should use random values for operation duration(stochastic duration). I have to implement the model with sample average approximation(SAA). I saw examples of stochastic optimization and added scenarios for operation duration and changed objective function like this:
// Decision variables
dvar boolean X[Patient][ORooms][Specialty][Day][Scenario];

// Objective function
maximize (1 / scenarios) * sum(p in P, r in ORooms, s in S, d in Day, sc in Scenario) X[Patient][ORooms][Specialty][Day][Scenario];

I use operation duration only in one constraint to check capacity. Other constraints check is patient assigned correctly or not …
// this constrain checks: is the total duration of operations on exact day smaller than capacity of the selected operation room.
forall(sc in Scenario, r in ORooms, s in Specialty, d in Day)
constraint2:
sum(p in Patient) DurationsWithScenario[p.id][sc] * X[p][r][s][d][sc] <= r.capacity * Y[r][s][d];

MY PROBLEM IS THAT IS IT ENOUGH FOR SAMPLE AVERAGE APPROXIMATION?