[jira] [Created] (FILEUPLOAD-301) Problems uploading files greater than 100kb using HTTPS

2019-09-26 Thread Andrea (Jira)
Andrea created FILEUPLOAD-301:
-

 Summary: Problems uploading files greater than 100kb using HTTPS
 Key: FILEUPLOAD-301
 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-301
 Project: Commons FileUpload
  Issue Type: Bug
Affects Versions: 1.2.2, 1.4
 Environment:  

Apache Tomcat 8.5

java 9.0.4

Windows Server 2016 Datacenter
Reporter: Andrea


I'have a java web app that uses Apache Commons FileUpload for uploading files 
using servlets. 

My base code worked perfectly for years on a plain http environment (Apache 
Tomcat 8.5).

I've changed my environment to work with HTTPS, using a Let's Encrypt 
certificate using connector configured with 
org.apache.coyote.http11.Http11AprProtocol.

My uploads now suddenly fail if files are greater than 100kb. Same files 
uploaded successfully using plain HTTP environment. 


This is the exception logged: 
   

{{org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: 
Processing of multipart/form-data request failed. java.io.IOException: The 
socket [925,024,592] associated with this connection has been closed.}}


this is the code fragment i use for manage request:
     

{{DiskFileItemFactory factory = new DiskFileItemFactory();   }}

{{File repository = (File)                    
request.getServletContext().getAttribute("javax.servlet.context.tempdir");   
factory.setRepository(repository);   }}

{{ServletFileUpload upload = new ServletFileUpload(factory);   
upload.setHeaderEncoding(encoding);    }}

{{multipartItems = upload.parseRequest(request);}}

 

Tomcat settings: 

 

{{}}
{{}}

{{        }}

{{        
            }}

{{        }}

{{    }}

{{}}



Thanks 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (FILEUPLOAD-301) Problems uploading files greater than 100kb using HTTPS

2019-09-27 Thread Andrea (Jira)


[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16939437#comment-16939437
 ] 

Andrea commented on FILEUPLOAD-301:
---

Thanks for the reply Michael. 

Maybe I've found the problem, it's this directive: 

{{}}

{{Removing that, it works even in HTTPS. Maybe Http2 escalation need a specific 
configuration for allowing big requests. }}

{{}}

> Problems uploading files greater than 100kb using HTTPS
> ---
>
> Key: FILEUPLOAD-301
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-301
> Project: Commons FileUpload
>  Issue Type: Bug
>Affects Versions: 1.2.2, 1.4
> Environment:  
> Apache Tomcat 8.5
> java 9.0.4
> Windows Server 2016 Datacenter
>Reporter: Andrea
>Priority: Major
>
> I'have a java web app that uses Apache Commons FileUpload for uploading files 
> using servlets. 
> My base code worked perfectly for years on a plain http environment (Apache 
> Tomcat 8.5).
> I've changed my environment to work with HTTPS, using a Let's Encrypt 
> certificate using connector configured with 
> org.apache.coyote.http11.Http11AprProtocol.
> My uploads now suddenly fail if files are greater than 100kb. Same files 
> uploaded successfully using plain HTTP environment. 
> This is the exception logged: 
>    
> {{org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: 
> Processing of multipart/form-data request failed. java.io.IOException: The 
> socket [925,024,592] associated with this connection has been closed.}}
> this is the code fragment i use for manage request:
>      
> {{DiskFileItemFactory factory = new DiskFileItemFactory();   }}
> {{File repository = (File)                    
> request.getServletContext().getAttribute("javax.servlet.context.tempdir");   
> factory.setRepository(repository);   }}
> {{ServletFileUpload upload = new ServletFileUpload(factory);   
> upload.setHeaderEncoding(encoding);    }}
> {{multipartItems = upload.parseRequest(request);}}
>  
> Tomcat settings: 
>  
> {{ redirectPort="443"   />}}
> {{}}
> {{ protocol="org.apache.coyote.http11.Http11AprProtocol"        maxThreads="150" 
> SSLEnabled="true" >        }}
> {{       
>              }}
> {{      certificateFile="D:/prj/certificati/certificate.crt"                
> certificateChainFile="D:/prj/certificati/ca_bundle.crt"                
> type="RSA"  />        }}
> {{    }}
> {{}}
> Thanks 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)
Andrea created DAEMON-365:
-

 Summary: Jsvc "Service killed by signal 11"
 Key: DAEMON-365
 URL: https://issues.apache.org/jira/browse/DAEMON-365
 Project: Commons Daemon
  Issue Type: Bug
 Environment: $ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

