Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 40534 invoked from network); 24 Sep 2009 18:17:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Sep 2009 18:17:42 -0000 Received: (qmail 66366 invoked by uid 500); 24 Sep 2009 18:17:42 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 66272 invoked by uid 500); 24 Sep 2009 18:17:41 -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 66261 invoked by uid 99); 24 Sep 2009 18:17:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Sep 2009 18:17:41 +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; Thu, 24 Sep 2009 18:17:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 717E2234C4AB for ; Thu, 24 Sep 2009 11:17:16 -0700 (PDT) Message-ID: <406048643.1253816236464.JavaMail.jira@brutus> Date: Thu, 24 Sep 2009 11:17:16 -0700 (PDT) From: "Luc Maisonobe (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (MATH-299) SimplexSolver returns no feasible solution In-Reply-To: <292910085.1253630656560.JavaMail.jira@brutus> 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 [ https://issues.apache.org/jira/browse/MATH-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12759200#action_12759200 ] Luc Maisonobe commented on MATH-299: ------------------------------------ David, do you consider the version in the subversion repository fixes this bug ? Can we change its state to resolved ? > SimplexSolver returns no feasible solution > ------------------------------------------ > > Key: MATH-299 > URL: https://issues.apache.org/jira/browse/MATH-299 > Project: Commons Math > Issue Type: Bug > Affects Versions: 2.0 > Environment: Windows XP commons Math 2.0 jre 1.6.0.16 > Reporter: David > Original Estimate: 8h > Remaining Estimate: 8h > > I am trying to optimize this: > maximize: v > v <= a1*p1 + a2*p2 + a3*p3 + a4*p4 > v <= b1*p1 + b2*p2 + b3*p3 + b4*p4 > v <= c1*p1 + c2*p2 + c3*p3 + c4*p4 > v <= d1*p1 + d2*p2 + d3*p3 + d4*p4 > p1 + p2 + p3 + p4 = 1 > where a1-d4 are constant specified below by the code (i didn't want to copy and paste them up here. you can look below to see what they are in the objective function). > LinearObjectiveFunction f = new LinearObjectiveFunction( > new double[] { 1, > 0, > 0, 0, 0}, 0 ); > Collection constraints = new ArrayList (); > constraints.add(new LinearConstraint(new double[] { -1, > 1.7316145027890766, > 1.3584341412980305, > 0.9305633063383639, > 1.687117394945513 > }, > Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, > 0.6617060079461883, > 1.4862459822191323, > 0.7692647272328988, > 0.7329140944025636 > }, > Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, > 1.3255966888982322, > 286.21607948837584, > 1.135907611434458, > 0.9803367440299271 > }, > Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, > 0.5428682596573682, > 1.5745685116536952, > 1.4834419186882808, > 1.2884923232048968 > }, > Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] {0, 1, 1, 1, 1}, > Relationship.EQ, 1)); > RealPointValuePair solution = null; > try { > > solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, true); > } > catch (OptimizationException e) { > e.printStackTrace(); > } > I get this error back from the SimplexSolver. > org.apache.commons.math.optimization.linear.NoFeasibleSolutionException: no feasible solution > at org.apache.commons.math.optimization.linear.SimplexSolver.solvePhase1(SimplexSolver.java:177) > at org.apache.commons.math.optimization.linear.SimplexSolver.doOptimize(SimplexSolver.java:187) > at org.apache.commons.math.optimization.linear.AbstractLinearOptimizer.optimize(AbstractLinearOptimizer.java:106) > at Runner.main(Runner.java:101) > One interesting thing to note is that if you round all the numbers to the nearest 100's place, it works. If you keep it with the floating point precision shown here, it doesn't. > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.