Lilian

10 Reputation

One Badge

4 years, 190 days

MaplePrimes Activity


These are questions asked by Lilian

Hi everyone,

I have a strange problem with the LSSolve function. I get an error when specifying an optimality tolerance as an option for LSSolve function : "unexpected parameters: optimalitytolerance = 1/1000" (see attached). When I remove the option, the LSSolve function works and returns something. Why ?

This is a problem for me because in my program I automatically generate lots of equations and I need to solve them using the same parameters.  "list1" is an example of a list that makes LSSolve to return an error and therefore it makes my program stop.
Is it possible, when LSSolve returns an Error, to re-run the function without the optimalitytolerance option ?
 

with(Optimization):

[0.127345646906885e-1-0.186555124779203e-2*D32-0.282637107183903e-3*D33, -0.427981372479296e-2+0.184372031092059e-1*D32+0.366060535331614e-2*D33, -0.279056870350439e-1+0.497068050546578e-1*D32+0.300683751452398e-1*D33, -0.159123153512316e-1-0.200310190531632e-2*D32+0.110642730744851e-1*D33, -0.358677392345135e-2-0.477282036776905e-2*D32+0.279495051520868e-2*D33, -.158025406913808+.301050727553470*D32+0.991309483578555e-1*D33, -0.767170565747362e-1+0.287589092672543e-1*D32+0.380554240544922e-1*D33, 0.134025593814442e-1-0.163134747085529e-1*D32-0.978424817965354e-2*D33, 0.177936771272063e-1-0.193555892719151e-1*D32-0.117324484775754e-1*D33, .136323651819599-.101383912457110*D32-0.800923073293239e-1*D33, 0.658540765374620e-1-.134530865070270*D32-0.449966493124888e-1*D33, 0.366589441985546e-1-0.923517762126252e-1*D32-0.313964041159186e-1*D33, 0.200320004853408e-2-0.454710553314498e-2*D32-0.121523285055995e-2*D33, 0.362766049610844e-2-0.103494064252009e-1*D32-0.347855768021822e-2*D33, 0.431461474510905e-2-0.122762710681104e-1*D32+0.305664301894285e-3*D33]

(1)

LSSolve(list1, [0 <= D32, 0 <= D33], optimalitytolerance = 10^(-3))

Error, (in Optimization:-LSSolve) unexpected parameters: optimalitytolerance = 1/1000

 

``

``

 

 

worksheet_help.mw



Thanks in advance,
Lilian

Hi everyone,

I am desperatly trying to find a reason to those weird results I get using LSSolve. It could really help me to understand, maybe I am using the function the wrong way.
I have a system of equations which is overdetermined that I wrote using an electrical simulation and kirchoff's laws.
I am trying to resolve it using the LSSolve function. Here is the list of residuals :