$ uname -a
Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
x86_64 x86_64 x86_64 GNU/Linux

$ jsvc --help
[...]
jsvc (Apache Commons Daemon) 1.0.15-dev


Reporter: Andrea


Jsvc is working fine on my machine and on other machines, however on a
particular one, it is not working.

In the logs I get "Service killed by signal 11".

I am using a simple daemon for tests[1]. I compiled it
with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
is installed on Ubuntu 16.04 LTS with apt-get and it is version
1.0.15-dev.

[1] 
http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3

When I run it in the logs I only get "Service killed by signal 11". I am using
/usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
/usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
/tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
-one -two

Starting it with -debug, I get no much more[2].

[2] 
http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2

I cannot stop it with -stop and I have to kill -9 it.

What should I do?
Do you have any idea?

Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea commented on DAEMON-365:
---

I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307.

{quote}
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea edited comment on DAEMON-365 at 6/22/17 1:29 PM:


I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16 = {version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 
0 '\000'}
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}


was (Author: alopumo):
I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307.

{quote}
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea edited comment on DAEMON-365 at 6/22/17 1:30 PM:


I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
16 = {version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 0 
'\000'}
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}


was (Author: alopumo):
I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16 = {version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 
0 '\000'}
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea edited comment on DAEMON-365 at 6/22/17 1:31 PM:


I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16   version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 0 
'\000'
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}


was (Author: alopumo):
I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
16 = {version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 0 
'\000'}
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea edited comment on DAEMON-365 at 6/22/17 2:04 PM:


I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16  =  version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 
0 '\000'
(gdb) print arg.options[0] 
$3 =  optionString = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/",
  extraInfo = 0x0 
(gdb) print arg.options[1]
$4 optionString = 0x613c60 "-Dcommons.daemon.process.id=9448", extraInfo = 0x0
(gdb) print arg.options[2]
$5 optionString = 0x613c90 "-Dcommons.daemon.process.parent=9447", extraInfo = 
0x0
(gdb) print arg.options[3]
$6 optionString = 0x613cc0 "-Dcommons.daemon.version=1.0.15-dev", extraInfo = 
0x0
(gdb) print arg.options[4]
$7 optionString = 0x613cf0 "abort", extraInfo = 0x405730 
(gdb) print arg.nOptions
$11 = 5
{quote}


was (Author: alopumo):
I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16  = { version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized 
= 0 '\000'
(gdb) print arg.options[0] }
$3 = { optionString = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/",
  extraInfo = 0x0 }
(gdb) print arg.options[1]
$4 optionString = 0x613c60 "-Dcommons.daemon.process.id=9448", extraInfo = 0x0
(gdb) print arg.options[2]
$5 optionString = 0x613c90 "-Dcommons.daemon.process.parent=9447", extraInfo = 
0x0
(gdb) print arg.options[3]
$6 optionString = 0x613cc0 "-Dcommons.daemon.version=1.0.15-dev", extraInfo = 
0x0
(gdb) print arg.options[4]
$7 optionString = 0x613cf0 "abort", extraInfo = 0x405730 
(gdb) print arg.nOptions
$11 = 5
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-22 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059314#comment-16059314
 ] 

Andrea edited comment on DAEMON-365 at 6/22/17 2:04 PM:


I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16  = { version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized 
= 0 '\000'
(gdb) print arg.options[0] }
$3 = { optionString = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/",
  extraInfo = 0x0 }
