Semicontinuous Variables

Many models require certain variables to either be 0 or lie within some nonnegative range, e.g., 10 to 20.  Variables with this property are said to be semicontinuous. Modeling semicontinuity in LINGO in the past meant having to add an additional 0/1 variable and two additional constraints.  LINGO now allows you to establish semicontinuous variables directly with the @SEMIC statement.

The syntax for the @SEMIC declarations is as follows:

@SEMIC( lower_bound, variable_reference, upper_bound);

This will restrict the variable, variable_reference, to be either 0 or to lie within the range [lower_bound, upper_bound].

Note:Each semi-continuous variable will be counted against any integer variable limit for your installation.

Some examples of @SEMIC usage are:

Example 1:        @SEMIC( 10, X, 20);

In this example, X will be restricted to being either 0, or to lie within the range [10,20].

Example 2:        @FOR( PLANT( I): @SEMIC( MIN_HOURS, HOURS( I), MAX_HOURS));

Here, we restrict the operating hours of each plant to be either 0, or to line in the range [MIN_HOURS,MAX_HOURS].  Note that MIN_HOURS and MAX_HOURS must have been set to explicit values beforehand in either a data or calc section.

Below, we have taken our familiar transportation model and modified it, via the use of @SEMIC, to restrict shipments from each warehouse to each customer to be either 0, or between 3 and 10.

MODEL:

! A 3 Warehouse, 4 Customer Transportation Problem

 that uses the semi-continuous (@SEMIC) to restrict

 nonzero shipments to be between 3 and 10 units.;

 

SETS:

  WAREHOUSE: CAPACITY;

  CUSTOMER: DEMAND;

  ROUTES( WAREHOUSE, CUSTOMER) : COST, VOLUME;

ENDSETS

 

DATA:

  WAREHOUSE,CAPACITY =  WH1,30 WH2,25 WH3,21;

  CUSTOMER,DEMAND =   C1,15 C2,17 C3,22 C4,12;

  COST =  6  2  6  7

          4  9  5  3

          8  8  1  5;

ENDDATA

 

! The objective;

[R_OBJ] MIN = @SUM( ROUTES: COST * VOLUME);

 

! The demand constraints;

@FOR( CUSTOMER( J): [R_DEM]

 @SUM( WAREHOUSE( I): VOLUME( I, J)) >=

  DEMAND( J));

 

! The supply constraints;

@FOR( WAREHOUSE( I): [R_SUP]

 @SUM( CUSTOMER( J): VOLUME( I, J)) <=

  CAPACITY( I));

 

@FOR( ROUTES: @SEMIC( 3, VOLUME, 10));

 

END

Model: TRANSEMIC

Solving this model yields the following optimal values for the semicontinuous attribute, VOLUME:

Global optimal solution found.

Objective value:                              264.0000

Objective bound:                              264.0000

Infeasibilities:                              0.000000

Extended solver steps:                               0

Total solver iterations:                            47

Elapsed runtime seconds:                          0.05

 

         Variable           Value        Reduced Cost

 VOLUME( WH1, C1)        5.000000            0.000000

 VOLUME( WH1, C2)        10.00000           -6.000000

 VOLUME( WH1, C3)        6.000000            0.000000

 VOLUME( WH1, C4)        0.000000            2.000000

 VOLUME( WH2, C1)        10.00000           -1.000000

 VOLUME( WH2, C2)        0.000000            2.000000

 VOLUME( WH2, C3)        6.000000            0.000000

 VOLUME( WH2, C4)        9.000000           -1.000000

 VOLUME( WH3, C1)        0.000000            2.000000

 VOLUME( WH3, C2)        7.000000            0.000000

 VOLUME( WH3, C3)        10.00000           -5.000000

 VOLUME( WH3, C4)        3.000000            0.000000