I have a stochastic optimization model wherein two-stage SP is not applicable. As such, I want to utilize sample average approximation for my solution to consider at least 100 scenarios with equal probabilities then arriving at one single solution. Is this kind of methodology default in AIMMS? Or are there things that I should do first before doing so?

# Sample Average Approximation in AIMMS

**Best answer by Marcel Hunting**

Hi

`Constraint c1 {`

IndexDomain: i;

Definition: sum( j, q(i,j) * x(i,j) ) <= p(i);

}

Here p and q are parameters, and x is a variable. You then have to change this constraint into

`Constraint c1 {`

IndexDomain: (sc,i);

Definition: sum( j, q2(sc,i,j) * x(i,j) ) <= p2(sc,i);

}

So the parameters p and q get an extra index in their stochastic variant (p2 and q2). You then have to generate the data for p2 and q2, e.g., using distribution functions.

Note: it could be that you only need scenarios for q. In that case you only have to use q2 and do not need p2.

Hi

`Constraint c1 {`

IndexDomain: i;

Definition: sum( j, q(i,j) * x(i,j) ) <= p(i);

}

Here p and q are parameters, and x is a variable. You then have to change this constraint into

`Constraint c1 {`

IndexDomain: (sc,i);

Definition: sum( j, q2(sc,i,j) * x(i,j) ) <= p2(sc,i);

}

So the parameters p and q get an extra index in their stochastic variant (p2 and q2). You then have to generate the data for p2 and q2, e.g., using distribution functions.

Note: it could be that you only need scenarios for q. In that case you only have to use q2 and do not need p2.

Thank you

### Reply

## Sign up

Already have an account? Login

**Please use your business or academic e-mail address to register**

## Login to the community

No account yet? Create an account

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.