(gdb) print arg.options[1]
$4 optionString = 0x613c60 "-Dcommons.daemon.process.id=9448", extraInfo = 0x0
(gdb) print arg.options[2]
$5 optionString = 0x613c90 "-Dcommons.daemon.process.parent=9447", extraInfo = 
0x0
(gdb) print arg.options[3]
$6 optionString = 0x613cc0 "-Dcommons.daemon.version=1.0.15-dev", extraInfo = 
0x0
(gdb) print arg.options[4]
$7 optionString = 0x613cf0 "abort", extraInfo = 0x405730 
(gdb) print arg.nOptions
$11 = 5
{quote}


was (Author: alopumo):
I debugged with gdb and found that the child process goes in segmentation fault 
in src/native/unix/native/java.c line 307, java_init function.

{quote}
bool java_init(arg_data *args, home_data *data)
{
 ...
 symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
 ...
 ret = (*symb) (&jvm, &env, &arg);   < line 307
{quote}

{quote}
(gdb) print jvm
$14 = (JavaVM *) 0x0
(gdb) print env
$15 = (JNIEnv *) 0x0
(gdb) print arg
$16   version = 65540, nOptions = 5, options = 0x613b80, ignoreUnrecognized = 0 
'\000'
(gdb) print arg.options.extraInfo
$17 = (void *) 0x0
(gdb) print arg.options.optionString
$18 = 0x613be0 
"-Djava.class.path=/usr/share/java/commons-daemon.jar:/home/myuser/commons-daemon-1.0.15-src/src/native/unix/native/"
{quote}

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DAEMON-365) Jsvc "Service killed by signal 11"

2017-06-23 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/DAEMON-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16060531#comment-16060531
 ] 

Andrea commented on DAEMON-365:
---

The  '-Xss1280k' workaround works for me.

> Jsvc "Service killed by signal 11"
> --
>
> Key: DAEMON-365
> URL: https://issues.apache.org/jira/browse/DAEMON-365
> Project: Commons Daemon
>  Issue Type: Bug
> Environment: $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> $ uname -a
> Linux server 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
> $ jsvc --help
> [...]
> jsvc (Apache Commons Daemon) 1.0.15-dev
>Reporter: Andrea
>
> Jsvc is working fine on my machine and on other machines, however on a
> particular one, it is not working.
> In the logs I get "Service killed by signal 11".
> I am using a simple daemon for tests[1]. I compiled it
> with javac -cp /usr/share/java/commons-daemon.jar MyDaemon.java. Jsvc
> is installed on Ubuntu 16.04 LTS with apt-get and it is version
> 1.0.15-dev.
> [1] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/3
> When I run it in the logs I only get "Service killed by signal 11". I am using
> /usr/bin/jsvc -home /usr/lib/jvm/java-8-oracle/ -cp
> /usr/share/java/commons-daemon.jar:$PWD/ -user myuser -pidfile
> /tmp/mydaemon.pid -outfile /tmp/test.out.log -errfile '&1'  MyDaemon
> -one -two
> Starting it with -debug, I get no much more[2].
> [2] 
> http://mail-archives.apache.org/mod_mbox/commons-user/201706.mbox/raw/%3CCABxFBzGfNVFOzySFT1CTTwb56GXr1gLsdmU4vnJYKUUrexBzxQ%40mail.gmail.com%3E/2
> I cannot stop it with -stop and I have to kill -9 it.
> What should I do?
> Do you have any idea?
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] Created: (MATH-286) SimplexSolver not working as expected?

2009-08-20 Thread Andrea (JIRA)
SimplexSolver not working as expected?
--

 Key: MATH-286
 URL: https://issues.apache.org/jira/browse/MATH-286
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 2.0
 Environment: Java 1.6.0_13 on  Windows XP 32-bit
Reporter: Andrea


I guess (but I could be wrong) that SimplexSolver does not always return the 
optimal solution, nor satisfies all the constraints...

Consider this LP:

max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
r1: x0 + x2 + x4 = 23.0;
r2: x1 + x3 + x5 = 23.0;
r3: x0 >= 10.0;
r4: x2 >= 8.0;
r5: x4 >= 5.0;

LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
x5 = 23.0;

The same LP expressed in Apache commons math is:

LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
Collection constraints = new ArrayList();
constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
Relationship.EQ, 23.0));
constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
Relationship.EQ, 23.0));
constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
Relationship.GEQ, 10.0));
constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
Relationship.GEQ, 8.0));
constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
Relationship.GEQ, 5.0));

RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
GoalType.MAXIMIZE, true);

that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, x5 
= 0.0;

Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...

Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MATH-286) SimplexSolver not working as expected?

2009-08-21 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12746223#action_12746223
 ] 

Andrea commented on MATH-286:
-

Hi Ben,
Your test is above is wrong, the GoalType should be MAXIMIZE and not MINIMIZE...
The MINIMIZE returns 4.6 which is the expected value.

> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Issue Comment Edited: (MATH-286) SimplexSolver not working as expected?

2009-08-21 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12746223#action_12746223
 ] 

Andrea edited comment on MATH-286 at 8/21/09 2:06 PM:
--

Hi Ben,
Your test here above is wrong, the GoalType should be MAXIMIZE and not 
MINIMIZE...
The MINIMIZE returns 4.6 which is the expected value.

  was (Author: ciaccia):
Hi Ben,
Your test is above is wrong, the GoalType should be MAXIMIZE and not MINIMIZE...
The MINIMIZE returns 4.6 which is the expected value.
  
> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (MATH-289) SimplexTableau's arrayCopy could be wrong

2009-08-24 Thread Andrea (JIRA)
SimplexTableau's arrayCopy could be wrong
-

 Key: MATH-289
 URL: https://issues.apache.org/jira/browse/MATH-289
 Project: Commons Math
  Issue Type: Improvement
Affects Versions: 2.0
 Environment: Java 1.6.0_13 on Windows XP 32-bit 
Reporter: Andrea
Priority: Minor


The private method copyArray in file SimplexTableau at line 329 takes 3 
parameters src, dest and destPos but the last one is never used/read.

private void copyArray(final double[] src, final double[] dest, final int 
destPos) {
System.arraycopy(src, 0, dest, getNumObjectiveFunctions(), src.length); 
}

The behavior of this method doesn't reflect its JavaDoc description, and 
"misleads" createTableau at line 157 that passes 1 as destPos.

I don't think this leads to a wrong result, but the method 
signature/implementation is misleading for a future reuse.

I suggest either to remove the destPos argument or use it in the method body.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (MATH-290) NullPointerException in SimplexTableau.initialize

2009-08-25 Thread Andrea (JIRA)
NullPointerException in SimplexTableau.initialize
-

 Key: MATH-290
 URL: https://issues.apache.org/jira/browse/MATH-290
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 2.0
 Environment: Java 1.6.0_13 on Windows XP 32-bit 
Reporter: Andrea


SimplexTableau throws a NullPointerException when no solution can be found 
instead of a NoFeasibleSolutionException

Here is the code that causes the NullPointerException:

LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 }, 
0 );
Collection constraints = new ArrayList();
constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, 
-1.0));

RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
GoalType.MINIMIZE, true);

Note: Tested both with Apache Commons Math 2.0 release and SVN trunk

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MATH-290) NullPointerException in SimplexTableau.initialize

2009-08-25 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747797#action_12747797
 ] 

Andrea commented on MATH-290:
-

Hi Ben, what you say in your last comment is not true. There is no feasible 
solution to my problem...
Maybe I should have expressed it in "human" readable format:

min: 1 x + 5 y;
r1: 2 x + 0 y <= -1;
x >= 0;
y >= 0;

x = 0 and y = 0 is not a valid solution since 2 * 0 + 0 * 0 (=0) is not <= -1...

The "trick" is that there will be never non-negative variables (in this case 
[x, y]) that multiplied with non-negative coefficients (here [2, 0]) will 
produce a negative result.

Do you agree?

> NullPointerException in SimplexTableau.initialize
> -
>
> Key: MATH-290
> URL: https://issues.apache.org/jira/browse/MATH-290
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on Windows XP 32-bit 
>Reporter: Andrea
> Attachments: SimplexSolverTest.patch, SimplexTableau.patch
>
>
> SimplexTableau throws a NullPointerException when no solution can be found 
> instead of a NoFeasibleSolutionException
> Here is the code that causes the NullPointerException:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 
> }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, 
> -1.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MINIMIZE, true);
> Note: Tested both with Apache Commons Math 2.0 release and SVN trunk

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MATH-290) NullPointerException in SimplexTableau.initialize

2009-08-26 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747996#action_12747996
 ] 

Andrea commented on MATH-290:
-

Ops... I found the bug with the <= but then I transcribed it wrongly... Sorry.

Another thing I found that is not related to this bug, are the comments in the 
SimplexTableau. JavaDoc for divideRow was copied from substractRow without 
being changed ;-)

> NullPointerException in SimplexTableau.initialize
> -
>
> Key: MATH-290
> URL: https://issues.apache.org/jira/browse/MATH-290
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on Windows XP 32-bit 
>Reporter: Andrea
> Attachments: SimplexSolverTest.patch, SimplexTableau.patch
>
>
> SimplexTableau throws a NullPointerException when no solution can be found 
> instead of a NoFeasibleSolutionException
> Here is the code that causes the NullPointerException:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 
> }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, 
> -1.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MINIMIZE, true);
> Note: Tested both with Apache Commons Math 2.0 release and SVN trunk

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Reopened: (MATH-286) SimplexSolver not working as expected?

2009-08-28 Thread Andrea (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea reopened MATH-286:
-


Hi all,
Maybe I'm doing something wrong extracting the latest version from the SVN 
repository, but the original issue is still not working on my apache commons 
math working copy :-(

Here is what I did:
-I extracted the latest version from the SVN repository
-I executed the original problematic LP for this bug and it still fails. 
Anyway, the simplified version (but maybe incompatible) succeeds...

Could please anyone look at that?
Thanks
Andrea

> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Attachments: SimplexSolverTest.patch, SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MATH-286) SimplexSolver not working as expected?

2009-08-31 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749580#action_12749580
 ] 

Andrea commented on MATH-286:
-

Hi Ben,
Even if I don't completely understand the format of the posted tableau, I guess 
the error is in the last step...

You can solve the above problem on this homepage, where you can see all the 
steps of the simplex method:

http://www.phpsimplex.com/simplex/page2.php?objetivo=max&x1=0.8&x2=0.7&restricciones=3&variables=2&l=en&x11=1&x12=1&desigualdad1=-1&y1=18&x21=1&x22=0&desigualdad2=1&y2=10&x31=0&x32=1&desigualdad3=1&y3=8&Submit=Continue

The tables you posted and the tables on the above homepage look similar till 
the last step (the first of the second phase)... Try look at it, maybe you find 
the problem

> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Attachments: simplex.txt, SimplexSolverTest.patch, 
> SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Issue Comment Edited: (MATH-286) SimplexSolver not working as expected?

2009-08-31 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749580#action_12749580
 ] 

Andrea edited comment on MATH-286 at 8/31/09 2:36 PM:
--

Hi all,
What I wrote before doesn't really make sense... 

Look at this LP simplex solver:

http://www.phpsimplex.com/simplex/page2.php?objetivo=max&x1=0.8&x2=0.7&restricciones=3&variables=2&l=en&x11=1&x12=1&desigualdad1=-1&y1=18&x21=1&x22=0&desigualdad2=1&y2=10&x31=0&x32=1&desigualdad3=1&y3=8&Submit=Continue

why after the first phase is over the coefficients for x1 and x2 are set to 0.8 
and 0.7 while here they are 0? Couldn't be the SimplexTableau's 
discardArtificialVariables doesn't do everything correct?

Just guessing...

  was (Author: ciaccia):
Hi Ben,
Even if I don't completely understand the format of the posted tableau, I guess 
the error is in the last step...

You can solve the above problem on this homepage, where you can see all the 
steps of the simplex method:

http://www.phpsimplex.com/simplex/page2.php?objetivo=max&x1=0.8&x2=0.7&restricciones=3&variables=2&l=en&x11=1&x12=1&desigualdad1=-1&y1=18&x21=1&x22=0&desigualdad2=1&y2=10&x31=0&x32=1&desigualdad3=1&y3=8&Submit=Continue