list := [-0.444299277411586e-2+(270.100000000000-Phi12_18)*D18, -.264819908561346+(627.030000000000-Phi23_18)*D18, .191242220011840+(-259.080000000000-Phi34_18)*D18, 0.269723795794403e-1+(-40.5060000000000-Phi45_18)*D18, 0.674200455699644e-2+(-10.1270000000000-Phi56_18)*D18, .109534122562258+(-197.290000000000-Phi67_18)*D18, 0.481462872723211e-3+(-2.41420000000000-Phi78_18)*D18, -0.346014532189641e-4+(-2.53290000000000-Phi89_18)*D18, -0.402474969346295e-4+(-2.94150000000000-Phi910_18)*D18, -0.632005430249463e-3+(-8.57100000000000-Phi1011_18)*D18, -0.105749265697549e-1+(-37.6580000000000-Phi1112_18)*D18, -0.116305497595306e-1+(-55.3250000000000-Phi1213_18)*D18, -0.581547498854927e-3+(-2.76630000000000-Phi1314_18)*D18, -0.371408130367776e-2+(-22.0900000000000-Phi1415_18)*D18, -0.886173700610320e-2+(-56.4810000000000-Phi1516_18)*D18, -0.478846208996643e-1+(262.447651185421-Phi12_18)*D29+(262.447651185421-Phi12_24)*D36, .348429199898355+(62.3165310883292-Phi23_18)*D29+(62.3165310883292-Phi23_24)*D36, .237294781239637+(41.8563477700905-Phi34_18)*D29+(41.8563477700905-Phi34_24)*D36, 0.356987380524040e-1+(6.12136413036823-Phi45_18)*D29+(6.12136413036823-Phi45_24)*D36, 0.892515544035472e-2+(1.53042068810978-Phi56_18)*D29+(1.53042068810978-Phi56_24)*D36, .163733792213247+(26.7554245920538-Phi67_18)*D29+(26.7554245920538-Phi67_24)*D36, 0.917897899527287e-3+(-0.110562085900856e-3-Phi78_18)*D29+(-0.110562085900856e-3-Phi78_24)*D36, 0.242480164562623e-4+(-.283316330467957-Phi89_18)*D29+(-.283316330467957-Phi89_24)*D36, 0.281967728090880e-4+(-.329007391842407-Phi910_18)*D29+(-.329007391842407-Phi910_24)*D36, -0.812318100863302e-3+(-1.22850243118112-Phi1011_18)*D29+(-1.22850243118112-Phi1011_24)*D36, -0.174002698946928e-1+(-9.57006175329410-Phi1112_18)*D29+(-9.57006175329410-Phi1112_24)*D36, -.125540933056649+(-44.2197489328973-Phi1213_18)*D29+(-44.2197489328973-Phi1213_24)*D36, -0.627722694977691e-2+(-2.21106159188713-Phi1314_18)*D29+(-2.21106159188713-Phi1314_24)*D36, -0.739424545575381e-1+(-24.8403831529913-Phi1415_18)*D29+(-24.8403831529913-Phi1415_24)*D36, -.203976357415920+(-68.0132712014090-Phi1516_18)*D29+(-68.0132712014090-Phi1516_24)*D36, 0.196522429267177e-1+(197.940000000000-Phi12_24)*D27, 0.368371276889244e-2+(57.8900000000000-Phi23_24)*D27, 0.144256702539785e-2+(48.4450000000000-Phi34_24)*D27, -0.115630146715321e-3+(10.-Phi45_24)*D27, -0.283028527731083e-4+(2.50010000000000-Phi56_24)*D27, -0.300476205822746e-2+(66.2640000000000-Phi67_24)*D27, -0.653509876948917e-3+(2.69040000000000-Phi78_24)*D27, -0.126753046978926e-2+(4.44790000000000-Phi89_24)*D27, -0.147212636486122e-2+(5.16530000000000-Phi910_24)*D27, -0.484316181019253e-2+(16.6000000000000-Phi1011_24)*D27, -0.298854531528585e-1+(96.8770000000000-Phi1112_24)*D27, -.120604432493978+(315.410000000000-Phi1213_24)*D27, -0.603334119632106e-2+(15.7700000000000-Phi1314_24)*D27, -0.664471982996522e-1+(167.170000000000-Phi1415_24)*D27, 0.786913003105101e-1+(-326.760000000000-Phi1516_24)*D27]


I know that all D values must be positive. When resolving the system without any constraints (D >= 0), i get the values I expected (knowing the input I used in the simulation), with a really low error :

result := LSSolve(list);

[1.82130325886306*10^(-8), [D10 = 0.200009334740825e-2, D11 = 0.666620509302803e-3, D14 = 0.222215208246154e-2, D15 = 0.128202791383597e-2, D17 = 0.499886140344411e-2, D19 = 0.302925526676043e-3, D2 = 0.100002349341980e-2, D20 = 0.142849446596938e-3, D22 = 0.111121127122156e-1, D23 = 0.222228054119820e-2, D25 = 0.714293621502836e-3, D26 = 0.833326349912537e-3, D28 = 0.217396531719902e-3, D3 = 0.400217567900069e-3, D6 = 0.166878862202449e-3, D7 = 0.999969828547956e-2, Phi1011_17 = -1.22850243118112, Phi1011_19 = -20.5335193736012, Phi1011_21 = -104.090964313150, Phi1011_23 = 19.2144499395683, Phi1112_17 = -9.57006175329410, Phi1112_19 = -81.6848630234903, Phi1112_21 = -242.149849175388, Phi1112_23 = 109.001351349915, Phi1213_17 = -44.2197489328973, Phi1213_19 = -92.8267195929548, Phi1213_21 = -204.444165890808, Phi1213_23 = -61.4447612788985, Phi12_17 = 262.447651185421, Phi12_19 = 262.149192406679, Phi12_21 = 256.248405276737, Phi12_23 = 246.521172863223, Phi1314_17 = -2.21106159188713, Phi1314_19 = -4.64255435896474, Phi1314_21 = -10.2212158757032, Phi1314_23 = -3.07798400495386, Phi1415_17 = -24.8403831529913, Phi1415_19 = -30.5944507718603, Phi1415_21 = -45.5847025259923, Phi1415_23 = -77.3297680041818, Phi1516_17 = -68.0132712014090, Phi1516_19 = -74.2023324471993, Phi1516_21 = -95.1952296374558, Phi1516_23 = -132.328467080565, Phi23_17 = 62.3165310883292, Phi23_19 = 200.804225452845, Phi23_21 = 130.018791598707, Phi23_23 = 73.7043262431720, Phi34_17 = 41.8563477700905, Phi34_19 = 343.409987932231, Phi34_21 = 159.593996060841, Phi34_23 = 62.6564757702407, Phi45_17 = 6.12136413036823, Phi45_19 = 12.3839171939746, Phi45_21 = 46.0005281797016, Phi45_23 = 13.1665796516893, Phi56_17 = 1.53042068810978, Phi56_19 = 3.16614687399595, Phi56_21 = 11.4998114891963, Phi56_23 = 3.29093394692614, Phi67_17 = 26.7554245920538, Phi67_19 = -244.288977944524, Phi67_21 = 376.351493538080, Phi67_23 = 88.4830465193635, Phi78_17 = -0.110562085900856e-3, Phi78_19 = -6.28061380389266, Phi78_21 = 43.7035845962372, Phi78_23 = 3.35123473697264, Phi89_17 = -.283316330467957, Phi89_19 = -6.18811507913178, Phi89_21 = -13.9258224376815, Phi89_23 = 5.20325572546379, Phi910_17 = -.329007391842407, Phi910_19 = -7.18580970783931, Phi910_21 = -16.1669897128450, Phi910_23 = 6.04291224185087]]


