Re: [ojAlgo-user] Auto-discard notification
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2008-11-19 15:15:49
|
What solution do you get from Matlab in this case? /Anders On 19 nov 2008, at 13.04, oja...@li... wrote: > The attached message has been automatically discarded. > Date: onsdag 19 nov 2008 13.03.33 GMT+01:00 > To: "'oja...@li...'" <ojalgo- > us...@li...> > Subject: RE: [ojAlgo-user] ojAlgo v25 > > > > Hi, I've tested the v25 ActiveSetSolver. > > I triggered an ArrayIndexOutOfBoundsException that I did not > encounter in v24.11: > > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 > at > org.ojalgo.optimisation.quadratic.ActiveSetSolver.needsAnotherIteratio > n(ActiveSetSolver.java:230) > at org.ojalgo.optimisation.quadratic.QuadraticSolver.solve > (QuadraticSolver..java:144) > > Here is an example that will reproduce the exception: > > > import org.ojalgo.matrix.BasicMatrix; > import org.ojalgo.matrix.PrimitiveMatrix; > import org.ojalgo.optimisation.OptimisationSolver.Result; > import org.ojalgo.optimisation.quadratic.ActiveSetSolver; > > public class QPTest { > > public static void main(String[] args) { > new QPTest(); > } > > public QPTest() { > > BasicMatrix[] system = new BasicMatrix[6]; > //{[AE], [be], [Q], [c], [AI], [bi]} > > double[][] AE = new double[][]{{-10.630019918689772, > 0.15715259580856766, -24.006889886456438, -3.4914813388431334E-15, > 0.9987922086746552, 0.9018272287390979, 1.0, 0.0, 0.0}, > {-3.711451617763614E-14, -3.1946032406211518, 50.10466796063192, > 1.0, 0.04913373475326318, 0.4320968057099691, 0.0, 1.0, 0.0}, > {-1.1134354853290842E-12, 94.42372385635744, -1719.2020477970657, > 30.0, -10.463141920669791, -4.8464591126471905, 0.0, 0.0, 1.0}}; > > system[0] = PrimitiveMatrix.FACTORY.copy(AE); // AE > system[1] = PrimitiveMatrix.FACTORY.copy(new double[][] > {{14.272908058664967}, {-3.888270819999793}, > {-0.06992907379067503}}); // be > system[2] = PrimitiveMatrix.FACTORY.buildEye(9, 9); // Q > system[2] = system[2].set(3, 3, 10); > system[2] = system[2].set(4, 4, 10); > system[2] = system[2].set(5, 5, 10); > system[2] = system[2].set(6, 6, 1000000000); > system[2] = system[2].set(7, 7, 1000000000); > system[2] = system[2].set(8, 8, 1000000000); > system[3] = PrimitiveMatrix.FACTORY.copy(new double[][]{{0}, {0}, > {0}, {1}, {1}, {-1}, {0}, {0}, {0}}); // c > > double[][] Ain = new double[18][9]; > > for(int i = 0; i < 9; i++) { > Ain[i][i] = 1; > Ain[i+9][i] = -1; > } > > system[4] = PrimitiveMatrix.FACTORY.copy(Ain); // AI > > double[][] bin = new double[][]{{0}, {0.0175}, {0.0175}, {5}, > {5}, {5}, {100000}, {100000}, {100000}, {0}, {0.0175}, {0.0175}, > {5}, {5}, {5}, {100000}, {100000}, {100000}}; > > system[5] = PrimitiveMatrix.FACTORY.copy(bin); // bi > > > ActiveSetSolver as = new ActiveSetSolver(system); > Result res = as.solve(); > System.out.println("state: " + res.getState()); > print("sol", res.getSolution()); > > } > } > > - Oddvar |