The tables you posted and the tables on the above homepage look similar till 
the last step (the first of the second phase)... Try look at it, maybe you find 
the problem
  
> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Attachments: simplex.txt, SimplexSolverTest.patch, 
> SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Reopened: (MATH-286) SimplexSolver not working as expected?

2009-09-08 Thread Andrea (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea reopened MATH-286:
-


Hi all,
I'm still not convinced the original problem is correct... Could you please try?

I would add the original LP with 6 variables and 5 restrictions to the test 
cases, since I'm not completely sure the "smaller examples" address exactly the 
same problem I posted weeks ago.

> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Fix For: 2.1
>
> Attachments: simplex.txt, SimplexSolver.patch, 
> SimplexSolverTest.patch, SimplexSolverTest.patch, SimplexTableau.patch, 
> SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (MATH-286) SimplexSolver not working as expected?

2009-09-09 Thread Andrea (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea updated MATH-286:


Attachment: SimplexSolverTest-Andrea.patch

Hi Luc, hi Ben,
This time I can confirm Ben's patch fixes the original problem. :-)

If I find something else related to this bug (or not) I will let you know, but 
I'm pretty sure this time the SimplexSolver is much more robust it was a couple 
of weeks ago!

I "improved" the JUnit test case for this bug, I attach the patch to this 
message. There are 5 new assertions that check all the constraints are really 
satisfied.

Thanks again for all the commitment
Andrea

> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Fix For: 2.1
>
> Attachments: patch.zip, simplex.txt, SimplexSolver.patch, 
> SimplexSolverTest-Andrea.patch, SimplexSolverTest.patch, 
> SimplexSolverTest.patch, SimplexTableau.patch, SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (MATH-293) Matrix's "OutOfBoundException" in SimplexSolver

2009-09-09 Thread Andrea (JIRA)
Matrix's "OutOfBoundException" in SimplexSolver
---

 Key: MATH-293
 URL: https://issues.apache.org/jira/browse/MATH-293
 Project: Commons Math
  Issue Type: Bug
Affects Versions: Nightly Builds
 Environment: java 1.6 on Windows XP 32-Bit
Reporter: Andrea


Hi all,
This bug is somehow related to incident MATH-286, but not necessarily...

Let's say I have an LP and I solve it using SimplexSolver. Then I create a 
second LP similar to the first one, but with "stronger" constraints. The second 
LP has the following properties:
* the only point in the feasible region for the second LP is the solution 
returned for the first LP
* the solution returned for the first LP is also the (only possible) solution 
to the second LP

This shows the problem:

{code:borderStyle=solid}
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
0.2, 0.7, 0.3, 0.4, 0.6}, 0 );
Collection constraints = new ArrayList();
constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
Relationship.EQ, 30.0));
constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
Relationship.EQ, 30.0));
constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 
0.0 }, Relationship.GEQ, 10.0));
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.7, 0.3, 0.0, 
0.0 }, Relationship.GEQ, 10.0));
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 
0.6 }, Relationship.GEQ, 10.0));

RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
GoalType.MAXIMIZE, true);

double valA = 0.8 * solution.getPoint()[0] + 0.2 * solution.getPoint()[1];
double valB = 0.7 * solution.getPoint()[2] + 0.3 * solution.getPoint()[3];
double valC = 0.4 * solution.getPoint()[4] + 0.6 * solution.getPoint()[5];

f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.4, 0.6}, 0 
);
constraints = new ArrayList();
constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
Relationship.EQ, 30.0));
constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
Relationship.EQ, 30.0));
constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 
0.0 }, Relationship.GEQ, valA));
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.7, 0.3, 0.0, 
0.0 }, Relationship.GEQ, valB));
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 
0.6 }, Relationship.GEQ, valC));

solution = new SimplexSolver().optimize(f, constraints, GoalType.MAXIMIZE, 
true);
{code} 

Instead of returning the solution, SimplexSolver throws an Exception:

