[R] Non-negative solution to an underdetermined linear system

Berend Hasselman bhh at xs4all.nl
Tue Mar 4 20:25:28 CET 2014


On 04-03-2014, at 12:38, klqmba at mail.bg wrote:

> I don't have any cost function to minimize. My task is to create the "best" matrix, matching the row sums, the column sums, row sumproducts (with the rows from another constant matrix) and also column sumproducts - it's a transportation problem of finding OD matrix corresponding the total tonnage and tonne-kilometres. Maybe the more suitable function would be "lsei", but it retuns also negative values for some X-es. Do you have an idea where in the code to put some verification for non-negative results?
> 

From the manual entry of lsei it seems that you should specify matrix G and vector h (inputs of lsei).

Berend


PS: Please do not post in HTML (see the posting guide).

> Thanks in advance.
> 
> Best Regards.
> 
> 
> ----- Цитат от Berend Hasselman (bhh at xs4all.nl), на 27.02.2014 в 21:09 -----
> 
>> 
>> On 27-02-2014, at 13:22, klqmba at mail.bg wrote:
>> 
>>> 
>>> 
>>> 
>>> Dear R users,
>>> 
>>> 
>>> I have to find optimal solution of an underdetermined linear system, but
>>> only with positive variables. I tried the function from this post
>>> https://stat.ethz.ch/pipermail/r-help/2007-October/143408.html , but it's
>>> solution includes also negative values. 
>>> 
>>> 
>> 
>> Have a look at package limSolve. Maybe (and only maybe) function linp can be of use.
>> 
>> Berend
>> 
>>> Thanks in advance.
>>> 
>>> 
>>> Best Regards.
>>> 
>>> -------------------------------------
>>> 
>>> Майски празници на остров Лефкада, Гърция от 158 евро
>>> Безкрайните романтични пясъци съчетани с узо...
>>> Дати: 30/04/14 - 05/04/14
>>> http://www.arrivalsidi.com/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8-%D0%B2-%D0%BB%D0%B5%D1%84%D0%BA%D0%B0%D0%B4%D0%B0
>>> [[alternative HTML version deleted]]
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
> 
> 
> 
> -------------------------------------
> Mail.BG: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 20 GB пощенска кутия, 1 GB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.




More information about the R-help mailing list