# Retrieving Solutions for Multiple Scenarios

Filter Content By
Version
Languages

## Retrieving Solutions for Multiple Scenarios

Your first step in retrieving the solutions computed by an optimize call on a multi-scenario model is to query the Status attribute. A status of OPTIMAL indicates that optimal solutions were found (subject to tolerances) for all scenarios that have feasible solutions, and that the other scenarios were determined to be infeasible. If all scenarios were found to be infeasible, the status will be INFEASIBLE. If any scenario is unbounded, the status will be UNBOUNDED. An early termination status code (e.g., TIME_LIMIT) indicates that the outcomes may vary across the different scenarios, and you will have to look at individual scenarios for more information.

Results for individual scenarios can be found in three attributes:

• ScenNObjVal: The objective value for the solution for scenario number .
• ScenNObjBound: The best known bound on the optimal objective value for scenario number .
• ScenNX: The solution vector for scenario number .
The ScenNObjVal and ScenNObjBound attributes are model attributes, while ScenNX is a variable attribute. Again, use the ScenarioNumber parameter to select the scenario you'd like to query.

If your optimize call terminated early, you should use the ScenNObjBound attribute to interpret the results. This attribute provides a bound on the optimal objective value for the selected scenario (much like ObjBound provides a bound for a single model). For example, if ScenNObjVal is 100 for a scenario and ScenNObjBound is 90 (assuming minimization), then you have a solution with a 10% optimality gap for that scenario.

You can also query the ObjVal and ObjBound attributes for a multi-scenario model. The former gives the best objective value for any solution found in any scenario. The latter provides a lower bound on the objective value for any solution that was not found.

Note that ScenNObjVal and ScenNObjBound are computed using the objective function for the corresponding scenario, which you may have changed from the base model.

If you query the ScenNX attribute and no feasible solution has been found for that scenario, you will get a DATA_NOT_AVAILABLE error.