/******************************************************** Xpress-BCL Java Example Problems ================================ file folioqc.java ````````````````` Modeling a small QCQP problem to perform portfolio optimization. -- Maximize return with limit on variance --- (c) 2008 Fair Isaac Corporation author: S.Heipcke, July 2008, rev. Dec. 2011 ********************************************************/ import com.dashoptimization.*; import java.io.*; import java.lang.*; public class folioqc { static final String DATAFILE = System.getProperty("XPRBDATA") + "/GS/foliocppqp.dat"; static final double MAXVAR = 0,55; /* Max. allowed variance */ static final int NSHARES = 10; /* Number of shares */ static final int NNA = 4; /* Number of North-American shares */ static final double[] RET = {5,17,26,12,8,9,7,6,31,21}; /* Estimated return in investment */ static final int[] NA = {0,1,2,3}; /* Shares issued in N.-America */ static double[][] VAR; /* Variance/covariance matrix of estimated returns */ static XPRB bcl; static XPRBprob p; private static void readData() throws IOException { int s,t; FileReader datafile=null; StreamTokenizer st=null; VAR = new double[NSHARES][NSHARES]; /* Read `VAR' data from file */ datafile=new FileReader(DATAFILE); /* Open the data file */ st=new StreamTokenizer(datafile); /* Initialize the stream tokenizer */ st.commentChar('!'); /* Use the character '!' for comments */ st.eolIsSignificant(true); /* Return end-of-line character */ st.parseNumbers(); /* Read numbers as numbers (not strings) */ for(s=0;s