subject to:
using System; using Imsl.Math; public class DenseLPEx2 { public static void Main(String[] args) { int[] constraintType = new int[]{3}; double[] upperBound = new double[]{1.0, 1.0}; double[,] a = {{1.0, 1.0}}; double[] b = new double[]{0.5}; double[] upperLimit = new double[]{1.5}; double[] c = new double[]{- 1.0, - 3.0}; DenseLP zf = new DenseLP(a, b, c); zf.SetUpperLimit(upperLimit); zf.SetConstraintType(constraintType); zf.SetUpperBound(upperBound); zf.Solve(); new PrintMatrix("Solution").Print(zf.GetSolution()); new PrintMatrix("Dual Solution").Print(zf.GetDualSolution()); Console.Out.WriteLine("Optimal Value = " + zf.ObjectiveValue); } }
Solution 0 0 0.5 1 1 Dual Solution 0 0 -1 Optimal Value = -3.5Link to C# source.