snap-stanford / snapvx

Other
65 stars 34 forks source link

Problems running the tests #34

Closed joanpavlidou closed 6 years ago

joanpavlidou commented 6 years ago

Hi everyone. I tried to install SnapVX via the master file downloaded from here(previously I downloaded also the file from the snapvx website) and when running the tests, I get all the below. Feeling quite frustrated. Can anyone help please? Thank you

System: MacOS Python: system python 2.7.15 64 bit

test_basic_solver_with_ADMM (main.BasicSolverTest) Test a basic SnapVX graph problem with ADMM. ... ERROR test_basic_solver_without_ADMM (main.BasicSolverTest) Test a basic SnapVX graph problem without ADMM ... ERROR

====================================================================== ERROR: test_basic_solver_with_ADMM (main.BasicSolverTest) Test a basic SnapVX graph problem with ADMM.

Traceback (most recent call last): File "test_basic_solver.py", line 28, in test_basic_solver_with_ADMM gvx.AddNode(1, Objective=obj, Constraints=[x1 <= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_basic_solver_without_ADMM (main.BasicSolverTest) Test a basic SnapVX graph problem without ADMM

Traceback (most recent call last): File "test_basic_solver.py", line 56, in test_basic_solver_without_ADMM gvx.AddNode(1, Objective=obj, Constraints=[x1 <= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.083s

FAILED (errors=2) test_cvxpy (main.CVXPYTest) Test that CVXPY installed correctly. ... ('optimal value with ECOS:', '5.999999995510096') ('optimal value with ECOS_BB:', '5.999999995510096') ('optimal value with CVXOPT:', '6.000000005119901') ('optimal value with SCS:', '5.999999829485595') ok


Ran 1 test in 0.229s

OK test_snap (main.SnapTest) Test that snap.py installed correctly. ... Randomizing edges (20, 60)... total 12k switchings attempted, 7k skiped [0.00s] ok


Ran 1 test in 0.353s

OK test_bulk_loading_with_ADMM (main.BulkLoadingTest) Test whether bulk loading functionality works when the optimisation problem is solved using ADMM ... ERROR test_bulk_loading_without_ADMM (main.BulkLoadingTest) Test whether bulk loading functionality works when the optimisation problem is solved without ADMM ... ERROR

====================================================================== ERROR: test_bulk_loading_with_ADMM (main.BulkLoadingTest) Test whether bulk loading functionality works when the optimisation problem is solved using ADMM

Traceback (most recent call last): File "test_bulk_loading.py", line 42, in test_bulk_loading_with_ADMM objective_node_func) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 695, in AddNodeObjectives self.SetNodeObjective(nid, ret) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_bulk_loading_without_ADMM (main.BulkLoadingTest) Test whether bulk loading functionality works when the optimisation problem is solved without ADMM

Traceback (most recent call last): File "test_bulk_loading.py", line 73, in test_bulk_loading_without_ADMM objective_node_func) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 695, in AddNodeObjectives self.SetNodeObjective(nid, ret) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.018s

FAILED (errors=2) test_clustering (main.ClusteringTest) Test whether ADMM works when the graph is transformed to a supergraph by clustering adjacent nodes ... ERROR

====================================================================== ERROR: test_clustering (main.ClusteringTest) Test whether ADMM works when the graph is transformed to a supergraph by clustering adjacent nodes

Traceback (most recent call last): File "test_clustering.py", line 35, in test_clustering gvx.SetNodeObjective(i, square(x-a)) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 1 test in 0.044s

FAILED (errors=1) test_basic_solver_with_ADMM (main.HighPrecTest) Test a basic SnapVX graph problem with ADMM with high precision. ... ERROR test_bulk_loading_with_ADMM_high_prec (main.HighPrecTest) Test whether bulk loading functionality also returns solutions with high precision. ... ERROR test_multi_vars_with_ADMM_high_prec (main.HighPrecTest) Test whether high precision solutions are returned when multiple variables are introduced ... ERROR

====================================================================== ERROR: test_basic_solver_with_ADMM (main.HighPrecTest) Test a basic SnapVX graph problem with ADMM with high precision.

Traceback (most recent call last): File "test_high_prec.py", line 28, in test_basic_solver_with_ADMM gvx.AddNode(1, Objective=obj, Constraints=[x1 <= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_bulk_loading_with_ADMM_high_prec (main.HighPrecTest) Test whether bulk loading functionality also returns solutions with high precision.

Traceback (most recent call last): File "test_high_prec.py", line 69, in test_bulk_loading_with_ADMM_high_prec objective_node_func) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 695, in AddNodeObjectives self.SetNodeObjective(nid, ret) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multi_vars_with_ADMM_high_prec (main.HighPrecTest) Test whether high precision solutions are returned when multiple variables are introduced

Traceback (most recent call last): File "test_high_prec.py", line 99, in test_multi_vars_with_ADMM_high_prec NodeIDs=[1,2]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 719, in AddNodeObjectives self.SetNodeObjective(nid, ret[0]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.002s

FAILED (errors=3) test_illegal_edge (main.IllegalEdgeTest) Test that invalid edges cannot be created. ... ERROR

====================================================================== ERROR: test_illegal_edge (main.IllegalEdgeTest) Test that invalid edges cannot be created.

Traceback (most recent call last): File "test_illegal_edge.py", line 21, in test_illegal_edge gvx.AddNode(1, square(x)) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 1 test in 0.001s

FAILED (errors=1) test_multi_vars_with_ADMM (main.MultiVarsTest) Test multiple variables with ADMM. ... ERROR test_multi_vars_without_ADMM (main.MultiVarsTest) Test multiple variables without ADMM. ... ERROR

====================================================================== ERROR: test_multi_vars_with_ADMM (main.MultiVarsTest) Test multiple variables with ADMM.

Traceback (most recent call last): File "test_multivars.py", line 38, in test_multi_vars_with_ADMM NodeIDs=[1,2]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 719, in AddNodeObjectives self.SetNodeObjective(nid, ret[0]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multi_vars_without_ADMM (main.MultiVarsTest) Test multiple variables without ADMM.

Traceback (most recent call last): File "test_multivars.py", line 73, in test_multi_vars_without_ADMM NodeIDs=[1,2]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 719, in AddNodeObjectives self.SetNodeObjective(nid, ret[0]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.002s

FAILED (errors=2) test_no_edges (main.NoEdgesTest) Test whether SnapVX works on a graph with no edges. ... ERROR

====================================================================== ERROR: test_no_edges (main.NoEdgesTest) Test whether SnapVX works on a graph with no edges.

Traceback (most recent call last): File "test_no_edges.py", line 23, in test_no_edges gvx.AddNode(1, Objective=square(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 1 test in 0.001s

FAILED (errors=1) test_shared_vars_unallowed (main.NoSharedVarsTest) Test that two nodes cannot share a variable. ... ERROR

====================================================================== ERROR: test_shared_vars_unallowed (main.NoSharedVarsTest) Test that two nodes cannot share a variable.

Traceback (most recent call last): File "test_no_sharedvars.py", line 20, in test_shared_vars_unallowed gvx.AddNode(1, square(x)) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 1 test in 0.001s

FAILED (errors=1) test_edge_constraint (main.AddEdgeTest) Test whether adding edge constraints results in correct solution ... ERROR test_edge_count (main.AddEdgeTest) Test whether AddEdge function sets the edges correctly ... ERROR test_edge_objective (main.AddEdgeTest) Test whether adding a edge objective results in correct solution ... ERROR

====================================================================== ERROR: test_edge_constraint (main.AddEdgeTest) Test whether adding edge constraints results in correct solution

Traceback (most recent call last): File "test_addedge.py", line 71, in test_edge_constraint gvx.AddNode(i+1, Objective=square(norm(x))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_edge_count (main.AddEdgeTest) Test whether AddEdge function sets the edges correctly

Traceback (most recent call last): File "test_addedge.py", line 32, in test_edgecount self.assertEqual(sum(1 for in gvx.Edges()), 3) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/affine/sum.py", line 102, in sum return Sum(expr, axis, keepdims) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/affine/sum.py", line 42, in init super(Sum, self).init(expr, axis=axis, keepdims=keepdims) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/axis_atom.py", line 36, in init super(AxisAtom, self).init(expr) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/atom.py", line 43, in init self.args = [Atom.cast_to_const(arg) for arg in args] File "/usr/local/lib/python2.7/site-packages/cvxpy/expressions/expression.py", line 356, in cast_to_const return expr if isinstance(expr, Expression) else cvxtypes.constant()(expr) File "/usr/local/lib/python2.7/site-packages/cvxpy/expressions/constants/constant.py", line 46, in init self._value = intf.DEFAULT_INTF.const_to_matrix(value) File "/usr/local/lib/python2.7/site-packages/cvxpy/interface/numpy_interface/ndarray_interface.py", line 53, in const_to_matrix return result.astype(numpy.float64) TypeError: float() argument must be a string or a number

====================================================================== ERROR: test_edge_objective (main.AddEdgeTest) Test whether adding a edge objective results in correct solution

Traceback (most recent call last): File "test_addedge.py", line 46, in test_edge_objective gvx.AddNode(i+1, Objective=square(norm(x))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.123s

FAILED (errors=3) test_multi_variables (main.AddEdgeObjectiveTest) Test whether AddEdgeObjectives behaves correctly when a single variable is associated with each node ... ERROR test_single_variable (main.AddEdgeObjectiveTest) Test whether AddEdgeObjectives behaves correctly when a single variable is associated with each node ... ERROR

====================================================================== ERROR: test_multi_variables (main.AddEdgeObjectiveTest) Test whether AddEdgeObjectives behaves correctly when a single variable is associated with each node

Traceback (most recent call last): File "test_addedgeobjectives.py", line 73, in test_multi_variables NodeIDs=[1,2]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 719, in AddNodeObjectives self.SetNodeObjective(nid, ret[0]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.AddEdgeObjectiveTest) Test whether AddEdgeObjectives behaves correctly when a single variable is associated with each node

Traceback (most recent call last): File "test_addedgeobjectives.py", line 42, in test_single_variable objective_node_func) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 695, in AddNodeObjectives self.SetNodeObjective(nid, ret) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.002s

FAILED (errors=2) test_node_constraint (main.AddNodeTest) Test whether adding a node constraint results in correct solution ... ERROR test_node_count (main.AddNodeTest) Test whether AddNode function sets the nodes correctly ... ERROR test_node_objective (main.AddNodeTest) Test whether adding a node objective results in correct solution ... ERROR

====================================================================== ERROR: test_node_constraint (main.AddNodeTest) Test whether adding a node constraint results in correct solution

Traceback (most recent call last): File "test_addnode.py", line 63, in test_node_constraint gvx.AddNode(i+1, Objective=square(norm(x-a)), Constraints=[x >= a+1]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_node_count (main.AddNodeTest) Test whether AddNode function sets the nodes correctly

Traceback (most recent call last): File "test_addnode.py", line 26, in test_nodecount self.assertEqual(sum(1 for in gvx.Nodes()), 2) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/affine/sum.py", line 102, in sum return Sum(expr, axis, keepdims) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/affine/sum.py", line 42, in init super(Sum, self).init(expr, axis=axis, keepdims=keepdims) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/axis_atom.py", line 36, in init super(AxisAtom, self).init(expr) File "/usr/local/lib/python2.7/site-packages/cvxpy/atoms/atom.py", line 43, in init self.args = [Atom.cast_to_const(arg) for arg in args] File "/usr/local/lib/python2.7/site-packages/cvxpy/expressions/expression.py", line 356, in cast_to_const return expr if isinstance(expr, Expression) else cvxtypes.constant()(expr) File "/usr/local/lib/python2.7/site-packages/cvxpy/expressions/constants/constant.py", line 46, in init self._value = intf.DEFAULT_INTF.const_to_matrix(value) File "/usr/local/lib/python2.7/site-packages/cvxpy/interface/numpy_interface/ndarray_interface.py", line 53, in const_to_matrix return result.astype(numpy.float64) TypeError: float() argument must be a string or a number

====================================================================== ERROR: test_node_objective (main.AddNodeTest) Test whether adding a node objective results in correct solution

Traceback (most recent call last): File "test_addnode.py", line 41, in test_node_objective gvx.AddNode(i+1, Objective=square(norm(x-a))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.003s

FAILED (errors=3) test_multi_variables (main.AddNodeObjectivesTest) Test whether the function works in case of multiple variables ... ERROR test_single_variable (main.AddNodeObjectivesTest) Test whether AddNodeObjectives behaves correctly when a single variable is associated with each node ... ERROR

====================================================================== ERROR: test_multi_variables (main.AddNodeObjectivesTest) Test whether the function works in case of multiple variables

Traceback (most recent call last): File "test_addnodeobjectives.py", line 62, in test_multi_variables NodeIDs=[1,2]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 719, in AddNodeObjectives self.SetNodeObjective(nid, ret[0]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.AddNodeObjectivesTest) Test whether AddNodeObjectives behaves correctly when a single variable is associated with each node

Traceback (most recent call last): File "test_addnodeobjectives.py", line 36, in test_single_variable objective_node_func) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 695, in AddNodeObjectives self.SetNodeObjective(nid, ret) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.002s

FAILED (errors=2) test_multiple_nodes (main.GetNodeValueTest) Test whether the value returned for variables on multiple nodes is correct ... ERROR test_multiple_variables (main.GetNodeValueTest) Test whether the value returned for two variables and a single node is correct ... ERROR test_single_variable (main.GetNodeValueTest) Test whether the value returned for a single variable and a single node is correct ... ERROR

====================================================================== ERROR: test_multiple_nodes (main.GetNodeValueTest) Test whether the value returned for variables on multiple nodes is correct

Traceback (most recent call last): File "test_getnodevalue.py", line 65, in test_multiple_nodes gvx.AddNode(i+1, Objective=square(norm(x-a))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multiple_variables (main.GetNodeValueTest) Test whether the value returned for two variables and a single node is correct

Traceback (most recent call last): File "test_getnodevalue.py", line 45, in test_multiple_variables gvx.AddNode(1, Objective=obj, Constraints=[x1 >= 10, x2 <= -5]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.GetNodeValueTest) Test whether the value returned for a single variable and a single node is correct

Traceback (most recent call last): File "test_getnodevalue.py", line 26, in test_single_variable gvx.AddNode(1, Objective=obj, Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.003s

FAILED (errors=3) test_multiple_nodes (main.GetTotalProblemValueTest) Test whether the value returned for variables on multiple nodes is correct ... ERROR test_multiple_variables (main.GetTotalProblemValueTest) Test whether the value returned for two variables and a single node is correct ... ERROR test_single_variable (main.GetTotalProblemValueTest) Test whether the value returned for a single variable and a single node is correct ... ERROR

====================================================================== ERROR: test_multiple_nodes (main.GetTotalProblemValueTest) Test whether the value returned for variables on multiple nodes is correct

Traceback (most recent call last): File "test_gettotalproblemvalue.py", line 64, in test_multiple_nodes gvx.AddNode(i+1, Objective=square(norm(x-a))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multiple_variables (main.GetTotalProblemValueTest) Test whether the value returned for two variables and a single node is correct

Traceback (most recent call last): File "test_gettotalproblemvalue.py", line 45, in test_multiple_variables gvx.AddNode(1, Objective=obj, Constraints=[x1 >= 10, x2 <= -5]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.GetTotalProblemValueTest) Test whether the value returned for a single variable and a single node is correct

Traceback (most recent call last): File "test_gettotalproblemvalue.py", line 26, in test_single_variable gvx.AddNode(1, Objective=obj, Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.002s

FAILED (errors=3) test_multiple_edges (main.SetEdgeConstraintsTest) Test for function correctness in case of multiple edges ... ERROR test_single_edge (main.SetEdgeConstraintsTest) Test for function correctness in case of a single edge ... ERROR

====================================================================== ERROR: test_multiple_edges (main.SetEdgeConstraintsTest) Test for function correctness in case of multiple edges

Traceback (most recent call last): File "test_setedgeconstraints.py", line 56, in test_multiple_edges gvx.AddNode(1, Objective=abs(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_edge (main.SetEdgeConstraintsTest) Test for function correctness in case of a single edge

Traceback (most recent call last): File "test_setedgeconstraints.py", line 27, in test_single_edge gvx.AddNode(1, Objective=abs(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.001s

FAILED (errors=2) test_multiple_edges (main.SetEdgeObjectiveTest) Test for function correctness in case of multiple edges ... ERROR test_single_edge (main.SetEdgeObjectiveTest) Test for function correctness in case of a single edge ... ERROR

====================================================================== ERROR: test_multiple_edges (main.SetEdgeObjectiveTest) Test for function correctness in case of multiple edges

Traceback (most recent call last): File "test_setedgeobjective.py", line 56, in test_multiple_edges gvx.AddNode(1, Objective=abs(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_edge (main.SetEdgeObjectiveTest) Test for function correctness in case of a single edge

Traceback (most recent call last): File "test_setedgeobjective.py", line 27, in test_single_edge gvx.AddNode(1, Objective=abs(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.001s

FAILED (errors=2) test_multiple_nodes (main.SetNodeConstraintTest) Test for function correctness when multiple nodes each contain a single variable ... ERROR test_multiple_variables (main.SetNodeConstraintTest) Test for function correctness when multiple variables are associated with a single node ... ERROR test_single_variable (main.SetNodeConstraintTest) Test for function correctness when a single variable is associated with a single node ... ERROR

====================================================================== ERROR: test_multiple_nodes (main.SetNodeConstraintTest) Test for function correctness when multiple nodes each contain a single variable

Traceback (most recent call last): File "test_setnodeconstraint.py", line 77, in test_multiple_nodes gvx.AddNode(i+1, Objective = square(norm(x-a))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multiple_variables (main.SetNodeConstraintTest) Test for function correctness when multiple variables are associated with a single node

Traceback (most recent call last): File "test_setnodeconstraint.py", line 52, in test_multiple_variables gvx.AddNode(1, Objective = square(x1) + abs(x2+3)) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.SetNodeConstraintTest) Test for function correctness when a single variable is associated with a single node

Traceback (most recent call last): File "test_setnodeconstraint.py", line 27, in test_single_variable gvx.AddNode(1, Objective=square(x1)) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.002s

FAILED (errors=3) test_multiple_nodes (main.SetNodeObjectiveTest) Test for function correctness when multiple nodes each contain a single variable ... ERROR test_multiple_variables (main.SetNodeObjectiveTest) Test for function correctness when multiple variables are associated with a single node ... ERROR test_single_variable (main.SetNodeObjectiveTest) Test for function correctness when a single variable is associated with a single node ... ERROR

====================================================================== ERROR: test_multiple_nodes (main.SetNodeObjectiveTest) Test for function correctness when multiple nodes each contain a single variable

Traceback (most recent call last): File "test_setnodeobjective.py", line 76, in test_multiple_nodes gvx.SetNodeObjective(i+1,square(norm(x-a))) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_multiple_variables (main.SetNodeObjectiveTest) Test for function correctness when multiple variables are associated with a single node

Traceback (most recent call last): File "test_setnodeobjective.py", line 53, in test_multiple_variables gvx.SetNodeObjective(1,obj) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_single_variable (main.SetNodeObjectiveTest) Test for function correctness when a single variable is associated with a single node

Traceback (most recent call last): File "test_setnodeobjective.py", line 30, in test_single_variable gvx.SetNodeObjective(1,obj) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 580, in SetNodeObjective self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 3 tests in 0.002s

FAILED (errors=3) test_rho_exp_decay (main.SetRhoUpdateTest) Test whether SnapVX works when rho decays exponentially ... ERROR test_rho_identity (main.SetRhoUpdateTest) Test whether SnapVX works when rho is set to a constant ... ERROR

====================================================================== ERROR: test_rho_exp_decay (main.SetRhoUpdateTest) Test whether SnapVX works when rho decays exponentially

Traceback (most recent call last): File "test_setrhoupdate.py", line 46, in test_rho_exp_decay gvx.AddNode(1, Objective=square(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.

====================================================================== ERROR: test_rho_identity (main.SetRhoUpdateTest) Test whether SnapVX works when rho is set to a constant

Traceback (most recent call last): File "test_setrhoupdate.py", line 23, in test_rho_identity gvx.AddNode(1, Objective=square(x1), Constraints=[x1 >= 10]) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 572, in AddNode self.node_variables[NId] = self.ExtractVariableList(Objective) File "/usr/local/lib/python2.7/site-packages/snapvx.py", line 564, in ExtractVariableList offset += var.size[0] IndexError: invalid index to scalar variable.


Ran 2 tests in 0.001s

FAILED (errors=2)

davidhallac commented 6 years ago

Hmm, did you modify anything in the code before running the tests? And which version of Python are you using?

davidhallac commented 6 years ago

Oh wait I see you included the Python version, but did you modify the code at all, or are you just using the default SnapVX?

joanpavlidou commented 6 years ago

No! I didn't modify anything, I just tried to follow the installation steps and nothing more. I have the system's 64 bit python version 2.7.15 . Any idea what's going on? Thanks!

davidhallac commented 6 years ago

Hmm, I just re-installed SnapVX on Python2.7 and ran the tests, and it seems to be working fine on my machine.

It seems like you're consistently getting the exact same error, in Line 564 of the code. That refers to how we extract CVXPY variables from the CVXPY objectives. I'm not 100% sure why that's happening but it might have to do with your CVXPY installation. Which CVXPY version are you using?

joanpavlidou commented 6 years ago

Probably the latest, as I installed CVXPY with pip(can't see right now as I did the installations in the uni computer-I ll check it out tomorrow). I also run the test for CVXPY(the test they have on their website) and it was working. Not sure though if the last version is compatible with SnapVX. Which one should I have? So I can try to install it manually tomorrow and come back to you.

davidhallac commented 6 years ago

Ah, yes, that might be the issue. The latest version of CVXPY (Version 1.0) changed a lot of the internals (http://www.cvxpy.org/updates/index.html#updates), and SnapVX has not yet been updated to support CVXPY 1.0.

If you download CVXPY version 0.4 (or any version before version 1), that should fix the issue and your code should work from there!

joanpavlidou commented 6 years ago

Thank you! Hopefully it will work. I will try it and let you know!

joanpavlidou commented 6 years ago

That was the problem! I removed CVXPY 1.0 and I installed the 0.4 version!

pip uninstall CVXPY pip install CVXPY==0.4

Thank you so much, haunted computer mystery solved ;) And thanks for the software, looking forward to experimenting with it!

inexplicable

davidhallac commented 6 years ago

Great, glad that fixed it!