[jira] [Commented] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13598435#comment-13598435 ] Raghu Rangarajan commented on MATH-819: --- Hi Thomas, Thanks. I will try it when I find some time. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan >Assignee: Thomas Neidhart > Fix For: 3.2 > > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414693#comment-13414693 ] Raghu Rangarajan commented on MATH-819: --- Hi Thomas, OK. I will try few more test cases and open a new defect if I see more issues. I will leave it to you if you want to keep this defect open until it gets fixed. Thanks. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414621#comment-13414621 ] Raghu Rangarajan commented on MATH-819: --- Hi Thomas, I will try to skip adding such constraints as much as possible. You mention that variables without any specified bounds may take values in the range [0, infinity]. Am I correct to assume that such variables could take values from -infinity to infinity if I call the SimplexSolver.optimize method with restrictToNonNegative set to false? Sorry if I am asking for clarification on something that is obvious. Thanks. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413643#comment-13413643 ] Raghu Rangarajan edited comment on MATH-819 at 7/14/12 11:47 AM: - Hi Thomas, I will check out Octave. But glpk is able to solve this problem with those large coeffs. I used the standalone solver (glpsol) that comes with glpk. I have attached the input, output and solution files (test.*) for the same problem. Please look into it. I guess I can skip specifying such wide bounds when we don't really know the bounds. I will try it out and get back if I see any more problems. Again, thanks for looking into this issue. -- Raghu was (Author: vidyaraghu): Hi Thomas, I will check out Octave. But glpk is able to solve this problem with those large coeffs. I used the standalone solver (glpsol) that comes with glpk. I have attached the input, output and solution files (test.*) for the same problem. Please look into it. Also please tell me if there is a way to specify "no bounds" for lower and upper bounds for a variable and if that would help the solver. We specify +/-1e10 for those in LinearConstraints since we don't know better. Again, thanks for looking into this issue. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413643#comment-13413643 ] Raghu Rangarajan edited comment on MATH-819 at 7/13/12 10:42 AM: - Hi Thomas, I will check out Octave. But glpk is able to solve this problem with those large coeffs. I used the standalone solver (glpsol) that comes with glpk. I have attached the input, output and solution files (test.*) for the same problem. Please look into it. Also please tell me if there is a way to specify "no bounds" for lower and upper bounds for a variable and if that would help the solver. We specify +/-1e10 for those in LinearConstraints since we don't know better. Again, thanks for looking into this issue. -- Raghu was (Author: vidyaraghu): Hi Thomas, I will check out Octave. But glpk is able to solve this problem with those large coeffs. I used the standalone solver (glpsol) that comes with glpk. I have attached the input, output and solution files (test.*) for the same problem. Please look into it. Again, thanks for looking into this issue. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413643#comment-13413643 ] Raghu Rangarajan commented on MATH-819: --- Hi Thomas, I will check out Octave. But glpk is able to solve this problem with those large coeffs. I used the standalone solver (glpsol) that comes with glpk. I have attached the input, output and solution files (test.*) for the same problem. Please look into it. Again, thanks for looking into this issue. -- Raghu > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan updated MATH-819: -- Attachment: test.out test.mod test.log > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java, lp-octave.txt, test.log, test.mod, > test.out > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
[ https://issues.apache.org/jira/browse/MATH-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan updated MATH-819: -- Attachment: CommonsSolver2.java > SimplexSolver - InfeasibleSolution when feasible > > > Key: MATH-819 > URL: https://issues.apache.org/jira/browse/MATH-819 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.1 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: CommonsSolver2.java > > > I am seeing an odd behavior with the latest code in the main trunk (Directory > revision: 1358535). The solver throws "NoFeasibleSolutionException" for a > problem which has a feasible solution. Just by commenting out the last > constraint, we get a feasible solution. And for that solution, the constraint > in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (MATH-819) SimplexSolver - InfeasibleSolution when feasible
Raghu Rangarajan created MATH-819: - Summary: SimplexSolver - InfeasibleSolution when feasible Key: MATH-819 URL: https://issues.apache.org/jira/browse/MATH-819 Project: Commons Math Issue Type: Bug Affects Versions: 3.1 Environment: Windows 7, JDK 1.7.0_03 Reporter: Raghu Rangarajan Attachments: CommonsSolver2.java I am seeing an odd behavior with the latest code in the main trunk (Directory revision: 1358535). The solver throws "NoFeasibleSolutionException" for a problem which has a feasible solution. Just by commenting out the last constraint, we get a feasible solution. And for that solution, the constraint in question does not seem to be playing a role. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Reopened] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan reopened MATH-813: --- > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Fix For: Nightly Builds > > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan resolved MATH-813. --- Resolution: Fixed > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Fix For: Nightly Builds > > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/ji
[jira] [Closed] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan closed MATH-813. - > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Fix For: Nightly Builds > > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan closed MATH-813. - Resolution: Fixed Fix Version/s: Nightly Builds > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Fix For: Nightly Builds > > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: htt
[jira] [Commented] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410751#comment-13410751 ] Raghu Rangarajan commented on MATH-813: --- Hi Thomas, I too am able to get the right results with the latest trunk code. Thanks for looking into this. Raghu > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Fix For: Nightly Builds > > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIR
[jira] [Updated] (MATH-813) SimplexSolver bug?
[ https://issues.apache.org/jira/browse/MATH-813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Raghu Rangarajan updated MATH-813: -- Attachment: Commons_Solver.java > SimplexSolver bug? > -- > > Key: MATH-813 > URL: https://issues.apache.org/jira/browse/MATH-813 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.0 > Environment: Windows 7, JDK 1.7.0_03 >Reporter: Raghu Rangarajan > Attachments: Commons_Solver.java > > > I am trying to use the SimplexSolver in commons-math3-3.0 and am getting > unpredictable results. I am pasting the problem code below. Basically > swapping the sequence of the last two constraints results in two different > results (of which one is pure sub-optimal). Am I not using the solver > correctly? > -- > import java.util.ArrayList; > import java.util.Collection; > import org.apache.commons.math3.optimization.*; > import org.apache.commons.math3.optimization.linear.*; > public class Commons_Solver { > public static void main(String[] args) { > // describe the optimization problem > > LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, > 1, 1, 1, 1, 1, 0, 0 }, 0); > Collection constraints = new > ArrayList(); > > //variables upper bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 38)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 34)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.LEQ, 1)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.LEQ, 6)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.LEQ, 17)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.LEQ, 11)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.LEQ, 101)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.LEQ, 1e10)); > //variables lower bounds > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, > 0 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, > 1 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, > -1, 1, 0 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, > -1,0 , 1 }, Relationship.EQ, 0)); > constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, > -0.2841121495327103 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, > -0.25420560747663556 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, > -0.04485981308411215 }, Relationship.GEQ, 0)); > > /*--- > Swapping the sequence of the below two constraints produces two different > results > --*/ > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, > -0.12710280373831778 }, Relationship.GEQ, 0)); > constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, > -0.08224299065420561 }, Relationship.GEQ, 0)); > /*--*/ > > PointValuePair solution = new SimplexSolver().optimize(f, constraints, > GoalType.MAXIMIZE, false); > // get the solution > for (int i = 0 ; i < solution.getPoint().length; i++) > System.out.println("x[" + i + "] = " + solution.getPoint()[i]); > > System.out.println("value = " + solution.getValue()); > } > } > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (MATH-813) SimplexSolver bug?
Raghu Rangarajan created MATH-813: - Summary: SimplexSolver bug? Key: MATH-813 URL: https://issues.apache.org/jira/browse/MATH-813 Project: Commons Math Issue Type: Bug Affects Versions: 3.0 Environment: Windows 7, JDK 1.7.0_03 Reporter: Raghu Rangarajan I am trying to use the SimplexSolver in commons-math3-3.0 and am getting unpredictable results. I am pasting the problem code below. Basically swapping the sequence of the last two constraints results in two different results (of which one is pure sub-optimal). Am I not using the solver correctly? -- import java.util.ArrayList; import java.util.Collection; import org.apache.commons.math3.optimization.*; import org.apache.commons.math3.optimization.linear.*; public class Commons_Solver { public static void main(String[] args) { // describe the optimization problem LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 1, 1, 1, 1, 1, 0, 0 }, 0); Collection constraints = new ArrayList(); //variables upper bounds constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, 0 }, Relationship.LEQ, 38)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, 0 }, Relationship.LEQ, 34)); constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, 0 }, Relationship.LEQ, 1)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, 0 }, Relationship.LEQ, 6)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, 0 }, Relationship.LEQ, 17)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, 0 }, Relationship.LEQ, 11)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, 0 }, Relationship.LEQ, 101)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, 1 }, Relationship.LEQ, 1e10)); //variables lower bounds constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 1, 0, 0, 0, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 1, 0 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 0, 0, 1 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { -1,-1, -1, -1, -1, -1, 1, 0 }, Relationship.EQ, 0)); constraints.add(new LinearConstraint(new double[] { -1, -1, -1, -1, -1, -1,0 , 1 }, Relationship.EQ, 0)); constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0, 0, -0.2841121495327103 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0, 0, 0, 0, -0.25420560747663556 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 1, 0, 0, 0, -0.04485981308411215 }, Relationship.GEQ, 0)); /*--- Swapping the sequence of the below two constraints produces two different results --*/ constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0, 0, -0.12710280373831778 }, Relationship.GEQ, 0)); constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 0, 1, 0, -0.08224299065420561 }, Relationship.GEQ, 0)); /*--*/ PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MAXIMIZE, false); // get the solution for (int i = 0 ; i < solution.getPoint().length; i++) System.out.println("x[" + i + "] = " + solution.getPoint()[i]); System.out.println("value = " + solution.getValue()); } } -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira