A CCP model will have one or more sets of chance constraints.  Each set is assigned a) a name, b) a direction and c) a probability.  You make these declarations using the @SPCHANCE function using the syntax:

@SPCHANCE( 'Set_Name', '>='|'<=', Probability)

The set name must be unique, enclosed in quotes, and must follow normal LINGO naming conventions.  The direction must be either '>=' or '<=', while the probability is a real number in the range of [0,1].  The direction argument indicates whether the probability that the set is satisfied is either greater-than-or-equal-to or less-than-or-equal-to the specified probability.  An example follows:

Example 1:        @SPCHANCE( 'CCP_DEMAND', '>=', .95);

Here we declare a CCP constraint set with name CCP_DEMAND, a direction of greater-than-or-equal-to, and a set probability of .95.  This says that the constraints assigned to this set must all be satisfied in at least 95% of the scenarios.  If just one constraint is unsatisfied in a particular scenario, then the whole set is considered unsatisfied for that scenario.

Once you've declared a CCP set, there is still an additional step of assigning actual constraints to the set.  This is again done with the @SPCHANCE function, however, the syntax is slightly different:

@SPCHANCE( 'Set_Name',  Constraint_Ref)

The same set name is used as was used in the set declaration, however, you now must enter a constraint reference, consisting of the name of a constraint in the core model.  Here's an example:

Example 2:        @FOR( CUST( I): @SPCHANCE( 'CCP_DEMAND', R_DEMAND( I)));

Here we use an @FOR loop to assign multiple constraints with name R_DEMAND to the CCP constraint set CCP_DEMAND.

When assigning constraints to a CCP constraint set there are a few rules to remember:

A constraint may be assigned to no more than one CCP set.
Each constraint belonging to a CCP set must reference at least one random variable.
The objective function may not be assigned to a CCP set.

In the next section, we will walk through building a complete CCP model for fuel blending.