When adding the constraints that D should be positive (and that are actually positive in the previous result), I get a worse result in term of precisions :

LSSolve(list, {D10 >= 0, D11 >= 0, D14 >= 0, D15 >= 0, D17 >= 0, D19 >= 0, D2 >= 0, D20 >= 0, D22 >= 0, D23 >= 0, D25 >= 0, D26 >= 0, D28 >= 0, D3 >= 0, D6 >= 0, D7 >= 0});

[0.667302976414869964e-1, [D10 = 0.240199442379079e-2, D11 = 0.666577572133538e-3, D14 = 0.222218786790062e-2, D15 = 0.128192441757651e-2, D17 = 0.278678889056743e-2, D19 = 0.200473317719685e-3, D2 = 0.109938538155804e-2, D20 = 0.840721762649974e-4, D22 = 0.685770482726534e-3, D23 = -1.387530857*10^(-312), D25 = 0.714397733627028e-3, D26 = 0.833201232339238e-3, D28 = 0.204319731851617e-3, D3 = 0.419994015872111e-3, D6 = 0.191996909862889e-3, D7 = 0.103884505319047e-1, Phi1011_17 = -.709707335593168, Phi1011_19 = -15.7863975896827, Phi1011_21 = -151.171843708558, Phi1011_23 = 19.2211409030343, Phi1112_17 = -8.90604676283968, Phi1112_19 = -75.8627539382983, Phi1112_21 = -311.423930967299, Phi1112_23 = 109.002880650927, Phi1213_17 = -54.9212365194647, Phi1213_19 = -89.9790565093006, Phi1213_21 = -250.971671756001, Phi1213_23 = -61.5160003335629, Phi12_17 = 251.480872515883, Phi12_19 = 255.977573006508, Phi12_21 = 254.397100891354, Phi12_23 = 246.524672366158, Phi1314_17 = -2.74614386328796, Phi1314_19 = -4.48401822538664, Phi1314_21 = -12.5381572344771, Phi1314_23 = -3.08154491280567, Phi1415_17 = -31.8947514252141, Phi1415_19 = -30.8090400512349, Phi1415_21 = -51.0499196769535, Phi1415_23 = -77.3268969229600, Phi1516_17 = -87.7947790488482, Phi1516_19 = -75.5403005246575, Phi1516_21 = -101.763771364478, Phi1516_23 = -132.314524393221, Phi23_17 = 94.0093590848714, Phi23_19 = 86.4429757025976, Phi23_21 = 108.554765004168, Phi23_23 = 73.7072279431268, Phi34_17 = 87.6938924370977, Phi34_19 = 82.3922347753764, Phi34_21 = 88.5582078636840, Phi34_23 = 62.6604078051191, Phi45_17 = 13.1910198060107, Phi45_19 = 69.3008595136787, Phi45_21 = 15.5530983566712, Phi45_23 = 13.1677681559684, Phi56_17 = 3.29792072169498, Phi56_19 = 17.4003349272078, Phi56_21 = 3.88187632917493, Phi56_23 = 3.29123115133383, Phi67_17 = 60.0045707036166, Phi67_19 = 54.3070868626015, Phi67_21 = 87.9421288802858, Phi67_23 = 88.4929920125095, Phi78_17 = .279952186311827, Phi78_19 = -3.50632712699693, Phi78_21 = -20.3872167203319, Phi78_23 = 3.35213748642018, Phi89_17 = -0.991299169828910e-1, Phi89_19 = -4.44636683843093, Phi89_21 = 297.888811926331, Phi89_23 = 5.20500671661437, Phi910_17 = -.115101700555720, Phi910_19 = -5.16603761776826, Phi910_21 = 346.033351291632, Phi910_23 = 6.04494564310825]]

I also get the warning "limiting number of major iterations has been reached".
Can someone explain me?

It may not seem important at first sight, but sometimes when using my program I get wrong values and a negative D, which is not possible. Therefore I try to add a positive constraint, but the LLSolve function doesn't return anything except the error "no improved point could be found", which is weird because when I manually substitute the value I consider correct, i get a really low error. I can show you the related list of equations if you are interested...

 

Thanks in advance,

Lilian

Page 1 of 1