{noformat} Exception in thread "main" 
org.apache.commons.math.linear.MatrixIndexException: no entry at indices (0, 7) 
in a 6x7 matrix
at 
org.apache.commons.math.linear.Array2DRowRealMatrix.getEntry(Array2DRowRealMatrix.java:356)
at 
org.apache.commons.math.optimization.linear.SimplexTableau.getEntry(SimplexTableau.java:408)
at 
org.apache.commons.math.optimization.linear.SimplexTableau.getBasicRow(SimplexTableau.java:258)
at 
org.apache.commons.math.optimization.linear.SimplexTableau.getSolution(SimplexTableau.java:336)
at 
org.apache.commons.math.optimization.linear.SimplexSolver.doOptimize(SimplexSolver.java:182)
at 
org.apache.commons.math.optimization.linear.AbstractLinearOptimizer.optimize(AbstractLinearOptimizer.java:106){noformat}
 

I was too optimistic with the bug MATH-286 ;-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Issue Comment Edited: (MATH-286) SimplexSolver not working as expected?

2009-09-09 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753053#action_12753053
 ] 

Andrea edited comment on MATH-286 at 9/9/09 7:41 AM:
-

Hi Luc, hi Ben,
This time I can confirm Ben's patch fixes the original problem. :-)

If I find something else related to this bug (or not) I will let you know, but 
I'm pretty sure this time the SimplexSolver is much more robust it was a couple 
of weeks ago!

I "improved" the JUnit test case for this bug, I attach the patch to this 
message. There are 5 new assertions that check all the constraints are really 
satisfied.

Thanks again for all the commitment
Andrea

PS: I don't know if this is somehow related, but I found another bug 
MATH-293... Ben, please look at that as well.

  was (Author: ciaccia):
Hi Luc, hi Ben,
This time I can confirm Ben's patch fixes the original problem. :-)

If I find something else related to this bug (or not) I will let you know, but 
I'm pretty sure this time the SimplexSolver is much more robust it was a couple 
of weeks ago!

I "improved" the JUnit test case for this bug, I attach the patch to this 
message. There are 5 new assertions that check all the constraints are really 
satisfied.

Thanks again for all the commitment
Andrea
  
> SimplexSolver not working as expected?
> --
>
> Key: MATH-286
> URL: https://issues.apache.org/jira/browse/MATH-286
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 2.0
> Environment: Java 1.6.0_13 on  Windows XP 32-bit
>Reporter: Andrea
> Fix For: 2.1
>
> Attachments: patch.zip, simplex.txt, SimplexSolver.patch, 
> SimplexSolverTest-Andrea.patch, SimplexSolverTest.patch, 
> SimplexSolverTest.patch, SimplexTableau.patch, SimplexTableau.patch
>
>
> I guess (but I could be wrong) that SimplexSolver does not always return the 
> optimal solution, nor satisfies all the constraints...
> Consider this LP:
> max: 0.8 x0 + 0.2 x1 + 0.7 x2 + 0.3 x3 + 0.6 x4 + 0.4 x5;
> r1: x0 + x2 + x4 = 23.0;
> r2: x1 + x3 + x5 = 23.0;
> r3: x0 >= 10.0;
> r4: x2 >= 8.0;
> r5: x4 >= 5.0;
> LPSolve returns 25.8, with x0 = 10.0, x1 = 0.0, x2 = 8.0, x3 = 0.0, x4 = 5.0, 
> x5 = 23.0;
> The same LP expressed in Apache commons math is:
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 23.0));
> constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, 
> Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0 }, 
> Relationship.GEQ, 8.0));
> constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, 
> Relationship.GEQ, 5.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> that returns 22.20, with x0 = 15.0, x1 = 23.0, x2 = 8.0, x3 = 0.0, x4 = 0.0, 
> x5 = 0.0;
> Is it possible SimplexSolver is buggy that way? The returned value is 22.20 
> instead of 25.8, and the last constraint (x4 >= 5.0) is not satisfied...
> Am I using the interface wrongly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MATH-293) Matrix's "OutOfBoundException" in SimplexSolver

