Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 45342 invoked from network); 24 Aug 2009 22:31:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Aug 2009 22:31:57 -0000 Received: (qmail 97801 invoked by uid 500); 24 Aug 2009 22:32:22 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 97685 invoked by uid 500); 24 Aug 2009 22:32:21 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 97455 invoked by uid 99); 24 Aug 2009 22:32:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 22:32:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 22:32:19 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5A191234C1EB for ; Mon, 24 Aug 2009 15:31:59 -0700 (PDT) Message-ID: <326531090.1251153119368.JavaMail.jira@brutus> Date: Mon, 24 Aug 2009 15:31:59 -0700 (PDT) From: "Stefan Radacovsky (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (MATH-288) SimplexSolver not working as expected 2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org SimplexSolver not working as expected 2 --------------------------------------- Key: MATH-288 URL: https://issues.apache.org/jira/browse/MATH-288 Project: Commons Math Issue Type: Bug Affects Versions: 2.1 Environment: Java 1.6.0_13 on Windows XP 32-bit Reporter: Stefan Radacovsky SimplexSolver didn't find the optimal solution. Program for Lpsolve: ===================== /* Objective function */ max: 7 a 3 b; /* Constraints */ R1: +3 a -5 c <= 0; R2: +2 a -5 d <= 0; R3: +2 b -5 c <= 0; R4: +3 b -5 d <= 0; R5: +3 a +2 b <= 5; R6: +2 a +3 b <= 5; /* Variable bounds */ a <= 1; b <= 1; ===================== Results(correct): a = 1, b = 1, value = 10 Program for SimplexSolve: ===================== LinearObjectiveFunction kritFcia = new LinearObjectiveFunction(new double[]{7, 3, 0, 0}, 0); Collection podmienky = new ArrayList(); podmienky.add(new LinearConstraint(new double[]{1, 0, 0, 0}, Relationship.LEQ, 1)); podmienky.add(new LinearConstraint(new double[]{0, 1, 0, 0}, Relationship.LEQ, 1)); podmienky.add(new LinearConstraint(new double[]{3, 0, -5, 0}, Relationship.LEQ, 0)); podmienky.add(new LinearConstraint(new double[]{2, 0, 0, -5}, Relationship.LEQ, 0)); podmienky.add(new LinearConstraint(new double[]{0, 2, -5, 0}, Relationship.LEQ, 0)); podmienky.add(new LinearConstraint(new double[]{0, 3, 0, -5}, Relationship.LEQ, 0)); podmienky.add(new LinearConstraint(new double[]{3, 2, 0, 0}, Relationship.LEQ, 5)); podmienky.add(new LinearConstraint(new double[]{2, 3, 0, 0}, Relationship.LEQ, 5)); SimplexSolver solver = new SimplexSolver(); RealPointValuePair result = solver.optimize(kritFcia, podmienky, GoalType.MAXIMIZE, true); ===================== Results(incorrect): a = 1, b = 0.5, value = 8.5 P.S. I used the latest software from the repository (including MATH-286 fix). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.