diff --git a/Makefile b/Makefile index f5491974b6fb..793e8997270b 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ mlint : matlab -nodisplay -r "addpath(fullfile(pwd,'thirdParty','runmlint')); runmlint('.mlintopts'); exit" test : configure - -@cd pod-build && ctest -D Experimental --output-on-failure --timeout 300 + -@cd pod-build && ctest -D Experimental --output-on-failure --timeout 300 -j 8 test_continuous : configure while true; do $(MAKE) Continuous; sleep 300; done diff --git a/solvers/@PolynomialProgram/PolynomialProgram.m b/solvers/@PolynomialProgram/PolynomialProgram.m index a095ee06f2c4..8f64ce73c32b 100644 --- a/solvers/@PolynomialProgram/PolynomialProgram.m +++ b/solvers/@PolynomialProgram/PolynomialProgram.m @@ -60,7 +60,7 @@ end end - obj = obj@NonlinearProgram(length(decision_vars),length(equality_constraints),length(inequality_constraints)); + obj = obj@NonlinearProgram(length(decision_vars)); obj.decision_vars = decision_vars; obj.poly_objective = objective; obj.poly_inequality_constraints = inequality_constraints; diff --git a/solvers/NonlinearProgram.m b/solvers/NonlinearProgram.m index 3a3c343f20a8..a4bcad013ec7 100644 --- a/solvers/NonlinearProgram.m +++ b/solvers/NonlinearProgram.m @@ -81,7 +81,7 @@ if(nargin<2) x_name = cellfun(@(i) sprintf('x%d',i),num2cell((1:obj.num_vars)'),'UniformOutput',false); else - if(~iscellstr(x_name) || numel(x_name) ~= obj.num_vars) + if(~iscellstr(x_name) || numel(x_name) ~= num_vars) error('Drake:NonlinearProgra:InvalidArgument','Argument x_name should be a cell containing %d strings',obj.num_vars); end x_name = x_name(:); @@ -1031,6 +1031,10 @@ function checkGradient(x_free) [exitflag,infeasible_constraint_name] = obj.mapSolverInfo(exitflag,x); objval = objective(x); end + + function obj = setVarBounds(obj,lb,ub) + error('Drake:NonlinearProgram:setVarBounds is deprecated, use addConstraint instead'); + end end methods(Access = protected) @@ -1124,7 +1128,8 @@ function checkGradient(x_free) methods(Access = private) function infeasible_constraint_name = infeasibleConstraint(obj,x) - fval = obj.nonlinearConstraints(x); + [g,h] = obj.nonlinearConstraints(x); + fval = [g;h]; A = [obj.Ain;obj.Aeq]; if(~isempty(A)) fval = [fval;A*x]; diff --git a/solvers/QuadraticProgram.m b/solvers/QuadraticProgram.m index 2ff38303c8ae..50a7124b429c 100644 --- a/solvers/QuadraticProgram.m +++ b/solvers/QuadraticProgram.m @@ -37,7 +37,7 @@ if nargin<7, x_lb=-inf(n,1); end if nargin<8, x_ub=inf(n,1); end - obj = obj@NonlinearProgram(size(Q,1),0,0); + obj = obj@NonlinearProgram(size(Q,1)); obj.Q = Q; obj.f = f; obj.Ain = Ain; diff --git a/solvers/test/gloptipoly_constrained_test.m b/solvers/test/gloptipoly_constrained_test.m index d30c84370f31..02bb13ac42f5 100644 --- a/solvers/test/gloptipoly_constrained_test.m +++ b/solvers/test/gloptipoly_constrained_test.m @@ -7,7 +7,7 @@ 3*x(2)+x(3)-6]; prog = PolynomialProgram(x,objective,ineq); -prog = setVarBounds(prog,[0;0;0],[2;inf;3]); +prog = prog.addConstraint(BoundingBoxConstraint([0;0;0],[2;inf;3])); [x,objval,exitflag] = gloptipoly(prog)