Abs in SetCoefficient of InteriorPointSolver

Unanswered Abs in SetCoefficient of InteriorPointSolver

  • Tuesday, March 05, 2013 7:31 PM
     
     

    The QuadraticPortfolio example included with Solver Foundation download imposes a constraint, "unity", to ensure that the sum of investments totals 1.00.  i.e. net exposure of the portfolio is one.  I would like to add an additional constraint, "grossExposure", to ensure that the sum of absolute value of investments totals 1.00.  The example contains the following code:

            int unity;
            solver.AddRow("Investments sum to one", out unity);
            solver.SetBounds(unity, 1, 1);

            for (int invest = m; 0 <= --invest; ) {
              solver.SetCoefficient(expectedReturn, allocations[invest], _means[invest]);
              solver.SetCoefficient(unity, allocations[invest], 1);
            }

    I specify my new constraint as follows:

            int grossExposure;
            solver.AddRow("Abs(Investments) sum to one", out grossExposure);
            solver.SetBounds(grossExposure, 1, 1);

    What is the proper syntax for solver.SetCoefficient(grossExposure, ???)?