2009-09-09 Thread Andrea (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753213#action_12753213
 ] 

Andrea commented on MATH-293:
-

Hi Ben,
Just to be clear, the first LP is solved correctly with the following solution:

Value: 40.57142857142857

x0: 15.714285714285714
x1: 0.0
x2: 14.285714285714286
x3: 0.0
x4: 0.0
x5: 30.0

Then I create new constraints that are satisfied by the solution here above:
c3: 0.8 * x0 + 0.2 * x1 >= 0.8 * 15.714285714285714 ( = 12.571428571428571)
c4: 0.7 * x2 + 0.3 * x3 >= 0.7 * 14.285714285714286 ( = 10.0)
c5: 0.4 * x4 + 0.6 * x5 >= 0.6 * 30.0 ( = 18.0)

Note that by its construction, the solution above satisfies the constraints c3, 
c4, and c5.

If I try to solve the new LP, a "OutOfBoundException" is thrown...

> Matrix's "OutOfBoundException" in SimplexSolver
> ---
>
> Key: MATH-293
> URL: https://issues.apache.org/jira/browse/MATH-293
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: Nightly Builds
> Environment: java 1.6 on Windows XP 32-Bit
>Reporter: Andrea
>
> Hi all,
> This bug is somehow related to incident MATH-286, but not necessarily...
> Let's say I have an LP and I solve it using SimplexSolver. Then I create a 
> second LP similar to the first one, but with "stronger" constraints. The 
> second LP has the following properties:
> * the only point in the feasible region for the second LP is the solution 
> returned for the first LP
> * the solution returned for the first LP is also the (only possible) solution 
> to the second LP
> This shows the problem:
> {code:borderStyle=solid}
> LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 
> 0.2, 0.7, 0.3, 0.4, 0.6}, 0 );
> Collection constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 30.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 30.0));
> constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 
> 0.0 }, Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.7, 0.3, 0.0, 
> 0.0 }, Relationship.GEQ, 10.0));
> constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 
> 0.6 }, Relationship.GEQ, 10.0));
> RealPointValuePair solution = new SimplexSolver().optimize(f, constraints, 
> GoalType.MAXIMIZE, true);
> double valA = 0.8 * solution.getPoint()[0] + 0.2 * solution.getPoint()[1];
> double valB = 0.7 * solution.getPoint()[2] + 0.3 * solution.getPoint()[3];
> double valC = 0.4 * solution.getPoint()[4] + 0.6 * solution.getPoint()[5];
> f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.4, 0.6}, 
> 0 );
> constraints = new ArrayList();
> constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, 
> Relationship.EQ, 30.0));
> constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, 
> Relationship.EQ, 30.0));
> constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 
> 0.0 }, Relationship.GEQ, valA));
> constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.7, 0.3, 0.0, 
> 0.0 }, Relationship.GEQ, valB));
> constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 
> 0.6 }, Relationship.GEQ, valC));
> solution = new SimplexSolver().optimize(f, constraints, GoalType.MAXIMIZE, 
> true);
> {code} 
> Instead of returning the solution, SimplexSolver throws an Exception:
> {noformat} Exception in thread "main" 
> org.apache.commons.math.linear.MatrixIndexException: no entry at indices (0, 
> 7) in a 6x7 matrix
>   at 
> org.apache.commons.math.linear.Array2DRowRealMatrix.getEntry(Array2DRowRealMatrix.java:356)
>   at 
> org.apache.commons.math.optimization.linear.SimplexTableau.getEntry(SimplexTableau.java:408)
>   at 
> org.apache.commons.math.optimization.linear.SimplexTableau.getBasicRow(SimplexTableau.java:258)
>   at 
> org.apache.commons.math.optimization.linear.SimplexTableau.getSolution(SimplexTableau.java:336)
>   at 
> org.apache.commons.math.optimization.linear.SimplexSolver.doOptimize(SimplexSolver.java:182)
>   at 
> org.apache.commons.math.optimization.linear.AbstractLinearOptimizer.optimize(AbstractLinearOptimizer.java:106){noformat}
>  
> I was too optimistic with the bug MATH-286 ;-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.