|
Nonlinear MIPs |
Top Previous Next |
|
Modelers may wish to impose integer restrictions on nonlinear formulations. Today GAMS contains the DICOPT and CBC solvers that permit this. They tie together other solvers. For example both can use CONOPT to solve the nonlinear sub-problems. DICOPT also uses MIP solvers on the integer part of the problem while CBC contains an internal integer solution algorithm. For example suppose we impose restrictions in a portfolio problem that a minimum of 10 shares be bought if any and that we buy integer numbers of shares (intev.gms)
Integer VARIABLES INVEST(STOCKS) MONEY INVESTED IN EACH STOCK binary variables mininv(stocks) at least 10 shares bought VARIABLE OBJ NUMBER TO BE MAXIMIZED ; EQUATIONS OBJJ OBJECTIVE FUNCTION INVESTAV INVESTMENT FUNDS AVAILABLE minstock(stocks) at least 10 units to be bought maxstock(stocks) Set up indicator variable ; OBJJ.. OBJ =E= SUM(STOCKS, MEAN(STOCKS) * INVEST(STOCKS)) - RAP*(SUM(STOCK, SUM(STOCKS, INVEST(STOCK)* COVAR(STOCK,STOCKS) * INVEST(STOCKS)))); INVESTAV.. SUM(STOCKS, PRICES(STOCKS) * INVEST(STOCKS)) =L= FUNDS; minstock(stocks).. invest(stocks) =g= 10*mininv(stocks); maxstock(stocks).. invest(stocks)=l=1000*mininv(stocks); MODEL EVPORTFOL /ALL/ ; SOLVE EVPORTFOL USING MINLP MAXIMIZING OBJ ;
When using DICOPT and CBC it is very important to have the constraints represent to the full extent possible the link between continuous and integer variables. |