Ordered alternatives
Suppose you have N possible investments of which at most one can be selected. The capital cost is CAPi and the expected return is RETi.
- Often use binary variables to choose between alternatives. However, SOS1 are more efficient to choose between a set of graded (ordered) alternatives.
- Define a variable di to represent the decision, di = 1 if investment i is picked
- Binary variable (standard) formulation
di : binary variablesMaximize: ret = ∑i RETidi ∑i di ≤ 1 ∑i CAPidi ≤ MAXCAP - SOS1 formulation
{di; ordering value CAPi} : SOS1Maximize: ret = ∑i RETidi ∑i di ≤ 1 ∑i CAPidi ≤ MAXCAP - Special ordered sets in Mosel
- special ordered sets are a special type of linear constraint
- the set includes all variables in the constraint
- the coefficient of a variable is used as the ordering value (i.e., each value must be unique)
declarations I=1..4 d: array(I) of mpvar CAP: array(I) of real My_Set, Ref_row: linctr end-declarations My_Set:= sum(i in I) CAP(i)*d(i) is_sos1
or alternatively (must be used if a coefficient is 0):Ref_row:= sum(i in I) CAP(i)*d(i) makesos1(My_Set, union(i in I) {d(i)}, Ref_row)
- Special ordered sets in BCL
- a special ordered set is an object of type XPRBsos
- the set includes all variables from the specified linear expression or constraint that have a coefficient different from 0
- the coefficient of a variable is used as the ordering value (i.e., each value must be unique)
XPRBprob prob("testsos"); XPRBvar d[I]; XPRBexpr le; XPRBsos My_Set; double CAP[I]; int i; for(i=0; i<I; i++) d[i] = prob.newVar("d"); for(i=0; i<I; i++) le += CAP[i]*d[i]; My_Set = prob.newSos("My_Set", XPRB_S1, le);
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.