diff --git a/optim/model.go b/optim/model.go index 3c1cb49..df3bca9 100644 --- a/optim/model.go +++ b/optim/model.go @@ -41,7 +41,7 @@ func (m *Model) AddRealVariable() Variable { return m.AddVariableClassic(-INFINITY, INFINITY, Continuous) } -// AddVariable adds a variable of a given variable type to the model given the lower +// AddVariableClassic AddVariable adds a variable of a given variable type to the model given the lower // and upper value limits. This variable is returned. func (m *Model) AddVariableClassic(lower, upper float64, vtype VarType) Variable { id := uint64(len(m.Variables)) @@ -50,7 +50,7 @@ func (m *Model) AddVariableClassic(lower, upper float64, vtype VarType) Variable return newVar } -// AddBinaryVar adds a binary variable to the model and returns said variable. +// AddBinaryVariable AddBinaryVar adds a binary variable to the model and returns said variable. func (m *Model) AddBinaryVariable() Variable { return m.AddVariableClassic(0, 1, Binary) } @@ -118,7 +118,7 @@ func (m *Model) AddBinaryVariableMatrix(rows, cols int) [][]Variable { return m.AddVariableMatrix(rows, cols, 0, 1, Binary) } -// AddConstr adds the given constraint to the model. +// AddConstraint AddConstr adds the given constraint to the model. func (m *Model) AddConstraint(constr Constraint, errors ...error) error { // Constants diff --git a/optim/scalar_expression.go b/optim/scalar_expression.go index 93a980e..5035c85 100644 --- a/optim/scalar_expression.go +++ b/optim/scalar_expression.go @@ -68,7 +68,7 @@ type ScalarExpression interface { Check() error } -// NewExpr returns a new expression with a single additive constant value, c, +// NewScalarExpression NewExpr returns a new expression with a single additive constant value, c, // and no variables. Creating an expression like sum := NewExpr(0) is useful // for creating new empty expressions that you can perform operatotions on // later diff --git a/optim/scalar_linear_expr.go b/optim/scalar_linear_expr.go index 6cc63ed..8c74d4e 100644 --- a/optim/scalar_linear_expr.go +++ b/optim/scalar_linear_expr.go @@ -39,7 +39,7 @@ func (sle ScalarLinearExpr) NumVars() int { return sle.X.Len() } -// Vars returns a slice of the Var ids in the expression +// IDs Vars returns a slice of the Var ids in the expression func (sle ScalarLinearExpr) IDs() []uint64 { return sle.X.IDs() } diff --git a/optim/vars.go b/optim/vars.go index a008cad..94270e8 100644 --- a/optim/vars.go +++ b/optim/vars.go @@ -31,7 +31,7 @@ func (v Variable) NumVars() int { return 1 } -// Vars returns a slice of the Var ids in the expression. For a variable, it +// IDs Vars returns a slice of the Var ids in the expression. For a variable, it // always returns a singleton slice with the given variable ID. func (v Variable) IDs() []uint64 { return []uint64{v.ID} diff --git a/problem/examples.go b/problem/examples.go index ed13b44..588b192 100644 --- a/problem/examples.go +++ b/problem/examples.go @@ -6,22 +6,18 @@ import ( "github.com/MatProGo-dev/SymbolicMath.go/symbolic" ) -/* -GetExampleProblem3 -Description: - - Returns the LP from this youtube video: - https://www.youtube.com/watch?v=QAR8zthQypc&t=483s - It should look like this: - Maximize 4 x1 + 3 x2 + 5 x3 - Subject to - x1 + 2 x2 + 2 x3 <= 4 - 3 x1 + 4 x3 <= 6 - 2 x1 + x2 + 4 x3 <= 8 - x1 >= -1.0 - x2 >= -1.0 - x3 >= -1.0 -*/ +// GetExampleProblem3 Returns the LP from this YouTube video: +// https://www.youtube.com/watch?v=QAR8zthQypc&t=483s +// +// It should look like this: +// Maximize 4 x1 + 3 x2 + 5 x3 +// Subject to +// x1 + 2 x2 + 2 x3 <= 4 +// 3 x1 + 4 x3 <= 6 +// 2 x1 + x2 + 4 x3 <= 8 +// x1 >= -1.0 +// x2 >= -1.0 +// x3 >= -1.0 func GetExampleProblem3() *OptimizationProblem { // Setup out := NewProblem("TestProblem3") @@ -61,22 +57,18 @@ func GetExampleProblem3() *OptimizationProblem { return out } -/* -GetExampleProblem4 -Description: - - Returns the LP from this youtube video: - https://www.youtube.com/watch?v=QAR8zthQypc&t=483s - It should look like this: - Maximize 4 x1 + 3 x2 + 5 x3 - Subject to - x1 + 2 x2 + 2 x3 <= 4 - 3 x1 + 4 x3 <= 6 - 2 x1 + x2 + 4 x3 <= 8 - x1 >= 0 - x2 >= 0 - x3 >= 0 -*/ +// GetExampleProblem4 Returns the LP from this YouTube video: +// https://www.youtube.com/watch?v=QAR8zthQypc&t=483s +// +// It should look like this: +// Maximize 4 x1 + 3 x2 + 5 x3 +// Subject to +// x1 + 2 x2 + 2 x3 <= 4 +// 3 x1 + 4 x3 <= 6 +// 2 x1 + x2 + 4 x3 <= 8 +// x1 >= 0 +// x2 >= 0 +// x3 >= 0 func GetExampleProblem4() *OptimizationProblem { // Setup out := NewProblem("TestProblem3") @@ -108,22 +100,18 @@ func GetExampleProblem4() *OptimizationProblem { return out } -/* -GetExampleProblem5 -Description: - - Returns the LP from this youtube video: - https://www.youtube.com/watch?v=QAR8zthQypc&t=483s - It should look like this: - Maximize 4 x1 + 3 x2 + 5 x3 - Subject to - x1 + 2 x2 + 2 x3 <= 4 - 3 x1 + 4 x3 <= 6 - 2 x1 + x2 + 4 x3 <= 8 - x1 >= 0 - x2 >= 0 - x3 >= 0 -*/ +// GetExampleProblem5 Returns the LP from this YouTube video: +// https://www.youtube.com/watch?v=QAR8zthQypc&t=483s +// +// It should look like this: +// Maximize 4 x1 + 3 x2 + 5 x3 +// Subject to +// x1 + 2 x2 + 2 x3 <= 4 +// 3 x1 + 4 x3 <= 6 +// 2 x1 + x2 + 4 x3 <= 8 +// x1 >= 0 +// x2 >= 0 +// x3 >= 0 func GetExampleProblem5() *OptimizationProblem { // Setup out := NewProblem("TestProblem3") diff --git a/problem/objective.go b/problem/objective.go index dfddd41..b3f625f 100644 --- a/problem/objective.go +++ b/problem/objective.go @@ -15,22 +15,12 @@ func NewObjective(e symbolic.Expression, sense ObjSense) *Objective { return &Objective{e, sense} } -/* -IsLinear -Description: - - This method returns true if the objective is linear, false otherwise. -*/ +// IsLinear Returns true if the objective is linear, false otherwise. func (o *Objective) IsLinear() bool { return symbolic.IsLinear(o.Expression) } -/* -SubstituteAccordingTo -Description: - - Substitutes the variables in the objective according to the replacement map. -*/ +// SubstituteAccordingTo Substitutes the variables in the objective according to the replacement map. func (o *Objective) SubstituteAccordingTo(replacementMap map[symbolic.Variable]symbolic.Expression) *Objective { newExpression := o.Expression.SubstituteAccordingTo(replacementMap) return &Objective{newExpression, o.Sense} diff --git a/problem/objective_sense.go b/problem/objective_sense.go index 2bb025e..479a15b 100644 --- a/problem/objective_sense.go +++ b/problem/objective_sense.go @@ -15,12 +15,7 @@ const ( SenseFind ObjSense = "Find" ) -/* -ToObjSense -Description: - - This method converts an input optim.ObjSense to a problem.ObjSense. -*/ +// ToObjSense Converts an input optim.ObjSense to a problem.ObjSense. func ToObjSense(sense optim.ObjSense) ObjSense { if sense == optim.SenseMinimize { return SenseMinimize diff --git a/problem/optimization_problem.go b/problem/optimization_problem.go index c1f52d9..a2a6edb 100644 --- a/problem/optimization_problem.go +++ b/problem/optimization_problem.go @@ -29,21 +29,17 @@ func NewProblem(name string) *OptimizationProblem { return &OptimizationProblem{Name: name} } -/* -This method adds an "unbounded" continuous variable to the model. -*/ +// AddVariable This method adds an "unbounded" continuous variable to the model. func (op *OptimizationProblem) AddVariable() symbolic.Variable { return op.AddRealVariable() } -/* -Adds a Real variable to the model and returns said variable. -*/ +// AddRealVariable Adds a Real variable to the model and returns said variable. func (op *OptimizationProblem) AddRealVariable() symbolic.Variable { return op.AddVariableClassic(-optim.INFINITY, optim.INFINITY, symbolic.Continuous) } -// AddVariable adds a variable of a given variable type to the model given the lower +// AddVariableClassic AddVariable adds a variable of a given variable type to the model given the lower // and upper value limits. This variable is returned. func (op *OptimizationProblem) AddVariableClassic(lower, upper float64, vtype symbolic.VarType) symbolic.Variable { id := uint64(len(op.Variables)) @@ -59,15 +55,13 @@ func (op *OptimizationProblem) AddVariableClassic(lower, upper float64, vtype sy return newVar } -// AddBinaryVar adds a binary variable to the model and returns said variable. +// AddBinaryVariable AddBinaryVar adds a binary variable to the model and returns said variable. func (op *OptimizationProblem) AddBinaryVariable() symbolic.Variable { return op.AddVariableClassic(0, 1, symbolic.Binary) } -/* -Creates a VarVector object using a constructor that assumes you want an "unbounded" vector of real optimization -variables. -*/ +// AddVariableVector Creates a VarVector object using a constructor that assumes you want an "unbounded" vector of real optimization +// variables. func (op *OptimizationProblem) AddVariableVector(dim int) symbolic.VariableVector { // Constants @@ -79,9 +73,7 @@ func (op *OptimizationProblem) AddVariableVector(dim int) symbolic.VariableVecto return varSlice } -/* -The classic version of AddVariableVector defined in the original goop. -*/ +// AddVariableVectorClassic The classic version of AddVariableVector defined in the original goop. func (op *OptimizationProblem) AddVariableVectorClassic( num int, lower, upper float64, vtype symbolic.VarType, ) symbolic.VariableVector { @@ -128,14 +120,12 @@ func (op *OptimizationProblem) AddBinaryVariableMatrix(rows, cols int) [][]symbo return op.AddVariableMatrix(rows, cols, 0, 1, symbolic.Binary) } -/* -Sets the objective of the model given an expression and -objective sense. - -Notes: - To make this function easier to parse, we will assume an expression - is given, even though objectives are normally scalars. -*/ +// Sets the objective of the model given an expression and +// objective sense. +// +// Notes: +// To make this function easier to parse, we will assume an expression +// is given, even though objectives are normally scalars. func (op *OptimizationProblem) SetObjective(e symbolic.Expression, sense ObjSense) error { // Input Processing @@ -149,9 +139,7 @@ func (op *OptimizationProblem) SetObjective(e symbolic.Expression, sense ObjSens return nil } -/* -Converts a constraint in the form of a optim.Constraint object into a symbolic.Constraint object. -*/ +// ToSymbolicConstraint Converts a constraint in the form of a optim.Constraint object into a symbolic.Constraint object. func ToSymbolicConstraint(inputConstraint optim.Constraint) (symbolic.Constraint, error) { // Input Processing @@ -190,9 +178,7 @@ func ToSymbolicConstraint(inputConstraint optim.Constraint) (symbolic.Constraint } -/* -Converts the given input into an optimization problem. -*/ +// From Converts the given input into an optimization problem. func From(inputModel optim.Model) (*OptimizationProblem, error) { // Create a new optimization problem newOptimProblem := NewProblem(inputModel.Name) @@ -253,9 +239,7 @@ func From(inputModel optim.Model) (*OptimizationProblem, error) { } -/* -Checks that the OptimizationProblem is valid. -*/ +// Check Checks that the OptimizationProblem is valid. func (op *OptimizationProblem) Check() error { // Check Objective if op.Objective == (Objective{}) { @@ -287,12 +271,10 @@ func (op *OptimizationProblem) Check() error { return nil } -/* -Checks if the optimization problem is linear. -Per the definition of a linear optimization problem, the problem is linear if and only if: -1. The objective function is linear (i.e., a constant or an affine combination of variables). -2. All constraints are linear (i.e., an affine combination of variables in an inequality or equality). -*/ +// IsLinear Checks if the optimization problem is linear. +// Per the definition of a linear optimization problem, the problem is linear if and only if: +// 1. The objective function is linear (i.e., a constant or an affine combination of variables). +// 2. All constraints are linear (i.e., an affine combination of variables in an inequality or equality). func (op *OptimizationProblem) IsLinear() bool { // Run the check method err := op.CheckIfLinear() @@ -320,13 +302,11 @@ func (op *OptimizationProblem) IsLinear() bool { return true } -/* -Returns the linear INEQUALITY constraint matrices and vectors. -For all linear inequality constraints, we assemble them into the form: - Ax <= b -Where A is the matrix of coefficients, x is the vector of variables, and b is the vector of constants. -We return A and b. -*/ +// LinearInequalityConstraintMatrices Returns the linear INEQUALITY constraint matrices and vectors. +// For all linear inequality constraints, we assemble them into the form: +// Ax <= b +// Where A is the matrix of coefficients, x is the vector of variables, and b is the vector of constants. +// We return A and b. func (op *OptimizationProblem) LinearInequalityConstraintMatrices() (symbolic.KMatrix, symbolic.KVector, error) { // Setup @@ -423,13 +403,11 @@ func (op *OptimizationProblem) LinearInequalityConstraintMatrices() (symbolic.KM return AOut.(symbolic.KMatrix), bOut.(symbolic.KVector), nil } -/* -Returns the linear EQUALITY constraint matrices and vectors. -For all linear equality constraints, we assemble them into the form: - Cx = d -Where C is the matrix of coefficients, x is the vector of variables, and d is the vector of constants. -We return C and d. -*/ +// LinearEqualityConstraintMatrices Returns the linear EQUALITY constraint matrices and vectors. +// For all linear equality constraints, we assemble them into the form: +// Cx = d +// Where C is the matrix of coefficients, x is the vector of variables, and d is the vector of constants. +// We return C and d. func (op *OptimizationProblem) LinearEqualityConstraintMatrices() (symbolic.KMatrix, symbolic.KVector, error) { // Setup @@ -535,14 +513,12 @@ func (op *OptimizationProblem) LinearEqualityConstraintMatrices() (symbolic.KMat return COut2, dOut2, nil } -/* -Transforms the given optimization problem into a new optimization problem -that only contains positive variables. -In math, this means that we will create two new variables (x_+ and x_-) for each -original variable (x), one for the positive part and one for the negative part. -Then, we replace every instance of the original variable with the difference -of the two new variables (x = x_+ - x_-). -*/ +// ToProblemWithAllPositiveVariables Transforms the given optimization problem into a new optimization problem +// that only contains positive variables. +// In math, this means that we will create two new variables (x_+ and x_-) for each +// original variable (x), one for the positive part and one for the negative part. +// Then, we replace every instance of the original variable with the difference +// of the two new variables (x = x_+ - x_-). func (op *OptimizationProblem) ToProblemWithAllPositiveVariables() (*OptimizationProblem, map[symbolic.Variable]symbolic.Expression, error) { // Setup newProblem := NewProblem(op.Name + " (All Positive Variables)") @@ -609,25 +585,23 @@ func (op *OptimizationProblem) ToProblemWithAllPositiveVariables() (*Optimizatio return newProblem, mapFromOriginalVariablesToNewExpressions, nil } -/* -Transforms the given linear program (represented in an OptimizationProblem object) -into a standard form (i.e., only linear equality constraints and a linear objective function). - - sense c^T * x - subject to - A * x = b - x >= 0 - -Where A is a matrix of coefficients, b is a vector of constants, and c is the vector of coefficients -for the objective function. This method also returns the slack variables (i.e., the variables that -are added to the problem to convert the inequalities into equalities). - -Note: - - This method will transform the vector or matrix constraints in the input problem - into a set of scalar constraints. Thus, the number of constraints in your problem may - "seem" to change. -*/ +// ToLPStandardForm1 Transforms the given linear program (represented in an OptimizationProblem object) +// into a standard form (i.e., only linear equality constraints and a linear objective function). +// +// sense c^T * x +// subject to +// A * x = b +// x >= 0 +// +// Where A is a matrix of coefficients, b is a vector of constants, and c is the vector of coefficients +// for the objective function. This method also returns the slack variables (i.e., the variables that +// are added to the problem to convert the inequalities into equalities). +// +// Note: +// +// This method will transform the vector or matrix constraints in the input problem +// into a set of scalar constraints. Thus, the number of constraints in your problem may +// "seem" to change. func (problemIn *OptimizationProblem) ToLPStandardForm1() (*OptimizationProblem, []symbolic.Variable, map[symbolic.Variable]symbolic.Expression, error) { // Input Processing err := problemIn.Check() @@ -744,22 +718,20 @@ func (problemIn *OptimizationProblem) ToLPStandardForm1() (*OptimizationProblem, return problemInStandardForm, slackVariables, originalVariablesToNewVariables, nil } -/* -Transforms the given linear program (represented in an OptimizationProblem object) -into a standard form (i.e., only linear equality constraints and a linear objective function). - - max c^T * x - subject to - A * x = b - x >= 0 - -Where: -- A is a matrix of coefficients, -- b is a vector of constants, and -- c is the vector of coefficients for the objective function. -This method also returns the slack variables (i.e., the variables that -are added to the problem to convert the inequalities into equalities). -*/ +// ToLPStandardForm2 Transforms the given linear program (represented in an OptimizationProblem object) +// into a standard form (i.e., only linear equality constraints and a linear objective function). +// +// max c^T * x +// subject to +// A * x = b +// x >= 0 +// +// Where: +// - A is a matrix of coefficients, +// - b is a vector of constants, and +// - c is the vector of coefficients for the objective function. +// This method also returns the slack variables (i.e., the variables that +// are added to the problem to convert the inequalities into equalities). func (problemIn *OptimizationProblem) ToLPStandardForm2() (*OptimizationProblem, []symbolic.Variable, map[symbolic.Variable]symbolic.Expression, error) { // Input Processing err := problemIn.Check() @@ -789,14 +761,12 @@ func (problemIn *OptimizationProblem) ToLPStandardForm2() (*OptimizationProblem, return problemInStandardForm, slackVariables, originalVariablesToNewVariables, nil } -/* -Returns a new optimization problem that is the same as the original problem -but with all constraints of the following form removed: - x >= 0 - 0 <= x -Where x is a variable in the problem. -This is useful for removing redundant constraints that are already implied by the variable bounds. -*/ +// WithAllPositiveVariableConstraintsRemoved Returns a new optimization problem that is the same as the original problem +// but with all constraints of the following form removed: +// x >= 0 +// 0 <= x +// Where x is a variable in the problem. +// This is useful for removing redundant constraints that are already implied by the variable bounds. func (op *OptimizationProblem) WithAllPositiveVariableConstraintsRemoved() *OptimizationProblem { // Setup newProblem := NewProblem(op.Name) @@ -825,10 +795,8 @@ func (op *OptimizationProblem) WithAllPositiveVariableConstraintsRemoved() *Opti return newProblem } -/* -Checks the current optimization problem to see if it is linear. -Returns an error if the problem is not linear. -*/ +// CheckIfLinear Checks the current optimization problem to see if it is linear. +// Returns an error if the problem is not linear. func (op *OptimizationProblem) CheckIfLinear() error { // Input Processing // Verify that the problem is well-formed @@ -865,10 +833,8 @@ func (op *OptimizationProblem) CheckIfLinear() error { return nil } -/* -Creates a deep copy of the given variable within -the optimization problem. -*/ +// CopyVariable Creates a deep copy of the given variable within +// the optimization problem. func (op *OptimizationProblem) CopyVariable(variable symbolic.Variable) symbolic.Variable { // Setup newVariable := variable @@ -888,9 +854,7 @@ func (op *OptimizationProblem) CopyVariable(variable symbolic.Variable) symbolic return newVariable } -/* -Returns a deep copy of the optimization problem. -*/ +// Copy Returns a deep copy of the optimization problem. func (op *OptimizationProblem) Copy() *OptimizationProblem { // Setup newProblem := NewProblem(op.Name) @@ -915,9 +879,7 @@ func (op *OptimizationProblem) Copy() *OptimizationProblem { return newProblem } -/* -This method simplifies the constraints of the optimization problem by removing redundant constraints. -*/ +// SimplifyConstraints This method simplifies the constraints of the optimization problem by removing redundant constraints. func (op *OptimizationProblem) SimplifyConstraints() { // Setup newConstraints := make([]symbolic.Constraint, 0) @@ -945,9 +907,7 @@ func (op *OptimizationProblem) MakeNotWellDefinedError() ope.NotWellDefinedError } } -/* -Creates a string for the problem. -*/ +// String Creates a string for the problem. func (op *OptimizationProblem) String() string { // Create string for the objective objString := fmt.Sprintf("\n%v\n\t%v\n", op.Objective.Sense, op.Objective.Expression) @@ -982,18 +942,14 @@ func (op *OptimizationProblem) String() string { return objString + constraintsString } -/* -Returns the name of the optimization problem. -(Necessary for implementing the symbolic.Environment interface). -*/ +// GetName Returns the name of the optimization problem. +// (Necessary for implementing the symbolic.Environment interface). func (op *OptimizationProblem) GetName() string { return op.Name } -/* -Adds the given variable to the optimization problem if it is not already present. -Returns true if the variable was added, false if it was already present. -*/ +// TrackVariable Adds the given variable to the optimization problem if it is not already present. +// Returns true if the variable was added, false if it was already present. func (op *OptimizationProblem) TrackVariable(v symbolic.Variable) bool { // Check if the variable is already present for _, variable := range op.Variables { @@ -1007,10 +963,8 @@ func (op *OptimizationProblem) TrackVariable(v symbolic.Variable) bool { return true } -/* -Returns a slice of all variables that are tracked by the optimization problem. -(Necessary for implementing the symbolic.Environment interface). -*/ +// AllTrackedVariables Returns a slice of all variables that are tracked by the optimization problem. +// (Necessary for implementing the symbolic.Environment interface). func (op *OptimizationProblem) AllTrackedVariables() []symbolic.Variable { return op.Variables } diff --git a/problem/utils.go b/problem/utils.go index 291f025..a50b8bd 100644 --- a/problem/utils.go +++ b/problem/utils.go @@ -2,6 +2,8 @@ package problem import "github.com/MatProGo-dev/SymbolicMath.go/symbolic" +// ConstraintIsRedundantGivenOthers returns true if one of the provided +// constraints implies the input constraint is already satisfied. func ConstraintIsRedundantGivenOthers( constraint symbolic.Constraint, constraints []symbolic.Constraint, diff --git a/testing/optim/constant_test.go b/testing/optim/constant_test.go index d2ce2d7..b1dbf8b 100644 --- a/testing/optim/constant_test.go +++ b/testing/optim/constant_test.go @@ -8,18 +8,9 @@ import ( "testing" ) -/* -constant_test.go -Description: - Test for the functions of the constant class for MatProInterface.go. -*/ - -/* -TestK_K1 -Description: - - Tests the ability to convert a float to a variable of type K -*/ +// Test for the functions of the constant class for MatProInterface.go. + +// TestK_K1 Tests the ability to convert a float to a variable of type K func TestK_K1(t *testing.T) { c1 := 2.1 c2 := optim.K(3.2) @@ -33,12 +24,7 @@ func TestK_K1(t *testing.T) { } } -/* -TestK_Variables1 -Description: - - Tests the method for extracting variables from the constant K. -*/ +// TestK_Variables1 Tests the method for extracting variables from the constant K. func TestK_Variables1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -50,12 +36,7 @@ func TestK_Variables1(t *testing.T) { } } -/* -TestK_NumVars1 -Description: - - Tests the method for extracting variables from the constant K. -*/ +// TestK_NumVars1 Tests the method for extracting variables from the constant K. func TestK_NumVars1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -70,13 +51,8 @@ func TestK_NumVars1(t *testing.T) { } } -/* -TestK_IDs1 -Description: - - Tests the method for extracting IDs of variables in the constant K. - There should be no such ids available. -*/ +// TestK_IDs1 Tests the method for extracting IDs of variables in the constant K. +// There should be no such ids available. func TestK_IDs1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -91,12 +67,7 @@ func TestK_IDs1(t *testing.T) { } } -/* -TestK_Coeffs1 -Description: - - Tests the method for extracting coefficients of the constant K. -*/ +// TestK_Coeffs1 Tests the method for extracting coefficients of the constant K. func TestK_Coeffs1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -111,12 +82,7 @@ func TestK_Coeffs1(t *testing.T) { } } -/* -TestK_Constant1 -Description: - - Tests the method for extracting the constant of the constant K. -*/ +// TestK_Constant1 Tests the method for extracting the constant of the constant K. func TestK_Constant1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -131,12 +97,7 @@ func TestK_Constant1(t *testing.T) { } } -/* -TestK_Plus1 -Description: - - Tests the addition operator of a constant with another expression. -*/ +// TestK_Plus1 Tests the addition operator of a constant with another expression. func TestK_Plus1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -160,12 +121,7 @@ func TestK_Plus1(t *testing.T) { } } -/* -TestK_Plus2 -Description: - - Tests the addition operator of a constant with a variable. -*/ +// TestK_Plus2 Tests the addition operator of a constant with a variable. func TestK_Plus2(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -205,12 +161,7 @@ func TestK_Plus2(t *testing.T) { } } -/* -TestK_Plus3 -Description: - - Tests the addition operator of a constant with a scalar linear expression. -*/ +// TestK_Plus3 Tests the addition operator of a constant with a scalar linear expression. func TestK_Plus3(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -258,12 +209,7 @@ func TestK_Plus3(t *testing.T) { } } -/* -TestK_Plus4 -Description: - - Tests the addition operator of a constant with a scalar quadratic expression. -*/ +// TestK_Plus4 Tests the addition operator of a constant with a scalar quadratic expression. func TestK_Plus4(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -322,12 +268,7 @@ func TestK_Plus4(t *testing.T) { } } -/* -TestK_Plus5 -Description: - - Tests the addition operator of a constant with an error. -*/ +// TestK_Plus5 Tests the addition operator of a constant with an error. func TestK_Plus5(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -346,12 +287,7 @@ func TestK_Plus5(t *testing.T) { } -/* -TestK_Plus6 -Description: - - Tests the addition operator of a constant with a constant but with an optional error included. -*/ +// TestK_Plus6 Tests the addition operator of a constant with a constant but with an optional error included. func TestK_Plus6(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -371,12 +307,7 @@ func TestK_Plus6(t *testing.T) { } -/* -TestK_LessEq1 -Description: - - Tests the ability to create constraints using a constant and a variable. -*/ +// TestK_LessEq1 Tests the ability to create constraints using a constant and a variable. func TestK_LessEq1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -407,12 +338,7 @@ func TestK_LessEq1(t *testing.T) { } } -/* -TestK_GreaterEq1 -Description: - - Tests the ability to create constraints using a constant and a scalar linear expression. -*/ +// TestK_GreaterEq1 Tests the ability to create constraints using a constant and a scalar linear expression. func TestK_GreaterEq1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -456,12 +382,7 @@ func TestK_GreaterEq1(t *testing.T) { } } -/* -TestK_Eq1 -Description: - - Tests the ability to create constraints using a constant and a scalar linear expression. -*/ +// TestK_Eq1 Tests the ability to create constraints using a constant and a scalar linear expression. func TestK_Eq1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -504,12 +425,7 @@ func TestK_Eq1(t *testing.T) { } } -/* -TestK_Comparison1 -Description: - - Tests the comparison method's error handling properties. -*/ +// TestK_Comparison1 Tests the comparison method's error handling properties. func TestK_Comparison1(t *testing.T) { // Constants k1 := optim.K(2.3) @@ -531,13 +447,8 @@ func TestK_Comparison1(t *testing.T) { } -/* -TestK_Comparison2 -Description: - - Tests the comparison method's error handling properties - with nil error. -*/ +// TestK_Comparison2 Tests the comparison method's error handling properties +// with nil error. func TestK_Comparison2(t *testing.T) { // Constants k1 := optim.K(2.3) @@ -552,12 +463,7 @@ func TestK_Comparison2(t *testing.T) { } -/* -TestK_Comparison3 -Description: - - Tests the comparison method's error handling properties. -*/ +// TestK_Comparison3 Tests the comparison method's error handling properties. func TestK_Comparison3(t *testing.T) { // Constants k1 := optim.K(2.3) @@ -581,12 +487,7 @@ func TestK_Comparison3(t *testing.T) { } -/* -TestK_Multiply1 -Description: - - Tests the ability to multiply a constant with another constant. -*/ +// TestK_Multiply1 Tests the ability to multiply a constant with another constant. func TestK_Multiply1(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -612,12 +513,7 @@ func TestK_Multiply1(t *testing.T) { } } -/* -TestK_Multiply2 -Description: - - Tests the ability to multiply a constant with a variable. -*/ +// TestK_Multiply2 Tests the ability to multiply a constant with a variable. func TestK_Multiply2(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -653,12 +549,7 @@ func TestK_Multiply2(t *testing.T) { } } -/* -TestK_Multiply3 -Description: - - Tests the ability to multiply a constant with a scalar linear expression. -*/ +// TestK_Multiply3 Tests the ability to multiply a constant with a scalar linear expression. func TestK_Multiply3(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -701,12 +592,7 @@ func TestK_Multiply3(t *testing.T) { } } -/* -TestK_Multiply4 -Description: - - Tests the ability to multiply a constant with a scalar linear expression. -*/ +// TestK_Multiply4 Tests the ability to multiply a constant with a scalar linear expression. func TestK_Multiply4(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -766,13 +652,8 @@ func TestK_Multiply4(t *testing.T) { } } -/* -TestK_Multiply5 -Description: - - Tests the ability to multiply a constant with another constant, - but with a bad error. -*/ +// TestK_Multiply5 Tests the ability to multiply a constant with another constant, +// but with a bad error. func TestK_Multiply5(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -794,12 +675,7 @@ func TestK_Multiply5(t *testing.T) { } -/* -TestK_Multiply6 -Description: - - Tests the ability to multiply a constant with a constant vector. -*/ +// TestK_Multiply6 Tests the ability to multiply a constant with a constant vector. func TestK_Multiply6(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -820,12 +696,7 @@ func TestK_Multiply6(t *testing.T) { } -/* -TestK_Multiply7 -Description: - -Tests the ability to multiply a constant with a float. -*/ +// TestK_Multiply7 Tests the ability to multiply a constant with a float. func TestK_Multiply7(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -851,12 +722,7 @@ func TestK_Multiply7(t *testing.T) { } } -/* -TestK_Multiply8 -Description: - -Tests the ability to multiply a constant with a float. -*/ +// TestK_Multiply8 Tests the ability to multiply a constant with a float. func TestK_Multiply8(t *testing.T) { // Constants c1 := optim.K(3.14) @@ -882,12 +748,7 @@ func TestK_Multiply8(t *testing.T) { } } -/* -TestK_Multiply9 -Description: - -Tests the ability to multiply a constant with a KVectorTranspose. -*/ +// TestK_Multiply9 Tests the ability to multiply a constant with a KVectorTranspose. func TestK_Multiply9(t *testing.T) { // Constants N := 3 @@ -921,13 +782,8 @@ func TestK_Multiply9(t *testing.T) { } } -/* -TestK_Multiply10 -Description: - - Tests the ability to multiply a constant with a VarVector - of non-unit length. -*/ +// TestK_Multiply10 Tests the ability to multiply a constant with a VarVector +// of non-unit length. func TestK_Multiply10(t *testing.T) { // Constants m := optim.NewModel("TestK_Multiply10") @@ -954,13 +810,8 @@ func TestK_Multiply10(t *testing.T) { } } -/* -TestK_Multiply11 -Description: - - Tests the ability to multiply a constant with a VarVector - of unit length. -*/ +// TestK_Multiply11 Tests the ability to multiply a constant with a VarVector +// of unit length. func TestK_Multiply11(t *testing.T) { // Constants m := optim.NewModel("TestK_Multiply10") @@ -985,13 +836,8 @@ func TestK_Multiply11(t *testing.T) { } } -/* -TestK_Multiply12 -Description: - - Tests the multiplication of a constant with a - non-unit VarVectorTranspose. -*/ +// TestK_Multiply12 Tests the multiplication of a constant with a +// non-unit VarVectorTranspose. func TestK_Multiply12(t *testing.T) { // Constants m := optim.NewModel("TestK_Multiply11") @@ -1038,13 +884,8 @@ func TestK_Multiply12(t *testing.T) { } } -/* -TestK_Multiply13 -Description: - - Tests the multiplication of a constant with a - non-unit VarVectorTranspose. -*/ +// TestK_Multiply13 Tests the multiplication of a constant with a +// non-unit VarVectorTranspose. func TestK_Multiply13(t *testing.T) { // Constants m := optim.NewModel("TestK_Multiply13") @@ -1084,12 +925,7 @@ func TestK_Multiply13(t *testing.T) { } } -/* -TestK_Check1 -Description: - - Tests that the Check() method returns nil as expected. -*/ +// TestK_Check1 Tests that the Check() method returns nil as expected. func TestK_Check1(t *testing.T) { // Constants k1 := optim.K(3.14) diff --git a/testing/optim/constraint_test.go b/testing/optim/constraint_test.go index a559fb9..bc14a32 100644 --- a/testing/optim/constraint_test.go +++ b/testing/optim/constraint_test.go @@ -5,18 +5,9 @@ import ( "testing" ) -/* -constraint_test.go -Description: - Tests for all functions and objects defined in the constraint.go file. -*/ - -/* -TestConstraint_IsConstraint1 -Description: - - This test verifies if a scalar constraint is properly detected by IsConstraint. -*/ +// Tests for all functions and objects defined in the constraint.go file. + +// TestConstraint_IsConstraint1 This test verifies if a scalar constraint is properly detected by IsConstraint. func TestConstraint_IsConstraint1(t *testing.T) { // Constants m := optim.NewModel("IsConstraint1") @@ -36,12 +27,7 @@ func TestConstraint_IsConstraint1(t *testing.T) { } } -/* -TestConstraint_IsConstraint2 -Description: - - This test verifies if a vector constraint is properly detected by IsConstraint. -*/ +// TestConstraint_IsConstraint2 This test verifies if a vector constraint is properly detected by IsConstraint. func TestConstraint_IsConstraint2(t *testing.T) { // Constants m := optim.NewModel("IsConstraint2") @@ -64,12 +50,7 @@ func TestConstraint_IsConstraint2(t *testing.T) { } } -/* -TestConstraint_IsConstraint3 -Description: - - This verifies that a float is not a constraint. -*/ +// TestConstraint_IsConstraint3 This verifies that a float is not a constraint. func TestConstraint_IsConstraint3(t *testing.T) { // Constants f1 := 7.5 @@ -80,12 +61,7 @@ func TestConstraint_IsConstraint3(t *testing.T) { } } -/* -TestConstraint_IsConstraint4 -Description: - - This test verifies if a pointer to a scalar constraint is properly detected by IsConstraint. -*/ +// TestConstraint_IsConstraint4 This test verifies if a pointer to a scalar constraint is properly detected by IsConstraint. func TestConstraint_IsConstraint4(t *testing.T) { // Constants m := optim.NewModel("IsConstraint4") @@ -105,12 +81,7 @@ func TestConstraint_IsConstraint4(t *testing.T) { } } -/* -TestConstraint_IsConstraint2 -Description: - - This test verifies if a pointer to vector constraint is properly detected by IsConstraint. -*/ +// TestConstraint_IsConstraint5 This test verifies if a pointer to vector constraint is properly detected by IsConstraint. func TestConstraint_IsConstraint5(t *testing.T) { // Constants m := optim.NewModel("IsConstraint5") @@ -133,12 +104,7 @@ func TestConstraint_IsConstraint5(t *testing.T) { } } -/* -TestConstraint_IsConstraint6 -Description: - - This test verifies if a pointer to a scalar constraint is properly detected by IsConstraint. -*/ +// TestConstraint_IsConstraint6 This test verifies if a pointer to a scalar constraint is properly detected by IsConstraint. func TestConstraint_IsConstraint6(t *testing.T) { // Constants m := optim.NewModel("IsConstraint6") diff --git a/testing/optim/expression_test.go b/testing/optim/expression_test.go index 56f9898..8cb4365 100644 --- a/testing/optim/expression_test.go +++ b/testing/optim/expression_test.go @@ -5,18 +5,9 @@ import ( "testing" ) -/* -expression_test.go -Description: - Tests some of the functions for our Expression interface. -*/ - -/* -TestExpression_NumVars1() -Description: - - Tests that the expression's NumVars() expression works. -*/ +// Tests some of the functions for our Expression interface. + +// TestExpression_NumVars1 Tests that the expression's NumVars() expression works. func TestExpression_NumVars1(t *testing.T) { // Constants m := optim.NewModel("test-expression-numvars1") @@ -56,12 +47,7 @@ func TestExpression_NumVars1(t *testing.T) { } -/* -TestExpression_ToExpression1 -Description: - - Tests whether or not a variable is correctly detected as an expression. -*/ +// TestExpression_ToExpression1 Tests whether or not a variable is correctly detected as an expression. func TestExpression_ToExpression1(t *testing.T) { // Constant v := optim.Variable{ @@ -83,12 +69,7 @@ func TestExpression_ToExpression1(t *testing.T) { } -/* -TestExpression_ToExpression2 -Description: - - Tests whether or not a bool is correctly detected as an expression. -*/ +// TestExpression_ToExpression2 Tests whether or not a bool is correctly detected as an expression. func TestExpression_ToExpression2(t *testing.T) { // Constant b1 := false @@ -103,12 +84,7 @@ func TestExpression_ToExpression2(t *testing.T) { } -/* -TestExpression_ToExpression3 -Description: - - Tests whether or not a ScalarQuadraticExpression is correctly detected as an expression. -*/ +// TestExpression_ToExpression3 Tests whether or not a ScalarQuadraticExpression is correctly detected as an expression. func TestExpression_ToExpression3(t *testing.T) { // Constant v1 := optim.Variable{ @@ -139,12 +115,7 @@ func TestExpression_ToExpression3(t *testing.T) { } -/* -TestExpression_ToExpression4 -Description: - - Tests whether or not a VarVectorTranspose is correctly detected as an expression. -*/ +// TestExpression_ToExpression4 Tests whether or not a VarVectorTranspose is correctly detected as an expression. func TestExpression_ToExpression4(t *testing.T) { // Constant m := optim.NewModel("ToExpression4") @@ -165,12 +136,7 @@ func TestExpression_ToExpression4(t *testing.T) { } -/* -TestExpression_ToExpression5 -Description: - - Tests whether or not a K is correctly detected as an expression. -*/ +// TestExpression_ToExpression5 Tests whether or not a K is correctly detected as an expression. func TestExpression_ToExpression5(t *testing.T) { // Constant k1 := optim.K(3.14) @@ -190,12 +156,7 @@ func TestExpression_ToExpression5(t *testing.T) { } -/* -TestExpression_ToExpression6 -Description: - - Tests whether or not a mat.VecDense is correctly detected as an expression. -*/ +// TestExpression_ToExpression6 Tests whether or not a mat.VecDense is correctly detected as an expression. func TestExpression_ToExpression6(t *testing.T) { // Constant vd1 := optim.OnesVector(7) @@ -215,12 +176,7 @@ func TestExpression_ToExpression6(t *testing.T) { } -/* -TestExpression_ToExpression7 -Description: - - Tests whether or not a KVector is correctly detected as an expression. -*/ +// TestExpression_ToExpression7 Tests whether or not a KVector is correctly detected as an expression. func TestExpression_ToExpression7(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(7)) @@ -240,12 +196,7 @@ func TestExpression_ToExpression7(t *testing.T) { } -/* -TestExpression_ToExpression8 -Description: - - Tests whether or not a VectorLinearExpr is correctly detected as an expression. -*/ +// TestExpression_ToExpression8 Tests whether or not a VectorLinearExpr is correctly detected as an expression. func TestExpression_ToExpression8(t *testing.T) { // Constant m := optim.NewModel("ToExpression8") @@ -267,12 +218,7 @@ func TestExpression_ToExpression8(t *testing.T) { } -/* -TestExpression_ToExpression9 -Description: - - Tests whether or not a KVectorTranspose is correctly detected as an expression. -*/ +// TestExpression_ToExpression9 Tests whether or not a KVectorTranspose is correctly detected as an expression. func TestExpression_ToExpression9(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(7)) @@ -292,12 +238,7 @@ func TestExpression_ToExpression9(t *testing.T) { } -/* -TestExpression_ToExpression10 -Description: - - Tests whether or not a VectorLinearExpressionTranspose is correctly detected as an expression. -*/ +// TestExpression_ToExpression10 Tests whether or not a VectorLinearExpressionTranspose is correctly detected as an expression. func TestExpression_ToExpression10(t *testing.T) { // Constant m := optim.NewModel("ToExpression10") @@ -319,12 +260,7 @@ func TestExpression_ToExpression10(t *testing.T) { } -/* -TestExpression_IsExpression1 -Description: - - Tests whether or not a ScalarQuadraticExpression is correctly detected as an expression. -*/ +// TestExpression_IsExpression1 Tests whether or not a ScalarQuadraticExpression is correctly detected as an expression. func TestExpression_IsExpression1(t *testing.T) { // Constant v1 := optim.Variable{ @@ -350,12 +286,7 @@ func TestExpression_IsExpression1(t *testing.T) { } -/* -TestExpression_IsExpression2 -Description: - - Tests whether or not a Bool is correctly detected as an expression. -*/ +// TestExpression_IsExpression2 Tests whether or not a Bool is correctly detected as an expression. func TestExpression_IsExpression2(t *testing.T) { // Constant b1 := true diff --git a/testing/optim/model_test.go b/testing/optim/model_test.go index e9bd22e..b34dd53 100644 --- a/testing/optim/model_test.go +++ b/testing/optim/model_test.go @@ -1,22 +1,14 @@ package optim -/* -model_test.go -Description: - This script tests the model object. -*/ +// This script tests the model object. import ( - "github.com/MatProGo-dev/MatProInterface.go/optim" "testing" -) -/* -TestModel_NewModel1 -Description: + "github.com/MatProGo-dev/MatProInterface.go/optim" +) - Tests the new model was initialized in the proper way. -*/ +// TestModel_NewModel1 Tests the new model was initialized in the proper way. func TestModel_NewModel1(t *testing.T) { // Constants m := optim.NewModel("test") @@ -27,10 +19,6 @@ func TestModel_NewModel1(t *testing.T) { } } -/* -TestModel_AddVariable1 -Description: -*/ func TestModel_AddVariable1(t *testing.T) { // Constants m := optim.NewModel("test-addvariable1") @@ -58,10 +46,6 @@ func TestModel_AddVariable1(t *testing.T) { } } -/* -TestModel_AddRealVariable1 -Description: -*/ func TestModel_AddRealVariable1(t *testing.T) { // Constants m := optim.NewModel("test-addvariable1") @@ -95,10 +79,6 @@ func TestModel_AddRealVariable1(t *testing.T) { } } -/* -TestModel_AddBinaryVariable1 -Description: -*/ func TestModel_AddBinaryVariable1(t *testing.T) { // Constants m := optim.NewModel("test-addbinaryvariable1") @@ -145,10 +125,6 @@ func TestModel_AddBinaryVariable1(t *testing.T) { } } -/* -TestModel_AddVariableClassic1 -Description: -*/ func TestModel_AddVariableClassic1(t *testing.T) { // Constants m := optim.NewModel("test-addvariable-classic1") @@ -192,13 +168,8 @@ func TestModel_AddVariableClassic1(t *testing.T) { } } -/* -TestModel_AddVariableVector1 -Description: - - This test verifies that the AddVariableVector function correctly adds - a vector of variables. -*/ +// TestModel_AddVariableVector1 This test verifies that the AddVariableVector function correctly adds +// a vector of variables. func TestModel_AddVariableVector1(t *testing.T) { // Constants m := optim.NewModel("test-addbinaryvariable1") @@ -235,13 +206,8 @@ func TestModel_AddVariableVector1(t *testing.T) { } } -/* -TestModel_AddVariableVectorClassic1 -Description: - - This test verifies that the AddVariableVectorClassic function correctly adds - a vector of variables. -*/ +// TestModel_AddVariableVectorClassic1 This test verifies that the AddVariableVectorClassic function correctly adds +// a vector of variables. func TestModel_AddVariableVectorClassic1(t *testing.T) { // Constants m := optim.NewModel("test-model-addvariablevectorclassic1") @@ -278,13 +244,8 @@ func TestModel_AddVariableVectorClassic1(t *testing.T) { } } -/* -TestModel_AddBinaryVariableVector1 -Description: - - This test verifies that the AddBinaryVariableVector function correctly adds - a vector of variables. -*/ +// TestModel_AddBinaryVariableVector1 This test verifies that the AddBinaryVariableVector function correctly adds +// a vector of variables. func TestModel_AddBinaryVariableVector1(t *testing.T) { // Constants m := optim.NewModel("test-model-addvariablevectorclassic1") @@ -321,13 +282,8 @@ func TestModel_AddBinaryVariableVector1(t *testing.T) { } } -/* -TestModel_AddVariableMatrix1 -Description: - - This test will verify that the appropriate number of variables are created by - AddVariableMatrix. -*/ +// TestModel_AddVariableMatrix1 This test will verify that the appropriate number of variables are created by +// AddVariableMatrix. func TestModel_AddVariableMatrix1(t *testing.T) { // Constants m := optim.NewModel("test-addvariablematrix1") @@ -371,13 +327,8 @@ func TestModel_AddVariableMatrix1(t *testing.T) { } } -/* -TestModel_AddBinaryVariableMatrix1 -Description: - - This test will verify that the appropriate number of variables are created by - AddVariableMatrix. -*/ +// TestModel_AddBinaryVariableMatrix1 This test will verify that the appropriate number of variables are created by +// AddVariableMatrix. func TestModel_AddBinaryVariableMatrix1(t *testing.T) { // Constants m := optim.NewModel("test-addbinaryvariablematrix1") @@ -421,13 +372,8 @@ func TestModel_AddBinaryVariableMatrix1(t *testing.T) { } } -/* -TestModel_SetObjective1 -Description: - - This test verifies that the AddVariableVector function and some other functions - can be used to set the objective properly. -*/ +// TestModel_SetObjective1 This test verifies that the AddVariableVector function and some other functions +// can be used to set the objective properly. func TestModel_SetObjective1(t *testing.T) { // Constants m := optim.NewModel("test-setobjective1") @@ -462,12 +408,7 @@ func TestModel_SetObjective1(t *testing.T) { } } -/* -TestModel_AddConstr1 -Description: - - Tests that a simple constraint (scalarlinearconstraint) can be given to the model. -*/ +// TestModel_AddConstr1 Tests that a simple constraint (scalarlinearconstraint) can be given to the model. func TestModel_AddConstr1(t *testing.T) { // Constants m := optim.NewModel("AddConstr1") @@ -497,12 +438,7 @@ func TestModel_AddConstr1(t *testing.T) { } -/* -TestModel_AddConstraint2 -Description: - - Tests that a simple constraint (VectorConstraint) can be given to the model. -*/ +// TestModel_AddConstraint2 Tests that a simple constraint (VectorConstraint) can be given to the model. func TestModel_AddConstraint2(t *testing.T) { // Constants m := optim.NewModel("AddConstraint1") @@ -528,12 +464,7 @@ func TestModel_AddConstraint2(t *testing.T) { } -/* -TestModel_AddConstraint3 -Description: - - Tests that a simple constraint (VectorConstraint) can be given to the model. -*/ +// TestModel_AddConstraint3 Tests that a simple constraint (VectorConstraint) can be given to the model. func TestModel_AddConstraint3(t *testing.T) { // Constants m := optim.NewModel("AddConstraint1") @@ -567,13 +498,8 @@ func TestModel_AddConstraint3(t *testing.T) { } -/* -TestModel_AddConstraint -Description: - - Tests that a simple constraint (VectorConstraint) can be given to the model - along with a nil error. -*/ +// TestModel_AddConstraint4 Tests that a simple constraint (VectorConstraint) can be given to the model +// along with a nil error. func TestModel_AddConstraint4(t *testing.T) { // Constants m := optim.NewModel("AddConstraint1") @@ -608,13 +534,13 @@ func TestModel_AddConstraint4(t *testing.T) { } -///* +// //TestModel_AddConstraint5 -//Description: +// // // Tests that a simple constraint (VectorConstraint) can be given to the model // along with a bool. -//*/ +// //func TestModel_AddConstraint5(t *testing.T) { // // Constants // m := optim.NewModel("AddConstraint5") @@ -651,13 +577,13 @@ func TestModel_AddConstraint4(t *testing.T) { // //} -///* +// //TestModel_AddConstraint6 -//Description: +// // // Tests that a simple constraint (VectorConstraint) can be given to the model // along with a couple of bools. -//*/ +// //func TestModel_AddConstraint6(t *testing.T) { // // Constants // m := optim.NewModel("AddConstraint6") diff --git a/testing/optim/objective_test.go b/testing/optim/objective_test.go index 6542e7e..87e0ca9 100644 --- a/testing/optim/objective_test.go +++ b/testing/optim/objective_test.go @@ -5,12 +5,7 @@ import ( "testing" ) -/* -objective_test.go -Description: - - Tests for the Objective object. -*/ +// TestObjective_NewObjective1 Tests for the Objective object. func TestObjective_NewObjective1(t *testing.T) { // Constants m := optim.NewModel("test-newobjective1") diff --git a/testing/optim/operators_test.go b/testing/optim/operators_test.go index b261297..b669962 100644 --- a/testing/optim/operators_test.go +++ b/testing/optim/operators_test.go @@ -7,12 +7,7 @@ import ( "testing" ) -/* -TestOperators_Eq1 -Description: - - Tests whether or not Eq works for two valid expressions. -*/ +// TestOperators_Eq1 Tests whether or not Eq works for two valid expressions. func TestOperators_Eq1(t *testing.T) { // Constants m := optim.NewModel("test-operators-eq1") @@ -36,12 +31,7 @@ func TestOperators_Eq1(t *testing.T) { } -/* -TestOperators_LessEq1 -Description: - - Tests whether or not a good LessEq comparison successfully is built and contains the right variables. -*/ +// TestOperators_LessEq1 Tests whether or not a good LessEq comparison successfully is built and contains the right variables. func TestOperators_LessEq1(t *testing.T) { // Constants desLength := 5 @@ -82,12 +72,7 @@ func TestOperators_LessEq1(t *testing.T) { } -/* -TestOperators_GreaterEq1 -Description: - - Tests whether or not GreaterEq works for two valid expressions. -*/ +// TestOperators_GreaterEq1 Tests whether or not GreaterEq works for two valid expressions. func TestOperators_GreaterEq1(t *testing.T) { // Constants m := optim.NewModel("test-operators-greatereq1") @@ -116,12 +101,7 @@ func TestOperators_GreaterEq1(t *testing.T) { } -/* -TestOperators_Comparison1 -Description: - - Tests whether or not Comparison works for two valid expressions. -*/ +// TestOperators_Comparison1 Tests whether or not Comparison works for two valid expressions. func TestOperators_Comparison1(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison1") @@ -150,13 +130,8 @@ func TestOperators_Comparison1(t *testing.T) { } -/* -TestOperators_Comparison2 -Description: - - Tests whether or not Comparison works for a valid expression and - a boolean. -*/ +// TestOperators_Comparison2 Tests whether or not Comparison works for a valid expression and +// a boolean. func TestOperators_Comparison2(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison2") @@ -182,13 +157,8 @@ func TestOperators_Comparison2(t *testing.T) { } } -/* -TestOperators_Comparison3 -Description: - - Tests whether or not Comparison works for a valid expression and - a boolean. -*/ +// TestOperators_Comparison3 Tests whether or not Comparison works for a valid expression and +// a boolean. func TestOperators_Comparison3(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison3") @@ -209,12 +179,7 @@ func TestOperators_Comparison3(t *testing.T) { } } -/* -TestOperators_Comparison4 -Description: - - Tests whether or not Comparison works for two valid expressions. -*/ +// TestOperators_Comparison4 Tests whether or not Comparison works for two valid expressions. func TestOperators_Comparison4(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison4") @@ -238,13 +203,8 @@ func TestOperators_Comparison4(t *testing.T) { } -/* -TestOperators_Comparison5 -Description: - - Tests whether or not Comparison works for a valid expression and - a boolean. -*/ +// TestOperators_Comparison5 Tests whether or not Comparison works for a valid expression and +// a boolean. func TestOperators_Comparison5(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison3") @@ -265,13 +225,8 @@ func TestOperators_Comparison5(t *testing.T) { } } -/* -TestOperators_Comparison6 -Description: - - Tests whether or not Comparison works for a valid expression and - a boolean. -*/ +// TestOperators_Comparison6 Tests whether or not Comparison works for a valid expression and +// a boolean. func TestOperators_Comparison6(t *testing.T) { // Constants m := optim.NewModel("test-operators-comparison2") @@ -296,10 +251,7 @@ func TestOperators_Comparison6(t *testing.T) { } } -/* -TestOperators_Multiply1 -Description: -*/ + func TestOperators_Multiply1(t *testing.T) { // Constants m := optim.NewModel("test-operators-multiply1") @@ -323,12 +275,7 @@ func TestOperators_Multiply1(t *testing.T) { } -/* -TestOperators_Multiply2 -Description: - - Tests multiply of scalar float with ScalarLinearExpression -*/ +// TestOperators_Multiply2 Tests multiply of scalar float with ScalarLinearExpression func TestOperators_Multiply2(t *testing.T) { // Constants m := optim.NewModel("test-operators-multiply1") @@ -370,10 +317,7 @@ func TestOperators_Multiply2(t *testing.T) { } -/* -TestOperators_Multiply3 -Description: -*/ + func TestOperators_Multiply3(t *testing.T) { // Constants m := optim.NewModel("test-operators-multiply3") @@ -397,12 +341,7 @@ func TestOperators_Multiply3(t *testing.T) { } -/* -TestOperators_Multiply4 -Description: - - Multiply a vecdense with a VarVector. Idk if this will work at all? -*/ +// TestOperators_Multiply4 Multiply a vecdense with a VarVector. Idk if this will work at all? func TestOperators_Multiply4(t *testing.T) { // Constants m := optim.NewModel("test-operators-multiply3") @@ -424,12 +363,7 @@ func TestOperators_Multiply4(t *testing.T) { } -/* -TestOperators_Multiply5 -Description: - - Multiply a KVectorTranspose with a VarVector. Should return a LinearExpression value -*/ +// TestOperators_Multiply5 Multiply a KVectorTranspose with a VarVector. Should return a LinearExpression value func TestOperators_Multiply5(t *testing.T) { // Constants m := optim.NewModel("test-operators-multiply3") @@ -499,12 +433,7 @@ func TestOperators_Multiply5(t *testing.T) { // optim.Dot(xs.Elements, coeffs) //} -/* -TestOperators_Sum1 -Description: - - Sums two expressions together. -*/ +// TestOperators_Sum1 Sums two expressions together. func TestOperators_Sum1(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum1") @@ -534,13 +463,8 @@ func TestOperators_Sum1(t *testing.T) { } } -/* -TestOperators_Sum2 -Description: - - Sums two expressions together. Tests whether or not error handling works when - first argument is not an expression. -*/ +// TestOperators_Sum2 Sums two expressions together. Tests whether or not error handling works when +// first argument is not an expression. func TestOperators_Sum2(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum1") @@ -562,13 +486,8 @@ func TestOperators_Sum2(t *testing.T) { } } -/* -TestOperators_Sum3 -Description: - - Sums two expressions together. Tests whether or not Sum of single expression is - properly returned. -*/ +// TestOperators_Sum3 Sums two expressions together. Tests whether or not Sum of single expression is +// properly returned. func TestOperators_Sum3(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum3") @@ -622,13 +541,8 @@ func TestOperators_Sum3(t *testing.T) { } } -/* -TestOperators_Sum4 -Description: - - Sums two expressions together. Tests whether or not single expression input - with error input is properly returned (when error is nil). -*/ +// TestOperators_Sum4 Sums two expressions together. Tests whether or not single expression input +// with error input is properly returned (when error is nil). func TestOperators_Sum4(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum4") @@ -683,13 +597,8 @@ func TestOperators_Sum4(t *testing.T) { } } -/* -TestOperators_Sum5 -Description: - - Sums two expressions together. Tests whether or not single expression input - with error input is properly errored (when error is NOT nil). -*/ +// TestOperators_Sum5 Sums two expressions together. Tests whether or not single expression input +// with error input is properly errored (when error is NOT nil). func TestOperators_Sum5(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum4") @@ -714,13 +623,8 @@ func TestOperators_Sum5(t *testing.T) { } -/* -TestOperators_Sum6 -Description: - - Sums two expressions together. Tests whether or not two expression input - with error input is properly returned (when error between is nil). -*/ +// TestOperators_Sum6 Sums two expressions together. Tests whether or not two expression input +// with error input is properly returned (when error between is nil). func TestOperators_Sum6(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum4") @@ -775,13 +679,8 @@ func TestOperators_Sum6(t *testing.T) { } } -/* -TestOperators_Sum7 -Description: - - Sums two expressions together. Tests whether or not two expression input - with error input is properly returned (when no error between). -*/ +// TestOperators_Sum7 Sums two expressions together. Tests whether or not two expression input +// with error input is properly returned (when no error between). func TestOperators_Sum7(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum7") @@ -836,13 +735,8 @@ func TestOperators_Sum7(t *testing.T) { } } -/* -TestOperators_Sum8 -Description: - - Sums two expressions together. Tests whether or not two vector expression input - with error input is properly returned (when no error between). -*/ +// TestOperators_Sum8 Sums two expressions together. Tests whether or not two vector expression input +// with error input is properly returned (when no error between). func TestOperators_Sum8(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum8") @@ -892,13 +786,8 @@ func TestOperators_Sum8(t *testing.T) { } } -/* -TestOperators_Sum9 -Description: - - Sums two expressions together. Tests whether or not sum of expression - and bool throws error (as expected). -*/ +// TestOperators_Sum9 Sums two expressions together. Tests whether or not sum of expression +// and bool throws error (as expected). func TestOperators_Sum9(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum9") @@ -918,13 +807,8 @@ func TestOperators_Sum9(t *testing.T) { } } -/* -TestOperators_Sum10 -Description: - - Sums two expressions together. Tests whether or not sum of three expressions - is correct. -*/ +// TestOperators_Sum10 Sums two expressions together. Tests whether or not sum of three expressions +// is correct. func TestOperators_Sum10(t *testing.T) { // Constants m := optim.NewModel("test-operators-sum10") diff --git a/testing/optim/scalar_constraint_test.go b/testing/optim/scalar_constraint_test.go index 527b19e..e20739b 100644 --- a/testing/optim/scalar_constraint_test.go +++ b/testing/optim/scalar_constraint_test.go @@ -1,10 +1,6 @@ package optim -/* -scalar_constraint_test.go -Description: - Creates the scalar constraint object. -*/ +// Creates the scalar constraint object. import ( "testing" @@ -34,13 +30,8 @@ func TestScalarConstraint_ScalarConstraint1(t *testing.T) { } } -/* -TestScalarConstraint_IsLinear1 -Description: - - Detects whether a simple inequality between - a variable and a constant is a linear constraint. -*/ +// TestScalarConstraint_IsLinear1 Detects whether a simple inequality between +// a variable and a constant is a linear constraint. func TestScalarConstraint_IsLinear1(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test1") @@ -64,13 +55,8 @@ func TestScalarConstraint_IsLinear1(t *testing.T) { } -/* -TestScalarConstraint_IsLinear2 -Description: - - Detects whether a simple inequality between - a variable and a constant is a linear constraint. -*/ +// TestScalarConstraint_IsLinear2 Detects whether a simple inequality between +// a variable and a constant is a linear constraint. func TestScalarConstraint_IsLinear2(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test1") @@ -100,14 +86,9 @@ func TestScalarConstraint_IsLinear2(t *testing.T) { } -/* -TestScalarConstraint_IsLinear3 -Description: - - Detects whether a simple inequality between - a variable and a constant is a quadratic expression. - The function should identify that this is NOT a linear expression. -*/ +// TestScalarConstraint_IsLinear3 Detects whether a simple inequality between +// a variable and a constant is a quadratic expression. +// The function should identify that this is NOT a linear expression. func TestScalarConstraint_IsLinear3(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test1") @@ -137,13 +118,8 @@ func TestScalarConstraint_IsLinear3(t *testing.T) { } -/* -TestScalarConstraint_Simplify1 -Description: - - Attempts to simplify the constraint between - a scalar linear epression and a scalar linear expression. -*/ +// TestScalarConstraint_Simplify1 Attempts to simplify the constraint between +// a scalar linear epression and a scalar linear expression. func TestScalarConstraint_Simplify1(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test1") @@ -177,15 +153,10 @@ func TestScalarConstraint_Simplify1(t *testing.T) { } } -/* -TestScalarConstraint_Simplify2 -Description: - - Attempts to simplify the constraint between - a scalar linear epression and a variable. - The resulting constraint should have a zero remainder on the right hand side - and the left hand side should contain a variable vector with 1 more element than it started with. -*/ +// TestScalarConstraint_Simplify2 Attempts to simplify the constraint between +// a scalar linear epression and a variable. +// The resulting constraint should have a zero remainder on the right hand side +// and the left hand side should contain a variable vector with 1 more element than it started with. func TestScalarConstraint_Simplify2(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test2") @@ -219,13 +190,8 @@ func TestScalarConstraint_Simplify2(t *testing.T) { } } -/* -TestScalarConstraint_Simplify3 -Description: - - Attempts to simplify the constraint between - a scalar linear epression and a scalar quadratic expression. -*/ +// TestScalarConstraint_Simplify3 Attempts to simplify the constraint between +// a scalar linear epression and a scalar quadratic expression. func TestScalarConstraint_Simplify3(t *testing.T) { // Constants m := optim.NewModel("scalar-constraint-test3") diff --git a/testing/optim/scalar_expression_test.go b/testing/optim/scalar_expression_test.go index 3642845..579c9ea 100644 --- a/testing/optim/scalar_expression_test.go +++ b/testing/optim/scalar_expression_test.go @@ -5,20 +5,11 @@ import ( "testing" ) -/* -scalar_expression_test.go -Description: - Tests whether or not the functions designed for the ScalarExpression interace - works well. -*/ +// Tests whether or not the functions designed for the ScalarExpression interace +// works well. -/* -TestScalarExpression_NewScalarExpression1 -Description: - - Tests how well the algorithm detects a small scalar expression created with - NewScalarExpression. -*/ +// TestScalarExpression_NewScalarExpression1 Tests how well the algorithm detects a small scalar expression created with +// NewScalarExpression. func TestScalarExpression_NewScalarExpression1(t *testing.T) { // Constants se := optim.NewScalarExpression(2.1) @@ -36,12 +27,7 @@ func TestScalarExpression_NewScalarExpression1(t *testing.T) { } } -/* -TestScalarExpression_IsScalarExpression1 -Description: - - Tests whether or not the IsScalarExpression function works on ScalarQuadraticExpression. -*/ +// TestScalarExpression_IsScalarExpression1 Tests whether or not the IsScalarExpression function works on ScalarQuadraticExpression. func TestScalarExpression_IsScalarExpression1(t *testing.T) { // Constants m := optim.NewModel("testse_IsScalarExpression1") @@ -61,13 +47,8 @@ func TestScalarExpression_IsScalarExpression1(t *testing.T) { } } -/* -TestScalarExpression_ToScalarExpression1 -Description: - - Tests how the conversion function ToScalarExpression() works on a - scalar quadratic expression. -*/ +// TestScalarExpression_ToScalarExpression1 Tests how the conversion function ToScalarExpression() works on a +// scalar quadratic expression. func TestScalarExpression_ToScalarExpression1(t *testing.T) { // Constants m := optim.NewModel("testse_ToScalarExpression1") diff --git a/testing/optim/scalar_linear_expr_test.go b/testing/optim/scalar_linear_expr_test.go index 2f6777d..14dc098 100644 --- a/testing/optim/scalar_linear_expr_test.go +++ b/testing/optim/scalar_linear_expr_test.go @@ -42,12 +42,7 @@ func TestLinearExpr_CoeffsAndConstant1(t *testing.T) { } } -/* -TestScalarLinearExpr_IDs1 -Description: - - Tests how well the IDs() method works for the ScalarLinearExpr -*/ +// TestScalarLinearExpr_IDs1 Tests how well the IDs() method works for the ScalarLinearExpr func TestScalarLinearExpr_IDs1(t *testing.T) { // Constants N := 4 @@ -86,12 +81,7 @@ func TestScalarLinearExpr_IDs1(t *testing.T) { } -/* -TestScalarLinearExpr_GreaterEq1 -Description: - - Makes sure that GreaterEq works for an arbitrary input. -*/ +// TestScalarLinearExpr_GreaterEq1 Makes sure that GreaterEq works for an arbitrary input. func TestScalarLinearExpr_GreaterEq1(t *testing.T) { // Constants m := optim.NewModel("SLE-GreaterEq1") @@ -129,13 +119,8 @@ func TestScalarLinearExpr_GreaterEq1(t *testing.T) { } -/* -TestScalarLinearExpr_Eq1 -Description: - - Makes sure that Eq works with a - variable. -*/ +// TestScalarLinearExpr_Eq1 Makes sure that Eq works with a +// variable. func TestScalarLinearExpr_Eq1(t *testing.T) { // Constants m := optim.NewModel("SLE-Eq1") @@ -190,13 +175,8 @@ func TestScalarLinearExpr_Eq1(t *testing.T) { } -/* -TestScalarLinearExpr_Comparison1 -Description: - - Makes sure that Comparison throws an error when compared with a - constant with a malformed sle! -*/ +// TestScalarLinearExpr_Comparison1 Makes sure that Comparison throws an error when compared with a +// constant with a malformed sle! func TestScalarLinearExpr_Comparison1(t *testing.T) { // Constants m := optim.NewModel("SLE-Eq1") @@ -231,13 +211,8 @@ func TestScalarLinearExpr_Comparison1(t *testing.T) { } -/* -TestScalarLinearExpr_Plus1 -Description: - - This function should test the Plus method of ScalarLinearExpr for a very nice case. - Two SLEs with the SAME varvector and simple constants. -*/ +// TestScalarLinearExpr_Plus1 This function should test the Plus method of ScalarLinearExpr for a very nice case. +// Two SLEs with the SAME varvector and simple constants. func TestScalarLinearExpr_Plus1(t *testing.T) { // Constants L1 := optim.OnesVector(2) @@ -283,13 +258,8 @@ func TestScalarLinearExpr_Plus1(t *testing.T) { } } -/* -TestScalarLinearExpr_Plus2 -Description: - - This function should test the Plus method of ScalarLinearExpr for a very nice case. - Two SLEs with very similar varvector objects simple constants. -*/ +// TestScalarLinearExpr_Plus2 This function should test the Plus method of ScalarLinearExpr for a very nice case. +// Two SLEs with very similar varvector objects simple constants. func TestScalarLinearExpr_Plus2(t *testing.T) { // Constants L1 := optim.OnesVector(2) @@ -370,12 +340,7 @@ func TestScalarLinearExpr_Plus2(t *testing.T) { } } -/* -TestScalarLinearExpr_Plus3 -Description: - - This function should test the Plus method of ScalarLinearExpr for the case of (SLE + K). -*/ +// TestScalarLinearExpr_Plus3 This function should test the Plus method of ScalarLinearExpr for the case of (SLE + K). func TestScalarLinearExpr_Plus3(t *testing.T) { // Constants L1 := optim.OnesVector(2) @@ -424,13 +389,8 @@ func TestScalarLinearExpr_Plus3(t *testing.T) { } } -/* -TestScalarLinearExpression_Plus3 -Description: - - Tests whether or not the Plus() function works for a linear expression and a quadratic one containing - slightly different variables. -*/ +// TestScalarLinearExpression_Plus3 Tests whether or not the Plus() function works for a linear expression and a quadratic one containing +// slightly different variables. func TestScalarLinearExpression_Plus3(t *testing.T) { // Constants m := optim.NewModel("Plus3") @@ -511,13 +471,8 @@ func TestScalarLinearExpression_Plus3(t *testing.T) { } -/* -TestScalarLinearExpression_Plus4 -Description: - - Tests whether or not the Plus() function works for a linear expression and a single variable that is not known - slightly different variables. -*/ +// TestScalarLinearExpression_Plus4 Tests whether or not the Plus() function works for a linear expression and a single variable that is not known +// slightly different variables. func TestScalarLinearExpression_Plus4(t *testing.T) { // Constants m := optim.NewModel("Plus4") @@ -574,13 +529,8 @@ func TestScalarLinearExpression_Plus4(t *testing.T) { } -/* -TestScalarLinearExpression_Plus5 -Description: - - Verifies that Plus() throws an error when the scalar linear expression - is not well-formed. -*/ +// TestScalarLinearExpression_Plus5 Verifies that Plus() throws an error when the scalar linear expression +// is not well-formed. func TestScalarLinearExpression_Plus5(t *testing.T) { // Constants m := optim.NewModel("TestSLE Plus5") @@ -613,13 +563,8 @@ func TestScalarLinearExpression_Plus5(t *testing.T) { } -/* -TestScalarLinearExpression_Plus6 -Description: - - Verifies that Plus() throws an error when a non-nil - error is provided. -*/ +// TestScalarLinearExpression_Plus6 Verifies that Plus() throws an error when a non-nil +// error is provided. func TestScalarLinearExpression_Plus6(t *testing.T) { // Constants m := optim.NewModel("TestSLE Plus6") @@ -648,13 +593,8 @@ func TestScalarLinearExpression_Plus6(t *testing.T) { } -/* -TestScalarLinearExpression_Plus7 -Description: - - Verifies that Plus() throws an error when a nil - error is provided. -*/ +// TestScalarLinearExpression_Plus7 Verifies that Plus() throws an error when a nil +// error is provided. func TestScalarLinearExpression_Plus7(t *testing.T) { // Constants m := optim.NewModel("TestSLE Plus7") @@ -692,13 +632,8 @@ func TestScalarLinearExpression_Plus7(t *testing.T) { } -/* -TestScalarLinearExpression_Plus8 -Description: - - Verifies that Plus() throws an error when a bad - input is provided. -*/ +// TestScalarLinearExpression_Plus8 Verifies that Plus() throws an error when a bad +// input is provided. func TestScalarLinearExpression_Plus8(t *testing.T) { // Constants m := optim.NewModel("TestSLE Plus8") @@ -732,12 +667,7 @@ func TestScalarLinearExpression_Plus8(t *testing.T) { } -/* -TestScalarLinearExpr_Multiply1 -Description: - - Tests the Multiply() function for an input of a float. -*/ +// TestScalarLinearExpr_Multiply1 Tests the Multiply() function for an input of a float. func TestScalarLinearExpr_Multiply1(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply1") @@ -785,12 +715,7 @@ func TestScalarLinearExpr_Multiply1(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply2 -Description: - - Tests the Multiply() function for an input of a constant K. -*/ +// TestScalarLinearExpr_Multiply2 Tests the Multiply() function for an input of a constant K. func TestScalarLinearExpr_Multiply2(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply2") @@ -838,12 +763,7 @@ func TestScalarLinearExpr_Multiply2(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply3 -Description: - - Tests the Multiply() function for an input of a variable v. -*/ +// TestScalarLinearExpr_Multiply3 Tests the Multiply() function for an input of a variable v. func TestScalarLinearExpr_Multiply3(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply3") @@ -898,13 +818,8 @@ func TestScalarLinearExpr_Multiply3(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply4 -Description: - - Tests the Multiply() function for an input of a variable v. - Input sle has offset. -*/ +// TestScalarLinearExpr_Multiply4 Tests the Multiply() function for an input of a variable v. +// Input sle has offset. func TestScalarLinearExpr_Multiply4(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply4") @@ -967,12 +882,7 @@ func TestScalarLinearExpr_Multiply4(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply5 -Description: - - Tests the Multiply() function for an input of a variable (different from original). -*/ +// TestScalarLinearExpr_Multiply5 Tests the Multiply() function for an input of a variable (different from original). func TestScalarLinearExpr_Multiply5(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply5") @@ -1059,12 +969,7 @@ func TestScalarLinearExpr_Multiply5(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply6 -Description: - - Tests the Multiply() function for an input of a scalar linear expression. -*/ +// TestScalarLinearExpr_Multiply6 Tests the Multiply() function for an input of a scalar linear expression. func TestScalarLinearExpr_Multiply6(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply5") @@ -1128,12 +1033,7 @@ func TestScalarLinearExpr_Multiply6(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply7 -Description: - - Tests the Multiply() function for an input of a scalar linear expression. -*/ +// TestScalarLinearExpr_Multiply7 Tests the Multiply() function for an input of a scalar linear expression. func TestScalarLinearExpr_Multiply7(t *testing.T) { // Constants m := optim.NewModel("Test-sle-Multiply7") @@ -1167,13 +1067,8 @@ func TestScalarLinearExpr_Multiply7(t *testing.T) { } -/* -TestScalarLinearExpr_Multiply8 -Description: - - Verifies that a malformed scalar linear expression throws an - error when used in a multiply(). -*/ +// TestScalarLinearExpr_Multiply8 Verifies that a malformed scalar linear expression throws an +// error when used in a multiply(). func TestScalarLinearExpr_Multiply8(t *testing.T) { // Constants N := 4 @@ -1204,13 +1099,8 @@ func TestScalarLinearExpr_Multiply8(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply9 -Description: - - Verifies that a multiplication with a vector of non-unit length - throws an error when used in a multiply(). -*/ +// TestScalarLinearExpr_Multiply9 Verifies that a multiplication with a vector of non-unit length +// throws an error when used in a multiply(). func TestScalarLinearExpr_Multiply9(t *testing.T) { // Constants N := 4 @@ -1243,13 +1133,8 @@ func TestScalarLinearExpr_Multiply9(t *testing.T) { } } -/* -TestScalarLinearExpr_Multiply10 -Description: - - Verifies that a multiplication with a KVector of unit length - doesn't throw an error. -*/ +// TestScalarLinearExpr_Multiply10 Verifies that a multiplication with a KVector of unit length +// doesn't throw an error. func TestScalarLinearExpr_Multiply10(t *testing.T) { // Constants N := 2 @@ -1287,12 +1172,7 @@ func TestScalarLinearExpr_Multiply10(t *testing.T) { } } -/* -TestScalarLinearExpr_NewLinearExpr1 -Description: - - Tests that the scalar linear expression is properly created by NewLinearExpr. -*/ +// TestScalarLinearExpr_NewLinearExpr1 Tests that the scalar linear expression is properly created by NewLinearExpr. func TestScalarLinearExpr_NewLinearExpr1(t *testing.T) { // Constants se := optim.NewLinearExpr(2.1) @@ -1310,12 +1190,7 @@ func TestScalarLinearExpr_NewLinearExpr1(t *testing.T) { } } -/* -TestScalarLinearExpr_Variables1 -Description: - - Verifies that this function works well for SLE's of one variable. -*/ +// TestScalarLinearExpr_Variables1 Verifies that this function works well for SLE's of one variable. func TestScalarLinearExpr_Variables1(t *testing.T) { // Constants m := optim.NewModel("testSLE-variables1") @@ -1344,12 +1219,7 @@ func TestScalarLinearExpr_Variables1(t *testing.T) { } } -/* -TestScalarLinearExpr_Variables2 -Description: - - Verifies that this function works well for SLE's of ten variable. -*/ +// TestScalarLinearExpr_Variables2 Verifies that this function works well for SLE's of ten variable. func TestScalarLinearExpr_Variables2(t *testing.T) { // Constants m := optim.NewModel("testSLE-variables1") diff --git a/testing/optim/scalar_quadratic_expression_test.go b/testing/optim/scalar_quadratic_expression_test.go index 851cbb5..d32960a 100644 --- a/testing/optim/scalar_quadratic_expression_test.go +++ b/testing/optim/scalar_quadratic_expression_test.go @@ -8,18 +8,9 @@ import ( "testing" ) -/* -scalar_quadratic_expression_test.go -Description: - Tests some of the basic functions of the quadraticExpr class. -*/ - -/* -TestQuadraticExpr_NewQuadraticExpr_q01 -Description: - - Tests whether or not the function returns two variables for a simple expression. -*/ +// Tests some of the basic functions of the quadraticExpr class. + +// TestQuadraticExpr_NewQuadraticExpr_qb01 Tests whether or not the function returns two variables for a simple expression. func TestQuadraticExpr_NewQuadraticExpr_qb01(t *testing.T) { // Constants Q1 := [][]float64{ @@ -45,12 +36,7 @@ func TestQuadraticExpr_NewQuadraticExpr_qb01(t *testing.T) { } -/* -TestQuadraticExpr_NewQuadraticExpr_q02 -Description: - - Tests whether or not the NewQuadraticExpr_q0() function gracefully fails when given a badly sized Q matrix. -*/ +// TestQuadraticExpr_NewQuadraticExpr_qb02 Tests whether or not the NewQuadraticExpr_q0() function gracefully fails when given a badly sized Q matrix. func TestQuadraticExpr_NewQuadraticExpr_qb02(t *testing.T) { // Constants Q2 := [][]float64{ @@ -79,13 +65,8 @@ func TestQuadraticExpr_NewQuadraticExpr_qb02(t *testing.T) { } -/* -TestQuadraticExpr_NewQuadraticExpr_q03 -Description: - - Tests whether or not the NewQuadraticExpr_q0() function gracefully fails when given a badly sized Q matrix. - (Wrong number of columns) -*/ +// TestQuadraticExpr_NewQuadraticExpr_qb03 Tests whether or not the NewQuadraticExpr_q0() function gracefully fails when given a badly sized Q matrix. +// (Wrong number of columns) func TestQuadraticExpr_NewQuadraticExpr_qb03(t *testing.T) { // Constants Q3 := [][]float64{ @@ -115,12 +96,7 @@ func TestQuadraticExpr_NewQuadraticExpr_qb03(t *testing.T) { } -/* -TestQuadraticExpr_NumVars1 -Description: - - Tests whether or not the function returns two variables for a simple expression. -*/ +// TestQuadraticExpr_NumVars1 Tests whether or not the function returns two variables for a simple expression. func TestQuadraticExpr_NumVars1(t *testing.T) { // Constants m := optim.NewModel("NumVars1") @@ -149,12 +125,7 @@ func TestQuadraticExpr_NumVars1(t *testing.T) { } } -/* -TestQuadraticExpr_NumVars2 -Description: - - Tests whether or not the function returns three variables for a more complex expression. -*/ +// TestQuadraticExpr_NumVars2 Tests whether or not the function returns three variables for a more complex expression. func TestQuadraticExpr_NumVars2(t *testing.T) { // Constants m := optim.NewModel("NumVars2") @@ -190,12 +161,7 @@ func TestQuadraticExpr_NumVars2(t *testing.T) { } } -/* -TestQuadraticExpr_NumVars3 -Description: - - Tests whether or not the function returns one variables for a more complex expression. -*/ +// TestQuadraticExpr_NumVars3 Tests whether or not the function returns one variables for a more complex expression. func TestQuadraticExpr_NumVars3(t *testing.T) { // Constants m := optim.NewModel("NumVars3") @@ -226,12 +192,7 @@ func TestQuadraticExpr_NumVars3(t *testing.T) { } } -/* -TestQuadraticExpr_Vars1 -Description: - - Tests whether or not the function returns two variables for a simple expression. -*/ +// TestQuadraticExpr_Vars1 Tests whether or not the function returns two variables for a simple expression. func TestQuadraticExpr_Vars1(t *testing.T) { // Constants m := optim.NewModel("Vars1") @@ -274,12 +235,7 @@ func TestQuadraticExpr_Vars1(t *testing.T) { } -/* -TestQuadraticExpr_Plus1 -Description: - - Tests whether or not the function returns one variable index for a more complex expression. -*/ +// TestQuadraticExpr_Plus1 Tests whether or not the function returns one variable index for a more complex expression. func TestQuadraticExpr_Plus1(t *testing.T) { // Constants m := optim.NewModel("Plus1") @@ -351,13 +307,8 @@ func TestQuadraticExpr_Plus1(t *testing.T) { } -/* -TestQuadraticExpr_Plus2 -Description: - - Tests whether or not the plus function works - for a sum of a quadratic expression and a linear expression (no id checking done). -*/ +// TestQuadraticExpr_Plus2 Tests whether or not the plus function works +// for a sum of a quadratic expression and a linear expression (no id checking done). func TestQuadraticExpr_Plus2(t *testing.T) { // Constants m := optim.NewModel("Plus2") @@ -424,13 +375,8 @@ func TestQuadraticExpr_Plus2(t *testing.T) { } -/* -TestQuadraticExpr_Plus3 -Description: - - Tests whether or not the Plus() function works for two quadratic expressions containing - slightly different variables. -*/ +// TestQuadraticExpr_Plus3 Tests whether or not the Plus() function works for two quadratic expressions containing +// slightly different variables. func TestQuadraticExpr_Plus3(t *testing.T) { // Constants m := optim.NewModel("Plus3") @@ -504,13 +450,8 @@ func TestQuadraticExpr_Plus3(t *testing.T) { } -/* -TestQuadraticExpr_Plus4 -Description: - - Tests whether or not the Plus() function works for a quadratic expression and a linear one containing - slightly different variables. -*/ +// TestQuadraticExpr_Plus4 Tests whether or not the Plus() function works for a quadratic expression and a linear one containing +// slightly different variables. func TestQuadraticExpr_Plus4(t *testing.T) { // Constants m := optim.NewModel("Plus4") @@ -591,12 +532,7 @@ func TestQuadraticExpr_Plus4(t *testing.T) { } -/* -TestQuadraticExpr_Plus5 -Description: - - Tests whether or not the Plus() function works for a quadratic expression and a constant one. -*/ +// TestQuadraticExpr_Plus5 Tests whether or not the Plus() function works for a quadratic expression and a constant one. func TestQuadraticExpr_Plus5(t *testing.T) { // Constants m := optim.NewModel("Plus5") @@ -661,12 +597,7 @@ func TestQuadraticExpr_Plus5(t *testing.T) { } -/* -TestQuadraticExpr_Plus6 -Description: - - Tests whether or not the Plus() function works for a quadratic expression and a variable. -*/ +// TestQuadraticExpr_Plus6 Tests whether or not the Plus() function works for a quadratic expression and a variable. func TestQuadraticExpr_Plus6(t *testing.T) { // Constants m := optim.NewModel("Plus6") @@ -777,13 +708,8 @@ func TestQuadraticExpr_Plus6(t *testing.T) { } -/* -TestQuadraticExpr_Plus7 -Description: - - Tests whether or not the function returns a proper error - when an error is provided. -*/ +// TestQuadraticExpr_Plus7 Tests whether or not the function returns a proper error +// when an error is provided. func TestQuadraticExpr_Plus7(t *testing.T) { // Constants m := optim.NewModel("SQE_Plus7") @@ -812,13 +738,8 @@ func TestQuadraticExpr_Plus7(t *testing.T) { } } -/* -TestQuadraticExpr_Plus8 -Description: - - Tests whether or not the function returns a proper error when a bad input - is given. -*/ +// TestQuadraticExpr_Plus8 Tests whether or not the function returns a proper error when a bad input +// is given. func TestQuadraticExpr_Plus8(t *testing.T) { // Constants m := optim.NewModel("SQE_Plus8") @@ -848,12 +769,7 @@ func TestQuadraticExpr_Plus8(t *testing.T) { } } -/* -TestQuadraticExpr_Plus9 -Description: - - Tests the Plus() function with a float. -*/ +// TestQuadraticExpr_Plus9 Tests the Plus() function with a float. func TestQuadraticExpr_Plus9(t *testing.T) { // Constants m := optim.NewModel("SQE_Plus8") @@ -890,12 +806,7 @@ func TestQuadraticExpr_Plus9(t *testing.T) { } } -/* -TestQuadraticExpr_RewriteInTermsOfIndices1 -Description: - - Tests whether or not the rewrite function returns a quadratic expression in three variables when asked. -*/ +// TestQuadraticExpr_RewriteInTermsOfIndices1 Tests whether or not the rewrite function returns a quadratic expression in three variables when asked. func TestQuadraticExpr_RewriteInTermsOfIndices1(t *testing.T) { // Constants m := optim.NewModel("RewriteInTermsOfIndices1") @@ -950,13 +861,8 @@ func TestQuadraticExpr_RewriteInTermsOfIndices1(t *testing.T) { } -/* -TestQuadraticExpr_Multiply1 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a constant one. -*/ +// TestQuadraticExpr_Multiply1 Tests whether or not the Multiply() function works for a quadratic expression +// and a constant one. func TestQuadraticExpr_Multiply1(t *testing.T) { // Constants m := optim.NewModel("Multiply1") @@ -1031,13 +937,8 @@ func TestQuadraticExpr_Multiply1(t *testing.T) { } -/* -TestQuadraticExpr_Multiply2 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a constant one (K). -*/ +// TestQuadraticExpr_Multiply2 Tests whether or not the Multiply() function works for a quadratic expression +// and a constant one (K). func TestQuadraticExpr_Multiply2(t *testing.T) { // Constants m := optim.NewModel("Multiply2") @@ -1112,13 +1013,8 @@ func TestQuadraticExpr_Multiply2(t *testing.T) { } -/* -TestQuadraticExpr_Multiply3 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a variable. -*/ +// TestQuadraticExpr_Multiply3 Tests whether or not the Multiply() function works for a quadratic expression +// and a variable. func TestQuadraticExpr_Multiply3(t *testing.T) { // Constants m := optim.NewModel("Multiply3") @@ -1157,13 +1053,8 @@ func TestQuadraticExpr_Multiply3(t *testing.T) { } -/* -TestQuadraticExpr_Multiply4 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a variable. -*/ +// TestQuadraticExpr_Multiply4 Tests whether or not the Multiply() function works for a quadratic expression +// and a variable. func TestQuadraticExpr_Multiply4(t *testing.T) { // Constants m := optim.NewModel("Multiply4") @@ -1206,13 +1097,8 @@ func TestQuadraticExpr_Multiply4(t *testing.T) { } -/* -TestQuadraticExpr_Multiply5 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a ScalarQuadraticExpression. -*/ +// TestQuadraticExpr_Multiply5 Tests whether or not the Multiply() function works for a quadratic expression +// and a ScalarQuadraticExpression. func TestQuadraticExpr_Multiply5(t *testing.T) { // Constants m := optim.NewModel("Multiply4") @@ -1250,13 +1136,8 @@ func TestQuadraticExpr_Multiply5(t *testing.T) { } -/* -TestQuadraticExpr_Multiply6 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a ScalarQuadraticExpression AND an error is also passed. -*/ +// TestQuadraticExpr_Multiply6 Tests whether or not the Multiply() function works for a quadratic expression +// and a ScalarQuadraticExpression AND an error is also passed. func TestQuadraticExpr_Multiply6(t *testing.T) { // Constants m := optim.NewModel("Multiply4") @@ -1295,13 +1176,8 @@ func TestQuadraticExpr_Multiply6(t *testing.T) { } -/* -TestQuadraticExpr_Multiply7 -Description: - - Tests whether or not the Multiply() function works for a quadratic expression - and a ScalarQuadraticExpression AND an error is also passed. -*/ +// TestQuadraticExpr_Multiply7 Tests whether or not the Multiply() function works for a quadratic expression +// and a ScalarQuadraticExpression AND an error is also passed. func TestQuadraticExpr_Multiply7(t *testing.T) { // Constants m := optim.NewModel("Multiply7") @@ -1340,13 +1216,8 @@ func TestQuadraticExpr_Multiply7(t *testing.T) { } -/* -TestScalarQuadraticExpression_Coeffs1 -Description: - - Tests whether or not the scalar quadratic expression's coefficients - function works. -*/ +// TestScalarQuadraticExpression_Coeffs1 Tests whether or not the scalar quadratic expression's coefficients +// function works. func TestScalarQuadraticExpression_Coeffs1(t *testing.T) { // Constants m := optim.NewModel("testsqe_coeffs1") @@ -1388,12 +1259,7 @@ func TestScalarQuadraticExpression_Coeffs1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_LessEq1 -Description: - - Tests whether or not the LessEq function works properly -*/ +// TestScalarQuadraticExpression_LessEq1 Tests whether or not the LessEq function works properly func TestScalarQuadraticExpression_LessEq1(t *testing.T) { // Constants m := optim.NewModel("testsqe_LessEq1") @@ -1421,12 +1287,7 @@ func TestScalarQuadraticExpression_LessEq1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_GreaterEq1 -Description: - - Tests whether or not the GreaterEq function works properly -*/ +// TestScalarQuadraticExpression_GreaterEq1 Tests whether or not the GreaterEq function works properly func TestScalarQuadraticExpression_GreaterEq1(t *testing.T) { // Constants m := optim.NewModel("testsqe_GreaterEq1") @@ -1460,12 +1321,7 @@ func TestScalarQuadraticExpression_GreaterEq1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_Eq1 -Description: - - Tests whether or not the Eq function works properly -*/ +// TestScalarQuadraticExpression_Eq1 Tests whether or not the Eq function works properly func TestScalarQuadraticExpression_Eq1(t *testing.T) { // Constants m := optim.NewModel("testsqe_Eq1") @@ -1493,12 +1349,7 @@ func TestScalarQuadraticExpression_Eq1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_Comparison1 -Description: - - Tests whether or not the Comparison function works properly -*/ +// TestScalarQuadraticExpression_Comparison1 Tests whether or not the Comparison function works properly func TestScalarQuadraticExpression_Comparison1(t *testing.T) { // Constants m := optim.NewModel("testsqe_Comparison1") @@ -1526,12 +1377,7 @@ func TestScalarQuadraticExpression_Comparison1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_Comparison2 -Description: - - Tests whether or not the Comparison function works properly -*/ +// TestScalarQuadraticExpression_Comparison2 Tests whether or not the Comparison function works properly func TestScalarQuadraticExpression_Comparison2(t *testing.T) { // Constants m := optim.NewModel("testsqe_Comparison2") @@ -1561,13 +1407,8 @@ func TestScalarQuadraticExpression_Comparison2(t *testing.T) { } } -/* -TestScalarQuadraticExpression_Comparison3 -Description: - - Tests whether or not the Comparison function returns error when - a bad input type was given. -*/ +// TestScalarQuadraticExpression_Comparison3 Tests whether or not the Comparison function returns error when +// a bad input type was given. func TestScalarQuadraticExpression_Comparison3(t *testing.T) { // Constants m := optim.NewModel("testsqe_Comparison3") @@ -1602,13 +1443,8 @@ func TestScalarQuadraticExpression_Comparison3(t *testing.T) { } } -/* -TestScalarQuadraticExpression_Check1 -Description: - - Tests to see if Check() works when the Q matrix in ScalarQuadraticExpression - is not square and doesn't have the right number of columns. -*/ +// TestScalarQuadraticExpression_Check1 Tests to see if Check() works when the Q matrix in ScalarQuadraticExpression +// is not square and doesn't have the right number of columns. func TestScalarQuadraticExpression_Check1(t *testing.T) { // Constants m := optim.NewModel("testsqe_Check1") @@ -1642,12 +1478,7 @@ func TestScalarQuadraticExpression_Check1(t *testing.T) { } } -/* -TestScalarQuadraticExpression_RewriteInTermsOf1 -Description: - - Making sure RewriteInTermsOf properly catches error. -*/ +// TestScalarQuadraticExpression_RewriteInTermsOf1 Making sure RewriteInTermsOf properly catches error. func TestScalarQuadraticExpression_RewriteInTermsOf1(t *testing.T) { // Constants m := optim.NewModel("testsqe_RewriteInTermsOf1") @@ -1682,12 +1513,7 @@ func TestScalarQuadraticExpression_RewriteInTermsOf1(t *testing.T) { } -/* -TestScalarQuadraticExpression_RewriteInTermsOf2 -Description: - - Making sure RewriteInTermsOf properly catches error. -*/ +// TestScalarQuadraticExpression_RewriteInTermsOf2 Making sure RewriteInTermsOf properly catches error. func TestScalarQuadraticExpression_RewriteInTermsOf2(t *testing.T) { // Constants m := optim.NewModel("testsqe_RewriteInTermsOf2") diff --git a/testing/optim/util_test.go b/testing/optim/util_test.go index c4c34b7..0c327f0 100644 --- a/testing/optim/util_test.go +++ b/testing/optim/util_test.go @@ -1,10 +1,6 @@ package optim_test -/* -util_test.go -Description: - This file tests some of the utilities added in MatProInterface.go's util.go file. -*/ +// This file tests some of the utilities added in MatProInterface.go's util.go file. import ( "fmt" @@ -13,12 +9,7 @@ import ( "testing" ) -/* -TestUtil_OnesVector1 -Description: - - Tests that the OnesVector() function works well with a large input size. -*/ +// TestUtil_OnesVector1 Tests that the OnesVector() function works well with a large input size. func TestUtil_OnesVector1(t *testing.T) { // Constants length1 := 10 @@ -37,12 +28,7 @@ func TestUtil_OnesVector1(t *testing.T) { } } -/* -TestUtil_OnesVector2 -Description: - - Tests that the OnesVector() function works well with an input size of 1. -*/ +// TestUtil_OnesVector2 Tests that the OnesVector() function works well with an input size of 1. func TestUtil_OnesVector2(t *testing.T) { // Constants length1 := 1 @@ -61,12 +47,7 @@ func TestUtil_OnesVector2(t *testing.T) { } } -/* -TestUtil_CheckExtras1 -Description: - - Tests the CheckExtras function can properly handle cases where extras has nil. -*/ +// TestUtil_CheckExtras1 Tests the CheckExtras function can properly handle cases where extras has nil. func TestUtil_CheckExtras1(t *testing.T) { // Constants extras := []interface{}{} @@ -81,13 +62,8 @@ func TestUtil_CheckExtras1(t *testing.T) { } } -/* -TestUtil_CheckExtras2 -Description: - - Tests the CheckExtras function can properly handle cases where extras - is simply a nil. -*/ +// TestUtil_CheckExtras2 Tests the CheckExtras function can properly handle cases where extras +// is simply a nil. func TestUtil_CheckExtras2(t *testing.T) { // Constants extras := []interface{}{ @@ -104,13 +80,8 @@ func TestUtil_CheckExtras2(t *testing.T) { } } -/* -TestUtil_CheckExtras3 -Description: - - Tests the CheckExtras function can properly handle cases where extras has - one element but it is not an error. -*/ +// TestUtil_CheckExtras3 Tests the CheckExtras function can properly handle cases where extras has +// one element but it is not an error. func TestUtil_CheckExtras3(t *testing.T) { // Constants extras := []interface{}{ @@ -133,13 +104,8 @@ func TestUtil_CheckExtras3(t *testing.T) { } } -/* -TestUtil_CheckExtras4 -Description: - - Tests the CheckExtras function can properly handle cases where extras has - one element but it is a proper error. -*/ +// TestUtil_CheckExtras4 Tests the CheckExtras function can properly handle cases where extras has +// one element but it is a proper error. func TestUtil_CheckExtras4(t *testing.T) { // Constants err0 := fmt.Errorf("test") @@ -160,13 +126,8 @@ func TestUtil_CheckExtras4(t *testing.T) { } } -/* -TestUtil_CheckExtras5 -Description: - - Tests the CheckExtras function can properly handle cases where extras has - multiple elements but it is a proper error. -*/ +// TestUtil_CheckExtras5 Tests the CheckExtras function can properly handle cases where extras has +// multiple elements but it is a proper error. func TestUtil_CheckExtras5(t *testing.T) { // Constants err0 := fmt.Errorf("test") @@ -190,12 +151,7 @@ func TestUtil_CheckExtras5(t *testing.T) { } } -/* -TestUtils_SumVars1 -Description: - - This function tests the rewritten version of SumVars. -*/ +// TestUtils_SumRow1 This function tests the rewritten version of SumVars. func TestUtils_SumRow1(t *testing.T) { // Constants N := 9 @@ -240,12 +196,7 @@ func TestUtils_SumRow1(t *testing.T) { } } -/* -TestUtils_SumCol1 -Description: - - This function tests the rewritten version of SumCol. -*/ +// TestUtils_SumCol1 This function tests the rewritten version of SumCol. func TestUtils_SumCol1(t *testing.T) { // Constants N := 9 @@ -290,12 +241,7 @@ func TestUtils_SumCol1(t *testing.T) { } } -/* -TestUtils_FindInSlice1 -Description: - - Tests whether or not FindInSlice collectly handles erorrs when a bad slice is given. -*/ +// TestUtils_FindInSlice1 Tests whether or not FindInSlice collectly handles erorrs when a bad slice is given. func TestUtils_FindInSlice1(t *testing.T) { // Constants m := optim.NewModel("FindInSlice1") @@ -319,12 +265,7 @@ func TestUtils_FindInSlice1(t *testing.T) { } } -/* -TestUtils_FindInSlice2 -Description: - - Tests whether or not FindInSlice collectly handles erorrs when an unknown type is given. -*/ +// TestUtils_FindInSlice2 Tests whether or not FindInSlice collectly handles erorrs when an unknown type is given. func TestUtils_FindInSlice2(t *testing.T) { // Constants b1 := false diff --git a/testing/optim/var_vector_test.go b/testing/optim/var_vector_test.go index efbe3af..3322014 100644 --- a/testing/optim/var_vector_test.go +++ b/testing/optim/var_vector_test.go @@ -25,12 +25,7 @@ func TestVarVector_Length1(t *testing.T) { } -/* -TestVarVector_Length2 -Description: - - Tests that a larger vector variable (contains 5 elements) properly returns the right length. -*/ +// TestVarVector_Length2 Tests that a larger vector variable (contains 5 elements) properly returns the right length. func TestVarVector_Length2(t *testing.T) { m := optim.NewModel("Length2") x := m.AddBinaryVariable() @@ -47,12 +42,7 @@ func TestVarVector_Length2(t *testing.T) { } -/* -TestVarVector_At1 -Description: - - Tests whether or not we can properly retrieve an element from a given vector. -*/ +// TestVarVector_At1 Tests whether or not we can properly retrieve an element from a given vector. func TestVarVector_At1(t *testing.T) { m := optim.NewModel("At1") x := m.AddBinaryVariable() @@ -69,13 +59,8 @@ func TestVarVector_At1(t *testing.T) { } } -/* -TestVarVector_At2 -Description: - - Tests whether or not we can properly retrieve an element from a given vector. - Makes sure that if we change the extracted vector, it does not effect the element saved in the slice. -*/ +// TestVarVector_At2 Tests whether or not we can properly retrieve an element from a given vector. +// Makes sure that if we change the extracted vector, it does not effect the element saved in the slice. func TestVarVector_At2(t *testing.T) { m := optim.NewModel("At2") x := m.AddBinaryVariable() @@ -94,13 +79,8 @@ func TestVarVector_At2(t *testing.T) { } } -/* -TestVarVector_VariableIDs1 -Description: - - This test will check to see if 2 unique ids in a VariableVector object will be returned correctly when - the VariableIDs method is called. -*/ +// TestVarVector_VariableIDs1 This test will check to see if 2 unique ids in a VariableVector object will be returned correctly when +// the VariableIDs method is called. func TestVarVector_VariableIDs1(t *testing.T) { m := optim.NewModel("VariableIDs1") x := m.AddBinaryVariable() @@ -122,13 +102,8 @@ func TestVarVector_VariableIDs1(t *testing.T) { } } -/* -TestVarVector_VariableIDs2 -Description: - - This test will check to see if a single unique id in a large VariableVector object will be returned correctly when - the VariableIDs method is called. -*/ +// TestVarVector_VariableIDs2 This test will check to see if a single unique id in a large VariableVector object will be returned correctly when +// the VariableIDs method is called. func TestVarVector_VariableIDs2(t *testing.T) { m := optim.NewModel("VariableIDs2") x := m.AddBinaryVariable() @@ -154,13 +129,8 @@ func TestVarVector_VariableIDs2(t *testing.T) { } } -/* -TestVarVector_NumVars1 -Description: - - This test will check to see vector of length 10 - contains 2 n Vars. -*/ +// TestVarVector_NumVars1 This test will check to see vector of length 10 +// contains 2 n Vars. func TestVarVector_NumVars1(t *testing.T) { m := optim.NewModel("NumVars1") x := m.AddBinaryVariable() @@ -181,12 +151,7 @@ func TestVarVector_NumVars1(t *testing.T) { } } -/* -TestVarVector_Constant1 -Description: - - This test verifies that the constant method returns an all zero vector for any varvector object. -*/ +// TestVarVector_Constant1 This test verifies that the constant method returns an all zero vector for any varvector object. func TestVarVector_Constant1(t *testing.T) { m := optim.NewModel("Constant1") x := m.AddBinaryVariable() @@ -208,13 +173,8 @@ func TestVarVector_Constant1(t *testing.T) { } } -/* -TestVarVector_Constant2 -Description: - - This test verifies that the constant method returns an all zero vector for any varvector object. - This one will be extremely long. -*/ +// TestVarVector_Constant2 This test verifies that the constant method returns an all zero vector for any varvector object. +// This one will be extremely long. func TestVarVector_Constant2(t *testing.T) { m := optim.NewModel("Constant2") x := m.AddBinaryVariable() @@ -236,13 +196,8 @@ func TestVarVector_Constant2(t *testing.T) { } } -/* -TestVarVector_LinearCoeff1 -Description: - - This test will check to see vector of length 10 - contains 10 n Vars. -*/ +// TestVarVector_LinearCoeff1 This test will check to see vector of length 10 +// contains 10 n Vars. func TestVarVector_LinearCoeff1(t *testing.T) { m := optim.NewModel("LinearCoeff1") x := m.AddBinaryVariable() @@ -289,12 +244,7 @@ func TestVarVector_LinearCoeff1(t *testing.T) { } } -/* -TestVarVector_Eq1 -Description: - - This test verifies that the Eq method works between a varvector and another object. -*/ +// TestVarVector_Eq1 This test verifies that the Eq method works between a varvector and another object. func TestVarVector_Eq1(t *testing.T) { m := optim.NewModel("Eq1") x := m.AddBinaryVariable() @@ -315,13 +265,8 @@ func TestVarVector_Eq1(t *testing.T) { } } -/* -TestVarVector_Eq2 -Description: - - This test verifies that the Eq method works between a varvector and another object. - Comparison should be between var vector and an unsupported type. -*/ +// TestVarVector_Eq2 This test verifies that the Eq method works between a varvector and another object. +// Comparison should be between var vector and an unsupported type. func TestVarVector_Eq2(t *testing.T) { m := optim.NewModel("Eq2") x := m.AddBinaryVariable() @@ -346,12 +291,7 @@ func TestVarVector_Eq2(t *testing.T) { } } -/* -TestVarVector_Eq2 -Description: - - This test verifies that the Eq method works between a varvector and another var vector. -*/ +// TestVarVector_Eq3 This test verifies that the Eq method works between a varvector and another var vector. func TestVarVector_Eq3(t *testing.T) { m := optim.NewModel("Eq3") x := m.AddBinaryVariable() @@ -373,12 +313,7 @@ func TestVarVector_Eq3(t *testing.T) { } } -/* -TestVarVector_Comparison1 -Description: - - Tests how well the comparison function works with a VectorLinearExpression comparison. -*/ +// TestVarVector_Comparison1 Tests how well the comparison function works with a VectorLinearExpression comparison. func TestVarVector_Comparison1(t *testing.T) { // Constants desLength := 10 @@ -401,13 +336,8 @@ func TestVarVector_Comparison1(t *testing.T) { } } -/* -TestVarVector_Comparison2 -Description: - - Tests how well the comparison function works with a VectorLinearExpression comparison. - Valid comparison of -*/ +// TestVarVector_Comparison2 Tests how well the comparison function works with a VectorLinearExpression comparison. +// Valid comparison of func TestVarVector_Comparison2(t *testing.T) { // Constants desLength := 10 @@ -430,12 +360,7 @@ func TestVarVector_Comparison2(t *testing.T) { } } -/* -TestVarVector_Comparison3 -Description: - - Tests that the Comparison() Method works well for future users. -*/ +// TestVarVector_Comparison3 Tests that the Comparison() Method works well for future users. func TestVarVector_Comparison3(t *testing.T) { // Constants desLength := 10 @@ -457,12 +382,7 @@ func TestVarVector_Comparison3(t *testing.T) { } -/* -TestVarVector_Comparison4 -Description: - - Tests that the Comparison() Method works for two VarVectors of different lengths. -*/ +// TestVarVector_Comparison4 Tests that the Comparison() Method works for two VarVectors of different lengths. func TestVarVector_Comparison4(t *testing.T) { // Constants desLength := 10 @@ -486,13 +406,8 @@ func TestVarVector_Comparison4(t *testing.T) { } -/* -TestVarVector_Comparison5 -Description: - - Tests that the Comparison() Method works well for a VarVector and - a VarVectorTranspose. -*/ +// TestVarVector_Comparison5 Tests that the Comparison() Method works well for a VarVector and +// a VarVectorTranspose. func TestVarVector_Comparison5(t *testing.T) { // Constants desLength := 10 @@ -514,13 +429,8 @@ func TestVarVector_Comparison5(t *testing.T) { } -/* -TestVarVector_Comparison6 -Description: - - Tests that the Comparison() Method works well for a VarVector and - a VectorLinearExpressionTranspose. -*/ +// TestVarVector_Comparison6 Tests that the Comparison() Method works well for a VarVector and +// a VectorLinearExpressionTranspose. func TestVarVector_Comparison6(t *testing.T) { // Constants desLength := 10 @@ -544,12 +454,7 @@ func TestVarVector_Comparison6(t *testing.T) { } -/* -TestVarVector_Plus1 -Description: - - Testing the Plus operator between a VarVector and a KVector. Proper sizes were given. -*/ +// TestVarVector_Plus1 Testing the Plus operator between a VarVector and a KVector. Proper sizes were given. func TestVarVector_Plus1(t *testing.T) { // Constants desLength := 10 @@ -600,12 +505,7 @@ func TestVarVector_Plus1(t *testing.T) { } } -/* -TestVarVector_Plus2 -Description: - - Testing the Plus operator between a VarVector and a KVector. Incorrect sizes were given. -*/ +// TestVarVector_Plus2 Testing the Plus operator between a VarVector and a KVector. Incorrect sizes were given. func TestVarVector_Plus2(t *testing.T) { // Constants desLength := 10 @@ -625,12 +525,7 @@ func TestVarVector_Plus2(t *testing.T) { } -/* -TestVarVector_Plus3 -Description: - - Testing the Plus operator between a VarVector and a KVector. Proper sizes were given. -*/ +// TestVarVector_Plus3 Testing the Plus operator between a VarVector and a KVector. Proper sizes were given. func TestVarVector_Plus3(t *testing.T) { // Constants desLength := 10 @@ -681,12 +576,7 @@ func TestVarVector_Plus3(t *testing.T) { } } -/* -TestVarVector_Plus4 -Description: - - Testing the Plus operator between a VarVector and a VarVector. All vectors are of same size. Some overlap in the variables but not all. -*/ +// TestVarVector_Plus4 Testing the Plus operator between a VarVector and a VarVector. All vectors are of same size. Some overlap in the variables but not all. func TestVarVector_Plus4(t *testing.T) { // Constants desLength := 10 @@ -803,13 +693,8 @@ func TestVarVector_Plus4(t *testing.T) { } } -/* -TestVarVector_Plus5 -Description: - - Testing the Plus operator between a VarVector and a VarVector. All vectors are of the same size. - No overlap between elements. -*/ +// TestVarVector_Plus5 Testing the Plus operator between a VarVector and a VarVector. All vectors are of the same size. +// No overlap between elements. func TestVarVector_Plus5(t *testing.T) { // Constants desLength := 10 @@ -923,14 +808,9 @@ func TestVarVector_Plus5(t *testing.T) { } } -/* -TestVarVector_Plus6 -Description: - - Testing the Plus operator between a VarVector and a KVectorTranspose. - All vectors are of the same size. - No overlap between elements. -*/ +// TestVarVector_Plus6 Testing the Plus operator between a VarVector and a KVectorTranspose. +// All vectors are of the same size. +// No overlap between elements. func TestVarVector_Plus6(t *testing.T) { // Constants desLength := 10 @@ -952,12 +832,7 @@ func TestVarVector_Plus6(t *testing.T) { } -/* -TestVarVector_Plus7 -Description: - - Testing the Plus operator between a VarVector and a VarVectorTranspose. -*/ +// TestVarVector_Plus7 Testing the Plus operator between a VarVector and a VarVectorTranspose. func TestVarVector_Plus7(t *testing.T) { // Constants desLength := 10 @@ -978,12 +853,7 @@ func TestVarVector_Plus7(t *testing.T) { } } -/* -TestVarVector_Plus8 -Description: - - Testing the Plus operator between a VarVector and a VectorLinearExpressionTranspose. -*/ +// TestVarVector_Plus8 Testing the Plus operator between a VarVector and a VectorLinearExpressionTranspose. func TestVarVector_Plus8(t *testing.T) { // Constants desLength := 10 @@ -1006,12 +876,7 @@ func TestVarVector_Plus8(t *testing.T) { } } -/* -TestVarVector_Plus9 -Description: - - Testing the Plus operator between a VarVector and a VectorLinearExpressionTranspose. -*/ +// TestVarVector_Plus9 Testing the Plus operator between a VarVector and a VectorLinearExpressionTranspose. func TestVarVector_Plus9(t *testing.T) { // Constants desLength := 10 @@ -1033,12 +898,10 @@ func TestVarVector_Plus9(t *testing.T) { } } -/* -TestVarVector_Mult1 -Descripiion: - - Tests that the Mult() method currently returns errors. -*/ +// TestVarVector_Mult1 +// Descripiion: +// +// Tests that the Mult() method currently returns errors. func TestVarVector_Mult1(t *testing.T) { // Constants desLength := 10 @@ -1055,12 +918,7 @@ func TestVarVector_Mult1(t *testing.T) { } } -/* -TestVarVector_GreaterEq1 -Description: - - Tests that the GreaterEq() Method works well for future users. -*/ +// TestVarVector_GreaterEq1 Tests that the GreaterEq() Method works well for future users. func TestVarVector_GreaterEq1(t *testing.T) { // Constants desLength := 10 @@ -1090,12 +948,7 @@ func TestVarVector_GreaterEq1(t *testing.T) { } -/* -TestVarVector_AtVec1 -Description: - - Testing the At operator on a VarVector object. -*/ +// TestVarVector_AtVec1 Testing the At operator on a VarVector object. func TestVarVector_AtVec1(t *testing.T) { // Constants desLength := 10 @@ -1125,13 +978,8 @@ func TestVarVector_AtVec1(t *testing.T) { } } -/* -TestVarVector_1 -Description: - - Tests that the error catching behavior works when - VarVector is malformed. -*/ +// TestVarVector_Check1 Tests that the error catching behavior works when +// VarVector is malformed. func TestVarVector_Check1(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Check1") @@ -1164,13 +1012,8 @@ func TestVarVector_Check1(t *testing.T) { } } -/* -TestVarVector_Multiply1 -Description: - - Tests that the error catching behavior works when - VarVector is malformed. -*/ +// TestVarVector_Multiply1 Tests that the error catching behavior works when +// VarVector is malformed. func TestVarVector_Multiply1(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply1") @@ -1203,13 +1046,8 @@ func TestVarVector_Multiply1(t *testing.T) { } } -/* -TestVarVector_Multiply2 -Description: - - Tests that the error catching behavior works when - a bad error input is given. -*/ +// TestVarVector_Multiply2 Tests that the error catching behavior works when +// a bad error input is given. func TestVarVector_Multiply2(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply2") @@ -1230,13 +1068,8 @@ func TestVarVector_Multiply2(t *testing.T) { } } -/* -TestVarVector_Multiply3 -Description: - - Tests that the error catching behavior works when - an input with bad shape is given. -*/ +// TestVarVector_Multiply3 Tests that the error catching behavior works when +// an input with bad shape is given. func TestVarVector_Multiply3(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply3") @@ -1261,13 +1094,8 @@ func TestVarVector_Multiply3(t *testing.T) { } } -/* -TestVarVector_Multiply4 -Description: - - Tests that the error catching behavior works when - a scalar float is given. Should result in VectorLinearExpression -*/ +// TestVarVector_Multiply4 Tests that the error catching behavior works when +// a scalar float is given. Should result in VectorLinearExpression func TestVarVector_Multiply4(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply4") @@ -1310,13 +1138,8 @@ func TestVarVector_Multiply4(t *testing.T) { } -/* -TestVarVector_Multiply5 -Description: - - Tests that the error catching behavior works when - a scalar K is given. Should result in VectorLinearExpression -*/ +// TestVarVector_Multiply5 Tests that the error catching behavior works when +// a scalar K is given. Should result in VectorLinearExpression func TestVarVector_Multiply5(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply5") @@ -1359,13 +1182,8 @@ func TestVarVector_Multiply5(t *testing.T) { } -/* -TestVarVector_Multiply6 -Description: - - Tests that the error catching behavior works when - a one element KVector is given. Should result in VectorLinearExpression -*/ +// TestVarVector_Multiply6 Tests that the error catching behavior works when +// a one element KVector is given. Should result in VectorLinearExpression func TestVarVector_Multiply6(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply3") @@ -1409,13 +1227,8 @@ func TestVarVector_Multiply6(t *testing.T) { } } -/* -TestVarVector_Multiply7 -Description: - - Tests that the error catching behavior works when - a one element KVectorTranspose is given. Should result in VectorLinearExpression -*/ +// TestVarVector_Multiply7 Tests that the error catching behavior works when +// a one element KVectorTranspose is given. Should result in VectorLinearExpression func TestVarVector_Multiply7(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply7") @@ -1460,13 +1273,8 @@ func TestVarVector_Multiply7(t *testing.T) { } -/* -TestVarVector_Multiply8 -Description: - - Tests that the error catching behavior works when - a non-single element KVectorTranspose is given. Should result in VectorLinearExpression -*/ +// TestVarVector_Multiply8 Tests that the error catching behavior works when +// a non-single element KVectorTranspose is given. Should result in VectorLinearExpression func TestVarVector_Multiply8(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_Multiply8") @@ -1490,13 +1298,8 @@ func TestVarVector_Multiply8(t *testing.T) { } -/* -TestVarVector_ToSymbolic1 -Description: - - Tests that the ToSymbolic() produces an error when the VarVector has one - variable that is not well-defined. -*/ +// TestVarVector_ToSymbolic1 Tests that the ToSymbolic() produces an error when the VarVector has one +// variable that is not well-defined. func TestVarVector_ToSymbolic1(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_ToSymbolic1") @@ -1526,13 +1329,8 @@ func TestVarVector_ToSymbolic1(t *testing.T) { } -/* -TestVarVector_ToSymbolic2 -Description: - - Tests that the ToSymbolic() does not produce an error when the VarVector - is well-defined. In addition, the output should be of type symbolic.VariableVector -*/ +// TestVarVector_ToSymbolic2 Tests that the ToSymbolic() does not produce an error when the VarVector +// is well-defined. In addition, the output should be of type symbolic.VariableVector func TestVarVector_ToSymbolic2(t *testing.T) { // Constants m := optim.NewModel("TestVarVector_ToSymbolic2") diff --git a/testing/optim/var_vector_transpose_test.go b/testing/optim/var_vector_transpose_test.go index 2814349..3c4ee44 100644 --- a/testing/optim/var_vector_transpose_test.go +++ b/testing/optim/var_vector_transpose_test.go @@ -2,11 +2,12 @@ package optim_test import ( "fmt" + "strings" + "testing" + "github.com/MatProGo-dev/MatProInterface.go/optim" "github.com/MatProGo-dev/SymbolicMath.go/symbolic" "gonum.org/v1/gonum/mat" - "strings" - "testing" ) func TestVarVectorTranspose_Length1(t *testing.T) { @@ -25,12 +26,7 @@ func TestVarVectorTranspose_Length1(t *testing.T) { } -/* -TestVarVectorTranspose_Length2 -Description: - - Tests that a larger vector variable (contains 5 elements) properly returns the right length. -*/ +// TestVarVectorTranspose_Length2 Tests that a larger vector variable (contains 5 elements) properly returns the right length. func TestVarVectorTranspose_Length2(t *testing.T) { m := optim.NewModel("Length2") x := m.AddBinaryVariable() @@ -47,12 +43,7 @@ func TestVarVectorTranspose_Length2(t *testing.T) { } -/* -TestVarVectorTranspose_NumVars1 -Description: - - Tests that the NumVars() method is working properly for a length 10 VarVectorTranspose. -*/ +// TestVarVectorTranspose_NumVars1 Tests that the NumVars() method is working properly for a length 10 VarVectorTranspose. func TestVarVectorTranspose_NumVars1(t *testing.T) { m := optim.NewModel("NumVars1") vv1 := m.AddVariableVector(10) @@ -65,14 +56,9 @@ func TestVarVectorTranspose_NumVars1(t *testing.T) { } } -/* -TestVarVectorTranspose_LinearCoeff1 -Description: - - Tests that the LinearCoeff() method is working properly for a length 10 VarVectorTranspose. - For a transposed vector, the linear coefficient L is the coefficient on the right of the variable. - (i.e., x^T L^T + c^T) -*/ +// TestVarVectorTranspose_LinearCoeff1 Tests that the LinearCoeff() method is working properly for a length 10 VarVectorTranspose. +// For a transposed vector, the linear coefficient L is the coefficient on the right of the variable. +// (i.e., x^T L^T + c^T) func TestVarVectorTranspose_LinearCoeff1(t *testing.T) { m := optim.NewModel("LinearCoeff1") vv1 := m.AddVariableVector(10) @@ -112,12 +98,7 @@ func TestVarVectorTranspose_LinearCoeff1(t *testing.T) { } } -/* -TestVarVectorTranspose_At1 -Description: - - Tests whether or not we can properly retrieve an element from a given vector. -*/ +// TestVarVectorTranspose_At1 Tests whether or not we can properly retrieve an element from a given vector. func TestVarVectorTranspose_At1(t *testing.T) { m := optim.NewModel("At1") x := m.AddBinaryVariable() @@ -134,13 +115,8 @@ func TestVarVectorTranspose_At1(t *testing.T) { } } -/* -TestVarVectorTranspose_At2 -Description: - - Tests whether or not we can properly retrieve an element from a given vector. - Makes sure that if we change the extracted vector, it does not effect the element saved in the slice. -*/ +// TestVarVectorTranspose_At2 Tests whether or not we can properly retrieve an element from a given vector. +// Makes sure that if we change the extracted vector, it does not effect the element saved in the slice. func TestVarVectorTranspose_At2(t *testing.T) { m := optim.NewModel("At2") x := m.AddBinaryVariable() @@ -159,13 +135,8 @@ func TestVarVectorTranspose_At2(t *testing.T) { } } -/* -TestVarVectorTranspose_VariableIDs1 -Description: - - This test will check to see if 2 unique ids in a VariableVector object will be returned correctly when - the VariableIDs method is called. -*/ +// TestVarVectorTranspose_VariableIDs1 This test will check to see if 2 unique ids in a VariableVector object will be returned correctly when +// the VariableIDs method is called. func TestVarVectorTranspose_VariableIDs1(t *testing.T) { m := optim.NewModel("VariableIDs1") x := m.AddBinaryVariable() @@ -187,13 +158,8 @@ func TestVarVectorTranspose_VariableIDs1(t *testing.T) { } } -/* -TestVarVectorTranspose_VariableIDs2 -Description: - - This test will check to see if a single unique id in a large VariableVector object will be returned correctly when - the VariableIDs method is called. -*/ +// TestVarVectorTranspose_VariableIDs2 This test will check to see if a single unique id in a large VariableVector object will be returned correctly when +// the VariableIDs method is called. func TestVarVectorTranspose_VariableIDs2(t *testing.T) { m := optim.NewModel("VariableIDs2") x := m.AddBinaryVariable() @@ -219,12 +185,7 @@ func TestVarVectorTranspose_VariableIDs2(t *testing.T) { } } -/* -TestVarVectorTranspose_Constant1 -Description: - - This test verifies that the constant method returns an all zero vector for any VarVectorTranspose object. -*/ +// TestVarVectorTranspose_Constant1 This test verifies that the constant method returns an all zero vector for any VarVectorTranspose object. func TestVarVectorTranspose_Constant1(t *testing.T) { m := optim.NewModel("Constant1") x := m.AddBinaryVariable() @@ -246,13 +207,8 @@ func TestVarVectorTranspose_Constant1(t *testing.T) { } } -/* -TestVarVectorTranspose_Constant2 -Description: - - This test verifies that the constant method returns an all zero vector for any VarVectorTranspose object. - This one will be extremely long. -*/ +// TestVarVectorTranspose_Constant2 This test verifies that the constant method returns an all zero vector for any VarVectorTranspose object. +// This one will be extremely long. func TestVarVectorTranspose_Constant2(t *testing.T) { m := optim.NewModel("Constant2") x := m.AddBinaryVariable() @@ -274,12 +230,7 @@ func TestVarVectorTranspose_Constant2(t *testing.T) { } } -/* -TestVarVectorTranspose_Eq1 -Description: - - This test verifies that the Eq method works between a VarVectorTranspose and another object. -*/ +// TestVarVectorTranspose_Eq1 This test verifies that the Eq method works between a VarVectorTranspose and another object. func TestVarVectorTranspose_Eq1(t *testing.T) { m := optim.NewModel("Eq1") x := m.AddBinaryVariable() @@ -300,13 +251,8 @@ func TestVarVectorTranspose_Eq1(t *testing.T) { } } -/* -TestVarVectorTranspose_Eq2 -Description: - - This test verifies that the Eq method works between a VarVectorTranspose and another object. - Comparison should be between var vector and an unsupported type. -*/ +// TestVarVectorTranspose_Eq2 This test verifies that the Eq method works between a VarVectorTranspose and another object. +// Comparison should be between var vector and an unsupported type. func TestVarVectorTranspose_Eq2(t *testing.T) { m := optim.NewModel("Eq2") x := m.AddBinaryVariable() @@ -327,12 +273,7 @@ func TestVarVectorTranspose_Eq2(t *testing.T) { } } -/* -TestVarVectorTranspose_Eq3 -Description: - - This test verifies that the Eq method works between a VarVectorTranspose and another var vector. -*/ +// TestVarVectorTranspose_Eq3 This test verifies that the Eq method works between a VarVectorTranspose and another var vector. func TestVarVectorTranspose_Eq3(t *testing.T) { m := optim.NewModel("Eq3") x := m.AddBinaryVariable() @@ -354,13 +295,8 @@ func TestVarVectorTranspose_Eq3(t *testing.T) { } } -/* -TestVarVectorTranspose_Eq4 -Description: - - This test verifies that the Eq method does not work between a - VarVectorTranspose object and a normal KVector. -*/ +// TestVarVectorTranspose_Eq4 This test verifies that the Eq method does not work between a +// VarVectorTranspose object and a normal KVector. func TestVarVectorTranspose_Eq4(t *testing.T) { // Constants m := optim.NewModel("Eq1") @@ -382,12 +318,7 @@ func TestVarVectorTranspose_Eq4(t *testing.T) { } } -/* -TestVarVectorTranspose_Comparison1 -Description: - - Tests how well the comparison function works with a VectorLinearExpression comparison. -*/ +// TestVarVectorTranspose_Comparison1 Tests how well the comparison function works with a VectorLinearExpression comparison. func TestVarVectorTranspose_Comparison1(t *testing.T) { // Constants desLength := 10 @@ -410,13 +341,8 @@ func TestVarVectorTranspose_Comparison1(t *testing.T) { } } -/* -TestVarVectorTranspose_Comparison2 -Description: - - Tests how well the comparison function works with a VectorLinearExpression comparison. - Valid comparison of -*/ +// TestVarVectorTranspose_Comparison2 Tests how well the comparison function works with a VectorLinearExpression comparison. +// Valid comparison of func TestVarVectorTranspose_Comparison2(t *testing.T) { // Constants desLength := 10 @@ -448,13 +374,8 @@ func TestVarVectorTranspose_Comparison2(t *testing.T) { } } -/* -TestVarVectorTranspose_Comparison3 -Description: - - Tests how well the comparison function works with a VectorLinearExpression comparison. - Valid comparison of -*/ +// TestVarVectorTranspose_Comparison3 Tests how well the comparison function works with a VectorLinearExpression comparison. +// Valid comparison of func TestVarVectorTranspose_Comparison3(t *testing.T) { // Constants desLength := 10 @@ -478,13 +399,8 @@ func TestVarVectorTranspose_Comparison3(t *testing.T) { } } -/* -TestVarVectorTranspose_Comparison4 -Description: - - Tests how well the comparison function works with a VectorLinearExpressionTranspose comparison. - Valid comparison -*/ +// TestVarVectorTranspose_Comparison4 Tests how well the comparison function works with a VectorLinearExpressionTranspose comparison. +// Valid comparison func TestVarVectorTranspose_Comparison4(t *testing.T) { // Constants desLength := 10 @@ -507,13 +423,8 @@ func TestVarVectorTranspose_Comparison4(t *testing.T) { } } -/* -TestVarVectorTranspose_Comparison5 -Description: - - Tests how well the comparison function works with a VarVectorTranspose comparison. - Invalid comparison with a bad length. -*/ +// TestVarVectorTranspose_Comparison5 Tests how well the comparison function works with a VarVectorTranspose comparison. +// Invalid comparison with a bad length. func TestVarVectorTranspose_Comparison5(t *testing.T) { // Constants desLength := 10 @@ -539,12 +450,7 @@ func TestVarVectorTranspose_Comparison5(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus1 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVectorTranspose. Proper sizes were given. -*/ +// TestVarVectorTranspose_Plus1 Testing the Plus operator between a VarVectorTranspose and a KVectorTranspose. Proper sizes were given. func TestVarVectorTranspose_Plus1(t *testing.T) { // Constants desLength := 10 @@ -595,12 +501,7 @@ func TestVarVectorTranspose_Plus1(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus2 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVector. Incorrect sizes were given. -*/ +// TestVarVectorTranspose_Plus2 Testing the Plus operator between a VarVectorTranspose and a KVector. Incorrect sizes were given. func TestVarVectorTranspose_Plus2(t *testing.T) { // Constants desLength := 10 @@ -620,12 +521,7 @@ func TestVarVectorTranspose_Plus2(t *testing.T) { } -/* -TestVarVectorTranspose_Plus3 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. -*/ +// TestVarVectorTranspose_Plus3 Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. func TestVarVectorTranspose_Plus3(t *testing.T) { // Constants desLength := 10 @@ -676,12 +572,7 @@ func TestVarVectorTranspose_Plus3(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus4 -Description: - - Testing the Plus operator between a VarVectorTranspose and a VarVectorTranspose. All vectors are of same size. Some overlap in the variables but not all. -*/ +// TestVarVectorTranspose_Plus4 Testing the Plus operator between a VarVectorTranspose and a VarVectorTranspose. All vectors are of same size. Some overlap in the variables but not all. func TestVarVectorTranspose_Plus4(t *testing.T) { // Constants desLength := 10 @@ -798,13 +689,8 @@ func TestVarVectorTranspose_Plus4(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus5 -Description: - - Testing the Plus operator between a VarVectorTranspose and a VarVectorTranspose. All vectors are of the same size. - No overlap between elements. -*/ +// TestVarVectorTranspose_Plus5 Testing the Plus operator between a VarVectorTranspose and a VarVectorTranspose. All vectors are of the same size. +// No overlap between elements. func TestVarVectorTranspose_Plus5(t *testing.T) { // Constants desLength := 10 @@ -918,12 +804,7 @@ func TestVarVectorTranspose_Plus5(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus6 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. -*/ +// TestVarVectorTranspose_Plus6 Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. func TestVarVectorTranspose_Plus6(t *testing.T) { // Constants desLength := 10 @@ -944,12 +825,7 @@ func TestVarVectorTranspose_Plus6(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus7 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. -*/ +// TestVarVectorTranspose_Plus7 Testing the Plus operator between a VarVectorTranspose and a KVector. Proper sizes were given. func TestVarVectorTranspose_Plus7(t *testing.T) { // Constants desLength := 10 @@ -970,13 +846,8 @@ func TestVarVectorTranspose_Plus7(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus8 -Description: - - Testing the Plus operator between a VarVectorTranspose and a KVectorTranspose. - Improper lengths are used. -*/ +// TestVarVectorTranspose_Plus8 Testing the Plus operator between a VarVectorTranspose and a KVectorTranspose. +// Improper lengths are used. func TestVarVectorTranspose_Plus8(t *testing.T) { // Constants desLength := 10 @@ -998,12 +869,7 @@ func TestVarVectorTranspose_Plus8(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus9 -Description: - - Testing the Plus operator between a VarVectorTranspose and a VarVector. -*/ +// TestVarVectorTranspose_Plus9 Testing the Plus operator between a VarVectorTranspose and a VarVector. func TestVarVectorTranspose_Plus9(t *testing.T) { // Constants desLength := 10 @@ -1024,12 +890,7 @@ func TestVarVectorTranspose_Plus9(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus10 -Description: - - Testing the Plus operator between a VarVectorTranspose and a ScalarLinearExpr. -*/ +// TestVarVectorTranspose_Plus10 Testing the Plus operator between a VarVectorTranspose and a ScalarLinearExpr. func TestVarVectorTranspose_Plus10(t *testing.T) { // Constants desLength := 10 @@ -1056,12 +917,7 @@ func TestVarVectorTranspose_Plus10(t *testing.T) { } } -/* -TestVarVectorTranspose_Plus11 -Description: - - Testing the Plus operator between a VarVectorTranspose and a bool. -*/ +// TestVarVectorTranspose_Plus11 Testing the Plus operator between a VarVectorTranspose and a bool. func TestVarVectorTranspose_Plus11(t *testing.T) { // Constants desLength := 10 @@ -1082,12 +938,7 @@ func TestVarVectorTranspose_Plus11(t *testing.T) { } } -/* -TestVarVectorTranspose_AtVec1 -Description: - - Testing the At operator on a VarVectorTranspose object. -*/ +// TestVarVectorTranspose_AtVec1 Testing the At operator on a VarVectorTranspose object. func TestVarVectorTranspose_AtVec1(t *testing.T) { // Constants desLength := 10 @@ -1117,13 +968,8 @@ func TestVarVectorTranspose_AtVec1(t *testing.T) { } } -/* -TestVarVectorTranspose_LessEq1 -Description: - - Verifies that the LessEq method throws an error when the KVectorTranspose is - of the wrong length. -*/ +// TestVarVectorTranspose_LessEq1 Verifies that the LessEq method throws an error when the KVectorTranspose is +// of the wrong length. func TestVarVectorTranspose_LessEq1(t *testing.T) { // Constants desLength := 10 @@ -1146,13 +992,8 @@ func TestVarVectorTranspose_LessEq1(t *testing.T) { } } -/* -TestVarVectorTranspose_GreaterEq1 -Description: - - Verifies that the GreaterEq method throws an error when the KVectorTranspose is - of the wrong length. -*/ +// TestVarVectorTranspose_GreaterEq1 Verifies that the GreaterEq method throws an error when the KVectorTranspose is +// of the wrong length. func TestVarVectorTranspose_GreaterEq1(t *testing.T) { // Constants desLength := 10 @@ -1180,13 +1021,8 @@ func TestVarVectorTranspose_GreaterEq1(t *testing.T) { } -/* -TestVarVectorTranspose_Multiply1 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a KVector - produces the right size of output for a unique varvector and KVector. -*/ +// TestVarVectorTranspose_Multiply1 Tests that the simple multiplication of a VarVectorTranspose with a KVector +// produces the right size of output for a unique varvector and KVector. func TestVarVectorTranspose_Multiply1(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply1") @@ -1227,13 +1063,8 @@ func TestVarVectorTranspose_Multiply1(t *testing.T) { } } -/* -TestVarVectorTranspose_Multiply2 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a KVector - produces the right size of output for a NON-unique varvector and KVector. -*/ +// TestVarVectorTranspose_Multiply2 Tests that the simple multiplication of a VarVectorTranspose with a KVector +// produces the right size of output for a NON-unique varvector and KVector. func TestVarVectorTranspose_Multiply2(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply2") @@ -1285,13 +1116,8 @@ func TestVarVectorTranspose_Multiply2(t *testing.T) { } } -/* -TestVarVectorTranspose_Multiply3 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a mat.VecDense - produces the right size of output for a NON-unique varvector and mat.VecDense. -*/ +// TestVarVectorTranspose_Multiply3 Tests that the simple multiplication of a VarVectorTranspose with a mat.VecDense +// produces the right size of output for a NON-unique varvector and mat.VecDense. func TestVarVectorTranspose_Multiply3(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply2") @@ -1345,13 +1171,8 @@ func TestVarVectorTranspose_Multiply3(t *testing.T) { } } -/* -TestVarVectorTranspose_Multiply4 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a float64 - produces the right size of output for a NON-unique varvector and float64. -*/ +// TestVarVectorTranspose_Multiply4 Tests that the simple multiplication of a VarVectorTranspose with a float64 +// produces the right size of output for a NON-unique varvector and float64. func TestVarVectorTranspose_Multiply4(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply4") @@ -1413,13 +1234,8 @@ func TestVarVectorTranspose_Multiply4(t *testing.T) { } } -/* -TestVarVectorTranspose_Multiply5 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a float64 - and with an error. -*/ +// TestVarVectorTranspose_Multiply5 Tests that the simple multiplication of a VarVectorTranspose with a float64 +// and with an error. func TestVarVectorTranspose_Multiply5(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply5") @@ -1440,12 +1256,7 @@ func TestVarVectorTranspose_Multiply5(t *testing.T) { } -/* -TestVarVectorTranspose_Multiply6 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a vector of the wrong dimension. -*/ +// TestVarVectorTranspose_Multiply6 Tests that the simple multiplication of a VarVectorTranspose with a vector of the wrong dimension. func TestVarVectorTranspose_Multiply6(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply5") @@ -1472,13 +1283,8 @@ func TestVarVectorTranspose_Multiply6(t *testing.T) { } -/* -TestVarVectorTranspose_Multiply7 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a K - produces the right size of output for a NON-unique varvector and K. -*/ +// TestVarVectorTranspose_Multiply7 Tests that the simple multiplication of a VarVectorTranspose with a K +// produces the right size of output for a NON-unique varvector and K. func TestVarVectorTranspose_Multiply7(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply7") @@ -1540,12 +1346,7 @@ func TestVarVectorTranspose_Multiply7(t *testing.T) { } } -/* -TestVarVectorTranspose_Multiply8 -Description: - - Tests that the simple multiplication of a VarVectorTranspose with a vector of the wrong dimension. -*/ +// TestVarVectorTranspose_Multiply8 Tests that the simple multiplication of a VarVectorTranspose with a vector of the wrong dimension. func TestVarVectorTranspose_Multiply8(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply8") @@ -1572,14 +1373,9 @@ func TestVarVectorTranspose_Multiply8(t *testing.T) { } -/* -TestVarVectorTranspose_Multiply9 -Description: - - Tests the multiplication of a VarVectorTranspose with a - vector constant transpose. - (When lengths are not matching, this should throw an error) -*/ +// TestVarVectorTranspose_Multiply9 Tests the multiplication of a VarVectorTranspose with a +// vector constant transpose. +// (When lengths are not matching, this should throw an error) func TestVarVectorTranspose_Multiply9(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply9") @@ -1605,14 +1401,9 @@ func TestVarVectorTranspose_Multiply9(t *testing.T) { } -/* -TestVarVectorTranspose_Multiply10 -Description: - - Tests the multiplication of a VarVectorTranspose with a - vector constant transpose. - (When lengths are mismatched, this should throw an error) -*/ +// TestVarVectorTranspose_Multiply10 Tests the multiplication of a VarVectorTranspose with a +// vector constant transpose. +// (When lengths are mismatched, this should throw an error) func TestVarVectorTranspose_Multiply10(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply10") @@ -1644,14 +1435,14 @@ func TestVarVectorTranspose_Multiply10(t *testing.T) { } -///* +// //TestVarVectorTranspose_Multiply11 -//Description: +// // // Tests the multiplication of a VarVectorTranspose with a // mat.Dense object. // (When dimensions are mismatched, this should throw an error) -//*/ +// //func TestVarVectorTranspose_Multiply11(t *testing.T) { // // Constants // m := optim.NewModel("VarVectorTranspose_Multiply11") @@ -1680,13 +1471,8 @@ func TestVarVectorTranspose_Multiply10(t *testing.T) { // //} -/* -TestVarVectorTranspose_Multiply12 -Description: - - Tests the multiplication of a VarVectorTranspose with a - proper mat.Dense object. -*/ +// TestVarVectorTranspose_Multiply12 Tests the multiplication of a VarVectorTranspose with a +// proper mat.Dense object. func TestVarVectorTranspose_Multiply12(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply12") @@ -1754,13 +1540,13 @@ func TestVarVectorTranspose_Multiply12(t *testing.T) { } -///* +// //TestVarVectorTranspose_Multiply13 -//Description: +// // // Tests the multiplication of a VarVectorTranspose with a // proper matrix.Constant object. -//*/ +// //func TestVarVectorTranspose_Multiply13(t *testing.T) { // // Constants // m := optim.NewModel("VarVectorTranspose_Multiply13") @@ -1829,14 +1615,9 @@ func TestVarVectorTranspose_Multiply12(t *testing.T) { // //} -/* -TestVarVectorTranspose_Multiply14 -Description: - - Tests the multiplication of a VarVectorTranspose with a - proper optim.VectorLinearExpr object. - (Used a varVector that is identical to vvt0 in VectorLinearExpression) -*/ +// TestVarVectorTranspose_Multiply14 Tests the multiplication of a VarVectorTranspose with a +// proper optim.VectorLinearExpr object. +// (Used a varVector that is identical to vvt0 in VectorLinearExpression) func TestVarVectorTranspose_Multiply14(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Multiply13") @@ -1908,14 +1689,9 @@ func TestVarVectorTranspose_Multiply14(t *testing.T) { } -/* -TestVarVectorTranspose_Check1 -Description: - - Tests the Check method for a VarVectorTranspose. - When there is an incorrectly initialized variable in one of the elements, - then this should throw an error. -*/ +// TestVarVectorTranspose_Check1 Tests the Check method for a VarVectorTranspose. +// When there is an incorrectly initialized variable in one of the elements, +// then this should throw an error. func TestVarVectorTranspose_Check1(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Check1") @@ -1946,13 +1722,8 @@ func TestVarVectorTranspose_Check1(t *testing.T) { } -/* -TestVarVectorTranspose_Check2 -Description: - - Tests the Check method for a VarVectorTranspose. - For a properly initialized VarVectorTranspose, this should not throw an error. -*/ +// TestVarVectorTranspose_Check2 Tests the Check method for a VarVectorTranspose. +// For a properly initialized VarVectorTranspose, this should not throw an error. func TestVarVectorTranspose_Check2(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_Check2") @@ -1968,13 +1739,8 @@ func TestVarVectorTranspose_Check2(t *testing.T) { } } -/* -TestVarVectorTranspose_ToSymbolic1 -Description: - - Tests the ToSymbolic method for a VarVectorTranspose - that is not well-defined. This should throw an error. -*/ +// TestVarVectorTranspose_ToSymbolic1 Tests the ToSymbolic method for a VarVectorTranspose +// that is not well-defined. This should throw an error. func TestVarVectorTranspose_ToSymbolic1(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_ToSymbolic1") @@ -2004,14 +1770,9 @@ func TestVarVectorTranspose_ToSymbolic1(t *testing.T) { } } -/* -TestVarVectorTranspose_ToSymbolic2 -Description: - - Tests the ToSymbolic method for a VarVectorTranspose - that is well-defined. The result should not produce - an error and should be of the type symbolic.VariableMatrix. -*/ +// TestVarVectorTranspose_ToSymbolic2 Tests the ToSymbolic method for a VarVectorTranspose +// that is well-defined. The result should not produce +// an error and should be of the type symbolic.VariableMatrix. func TestVarVectorTranspose_ToSymbolic2(t *testing.T) { // Constants m := optim.NewModel("VarVectorTranspose_ToSymbolic2") diff --git a/testing/optim/vars_test.go b/testing/optim/vars_test.go index 74005e5..3c13e0f 100644 --- a/testing/optim/vars_test.go +++ b/testing/optim/vars_test.go @@ -7,18 +7,9 @@ import ( "testing" ) -/* -vars_test.go -Description: - Testing functions relevant to the Var() object. (Scalar Variable) -*/ - -/* -TestVar_NumVars1 -Description: - - Tests whether or not NumVars returns 1 for a single variable. -*/ +// Testing functions relevant to the Var() object. (Scalar Variable) + +// TestVar_NumVars1 Tests whether or not NumVars returns 1 for a single variable. func TestVar_NumVars1(t *testing.T) { // Constants m := optim.NewModel("NumVars1") @@ -35,12 +26,7 @@ func TestVar_NumVars1(t *testing.T) { } -/* -TestVar_Constant1 -Description: - - Tests whether or not NumVars returns 0 as the constant included in the a single variable. -*/ +// TestVar_Constant1 Tests whether or not NumVars returns 0 as the constant included in the a single variable. func TestVar_Constant1(t *testing.T) { // Constants m := optim.NewModel("Var-Constant1") @@ -57,12 +43,7 @@ func TestVar_Constant1(t *testing.T) { } -/* -TestVar_Plus1 -Description: - - Tests the approach of performing addition of a var with a constant. -*/ +// TestVar_Plus1 Tests the approach of performing addition of a var with a constant. func TestVar_Plus1(t *testing.T) { // Constants m := optim.NewModel("Plus1") @@ -98,12 +79,7 @@ func TestVar_Plus1(t *testing.T) { } } -/* -TestVar_Plus2 -Description: - - Tests the approach of performing addition of a var with a var. -*/ +// TestVar_Plus2 Tests the approach of performing addition of a var with a var. func TestVar_Plus2(t *testing.T) { // Constants m := optim.NewModel("Plus2") @@ -146,12 +122,7 @@ func TestVar_Plus2(t *testing.T) { } } -/* -TestVar_Plus3 -Description: - - Tests the approach of performing addition of a var with a scalar linear expression. -*/ +// TestVar_Plus3 Tests the approach of performing addition of a var with a scalar linear expression. func TestVar_Plus3(t *testing.T) { // Constants m := optim.NewModel("Plus3") @@ -237,12 +208,7 @@ func TestVar_Plus3(t *testing.T) { } } -/* -TestVar_Plus4 -Description: - - Tests the approach of performing addition of a var with a scalar quadratic expression. -*/ +// TestVar_Plus4 Tests the approach of performing addition of a var with a scalar quadratic expression. func TestVar_Plus4(t *testing.T) { // Constants m := optim.NewModel("Plus4") @@ -330,12 +296,7 @@ func TestVar_Plus4(t *testing.T) { } } -/* -TestVar_Plus5 -Description: - - Tests that the Plus method properly throws an error. -*/ +// TestVar_Plus5 Tests that the Plus method properly throws an error. func TestVar_Plus5(t *testing.T) { // Constants m := optim.NewModel("Plus1") @@ -358,13 +319,8 @@ func TestVar_Plus5(t *testing.T) { } } -/* -TestVar_Plus6 -Description: - - Tests the approach of performing addition of a var with a var - when the var is the same. -*/ +// TestVar_Plus6 Tests the approach of performing addition of a var with a var +// when the var is the same. func TestVar_Plus6(t *testing.T) { // Constants m := optim.NewModel("Plus2") @@ -405,12 +361,7 @@ func TestVar_Plus6(t *testing.T) { } } -/* -TestVariable_Multiply1 -Description: - - Tests how well the Multiply() function works between a variable and a float. -*/ +// TestVariable_Multiply1 Tests how well the Multiply() function works between a variable and a float. func TestVariable_Multiply1(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") @@ -454,12 +405,7 @@ func TestVariable_Multiply1(t *testing.T) { } } -/* -TestVariable_Multiply2 -Description: - - Tests how well the Multiply() function works between a variable and a K. -*/ +// TestVariable_Multiply2 Tests how well the Multiply() function works between a variable and a K. func TestVariable_Multiply2(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply2") @@ -503,12 +449,7 @@ func TestVariable_Multiply2(t *testing.T) { } } -/* -TestVariable_Multiply3 -Description: - - Tests how well the Multiply() function works between a variable and a variable (different). -*/ +// TestVariable_Multiply3 Tests how well the Multiply() function works between a variable and a variable (different). func TestVariable_Multiply3(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") @@ -563,12 +504,7 @@ func TestVariable_Multiply3(t *testing.T) { } -/* -TestVariable_Multiply4 -Description: - - Tests how well the Multiply() function works between a variable and a variable (same as original). -*/ +// TestVariable_Multiply4 Tests how well the Multiply() function works between a variable and a variable (same as original). func TestVariable_Multiply4(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") @@ -622,12 +558,7 @@ func TestVariable_Multiply4(t *testing.T) { } -/* -TestVariable_Multiply5 -Description: - - Tests how well the Multiply() function works between a variable and a scalar linear expression. -*/ +// TestVariable_Multiply5 Tests how well the Multiply() function works between a variable and a scalar linear expression. func TestVariable_Multiply5(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") @@ -681,12 +612,7 @@ func TestVariable_Multiply5(t *testing.T) { } -/* -TestVariable_Multiply6 -Description: - - Tests how well the Multiply() function works between a variable and a scalar linear expression. -*/ +// TestVariable_Multiply6 Tests how well the Multiply() function works between a variable and a scalar linear expression. func TestVariable_Multiply6(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") @@ -772,13 +698,8 @@ func TestVariable_Multiply6(t *testing.T) { } -/* -TestVariable_Multiply7 -Description: - - Tests how well the Multiply() function works between a variable and - a scalar quadratic expression. Should produce an error -*/ +// TestVariable_Multiply7 Tests how well the Multiply() function works between a variable and +// a scalar quadratic expression. Should produce an error func TestVariable_Multiply7(t *testing.T) { //Constants m := optim.NewModel("Test-Variable-Multiply1") diff --git a/testing/optim/vector_constant_test.go b/testing/optim/vector_constant_test.go index ee3e67c..79af403 100644 --- a/testing/optim/vector_constant_test.go +++ b/testing/optim/vector_constant_test.go @@ -8,19 +8,10 @@ import ( "testing" ) -/* -vector_constant_test.go -Description: - Tests the new type KVector which represents a constant vector. -*/ - -/* -TestKVector_At1 -Description: - - This test verifies whether or not a 1 is retrieved when we create a KVector - using OnesVector(). -*/ +// Tests the new type KVector which represents a constant vector. + +// TestKVector_AtVec1 This test verifies whether or not a 1 is retrieved when we create a KVector +// using OnesVector(). func TestKVector_AtVec1(t *testing.T) { // Create a KVector desLength := 4 @@ -32,13 +23,8 @@ func TestKVector_AtVec1(t *testing.T) { } } -/* -TestKVector_At2 -Description: - - This test verifies whether or not an arbitrary number is retrieved when we create a KVector - using NewVecDense(). -*/ +// TestKVector_AtVec2 This test verifies whether or not an arbitrary number is retrieved when we create a KVector +// using NewVecDense(). func TestKVector_AtVec2(t *testing.T) { // Create a KVector vec1Elts := []float64{1.0, 3.0, 5.0, 7.0, 9.0} @@ -50,13 +36,8 @@ func TestKVector_AtVec2(t *testing.T) { } } -/* -TestKVector_Len1 -Description: - - This function tests that the Len() method works. - (Should be inherited from the base type mat.DenseVec) -*/ +// TestKVector_Len1 This function tests that the Len() method works. +// (Should be inherited from the base type mat.DenseVec) func TestKVector_Len1(t *testing.T) { // Create a KVector desLength := 4 @@ -67,12 +48,7 @@ func TestKVector_Len1(t *testing.T) { } } -/* -TestKVector_Len2 -Description: - - This function tests that the Len() method is properly inherited by KVector. -*/ +// TestKVector_Len2 This function tests that the Len() method is properly inherited by KVector. func TestKVector_Len2(t *testing.T) { // Create a KVector desLength := 10 @@ -83,12 +59,7 @@ func TestKVector_Len2(t *testing.T) { } } -/* -TestKVector_NumVars1 -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVector_NumVars1 Verify that the number of variables associated with the constant vector is zero. func TestKVector_NumVars1(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(10)) @@ -103,12 +74,7 @@ func TestKVector_NumVars1(t *testing.T) { } -/* -TestKVector_IDs1() -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVector_IDs1 Verify that the number of variables associated with the constant vector is zero. func TestKVector_IDs1(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(10)) @@ -123,12 +89,7 @@ func TestKVector_IDs1(t *testing.T) { } -/* -TestKVector_LinearCoeff1 -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVector_LinearCoeff1 Verify that the number of variables associated with the constant vector is zero. func TestKVector_LinearCoeff1(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(10)) @@ -158,12 +119,7 @@ func TestKVector_LinearCoeff1(t *testing.T) { } -/* -TestKVector_Constant1 -Description: - - Tests that the constant function correctly retrieves a matrix. -*/ +// TestKVector_Constant1 Tests that the constant function correctly retrieves a matrix. func TestKVector_Constant1(t *testing.T) { // Constant kv1 := optim.KVector(optim.OnesVector(10)) @@ -189,12 +145,7 @@ func TestKVector_Constant1(t *testing.T) { } } -/* -TestKVector_Comparison1 -Description: - - This function tests that the Comparison() method is properly working for KVector inputs. -*/ +// TestKVector_Comparison1 This function tests that the Comparison() method is properly working for KVector inputs. func TestKVector_Comparison1(t *testing.T) { // Constants desLength := 10 @@ -216,16 +167,11 @@ func TestKVector_Comparison1(t *testing.T) { } } -/* -TestKVector_Comparison2 -Description: - - This function tests that the Comparison() method is properly working for KVector inputs. - Uses SenseLessThanEqual. - Comparison of: - - KVector - - VarVector -*/ +// TestKVector_Comparison2 This function tests that the Comparison() method is properly working for KVector inputs. +// Uses SenseLessThanEqual. +// Comparison of: +// - KVector +// - VarVector func TestKVector_Comparison2(t *testing.T) { // Constants desLength := 10 @@ -248,16 +194,11 @@ func TestKVector_Comparison2(t *testing.T) { } } -/* -TestKVector_Comparison3 -Description: - - This function tests that the Comparison() method is properly working for KVector inputs. - Uses SenseGreaterThanEqual. - Comparison of: - - KVector - - VectorLinearExpression -*/ +// TestKVector_Comparison3 This function tests that the Comparison() method is properly working for KVector inputs. +// Uses SenseGreaterThanEqual. +// Comparison of: +// - KVector +// - VectorLinearExpression func TestKVector_Comparison3(t *testing.T) { // Constants desLength := 10 @@ -288,17 +229,12 @@ func TestKVector_Comparison3(t *testing.T) { } } -/* -TestKVector_Comparison4 -Description: - - This function tests that the Comparison() method is properly working for KVector inputs. - Input is bad (dimension of linear vector expression is different from constant vector) and error should be thrown. - Uses SenseGreaterThanEqual. - Comparison of: - - KVector - - VectorLinearExpression -*/ +// TestKVector_Comparison4 This function tests that the Comparison() method is properly working for KVector inputs. +// Input is bad (dimension of linear vector expression is different from constant vector) and error should be thrown. +// Uses SenseGreaterThanEqual. +// Comparison of: +// - KVector +// - VectorLinearExpression func TestKVector_Comparison4(t *testing.T) { // Constants desLength := 10 @@ -321,13 +257,8 @@ func TestKVector_Comparison4(t *testing.T) { } } -/* -TestKVector_Comparison5 -Description: - - Tests the Eq comparison of KVector with a bool - results in a proper error. -*/ +// TestKVector_Comparison5 Tests the Eq comparison of KVector with a bool +// results in a proper error. func TestKVector_Comparison5(t *testing.T) { // Constants desLength := 10 @@ -354,13 +285,8 @@ func TestKVector_Comparison5(t *testing.T) { } -/* -TestKVector_Comparison6 -Description: - - Tests the Eq comparison of KVector with a VarVectorTranspose - results in a proper error. -*/ +// TestKVector_Comparison6 Tests the Eq comparison of KVector with a VarVectorTranspose +// results in a proper error. func TestKVector_Comparison6(t *testing.T) { // Constants desLength := 10 @@ -385,13 +311,8 @@ func TestKVector_Comparison6(t *testing.T) { } -/* -TestKVector_Comparison7 -Description: - - Tests the Eq comparison of KVector with a KVector of incorrect length - results in a proper error. -*/ +// TestKVector_Comparison7 Tests the Eq comparison of KVector with a KVector of incorrect length +// results in a proper error. func TestKVector_Comparison7(t *testing.T) { // Constants desLength := 10 @@ -416,12 +337,7 @@ func TestKVector_Comparison7(t *testing.T) { } -/* -TestKVector_Plus1 -Description: - - Tests the addition of KVector with another KVector -*/ +// TestKVector_Plus1 Tests the addition of KVector with another KVector func TestKVector_Plus1(t *testing.T) { // Constants desLength := 10 @@ -452,12 +368,7 @@ func TestKVector_Plus1(t *testing.T) { } } -/* -TestKVector_Plus2 -Description: - - Tests the addition of KVector with a float64 -*/ +// TestKVector_Plus2 Tests the addition of KVector with a float64 func TestKVector_Plus2(t *testing.T) { // Constants desLength := 10 @@ -488,12 +399,7 @@ func TestKVector_Plus2(t *testing.T) { } } -/* -TestKVector_Plus3 -Description: - - Tests the addition of KVector with a K -*/ +// TestKVector_Plus3 Tests the addition of KVector with a K func TestKVector_Plus3(t *testing.T) { // Constants desLength := 10 @@ -524,12 +430,7 @@ func TestKVector_Plus3(t *testing.T) { } } -/* -TestKVector_Plus4 -Description: - - Tests the addition of KVector with a mat.VecDense vector -*/ +// TestKVector_Plus4 Tests the addition of KVector with a mat.VecDense vector func TestKVector_Plus4(t *testing.T) { // Constants desLength := 10 @@ -560,12 +461,7 @@ func TestKVector_Plus4(t *testing.T) { } } -/* -TestKVector_Plus5 -Description: - - Tests the addition of KVector with a mat.VecDense of improper length -*/ +// TestKVector_Plus5 Tests the addition of KVector with a mat.VecDense of improper length func TestKVector_Plus5(t *testing.T) { // Constants desLength := 10 @@ -587,12 +483,7 @@ func TestKVector_Plus5(t *testing.T) { } } -/* -TestKVector_Plus6 -Description: - - Tests the addition of KVector with another KVector. Length mismatch. -*/ +// TestKVector_Plus6 Tests the addition of KVector with another KVector. Length mismatch. func TestKVector_Plus6(t *testing.T) { // Constants desLength := 10 @@ -615,12 +506,7 @@ func TestKVector_Plus6(t *testing.T) { } -/* -TestKVector_Plus7 -Description: - - Tests the addition of KVector with a VarVector -*/ +// TestKVector_Plus7 Tests the addition of KVector with a VarVector func TestKVector_Plus7(t *testing.T) { // Constants desLength := 10 @@ -674,12 +560,7 @@ func TestKVector_Plus7(t *testing.T) { } } -/* -TestKVector_Plus8 -Description: - - Tests the addition of KVector with a VectorLinearExpr -*/ +// TestKVector_Plus8 Tests the addition of KVector with a VectorLinearExpr func TestKVector_Plus8(t *testing.T) { // Constants desLength := 10 @@ -734,12 +615,7 @@ func TestKVector_Plus8(t *testing.T) { } } -/* -TestKVector_Plus9 -Description: - - Tests the addition of KVector with a bool -*/ +// TestKVector_Plus9 Tests the addition of KVector with a bool func TestKVector_Plus9(t *testing.T) { // Constants desLength := 10 @@ -757,12 +633,7 @@ func TestKVector_Plus9(t *testing.T) { } } -/* -TestKVector_Plus10 -Description: - - Tests the addition of KVector with a KVectorTranspose -*/ +// TestKVector_Plus10 Tests the addition of KVector with a KVectorTranspose func TestKVector_Plus10(t *testing.T) { // Constants desLength := 10 @@ -784,12 +655,7 @@ func TestKVector_Plus10(t *testing.T) { } } -/* -TestKVector_Plus11 -Description: - - Tests the addition of KVector with a VarVectorTranspose -*/ +// TestKVector_Plus11 Tests the addition of KVector with a VarVectorTranspose func TestKVector_Plus11(t *testing.T) { // Constants desLength := 10 @@ -811,12 +677,7 @@ func TestKVector_Plus11(t *testing.T) { } } -/* -TestKVector_Plus12 -Description: - - Tests the addition of KVector with a VectorLinearExpression -*/ +// TestKVector_Plus12 Tests the addition of KVector with a VectorLinearExpression func TestKVector_Plus12(t *testing.T) { // Constants desLength := 10 @@ -866,12 +727,7 @@ func TestKVector_Plus12(t *testing.T) { } -/* -TestKVector_Plus13 -Description: - - Tests the addition of KVector with a VectorLinearExpressionTranspose -*/ +// TestKVector_Plus13 Tests the addition of KVector with a VectorLinearExpressionTranspose func TestKVector_Plus13(t *testing.T) { // Constants desLength := 10 @@ -905,12 +761,7 @@ func TestKVector_Plus13(t *testing.T) { } -/* -TestKVector_Multiply1 -Description: - - Tests the multiplication of the KVector with a float. -*/ +// TestKVector_Multiply1 Tests the multiplication of the KVector with a float. func TestKVector_Multiply1(t *testing.T) { // Constants desLength := 10 @@ -943,12 +794,7 @@ func TestKVector_Multiply1(t *testing.T) { } } -/* -TestKVector_Multiply2 -Description: - - Tests the multiplication of the KVector with a float and an error. -*/ +// TestKVector_Multiply2 Tests the multiplication of the KVector with a float and an error. func TestKVector_Multiply2(t *testing.T) { // Constants desLength := 10 @@ -968,12 +814,7 @@ func TestKVector_Multiply2(t *testing.T) { } } -/* -TestKVector_Multiply3 -Description: - - Tests the multiplication of the KVector with a KVector of different length. -*/ +// TestKVector_Multiply3 Tests the multiplication of the KVector with a KVector of different length. func TestKVector_Multiply3(t *testing.T) { // Constants desLength := 10 @@ -997,12 +838,7 @@ func TestKVector_Multiply3(t *testing.T) { } } -/* -TestKVector_Multiply4 -Description: - - Tests the multiplication of the KVector with a constant K. -*/ +// TestKVector_Multiply4 Tests the multiplication of the KVector with a constant K. func TestKVector_Multiply4(t *testing.T) { // Constants desLength := 10 @@ -1035,12 +871,7 @@ func TestKVector_Multiply4(t *testing.T) { } } -/* -TestKVector_Multiply5 -Description: - - Tests the multiplication of the KVector with a mat.VecDense object. -*/ +// TestKVector_Multiply5 Tests the multiplication of the KVector with a mat.VecDense object. func TestKVector_Multiply5(t *testing.T) { // Constants desLength := 10 @@ -1060,12 +891,7 @@ func TestKVector_Multiply5(t *testing.T) { } } -/* -TestKVector_Multiply6 -Description: - - Tests the multiplication of the KVector with a KVector. -*/ +// TestKVector_Multiply6 Tests the multiplication of the KVector with a KVector. func TestKVector_Multiply6(t *testing.T) { // Constants desLength := 10 @@ -1087,12 +913,7 @@ func TestKVector_Multiply6(t *testing.T) { } } -/* -TestKVector_Multiply7 -Description: - - Tests the multiplication of the KVector with a KVectorTranspose object. -*/ +// TestKVector_Multiply7 Tests the multiplication of the KVector with a KVectorTranspose object. func TestKVector_Multiply7(t *testing.T) { // Constants desLength := 10 @@ -1110,12 +931,7 @@ func TestKVector_Multiply7(t *testing.T) { } } -/* -TestKVector_Multiply8 -Description: - - Tests the multiplication of the KVector with a VarVector. -*/ +// TestKVector_Multiply8 Tests the multiplication of the KVector with a VarVector. func TestKVector_Multiply8(t *testing.T) { // Constants desLength := 10 @@ -1137,12 +953,7 @@ func TestKVector_Multiply8(t *testing.T) { } } -/* -TestKVector_Multiply9 -Description: - - Tests the multiplication of the KVector with a KVectorTranspose object. -*/ +// TestKVector_Multiply9 Tests the multiplication of the KVector with a KVectorTranspose object. func TestKVector_Multiply9(t *testing.T) { // Constants desLength := 10 @@ -1160,12 +971,7 @@ func TestKVector_Multiply9(t *testing.T) { } } -/* -TestKVector_Multiply10 -Description: - - Tests the multiplication of the KVector with a VarVector. -*/ +// TestKVector_Multiply10 Tests the multiplication of the KVector with a VarVector. func TestKVector_Multiply10(t *testing.T) { // Constants desLength := 10 @@ -1188,12 +994,7 @@ func TestKVector_Multiply10(t *testing.T) { } } -/* -TestKVector_Multiply11 -Description: - - Tests the multiplication of the KVector with a KVectorTranspose object. -*/ +// TestKVector_Multiply11 Tests the multiplication of the KVector with a KVectorTranspose object. func TestKVector_Multiply11(t *testing.T) { // Constants desLength := 10 @@ -1212,12 +1013,7 @@ func TestKVector_Multiply11(t *testing.T) { } } -/* -TestKVector_Multiply12 -Description: - - Tests the multiplication of the KVector with a KVectorTranspose object. -*/ +// TestKVector_Multiply12 Tests the multiplication of the KVector with a KVectorTranspose object. func TestKVector_Multiply12(t *testing.T) { // Constants desLength := 10 @@ -1237,13 +1033,8 @@ func TestKVector_Multiply12(t *testing.T) { } } -/* -TestKVector_LessEq1 -Description: - - Tests the LessEq comparison of KVector with a VectorLinearExpressionTranspose. - (should result in an error) -*/ +// TestKVector_LessEq1 Tests the LessEq comparison of KVector with a VectorLinearExpressionTranspose. +// (should result in an error) func TestKVector_LessEq1(t *testing.T) { // Constants desLength := 10 @@ -1276,14 +1067,9 @@ func TestKVector_LessEq1(t *testing.T) { } -/* -TestKVector_GreaterEq1 -Description: - - Tests the LessEq comparison of KVector with a VectorLinearExpression - with different variable lengths. - (should result in an error) -*/ +// TestKVector_GreaterEq1 Tests the LessEq comparison of KVector with a VectorLinearExpression +// with different variable lengths. +// (should result in an error) func TestKVector_GreaterEq1(t *testing.T) { // Constants desLength := 10 @@ -1317,13 +1103,8 @@ func TestKVector_GreaterEq1(t *testing.T) { } -/* -TestKVector_Eq1 -Description: - - Tests the Eq comparison of KVector with a KVectorTranspose - results in a proper error. -*/ +// TestKVector_Eq1 Tests the Eq comparison of KVector with a KVectorTranspose +// results in a proper error. func TestKVector_Eq1(t *testing.T) { // Constants desLength := 10 @@ -1348,12 +1129,7 @@ func TestKVector_Eq1(t *testing.T) { } -/* -TestKVector_Transpose1 -Description: - - Tests the transposition of a given vector returns the new type KVectorTranspose. -*/ +// TestKVector_Transpose1 Tests the transposition of a given vector returns the new type KVectorTranspose. func TestKVector_Transpose1(t *testing.T) { // Constants desLength := 10 @@ -1370,12 +1146,7 @@ func TestKVector_Transpose1(t *testing.T) { } } -/* -TestKVector_Mult1 -Description: - - Tests the multiplication of the KVector with a float. -*/ +// TestKVector_Mult1 Tests the multiplication of the KVector with a float. func TestKVector_Mult1(t *testing.T) { // Constants desLength := 10 diff --git a/testing/optim/vector_constant_transposed_test.go b/testing/optim/vector_constant_transposed_test.go index ec7dfff..29fbb6a 100644 --- a/testing/optim/vector_constant_transposed_test.go +++ b/testing/optim/vector_constant_transposed_test.go @@ -9,18 +9,9 @@ import ( "testing" ) -/* -vector_constant_transposed_test.go -Description: - Tests the new type KVectorTranspose which represents a constant vector. -*/ - -/* -TestKVectorTranspose_Check1 -Description: - - Tests that the Check() method returns nil. -*/ +// Tests the new type KVectorTranspose which represents a constant vector. + +// TestKVectorTranspose_Check1 Tests that the Check() method returns nil. func TestKVectorTranspose_Check1(t *testing.T) { // Create a KVectorTranspose desLength := 4 @@ -32,13 +23,8 @@ func TestKVectorTranspose_Check1(t *testing.T) { } } -/* -TestKVectorTranspose_At1 -Description: - - This test verifies whether or not a 1 is retrieved when we create a KVectorTranspose - using OnesVector(). -*/ +// TestKVectorTranspose_AtVec1 This test verifies whether or not a 1 is retrieved when we create a KVectorTranspose +// using OnesVector(). func TestKVectorTranspose_AtVec1(t *testing.T) { // Create a KVectorTranspose desLength := 4 @@ -50,13 +36,8 @@ func TestKVectorTranspose_AtVec1(t *testing.T) { } } -/* -TestKVectorTranspose_At2 -Description: - - This test verifies whether or not an arbitrary number is retrieved when we create a KVectorTranspose - using NewVecDense(). -*/ +// TestKVectorTranspose_AtVec2 This test verifies whether or not an arbitrary number is retrieved when we create a KVectorTranspose +// using NewVecDense(). func TestKVectorTranspose_AtVec2(t *testing.T) { // Create a KVectorTranspose vec1Elts := []float64{1.0, 3.0, 5.0, 7.0, 9.0} @@ -68,13 +49,8 @@ func TestKVectorTranspose_AtVec2(t *testing.T) { } } -/* -TestKVectorTranspose_Len1 -Description: - - This function tests that the Len() method works. - (Should be inherited from the base type mat.DenseVec) -*/ +// TestKVectorTranspose_Len1 This function tests that the Len() method works. +// (Should be inherited from the base type mat.DenseVec) func TestKVectorTranspose_Len1(t *testing.T) { // Create a KVectorTranspose desLength := 4 @@ -85,12 +61,7 @@ func TestKVectorTranspose_Len1(t *testing.T) { } } -/* -TestKVectorTranspose_Len2 -Description: - - This function tests that the Len() method is properly inherited by KVectorTranspose. -*/ +// TestKVectorTranspose_Len2 This function tests that the Len() method is properly inherited by KVectorTranspose. func TestKVectorTranspose_Len2(t *testing.T) { // Create a KVectorTranspose desLength := 10 @@ -101,12 +72,7 @@ func TestKVectorTranspose_Len2(t *testing.T) { } } -/* -TestKVectorTranspose_NumVars1 -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVectorTranspose_NumVars1 Verify that the number of variables associated with the constant vector is zero. func TestKVectorTranspose_NumVars1(t *testing.T) { // Constant kv1 := optim.KVectorTranspose(optim.OnesVector(10)) @@ -121,12 +87,7 @@ func TestKVectorTranspose_NumVars1(t *testing.T) { } -/* -TestKVectorTranspose_IDs1() -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVectorTranspose_IDs1 Verify that the number of variables associated with the constant vector is zero. func TestKVectorTranspose_IDs1(t *testing.T) { // Constant kv1 := optim.KVectorTranspose(optim.OnesVector(10)) @@ -141,12 +102,7 @@ func TestKVectorTranspose_IDs1(t *testing.T) { } -/* -TestKVectorTranspose_LinearCoeff1 -Description: - - Verify that the number of variables associated with the constant vector is zero. -*/ +// TestKVectorTranspose_LinearCoeff1 Verify that the number of variables associated with the constant vector is zero. func TestKVectorTranspose_LinearCoeff1(t *testing.T) { // Constant kv1 := optim.KVectorTranspose(optim.OnesVector(10)) @@ -176,12 +132,7 @@ func TestKVectorTranspose_LinearCoeff1(t *testing.T) { } -/* -TestKVectorTranspose_Constant1 -Description: - - Tests that the constant function correctly retrieves a matrix. -*/ +// TestKVectorTranspose_Constant1 Tests that the constant function correctly retrieves a matrix. func TestKVectorTranspose_Constant1(t *testing.T) { // Constant kv1 := optim.KVectorTranspose(optim.OnesVector(10)) @@ -207,12 +158,7 @@ func TestKVectorTranspose_Constant1(t *testing.T) { } } -/* -TestKVectorTranspose_Comparison1 -Description: - - This function tests that the Comparison() method is properly working for KVectorTranspose inputs. -*/ +// TestKVectorTranspose_Comparison1 This function tests that the Comparison() method is properly working for KVectorTranspose inputs. func TestKVectorTranspose_Comparison1(t *testing.T) { // Constants desLength := 10 @@ -234,16 +180,11 @@ func TestKVectorTranspose_Comparison1(t *testing.T) { } } -/* -TestKVectorTranspose_Comparison2 -Description: - - This function tests that the Comparison() method is properly working for KVectorTranspose inputs. - Uses SenseLessThanEqual. - Comparison of: - - KVectorTranspose - - VarVector -*/ +// TestKVectorTranspose_Comparison2 This function tests that the Comparison() method is properly working for KVectorTranspose inputs. +// Uses SenseLessThanEqual. +// Comparison of: +// - KVectorTranspose +// - VarVector func TestKVectorTranspose_Comparison2(t *testing.T) { // Constants desLength := 10 @@ -266,16 +207,11 @@ func TestKVectorTranspose_Comparison2(t *testing.T) { } } -/* -TestKVectorTranspose_Comparison3 -Description: - - This function tests that the Comparison() method is properly working for KVectorTranspose inputs. - Uses SenseGreaterThanEqual. - Comparison of: - - KVectorTranspose - - VectorLinearExpression -*/ +// TestKVectorTranspose_Comparison3 This function tests that the Comparison() method is properly working for KVectorTranspose inputs. +// Uses SenseGreaterThanEqual. +// Comparison of: +// - KVectorTranspose +// - VectorLinearExpression func TestKVectorTranspose_Comparison3(t *testing.T) { // Constants desLength := 10 @@ -306,17 +242,12 @@ func TestKVectorTranspose_Comparison3(t *testing.T) { } } -/* -TestKVectorTranspose_Comparison4 -Description: - - This function tests that the Comparison() method is properly working for KVectorTranspose inputs. - Input is bad (dimension of linear vector expression is different from constant vector) and error should be thrown. - Uses SenseGreaterThanEqual. - Comparison of: - - KVectorTranspose - - VectorLinearExpression -*/ +// TestKVectorTranspose_Comparison4 This function tests that the Comparison() method is properly working for KVectorTranspose inputs. +// Input is bad (dimension of linear vector expression is different from constant vector) and error should be thrown. +// Uses SenseGreaterThanEqual. +// Comparison of: +// - KVectorTranspose +// - VectorLinearExpression func TestKVectorTranspose_Comparison4(t *testing.T) { // Constants desLength := 10 @@ -339,18 +270,13 @@ func TestKVectorTranspose_Comparison4(t *testing.T) { } } -/* -TestKVectorTranspose_Comparison5 -Description: - - This function tests that the Comparison() method is properly working - for KVectorTranspose. - Uses SenseLessThanEqual. - Comparison of: - - KVectorTranspose - - VarVector - Should throw error -*/ +// TestKVectorTranspose_Comparison5 This function tests that the Comparison() method is properly working +// for KVectorTranspose. +// Uses SenseLessThanEqual. +// Comparison of: +// - KVectorTranspose +// - VarVector +// Should throw error func TestKVectorTranspose_Comparison5(t *testing.T) { // Constants desLength := 10 @@ -371,12 +297,7 @@ func TestKVectorTranspose_Comparison5(t *testing.T) { } } -/* -TestKVectorTranspose_LessEq1 -Description: - - This function tests that the LessEq() method is properly working for KVector inputs. -*/ +// TestKVectorTranspose_LessEq1 This function tests that the LessEq() method is properly working for KVector inputs. func TestKVectorTranspose_LessEq1(t *testing.T) { // Constants desLength := 10 @@ -396,13 +317,8 @@ func TestKVectorTranspose_LessEq1(t *testing.T) { } } -/* -TestKVectorTranspose_GreaterEq1 -Description: - - This function tests that the GreaterEq() method is properly working for - KVectorTranspose inputs of improper length. -*/ +// TestKVectorTranspose_GreaterEq1 This function tests that the GreaterEq() method is properly working for +// KVectorTranspose inputs of improper length. func TestKVectorTranspose_GreaterEq1(t *testing.T) { // Constants desLength := 10 @@ -423,13 +339,8 @@ func TestKVectorTranspose_GreaterEq1(t *testing.T) { } } -/* -TestKVectorTranspose_Eq1 -Description: - - This function tests that the Eq() method is properly working for - when given an unexpected type input. -*/ +// TestKVectorTranspose_Eq1 This function tests that the Eq() method is properly working for +// when given an unexpected type input. func TestKVectorTranspose_Eq1(t *testing.T) { // Constants desLength := 10 @@ -451,12 +362,7 @@ func TestKVectorTranspose_Eq1(t *testing.T) { } } -/* -TestKVectorTranspose_Plus1 -Description: - - Tests the addition of KVectorTranspose with another KVectorTranspose -*/ +// TestKVectorTranspose_Plus1 Tests the addition of KVectorTranspose with another KVectorTranspose func TestKVectorTranspose_Plus1(t *testing.T) { // Constants desLength := 10 @@ -487,12 +393,7 @@ func TestKVectorTranspose_Plus1(t *testing.T) { } } -/* -TestKVectorTranspose_Plus2 -Description: - - Tests the addition of KVectorTranspose with a float64 -*/ +// TestKVectorTranspose_Plus2 Tests the addition of KVectorTranspose with a float64 func TestKVectorTranspose_Plus2(t *testing.T) { // Constants desLength := 10 @@ -523,12 +424,7 @@ func TestKVectorTranspose_Plus2(t *testing.T) { } } -/* -TestKVectorTranspose_Plus3 -Description: - - Tests the addition of KVectorTranspose with a K -*/ +// TestKVectorTranspose_Plus3 Tests the addition of KVectorTranspose with a K func TestKVectorTranspose_Plus3(t *testing.T) { // Constants desLength := 10 @@ -559,12 +455,7 @@ func TestKVectorTranspose_Plus3(t *testing.T) { } } -/* -TestKVectorTranspose_Plus4 -Description: - - Tests the addition of KVectorTranspose with a mat.VecDense vector -*/ +// TestKVectorTranspose_Plus4 Tests the addition of KVectorTranspose with a mat.VecDense vector func TestKVectorTranspose_Plus4(t *testing.T) { // Constants desLength := 10 @@ -595,12 +486,7 @@ func TestKVectorTranspose_Plus4(t *testing.T) { } } -/* -TestKVectorTranspose_Plus5 -Description: - - Tests the addition of KVectorTranspose with a mat.VecDense of improper length -*/ +// TestKVectorTranspose_Plus5 Tests the addition of KVectorTranspose with a mat.VecDense of improper length func TestKVectorTranspose_Plus5(t *testing.T) { // Constants desLength := 10 @@ -622,12 +508,7 @@ func TestKVectorTranspose_Plus5(t *testing.T) { } } -/* -TestKVectorTranspose_Plus6 -Description: - - Tests the addition of KVectorTranspose with another KVectorTranspose. Length mismatch. -*/ +// TestKVectorTranspose_Plus6 Tests the addition of KVectorTranspose with another KVectorTranspose. Length mismatch. func TestKVectorTranspose_Plus6(t *testing.T) { // Constants desLength := 10 @@ -650,12 +531,7 @@ func TestKVectorTranspose_Plus6(t *testing.T) { } -/* -TestKVectorTranspose_Plus7 -Description: - - Tests the addition of KVectorTranspose with a VarVector -*/ +// TestKVectorTranspose_Plus7 Tests the addition of KVectorTranspose with a VarVector func TestKVectorTranspose_Plus7(t *testing.T) { // Constants desLength := 10 @@ -709,12 +585,7 @@ func TestKVectorTranspose_Plus7(t *testing.T) { } } -/* -TestKVectorTranspose_Plus8 -Description: - - Tests the addition of KVectorTranspose with a VectorLinearExpr -*/ +// TestKVectorTranspose_Plus8 Tests the addition of KVectorTranspose with a VectorLinearExpr func TestKVectorTranspose_Plus8(t *testing.T) { // Constants desLength := 10 @@ -769,12 +640,7 @@ func TestKVectorTranspose_Plus8(t *testing.T) { } } -/* -TestKVectorTranspose_Plus9 -Description: - - Tests the addition of KVectorTranspose with a bool -*/ +// TestKVectorTranspose_Plus9 Tests the addition of KVectorTranspose with a bool func TestKVectorTranspose_Plus9(t *testing.T) { // Constants desLength := 10 @@ -792,12 +658,7 @@ func TestKVectorTranspose_Plus9(t *testing.T) { } } -/* -TestKVectorTranspose_Plus10 -Description: - - Tests the addition of KVectorTranspose with a bool -*/ +// TestKVectorTranspose_Plus10 Tests the addition of KVectorTranspose with a bool func TestKVectorTranspose_Plus10(t *testing.T) { // Constants desLength := 10 @@ -819,12 +680,7 @@ func TestKVectorTranspose_Plus10(t *testing.T) { } } -/* -TestKVectorTranspose_Plus11 -Description: - - Tests the addition of KVectorTranspose with a bool -*/ +// TestKVectorTranspose_Plus11 Tests the addition of KVectorTranspose with a bool func TestKVectorTranspose_Plus11(t *testing.T) { // Constants desLength := 10 @@ -846,12 +702,7 @@ func TestKVectorTranspose_Plus11(t *testing.T) { } } -/* -TestKVectorTranspose_Plus12 -Description: - - Tests the addition of KVectorTranspose with a varvector -*/ +// TestKVectorTranspose_Plus12 Tests the addition of KVectorTranspose with a varvector func TestKVectorTranspose_Plus12(t *testing.T) { // Constants desLength := 10 @@ -873,12 +724,7 @@ func TestKVectorTranspose_Plus12(t *testing.T) { } } -/* -TestKVectorTranspose_Plus13 -Description: - - Tests the addition of KVectorTranspose with a vle -*/ +// TestKVectorTranspose_Plus13 Tests the addition of KVectorTranspose with a vle func TestKVectorTranspose_Plus13(t *testing.T) { // Constants desLength := 10 @@ -905,12 +751,7 @@ func TestKVectorTranspose_Plus13(t *testing.T) { } } -/* -TestKVectorTranspose_Plus14 -Description: - - Tests the addition of KVectorTranspose with a vletranspose -*/ +// TestKVectorTranspose_Plus14 Tests the addition of KVectorTranspose with a vletranspose func TestKVectorTranspose_Plus14(t *testing.T) { // Constants desLength := 10 @@ -937,12 +778,7 @@ func TestKVectorTranspose_Plus14(t *testing.T) { } } -/* -TestKVectorTranspose_Mult1 -Description: - - Tests that the scalar multiplication function works as expected. -*/ +// TestKVectorTranspose_Mult1 Tests that the scalar multiplication function works as expected. func TestKVectorTranspose_Mult1(t *testing.T) { // Constants desLength := 10 @@ -970,12 +806,7 @@ func TestKVectorTranspose_Mult1(t *testing.T) { } } -/* -TestKVectorTranspose_Multiply1 -Description: - - Tests that the scalar multiplication function works as expected. -*/ +// TestKVectorTranspose_Multiply1 Tests that the scalar multiplication function works as expected. func TestKVectorTranspose_Multiply1(t *testing.T) { // Constants desLength := 10 @@ -1001,12 +832,7 @@ func TestKVectorTranspose_Multiply1(t *testing.T) { } } -/* -TestKVectorTranspose_Multiply2 -Description: - - Tests that the multiplication function works as expected for K input. -*/ +// TestKVectorTranspose_Multiply2 Tests that the multiplication function works as expected for K input. func TestKVectorTranspose_Multiply2(t *testing.T) { // Constants desLength := 10 @@ -1032,12 +858,7 @@ func TestKVectorTranspose_Multiply2(t *testing.T) { } } -/* -TestKVectorTranspose_Multiply3 -Description: - - Tests that the multiplication function works as expected for mat.VecDense input. -*/ +// TestKVectorTranspose_Multiply3 Tests that the multiplication function works as expected for mat.VecDense input. func TestKVectorTranspose_Multiply3(t *testing.T) { // Constants desLength := 10 @@ -1063,12 +884,7 @@ func TestKVectorTranspose_Multiply3(t *testing.T) { } } -/* -TestKVectorTranspose_Multiply4 -Description: - - Tests that the multiplication function works as expected for KVector input. -*/ +// TestKVectorTranspose_Multiply4 Tests that the multiplication function works as expected for KVector input. func TestKVectorTranspose_Multiply4(t *testing.T) { // Constants desLength := 10 @@ -1094,12 +910,7 @@ func TestKVectorTranspose_Multiply4(t *testing.T) { } } -/* -TestKVectorTranspose_Multiply5 -Description: - - Tests that the multiplication function works as expected for KVectorTranspose input. -*/ +// TestKVectorTranspose_Multiply5 Tests that the multiplication function works as expected for KVectorTranspose input. func TestKVectorTranspose_Multiply5(t *testing.T) { // Constants desLength := 10 @@ -1121,12 +932,7 @@ func TestKVectorTranspose_Multiply5(t *testing.T) { } -/* -TestKVectorTranspose_Multiply6 -Description: - - Tests that the multiplication function works as expected when a bad error is provided. -*/ +// TestKVectorTranspose_Multiply6 Tests that the multiplication function works as expected when a bad error is provided. func TestKVectorTranspose_Multiply6(t *testing.T) { // Constants desLength := 10 @@ -1149,12 +955,7 @@ func TestKVectorTranspose_Multiply6(t *testing.T) { } -/* -TestKVectorTranspose_Multiply7 -Description: - - Tests that the multiplication function works as expected when a vector of the wrong length is provided. -*/ +// TestKVectorTranspose_Multiply7 Tests that the multiplication function works as expected when a vector of the wrong length is provided. func TestKVectorTranspose_Multiply7(t *testing.T) { // Constants desLength := 10 @@ -1180,12 +981,7 @@ func TestKVectorTranspose_Multiply7(t *testing.T) { } -/* -TestKVectorTranspose_Transpose1 -Description: - - Tests that the transpose function works as expected. -*/ +// TestKVectorTranspose_Transpose1 Tests that the transpose function works as expected. func TestKVectorTranspose_Transpose1(t *testing.T) { // Constants desLength := 10 @@ -1206,13 +1002,8 @@ func TestKVectorTranspose_Transpose1(t *testing.T) { } } -/* -TestKVectorTranspose_ToSymbolic1 -Description: - - Tests that the ToSymbolic function works as expected. - Expects for the error to be nil and for the result to be a symbolic.KMatrix -*/ +// TestKVectorTranspose_ToSymbolic1 Tests that the ToSymbolic function works as expected. +// Expects for the error to be nil and for the result to be a symbolic.KMatrix func TestKVectorTranspose_ToSymbolic1(t *testing.T) { // Constants desLength := 10 diff --git a/testing/optim/vector_constraint_test.go b/testing/optim/vector_constraint_test.go index 80359ba..7b615ed 100644 --- a/testing/optim/vector_constraint_test.go +++ b/testing/optim/vector_constraint_test.go @@ -1,10 +1,6 @@ package optim -/* -vector_constraint_test.go -Description: - A set of tests for the class VectorConstraint and its associated methods. -*/ +// A set of tests for the class VectorConstraint and its associated methods. import ( "fmt" @@ -13,13 +9,8 @@ import ( "testing" ) -/* -TestVectorConstraint_Check1 -Description: - - Checks to see whether or not a bad vector constraint is good or not. - Provide a vector constraint that contains a slightly bad expression (length of one expression is different than the other). -*/ +// TestVectorConstraint_Check1 Checks to see whether or not a bad vector constraint is good or not. +// Provide a vector constraint that contains a slightly bad expression (length of one expression is different than the other). func TestVectorConstraint_Check1(t *testing.T) { // Constants dim := 4 @@ -50,13 +41,8 @@ func TestVectorConstraint_Check1(t *testing.T) { } } -/* -TestVectorConstraint_Check2 -Description: - - This function checks whether or not a good vector constraint is good or not. - All dimensions of the vectors in the constraint should match. -*/ +// TestVectorConstraint_Check2 This function checks whether or not a good vector constraint is good or not. +// All dimensions of the vectors in the constraint should match. func TestVectorConstraint_Check2(t *testing.T) { // Constants dim := 4 @@ -81,12 +67,7 @@ func TestVectorConstraint_Check2(t *testing.T) { } -/* -TestVectorConstraint_AtVec1 -Description: - - Tests whether or not the function AtVec() throws an error properly if given a bad expression to use AtVec on. -*/ +// TestVectorConstraint_AtVec1 Tests whether or not the function AtVec() throws an error properly if given a bad expression to use AtVec on. func TestVectorConstraint_AtVec1(t *testing.T) { // Constants dim := 4 @@ -127,12 +108,7 @@ func TestVectorConstraint_AtVec1(t *testing.T) { } } -/* -TestVectorConstraint_AtVec2 -Description: - - Tests whether or not the function AtVec() throws an error properly if given a bad index to the AtVec function. -*/ +// TestVectorConstraint_AtVec2 Tests whether or not the function AtVec() throws an error properly if given a bad index to the AtVec function. func TestVectorConstraint_AtVec2(t *testing.T) { // Constants dim := 4 @@ -172,12 +148,7 @@ func TestVectorConstraint_AtVec2(t *testing.T) { } } -/* -TestVectorConstraint_AtVec3 -Description: - - Tests whether or not the function AtVec() doesn't throw an error when properly accessing a well-structured vector constraint. -*/ +// TestVectorConstraint_AtVec3 Tests whether or not the function AtVec() doesn't throw an error when properly accessing a well-structured vector constraint. func TestVectorConstraint_AtVec3(t *testing.T) { // Constants dim := 4 diff --git a/testing/optim/vector_expression_test.go b/testing/optim/vector_expression_test.go index 05e55f8..5f14645 100644 --- a/testing/optim/vector_expression_test.go +++ b/testing/optim/vector_expression_test.go @@ -7,12 +7,7 @@ import ( "testing" ) -/* -TestVectorExpression_IsVectorExpression1 -Description: - - Tests whether or not IsVectorExpression() works on a KVector object. -*/ +// TestVectorExpression_IsVectorExpression1 Tests whether or not IsVectorExpression() works on a KVector object. func TestVectorExpression_IsVectorExpression1(t *testing.T) { // Constants N := 10 @@ -24,12 +19,7 @@ func TestVectorExpression_IsVectorExpression1(t *testing.T) { } } -/* -TestVectorExpression_IsVectorExpression2 -Description: - - Tests whether or not IsVectorExpression() works on a KVectorTranspose object. -*/ +// TestVectorExpression_IsVectorExpression2 Tests whether or not IsVectorExpression() works on a KVectorTranspose object. func TestVectorExpression_IsVectorExpression2(t *testing.T) { // Constants N := 10 @@ -41,12 +31,7 @@ func TestVectorExpression_IsVectorExpression2(t *testing.T) { } } -/* -TestVectorExpression_IsVectorExpression3 -Description: - - Tests whether or not IsVectorExpression() works on a VarVectorTranspose object. -*/ +// TestVectorExpression_IsVectorExpression3 Tests whether or not IsVectorExpression() works on a VarVectorTranspose object. func TestVectorExpression_IsVectorExpression3(t *testing.T) { // Constants N := 10 @@ -62,12 +47,7 @@ func TestVectorExpression_IsVectorExpression3(t *testing.T) { } } -/* -TestVectorExpression_IsVectorExpression4 -Description: - - Tests whether or not IsVectorExpression() works on a VectorLinearExpression object. -*/ +// TestVectorExpression_IsVectorExpression4 Tests whether or not IsVectorExpression() works on a VectorLinearExpression object. func TestVectorExpression_IsVectorExpression4(t *testing.T) { // Constants N := 10 @@ -83,12 +63,7 @@ func TestVectorExpression_IsVectorExpression4(t *testing.T) { } } -/* -TestVectorExpression_IsVectorExpression5 -Description: - - Tests whether or not IsVectorExpression() works on a VectorLinearExpressionTranspose object. -*/ +// TestVectorExpression_IsVectorExpression5 Tests whether or not IsVectorExpression() works on a VectorLinearExpressionTranspose object. func TestVectorExpression_IsVectorExpression5(t *testing.T) { // Constants N := 10 @@ -104,12 +79,7 @@ func TestVectorExpression_IsVectorExpression5(t *testing.T) { } } -/* -TestVectorExpression_NewVectorExpression1 -Description: - - Tests whether or not the NewVectorExpression function returns a vector expression. -*/ +// TestVectorExpression_NewVectorExpression1 Tests whether or not the NewVectorExpression function returns a vector expression. func TestVectorExpression_NewVectorExpression1(t *testing.T) { // Constants N := 10 @@ -126,12 +96,7 @@ func TestVectorExpression_NewVectorExpression1(t *testing.T) { } -/* -TestVectorExpression_ToVectorExpression1 -Description: - - Tests whether or not the ToVectorExpression properly handles bad inputs. -*/ +// TestVectorExpression_ToVectorExpression1 Tests whether or not the ToVectorExpression properly handles bad inputs. func TestVectorExpression_ToVectorExpression1(t *testing.T) { // Constants b1 := false @@ -155,13 +120,8 @@ func TestVectorExpression_ToVectorExpression1(t *testing.T) { } } -/* -TestVectorExpression_ToVectorExpression2 -Description: - - Tests whether or not the ToVectorExpression properly handles - VarVectorTranspose. -*/ +// TestVectorExpression_ToVectorExpression2 Tests whether or not the ToVectorExpression properly handles +// VarVectorTranspose. func TestVectorExpression_ToVectorExpression2(t *testing.T) { // Constants N := 10 @@ -183,13 +143,8 @@ func TestVectorExpression_ToVectorExpression2(t *testing.T) { } } -/* -TestVectorExpression_ToVectorExpression3 -Description: - - Tests whether or not the ToVectorExpression properly handles - LinearVectorExpr. -*/ +// TestVectorExpression_ToVectorExpression3 Tests whether or not the ToVectorExpression properly handles +// LinearVectorExpr. func TestVectorExpression_ToVectorExpression3(t *testing.T) { // Constants N := 10 @@ -211,13 +166,8 @@ func TestVectorExpression_ToVectorExpression3(t *testing.T) { } } -/* -TestVectorExpression_ToVectorExpression4 -Description: - - Tests whether or not the ToVectorExpression properly handles - LinearVectorExpressionTranspose. -*/ +// TestVectorExpression_ToVectorExpression4 Tests whether or not the ToVectorExpression properly handles +// LinearVectorExpressionTranspose. func TestVectorExpression_ToVectorExpression4(t *testing.T) { // Constants N := 10 @@ -239,13 +189,8 @@ func TestVectorExpression_ToVectorExpression4(t *testing.T) { } } -/* -TestVectorExpression_ToVectorExpression5 -Description: - - Tests whether or not the ToVectorExpression properly handles - mat.VecDense. -*/ +// TestVectorExpression_ToVectorExpression5 Tests whether or not the ToVectorExpression properly handles +// mat.VecDense. func TestVectorExpression_ToVectorExpression5(t *testing.T) { // Constants N := 10 diff --git a/testing/optim/vector_linear_expr_test.go b/testing/optim/vector_linear_expr_test.go index f4c90a0..771878c 100644 --- a/testing/optim/vector_linear_expr_test.go +++ b/testing/optim/vector_linear_expr_test.go @@ -8,13 +8,8 @@ import ( "testing" ) -/* -TestVectorLinearExpression_Check1 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpression is valid. -*/ +// TestVectorLinearExpression_Check1 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpression is valid. func TestVectorLinearExpression_Check1(t *testing.T) { m := optim.NewModel("Check1") x := m.AddBinaryVariable() @@ -40,13 +35,8 @@ func TestVectorLinearExpression_Check1(t *testing.T) { } } -/* -TestVectorLinearExpression_Check2 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpression is NOT valid. L is too big in rows. -*/ +// TestVectorLinearExpression_Check2 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpression is NOT valid. L is too big in rows. func TestVectorLinearExpression_Check2(t *testing.T) { m := optim.NewModel("Check2") x := m.AddBinaryVariable() @@ -77,13 +67,8 @@ func TestVectorLinearExpression_Check2(t *testing.T) { } } -/* -TestVectorLinearExpression_Check3 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpression is NOT valid. L is too big in columns. -*/ +// TestVectorLinearExpression_Check3 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpression is NOT valid. L is too big in columns. func TestVectorLinearExpression_Check3(t *testing.T) { m := optim.NewModel("Check3") x := m.AddBinaryVariable() @@ -114,12 +99,7 @@ func TestVectorLinearExpression_Check3(t *testing.T) { } } -/* -TestVectorLinearExpression_VariableIDs1 -Description: - - This test the VariableIDs() method when a variable vector with 2 unique vectors. -*/ +// TestVectorLinearExpression_VariableIDs1 This test the VariableIDs() method when a variable vector with 2 unique vectors. func TestVectorLinearExpression_VariableIDs1(t *testing.T) { m := optim.NewModel("VariableIDs1") x := m.AddBinaryVariable() @@ -155,12 +135,7 @@ func TestVectorLinearExpression_VariableIDs1(t *testing.T) { } } -/* -TestVectorLinearExpression_VariableIDs2 -Description: - - This test the VariableIDs() method works for a variable vector with 1 unique vectors. -*/ +// TestVectorLinearExpression_VariableIDs2 This test the VariableIDs() method works for a variable vector with 1 unique vectors. func TestVectorLinearExpression_VariableIDs2(t *testing.T) { m := optim.NewModel("VariableIDs2") x := m.AddBinaryVariable() @@ -200,12 +175,7 @@ func TestVectorLinearExpression_VariableIDs2(t *testing.T) { } } -/* -TestVectorLinearExpression_Coeffs1 -Description: - - This test the Coeffs() method which should return the matrix's elements in a prescribed order. -*/ +// TestVectorLinearExpression_Coeffs1 This test the Coeffs() method which should return the matrix's elements in a prescribed order. func TestVectorLinearExpression_Coeffs1(t *testing.T) { m := optim.NewModel("Coeffs1") x := m.AddBinaryVariable() @@ -249,12 +219,7 @@ func TestVectorLinearExpression_Coeffs1(t *testing.T) { } -/* -TestVectorLinearExpression_Coeffs2 -Description: - - This test the Coeffs() method which should return the matrix's elements in a prescribed order. -*/ +// TestVectorLinearExpression_Coeffs2 This test the Coeffs() method which should return the matrix's elements in a prescribed order. func TestVectorLinearExpression_Coeffs2(t *testing.T) { m := optim.NewModel("Coeffs2") x := m.AddBinaryVariable() @@ -296,11 +261,7 @@ func TestVectorLinearExpression_Coeffs2(t *testing.T) { } } -/* -TestVectorLinearExpression_LessEq1 -Description: - This tests that the less than or equal to command works with a constant input. -*/ +// This tests that the less than or equal to command works with a constant input. //func TestVectorLinearExpression_LessEq1(t *testing.T) { // // Constants // m := optim.NewModel() @@ -337,15 +298,10 @@ Description: // //} -/* -TestVectorLinearExpression_Eq1 -Description: - - Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. - Eq comparison between: - - Vector Linear Expression, and - - mat.VecDense -*/ +// TestVectorLinearExpression_Eq1 Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. +// Eq comparison between: +// - Vector Linear Expression, and +// - mat.VecDense func TestVectorLinearExpression_Eq1(t *testing.T) { // Constants m := optim.NewModel("Eq1") @@ -388,15 +344,10 @@ func TestVectorLinearExpression_Eq1(t *testing.T) { } -/* -TestVectorLinearExpression_Eq2 -Description: - - Tests whether or not an equality constraint between a bool and a proper vector variable leads to an error. - Eq comparison between: - - Vector Linear Expression, and - - bool -*/ +// TestVectorLinearExpression_Eq2 Tests whether or not an equality constraint between a bool and a proper vector variable leads to an error. +// Eq comparison between: +// - Vector Linear Expression, and +// - bool func TestVectorLinearExpression_Eq2(t *testing.T) { // Constants m := optim.NewModel("Eq2") @@ -430,15 +381,10 @@ func TestVectorLinearExpression_Eq2(t *testing.T) { } -/* -TestVectorLinearExpression_Eq3 -Description: - - Tests whether or not an equality constraint between a KVector and a proper vector variable leads to an error. - Eq comparison between: - - Vector Linear Expression, and - - KVector -*/ +// TestVectorLinearExpression_Eq3 Tests whether or not an equality constraint between a KVector and a proper vector variable leads to an error. +// Eq comparison between: +// - Vector Linear Expression, and +// - KVector func TestVectorLinearExpression_Eq3(t *testing.T) { // Constants m := optim.NewModel("Eq3") @@ -477,16 +423,11 @@ func TestVectorLinearExpression_Eq3(t *testing.T) { } -/* -TestVectorLinearExpression_Eq4 -Description: - - This test will evaluate how well the Eq() method for the vector of linear constraints works. - Creates a simple two-dimensional constraint. - Eq comparison between: - - Vector Linear Expression, and - - VarVector -*/ +// TestVectorLinearExpression_Eq4 This test will evaluate how well the Eq() method for the vector of linear constraints works. +// Creates a simple two-dimensional constraint. +// Eq comparison between: +// - Vector Linear Expression, and +// - VarVector func TestVectorLinearExpression_Eq4(t *testing.T) { m := optim.NewModel("Eq4") dimX := 2 @@ -513,16 +454,11 @@ func TestVectorLinearExpression_Eq4(t *testing.T) { } -/* -TestVectorLinearExpression_Eq5 -Description: - - This test will evaluate how well the Eq() method for the vector of linear constraints works. - Creates a simple two-dimensional constraint. - Eq comparison between: - - Vector Linear Expression, and - - Vector Linear Expression -*/ +// TestVectorLinearExpression_Eq5 This test will evaluate how well the Eq() method for the vector of linear constraints works. +// Creates a simple two-dimensional constraint. +// Eq comparison between: +// - Vector Linear Expression, and +// - Vector Linear Expression func TestVectorLinearExpression_Eq5(t *testing.T) { m := optim.NewModel("Eq5") dimX := 2 @@ -549,13 +485,8 @@ func TestVectorLinearExpression_Eq5(t *testing.T) { } -/* -TestVectorLinearExpression_Len1 -Description: - - This test will evaluate how well the Len() method for the vector of linear constraints works. - A constraint between two vectors of length 2 -*/ +// TestVectorLinearExpression_Len1 This test will evaluate how well the Len() method for the vector of linear constraints works. +// A constraint between two vectors of length 2 func TestVectorLinearExpression_Len1(t *testing.T) { m := optim.NewModel("Len1") x := m.AddBinaryVariable() @@ -585,13 +516,8 @@ func TestVectorLinearExpression_Len1(t *testing.T) { } } -/* -TestVectorLinearExpression_Len2 -Description: - - This test will evaluate how well the Len() method for the vector of linear constraints works. - A constraint between two vectors of length 10 -*/ +// TestVectorLinearExpression_Len2 This test will evaluate how well the Len() method for the vector of linear constraints works. +// A constraint between two vectors of length 10 func TestVectorLinearExpression_Len2(t *testing.T) { m := optim.NewModel("Len2") x := m.AddBinaryVariable() @@ -623,12 +549,7 @@ func TestVectorLinearExpression_Len2(t *testing.T) { } -/* -TestVectorLinearExpr_Plus1 -Description: - - Add VectorLinearExpr to a KVector of appropriate length. -*/ +// TestVectorLinearExpr_Plus1 Add VectorLinearExpr to a KVector of appropriate length. func TestVectorLinearExpr_Plus1(t *testing.T) { // Constants n := 5 @@ -691,12 +612,7 @@ func TestVectorLinearExpr_Plus1(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus2 -Description: - - Add VectorLinearExpr to a KVector of inappropriate length. -*/ +// TestVectorLinearExpr_Plus2 Add VectorLinearExpr to a KVector of inappropriate length. func TestVectorLinearExpr_Plus2(t *testing.T) { // Constants n := 5 @@ -730,13 +646,8 @@ func TestVectorLinearExpr_Plus2(t *testing.T) { } -/* -TestVectorLinearExpr_Plus3 -Description: - - Add VectorLinearExpr to a KVector of appropriate length. - Nonzero offset in VectorLinearExpression. -*/ +// TestVectorLinearExpr_Plus3 Add VectorLinearExpr to a KVector of appropriate length. +// Nonzero offset in VectorLinearExpression. func TestVectorLinearExpr_Plus3(t *testing.T) { // Constants n := 5 @@ -799,12 +710,7 @@ func TestVectorLinearExpr_Plus3(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus4 -Description: - - Add VectorLinearExpr to a VarVector of appropriate length. -*/ +// TestVectorLinearExpr_Plus4 Add VectorLinearExpr to a VarVector of appropriate length. func TestVectorLinearExpr_Plus4(t *testing.T) { // Constants n := 5 @@ -878,12 +784,7 @@ func TestVectorLinearExpr_Plus4(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus5 -Description: - - Add VectorLinearExpr to a VarVector of appropriate length. -*/ +// TestVectorLinearExpr_Plus5 Add VectorLinearExpr to a VarVector of appropriate length. func TestVectorLinearExpr_Plus5(t *testing.T) { // Constants n := 5 @@ -954,12 +855,7 @@ func TestVectorLinearExpr_Plus5(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus6 -Description: - - Add VectorLinearExpr to a VectorLinearExpression of appropriate length. (But different variables) -*/ +// TestVectorLinearExpr_Plus6 Add VectorLinearExpr to a VectorLinearExpression of appropriate length. (But different variables) func TestVectorLinearExpr_Plus6(t *testing.T) { // Constants n := 5 @@ -1038,12 +934,7 @@ func TestVectorLinearExpr_Plus6(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus7 -Description: - - Add VectorLinearExpr to a KVectorTranspose of appropriate length. -*/ +// TestVectorLinearExpr_Plus7 Add VectorLinearExpr to a KVectorTranspose of appropriate length. func TestVectorLinearExpr_Plus7(t *testing.T) { // Constants n := 5 @@ -1077,12 +968,7 @@ func TestVectorLinearExpr_Plus7(t *testing.T) { } -/* -TestVectorLinearExpr_Plus8 -Description: - - Add VectorLinearExpr to a VarVectorTranspose of appropriate length. -*/ +// TestVectorLinearExpr_Plus8 Add VectorLinearExpr to a VarVectorTranspose of appropriate length. func TestVectorLinearExpr_Plus8(t *testing.T) { // Constants n := 5 @@ -1113,12 +999,7 @@ func TestVectorLinearExpr_Plus8(t *testing.T) { } } -/* -TestVectorLinearExpr_Plus9 -Description: - - Add VectorLinearExpr to a VectorLinearExpressionTranspose of appropriate length. -*/ +// TestVectorLinearExpr_Plus9 Add VectorLinearExpr to a VectorLinearExpressionTranspose of appropriate length. func TestVectorLinearExpr_Plus9(t *testing.T) { // Constants n := 5 @@ -1149,15 +1030,10 @@ func TestVectorLinearExpr_Plus9(t *testing.T) { } -/* -TestVectorLinearExpression_GreaterEq1 -Description: - - Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. - Eq comparison between: - - Vector Linear Expression, and - - mat.VecDense -*/ +// TestVectorLinearExpression_GreaterEq1 Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. +// Eq comparison between: +// - Vector Linear Expression, and +// - mat.VecDense func TestVectorLinearExpression_GreaterEq1(t *testing.T) { // Constants m := optim.NewModel("VLE-GreaterEq1") @@ -1192,12 +1068,7 @@ func TestVectorLinearExpression_GreaterEq1(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply1 -Description: - - Testing that the method properly throws an error when an error is provided. -*/ +// TestVectorLinearExpr_Multiply1 Testing that the method properly throws an error when an error is provided. func TestVectorLinearExpr_Multiply1(t *testing.T) { // Constants n := 5 @@ -1225,13 +1096,8 @@ func TestVectorLinearExpr_Multiply1(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply2 -Description: - - Testing that the method properly throws an error when a dimension mismatch - occurs. -*/ +// TestVectorLinearExpr_Multiply2 Testing that the method properly throws an error when a dimension mismatch +// occurs. func TestVectorLinearExpr_Multiply2(t *testing.T) { // Constants n := 5 @@ -1264,12 +1130,7 @@ func TestVectorLinearExpr_Multiply2(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply3 -Description: - - Testing that the method properly multiplies vle with float. -*/ +// TestVectorLinearExpr_Multiply3 Testing that the method properly multiplies vle with float. func TestVectorLinearExpr_Multiply3(t *testing.T) { // Constants n := 5 @@ -1334,12 +1195,7 @@ func TestVectorLinearExpr_Multiply3(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply4 -Description: - - Testing that the method properly multiplies vle with K. -*/ +// TestVectorLinearExpr_Multiply4 Testing that the method properly multiplies vle with K. func TestVectorLinearExpr_Multiply4(t *testing.T) { // Constants n := 5 @@ -1404,13 +1260,8 @@ func TestVectorLinearExpr_Multiply4(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply5 -Description: - - Testing that the Multiply method properly works for - mat.VecDense -*/ +// TestVectorLinearExpr_Multiply5 Testing that the Multiply method properly works for +// mat.VecDense func TestVectorLinearExpr_Multiply5(t *testing.T) { // Constants n := 5 @@ -1442,13 +1293,8 @@ func TestVectorLinearExpr_Multiply5(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply6 -Description: - - Testing that the Multiply method properly works for - KVector -*/ +// TestVectorLinearExpr_Multiply6 Testing that the Multiply method properly works for +// KVector func TestVectorLinearExpr_Multiply6(t *testing.T) { // Constants n := 5 @@ -1480,13 +1326,8 @@ func TestVectorLinearExpr_Multiply6(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply7 -Description: - - Testing that the Multiply method properly works for - KVectorTranspose -*/ +// TestVectorLinearExpr_Multiply7 Testing that the Multiply method properly works for +// KVectorTranspose func TestVectorLinearExpr_Multiply7(t *testing.T) { // Constants n := 5 @@ -1517,13 +1358,8 @@ func TestVectorLinearExpr_Multiply7(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply8 -Description: - - Testing that the Multiply method properly works for - VectorLinearExpr -*/ +// TestVectorLinearExpr_Multiply8 Testing that the Multiply method properly works for +// VectorLinearExpr func TestVectorLinearExpr_Multiply8(t *testing.T) { // Constants n := 5 @@ -1555,13 +1391,8 @@ func TestVectorLinearExpr_Multiply8(t *testing.T) { } -/* -TestVectorLinearExpr_Multiply9 -Description: - - Testing that the Multiply method properly works for - KVectorTranspose -*/ +// TestVectorLinearExpr_Multiply9 Testing that the Multiply method properly works for +// KVectorTranspose func TestVectorLinearExpr_Multiply9(t *testing.T) { // Constants n := 5 diff --git a/testing/optim/vector_linear_expression_transpose_test.go b/testing/optim/vector_linear_expression_transpose_test.go index 0ea12b7..1a8164d 100644 --- a/testing/optim/vector_linear_expression_transpose_test.go +++ b/testing/optim/vector_linear_expression_transpose_test.go @@ -9,13 +9,8 @@ import ( "testing" ) -/* -TestVectorLinearExpressionTranspose_Check1 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpressionTranspose is valid. -*/ +// TestVectorLinearExpressionTranspose_Check1 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpressionTranspose is valid. func TestVectorLinearExpressionTranspose_Check1(t *testing.T) { m := optim.NewModel("Check1") x := m.AddBinaryVariable() @@ -41,13 +36,8 @@ func TestVectorLinearExpressionTranspose_Check1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Check2 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpressionTranspose is NOT valid. L is too big in rows. -*/ +// TestVectorLinearExpressionTranspose_Check2 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpressionTranspose is NOT valid. L is too big in rows. func TestVectorLinearExpressionTranspose_Check2(t *testing.T) { m := optim.NewModel("Check2") x := m.AddBinaryVariable() @@ -78,13 +68,8 @@ func TestVectorLinearExpressionTranspose_Check2(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Check3 -Description: - - This test will evaluate whether or not the linear expression that has been given is valid. - In this case, the VectorLinearExpressionTranspose is NOT valid. L is too big in columns. -*/ +// TestVectorLinearExpressionTranspose_Check3 This test will evaluate whether or not the linear expression that has been given is valid. +// In this case, the VectorLinearExpressionTranspose is NOT valid. L is too big in columns. func TestVectorLinearExpressionTranspose_Check3(t *testing.T) { m := optim.NewModel("Check3") x := m.AddBinaryVariable() @@ -115,12 +100,7 @@ func TestVectorLinearExpressionTranspose_Check3(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_VariableIDs1 -Description: - - This test the VariableIDs() method when a variable vector with 2 unique vectors. -*/ +// TestVectorLinearExpressionTranspose_VariableIDs1 This test the VariableIDs() method when a variable vector with 2 unique vectors. func TestVectorLinearExpressionTranspose_VariableIDs1(t *testing.T) { m := optim.NewModel("VariableIDs1") x := m.AddBinaryVariable() @@ -156,12 +136,7 @@ func TestVectorLinearExpressionTranspose_VariableIDs1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_VariableIDs2 -Description: - - This test the VariableIDs() method works for a variable vector with 1 unique vectors. -*/ +// TestVectorLinearExpressionTranspose_VariableIDs2 This test the VariableIDs() method works for a variable vector with 1 unique vectors. func TestVectorLinearExpressionTranspose_VariableIDs2(t *testing.T) { m := optim.NewModel("VariableIDs2") x := m.AddBinaryVariable() @@ -201,12 +176,7 @@ func TestVectorLinearExpressionTranspose_VariableIDs2(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_NumVars1 -Description: - - This test the NumVars() method when a variable vector with a short, unique vectors. -*/ +// TestVectorLinearExpressionTranspose_NumVars1 This test the NumVars() method when a variable vector with a short, unique vectors. func TestVectorLinearExpressionTranspose_NumVars1(t *testing.T) { m := optim.NewModel("VariableIDs1") x := m.AddBinaryVariable() @@ -236,12 +206,7 @@ func TestVectorLinearExpressionTranspose_NumVars1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Coeffs1 -Description: - - This test the Coeffs() method which should return the matrix's elements in a prescribed order. -*/ +// TestVectorLinearExpressionTranspose_Coeffs1 This test the Coeffs() method which should return the matrix's elements in a prescribed order. func TestVectorLinearExpressionTranspose_Coeffs1(t *testing.T) { m := optim.NewModel("Coeffs1") x := m.AddBinaryVariable() @@ -285,12 +250,7 @@ func TestVectorLinearExpressionTranspose_Coeffs1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Coeffs2 -Description: - - This test the Coeffs() method which should return the matrix's elements in a prescribed order. -*/ +// TestVectorLinearExpressionTranspose_Coeffs2 This test the Coeffs() method which should return the matrix's elements in a prescribed order. func TestVectorLinearExpressionTranspose_Coeffs2(t *testing.T) { m := optim.NewModel("Coeffs2") x := m.AddBinaryVariable() @@ -332,12 +292,7 @@ func TestVectorLinearExpressionTranspose_Coeffs2(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_LessEq1 -Description: - - This tests that the less than or equal to command works with a constant input. -*/ +// TestVectorLinearExpressionTranspose_LessEq1 This tests that the less than or equal to command works with a constant input. func TestVectorLinearExpressionTranspose_LessEq1(t *testing.T) { // Constants m := optim.NewModel("TestVectorLinearExpressionTranspose_LessEq1") @@ -380,12 +335,7 @@ func TestVectorLinearExpressionTranspose_LessEq1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_GreaterEq1 -Description: - - This tests that the greater than or equal to command works with a constant input. -*/ +// TestVectorLinearExpressionTranspose_GreaterEq1 This tests that the greater than or equal to command works with a constant input. func TestVectorLinearExpressionTranspose_GreaterEq1(t *testing.T) { // Constants m := optim.NewModel("TestVectorLinearExpressionTranspose_GreaterEq1") @@ -428,12 +378,7 @@ func TestVectorLinearExpressionTranspose_GreaterEq1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Mult1 -Description: - - Tests that the unfinished Mult() function is properly returning errors. -*/ +// TestVectorLinearExpressionTranspose_Mult1 Tests that the unfinished Mult() function is properly returning errors. func TestVectorLinearExpressionTranspose_Mult1(t *testing.T) { // Constants @@ -465,15 +410,10 @@ func TestVectorLinearExpressionTranspose_Mult1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Eq1 -Description: - - Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. - Eq comparison between: - - Vector Linear Expression, and - - mat.VecDense -*/ +// TestVectorLinearExpressionTranspose_Eq1 Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. +// Eq comparison between: +// - Vector Linear Expression, and +// - mat.VecDense func TestVectorLinearExpressionTranspose_Eq1(t *testing.T) { // Constants m := optim.NewModel("VLETranspose-Eq1") @@ -516,15 +456,10 @@ func TestVectorLinearExpressionTranspose_Eq1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Eq2 -Description: - - Tests whether or not an equality constraint between a bool and a proper vector variable leads to an error. - Eq comparison between: - - Vector Linear Expression, and - - bool -*/ +// TestVectorLinearExpressionTranspose_Eq2 Tests whether or not an equality constraint between a bool and a proper vector variable leads to an error. +// Eq comparison between: +// - Vector Linear Expression, and +// - bool func TestVectorLinearExpressionTranspose_Eq2(t *testing.T) { // Constants m := optim.NewModel("Eq2") @@ -558,15 +493,10 @@ func TestVectorLinearExpressionTranspose_Eq2(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Eq3 -Description: - - Tests whether or not an equality constraint between a KVector and a proper vector variable leads to an error. - Eq comparison between: - - Vector Linear Expression, and - - KVector -*/ +// TestVectorLinearExpressionTranspose_Eq3 Tests whether or not an equality constraint between a KVector and a proper vector variable leads to an error. +// Eq comparison between: +// - Vector Linear Expression, and +// - KVector func TestVectorLinearExpressionTranspose_Eq3(t *testing.T) { // Constants m := optim.NewModel("Eq3") @@ -605,16 +535,11 @@ func TestVectorLinearExpressionTranspose_Eq3(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Eq4 -Description: - - This test will evaluate how well the Eq() method for the vector of linear constraints works. - Creates a simple two-dimensional constraint. - Eq comparison between: - - Vector Linear Expression, and - - VarVector -*/ +// TestVectorLinearExpressionTranspose_Eq4 This test will evaluate how well the Eq() method for the vector of linear constraints works. +// Creates a simple two-dimensional constraint. +// Eq comparison between: +// - Vector Linear Expression, and +// - VarVector func TestVectorLinearExpressionTranspose_Eq4(t *testing.T) { m := optim.NewModel("Eq4") dimX := 2 @@ -641,16 +566,11 @@ func TestVectorLinearExpressionTranspose_Eq4(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Eq5 -Description: - - This test will evaluate how well the Eq() method for the vector of linear constraints works. - Creates a simple two-dimensional constraint. - Eq comparison between: - - Vector Linear Expression, and - - Vector Linear Expression -*/ +// TestVectorLinearExpressionTranspose_Eq5 This test will evaluate how well the Eq() method for the vector of linear constraints works. +// Creates a simple two-dimensional constraint. +// Eq comparison between: +// - Vector Linear Expression, and +// - Vector Linear Expression func TestVectorLinearExpressionTranspose_Eq5(t *testing.T) { m := optim.NewModel("Eq5") dimX := 2 @@ -677,15 +597,10 @@ func TestVectorLinearExpressionTranspose_Eq5(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Eq16 -Description: - - Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. - Eq comparison between: - - Vector Linear Expression, and - - mat.VecDense -*/ +// TestVectorLinearExpressionTranspose_Eq6 Tests whether or not an equality constraint between a ones vector and a standard vector variable works well. +// Eq comparison between: +// - Vector Linear Expression, and +// - mat.VecDense func TestVectorLinearExpressionTranspose_Eq6(t *testing.T) { // Constants m := optim.NewModel("Eq6") @@ -720,13 +635,8 @@ func TestVectorLinearExpressionTranspose_Eq6(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Len1 -Description: - - This test will evaluate how well the Len() method for the vector of linear constraints works. - A constraint between two vectors of length 2 -*/ +// TestVectorLinearExpressionTranspose_Len1 This test will evaluate how well the Len() method for the vector of linear constraints works. +// A constraint between two vectors of length 2 func TestVectorLinearExpressionTranspose_Len1(t *testing.T) { m := optim.NewModel("Len1") x := m.AddBinaryVariable() @@ -756,13 +666,8 @@ func TestVectorLinearExpressionTranspose_Len1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Len2 -Description: - - This test will evaluate how well the Len() method for the vector of linear constraints works. - A constraint between two vectors of length 10 -*/ +// TestVectorLinearExpressionTranspose_Len2 This test will evaluate how well the Len() method for the vector of linear constraints works. +// A constraint between two vectors of length 10 func TestVectorLinearExpressionTranspose_Len2(t *testing.T) { m := optim.NewModel("Len2") x := m.AddBinaryVariable() @@ -794,12 +699,7 @@ func TestVectorLinearExpressionTranspose_Len2(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus1 -Description: - - Add VectorLinearExpressionTranspose to a KVector of appropriate length. -*/ +// TestVectorLinearExpressionTranspose_Plus1 Add VectorLinearExpressionTranspose to a KVector of appropriate length. func TestVectorLinearExpressionTranspose_Plus1(t *testing.T) { // Constants n := 5 @@ -862,12 +762,7 @@ func TestVectorLinearExpressionTranspose_Plus1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Plus2 -Description: - - Add VectorLinearExpressionTranspose to a KVector of inappropriate length. -*/ +// TestVectorLinearExpressionTranspose_Plus2 Add VectorLinearExpressionTranspose to a KVector of inappropriate length. func TestVectorLinearExpressionTranspose_Plus2(t *testing.T) { // Constants n := 5 @@ -901,13 +796,8 @@ func TestVectorLinearExpressionTranspose_Plus2(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus3 -Description: - - Add VectorLinearExpressionTranspose to a KVector of appropriate length. - Nonzero offset in VectorLinearExpressionTranspose. -*/ +// TestVectorLinearExpressionTranspose_Plus3 Add VectorLinearExpressionTranspose to a KVector of appropriate length. +// Nonzero offset in VectorLinearExpressionTranspose. func TestVectorLinearExpressionTranspose_Plus3(t *testing.T) { // Constants n := 5 @@ -970,12 +860,7 @@ func TestVectorLinearExpressionTranspose_Plus3(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Plus4 -Description: - - Add VectorLinearExpressionTranspose to a VarVector of appropriate length. -*/ +// TestVectorLinearExpressionTranspose_Plus4 Add VectorLinearExpressionTranspose to a VarVector of appropriate length. func TestVectorLinearExpressionTranspose_Plus4(t *testing.T) { // Constants n := 5 @@ -1049,12 +934,7 @@ func TestVectorLinearExpressionTranspose_Plus4(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Plus5 -Description: - - Add VectorLinearExpressionTranspose to a VarVector of appropriate length. -*/ +// TestVectorLinearExpressionTranspose_Plus5 Add VectorLinearExpressionTranspose to a VarVector of appropriate length. func TestVectorLinearExpressionTranspose_Plus5(t *testing.T) { // Constants n := 5 @@ -1125,12 +1005,7 @@ func TestVectorLinearExpressionTranspose_Plus5(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Plus6 -Description: - - Add VectorLinearExpressionTranspose to a VectorLinearExpressionTranspose of appropriate length. (But different variables) -*/ +// TestVectorLinearExpressionTranspose_Plus6 Add VectorLinearExpressionTranspose to a VectorLinearExpressionTranspose of appropriate length. (But different variables) func TestVectorLinearExpressionTranspose_Plus6(t *testing.T) { // Constants n := 5 @@ -1209,12 +1084,7 @@ func TestVectorLinearExpressionTranspose_Plus6(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Plus7 -Description: - - Add VectorLinearExpressionTranspose to a KVector. -*/ +// TestVectorLinearExpressionTranspose_Plus7 Add VectorLinearExpressionTranspose to a KVector. func TestVectorLinearExpressionTranspose_Plus7(t *testing.T) { // Constants n := 5 @@ -1248,12 +1118,7 @@ func TestVectorLinearExpressionTranspose_Plus7(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus8 -Description: - - Add VectorLinearExpressionTranspose to a VarVector. -*/ +// TestVectorLinearExpressionTranspose_Plus8 Add VectorLinearExpressionTranspose to a VarVector. func TestVectorLinearExpressionTranspose_Plus8(t *testing.T) { // Constants n := 5 @@ -1284,12 +1149,7 @@ func TestVectorLinearExpressionTranspose_Plus8(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus9 -Description: - - Add VectorLinearExpressionTranspose to a VectorLinearExpression. -*/ +// TestVectorLinearExpressionTranspose_Plus9 Add VectorLinearExpressionTranspose to a VectorLinearExpression. func TestVectorLinearExpressionTranspose_Plus9(t *testing.T) { // Constants n := 5 @@ -1319,12 +1179,7 @@ func TestVectorLinearExpressionTranspose_Plus9(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus10 -Description: - - Add VectorLinearExpressionTranspose to a VectorLinearExpression. -*/ +// TestVectorLinearExpressionTranspose_Plus10 Add VectorLinearExpressionTranspose to a VectorLinearExpression. func TestVectorLinearExpressionTranspose_Plus10(t *testing.T) { // Constants n := 5 @@ -1355,13 +1210,8 @@ func TestVectorLinearExpressionTranspose_Plus10(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Plus11 -Description: - - Add VectorLinearExpressionTranspose to a VectorLinearExpressionTranspose - that is not of the right size. -*/ +// TestVectorLinearExpressionTranspose_Plus11 Add VectorLinearExpressionTranspose to a VectorLinearExpressionTranspose +// that is not of the right size. func TestVectorLinearExpressionTranspose_Plus11(t *testing.T) { // Constants n := 5 @@ -1398,12 +1248,7 @@ func TestVectorLinearExpressionTranspose_Plus11(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Comparison1 -Description: - - Compares a VectorLinearExpressionTranspose with a constant vector. -*/ +// TestVectorLinearExpressionTranspose_Comparison1 Compares a VectorLinearExpressionTranspose with a constant vector. func TestVectorLinearExpressionTranspose_Comparison1(t *testing.T) { // Constants n := 5 @@ -1433,12 +1278,7 @@ func TestVectorLinearExpressionTranspose_Comparison1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Comparison2 -Description: - - Compares a VectorLinearExpressionTranspose with a constant vector transpose. -*/ +// TestVectorLinearExpressionTranspose_Comparison2 Compares a VectorLinearExpressionTranspose with a constant vector transpose. func TestVectorLinearExpressionTranspose_Comparison2(t *testing.T) { // Constants n := 5 @@ -1469,12 +1309,7 @@ func TestVectorLinearExpressionTranspose_Comparison2(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Comparison3 -Description: - - Compares a VectorLinearExpressionTranspose with a var vector. -*/ +// TestVectorLinearExpressionTranspose_Comparison3 Compares a VectorLinearExpressionTranspose with a var vector. func TestVectorLinearExpressionTranspose_Comparison3(t *testing.T) { // Constants n := 5 @@ -1504,13 +1339,8 @@ func TestVectorLinearExpressionTranspose_Comparison3(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Comparison4 -Description: - - Compares a VectorLinearExpressionTranspose with a varVectorTranspose - of the wrong shape. -*/ +// TestVectorLinearExpressionTranspose_Comparison4 Compares a VectorLinearExpressionTranspose with a varVectorTranspose +// of the wrong shape. func TestVectorLinearExpressionTranspose_Comparison4(t *testing.T) { // Constants n := 5 @@ -1541,12 +1371,7 @@ func TestVectorLinearExpressionTranspose_Comparison4(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Comparison5 -Description: - - Compares a VectorLinearExpressionTranspose with a vector linear expression. -*/ +// TestVectorLinearExpressionTranspose_Comparison5 Compares a VectorLinearExpressionTranspose with a vector linear expression. func TestVectorLinearExpressionTranspose_Comparison5(t *testing.T) { // Constants n := 5 @@ -1575,13 +1400,8 @@ func TestVectorLinearExpressionTranspose_Comparison5(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Comparison6 -Description: - - Compares a VectorLinearExpressionTranspose with a vector linear expression transpose of - the wrong shape. -*/ +// TestVectorLinearExpressionTranspose_Comparison6 Compares a VectorLinearExpressionTranspose with a vector linear expression transpose of +// the wrong shape. func TestVectorLinearExpressionTranspose_Comparison6(t *testing.T) { // Constants n := 5 @@ -1617,12 +1437,7 @@ func TestVectorLinearExpressionTranspose_Comparison6(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_AtVec1 -Description: - - Tests to make sure that AtVec properly works. -*/ +// TestVectorLinearExpressionTranspose_AtVec1 Tests to make sure that AtVec properly works. func TestVectorLinearExpressionTranspose_AtVec1(t *testing.T) { // Constants n := 5 @@ -1642,12 +1457,7 @@ func TestVectorLinearExpressionTranspose_AtVec1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Transpose1 -Description: - - Tests to make sure that AtVec properly works. -*/ +// TestVectorLinearExpressionTranspose_Transpose1 Tests to make sure that AtVec properly works. func TestVectorLinearExpressionTranspose_Transpose1(t *testing.T) { // Constants n := 5 @@ -1667,12 +1477,7 @@ func TestVectorLinearExpressionTranspose_Transpose1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Multiply1 -Description: - - Tests what happens if the errors input contains a bad error choice. -*/ +// TestVectorLinearExpressionTranspose_Multiply1 Tests what happens if the errors input contains a bad error choice. func TestVectorLinearExpressionTranspose_Multiply1(t *testing.T) { // Constants n := 5 @@ -1705,12 +1510,7 @@ func TestVectorLinearExpressionTranspose_Multiply1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Multiply2 -Description: - - Tests what happens if the errors input contains a nil error choice. -*/ +// TestVectorLinearExpressionTranspose_Multiply2 Tests what happens if the errors input contains a nil error choice. func TestVectorLinearExpressionTranspose_Multiply2(t *testing.T) { // Constants n := 5 @@ -1769,13 +1569,8 @@ func TestVectorLinearExpressionTranspose_Multiply2(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_Multiply3 -Description: - - Tests what happens if the input to errors has a - float input but has large size. -*/ +// TestVectorLinearExpressionTranspose_Multiply3 Tests what happens if the input to errors has a +// float input but has large size. func TestVectorLinearExpressionTranspose_Multiply3(t *testing.T) { // Constants n := 5 @@ -1811,13 +1606,8 @@ func TestVectorLinearExpressionTranspose_Multiply3(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_Multiply4 -Description: - - Tests what happens if the input to errors has a - float input. With VLE that happens to be of dimension 1. -*/ +// TestVectorLinearExpressionTranspose_Multiply4 Tests what happens if the input to errors has a +// float input. With VLE that happens to be of dimension 1. func TestVectorLinearExpressionTranspose_Multiply4(t *testing.T) { // Constants n := 1 @@ -1870,13 +1660,8 @@ func TestVectorLinearExpressionTranspose_Multiply4(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_ToScalarExpression1 -Description: - - ToScalarExpression() should throw an error because the vlet1 - was malformed. -*/ +// TestVectorLinearExpressionTranspose_ToScalarExpression1 ToScalarExpression() should throw an error because the vlet1 +// was malformed. func TestVectorLinearExpressionTranspose_ToScalarExpression1(t *testing.T) { // Constants n := 5 @@ -1911,13 +1696,8 @@ func TestVectorLinearExpressionTranspose_ToScalarExpression1(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_ToScalarExpression2 -Description: - - ToScalarExpression() should throw an error when the vlet1 - has dimension larger than 1. -*/ +// TestVectorLinearExpressionTranspose_ToScalarExpression2 ToScalarExpression() should throw an error when the vlet1 +// has dimension larger than 1. func TestVectorLinearExpressionTranspose_ToScalarExpression2(t *testing.T) { // Constants n := 5 @@ -1949,13 +1729,8 @@ func TestVectorLinearExpressionTranspose_ToScalarExpression2(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_ToScalarExpression3 -Description: - - ToScalarExpression() should throw an error when the vlet1 - has dimension 1. -*/ +// TestVectorLinearExpressionTranspose_ToScalarExpression3 ToScalarExpression() should throw an error when the vlet1 +// has dimension 1. func TestVectorLinearExpressionTranspose_ToScalarExpression3(t *testing.T) { // Constants n := 1 @@ -1990,13 +1765,8 @@ func TestVectorLinearExpressionTranspose_ToScalarExpression3(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_ToScalarExpression4 -Description: - - ToScalarExpression() should throw an error when the vlet1 - has dimension 1 AND is a non square matrix. -*/ +// TestVectorLinearExpressionTranspose_ToScalarExpression4 ToScalarExpression() should throw an error when the vlet1 +// has dimension 1 AND is a non square matrix. func TestVectorLinearExpressionTranspose_ToScalarExpression4(t *testing.T) { // Constants n := 5 @@ -2037,13 +1807,8 @@ func TestVectorLinearExpressionTranspose_ToScalarExpression4(t *testing.T) { } -/* -TestVectorLinearExpressionTranspose_ToSymbolic1 -Description: - - ToSymbolic() should throw an error when the vlet1 - is not well-defined. -*/ +// TestVectorLinearExpressionTranspose_ToSymbolic1 ToSymbolic() should throw an error when the vlet1 +// is not well-defined. func TestVectorLinearExpressionTranspose_ToSymbolic1(t *testing.T) { // Constants n := 5 @@ -2077,13 +1842,8 @@ func TestVectorLinearExpressionTranspose_ToSymbolic1(t *testing.T) { } } -/* -TestVectorLinearExpressionTranspose_ToSymbolic2 -Description: - - ToSymbolic() should produce a VectorPolynomialExpression - when the vlet1 is well-defined. -*/ +// TestVectorLinearExpressionTranspose_ToSymbolic2 ToSymbolic() should produce a VectorPolynomialExpression +// when the vlet1 is well-defined. func TestVectorLinearExpressionTranspose_ToSymbolic2(t *testing.T) { // Constants n := 5 diff --git a/testing/problem/objective_sense_test.go b/testing/problem/objective_sense_test.go index da5c360..0b78308 100644 --- a/testing/problem/objective_sense_test.go +++ b/testing/problem/objective_sense_test.go @@ -8,19 +8,9 @@ import ( "github.com/MatProGo-dev/MatProInterface.go/problem" ) -/* -objective_sense_test.go -Description: +// Tests for the objective sense object. - Tests for the objective sense object. -*/ - -/* -TestObjectiveSense_ToObjSense1 -Description: - - Tests the ToObjSense function with a minimization sense. -*/ +// TestObjectiveSense_ToObjSense1 Tests the ToObjSense function with a minimization sense. func TestObjectiveSense_ToObjSense1(t *testing.T) { // Constants sense := optim.SenseMinimize @@ -35,12 +25,7 @@ func TestObjectiveSense_ToObjSense1(t *testing.T) { } } -/* -TestObjectiveSense_ToObjSense2 -Description: - - Tests the ToObjSense function with a maximization sense. -*/ +// TestObjectiveSense_ToObjSense2 Tests the ToObjSense function with a maximization sense. func TestObjectiveSense_ToObjSense2(t *testing.T) { // Constants var sense optim.ObjSense = optim.SenseMaximize @@ -55,13 +40,8 @@ func TestObjectiveSense_ToObjSense2(t *testing.T) { } } -/* -TestObjectiveSense_String1 -Description: - - Tests that we can extract strings from the three normal ObjSense values - (Minimize, Maximize, Find). -*/ +// TestObjectiveSense_String1 Tests that we can extract strings from the three normal ObjSense values +// (Minimize, Maximize, Find). func TestObjectiveSense_String1(t *testing.T) { // Test Minimize minSense := problem.SenseMinimize diff --git a/testing/problem/objective_test.go b/testing/problem/objective_test.go index 02b99fb..df0a24c 100644 --- a/testing/problem/objective_test.go +++ b/testing/problem/objective_test.go @@ -6,14 +6,9 @@ import ( "testing" ) -/* -TestObjective_NewObjective1 -Description: - - This test verifies that a new objective can be created - with the NewObjective function. It also verifies the types - of the returned value of NewObjective. -*/ +// TestObjective_NewObjective1 This test verifies that a new objective can be created +// with the NewObjective function. It also verifies the types +// of the returned value of NewObjective. func TestObjective_NewObjective1(t *testing.T) { // Constants v1 := symbolic.NewVariable() diff --git a/testing/problem/optimization_problem_test.go b/testing/problem/optimization_problem_test.go index 2c42d9c..e09d0be 100644 --- a/testing/problem/optimization_problem_test.go +++ b/testing/problem/optimization_problem_test.go @@ -1,11 +1,6 @@ package problem_test -/* -optimization_problem_test.go -Description: - - Tests for all functions and objects defined in the optimization_problem.go file. -*/ +// Tests for all functions and objects defined in the optimization_problem.go file. import ( "fmt" @@ -22,15 +17,10 @@ import ( "gonum.org/v1/gonum/mat" ) -/* -TestOptimizationProblem_NewProblem1 -Description: - - Tests the NewProblem function with a simple name. - Verifies that the name is set correctly and - that zero variables and constraints exist in the fresh - problem. -*/ +// TestOptimizationProblem_NewProblem1 Tests the NewProblem function with a simple name. +// Verifies that the name is set correctly and +// that zero variables and constraints exist in the fresh +// problem. func TestOptimizationProblem_NewProblem1(t *testing.T) { // Constants name := "TestProblem1" @@ -57,12 +47,7 @@ func TestOptimizationProblem_NewProblem1(t *testing.T) { } } -/* -TestOptimizationProblem_AddVariable1 -Description: - - Tests the AddVariable function with a simple problem. -*/ +// TestOptimizationProblem_AddVariable1 Tests the AddVariable function with a simple problem. func TestOptimizationProblem_AddVariable1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -83,12 +68,7 @@ func TestOptimizationProblem_AddVariable1(t *testing.T) { } } -/* -TestOptimizationProblem_AddRealVariable1 -Description: - - Tests the AddRealVariable function with a simple problem. -*/ +// TestOptimizationProblem_AddRealVariable1 Tests the AddRealVariable function with a simple problem. func TestOptimizationProblem_AddRealVariable1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -109,12 +89,7 @@ func TestOptimizationProblem_AddRealVariable1(t *testing.T) { } } -/* -TestOptimizationProblem_AddVariableClassic1 -Description: - - Tests the AddVariableClassic function with a simple problem. -*/ +// TestOptimizationProblem_AddVariableClassic1 Tests the AddVariableClassic function with a simple problem. func TestOptimizationProblem_AddVariableClassic1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -135,12 +110,7 @@ func TestOptimizationProblem_AddVariableClassic1(t *testing.T) { } } -/* -TestOptimizationProblem_AddBinaryVariable1 -Description: - - Tests the AddBinaryVariable function with a simple problem. -*/ +// TestOptimizationProblem_AddBinaryVariable1 Tests the AddBinaryVariable function with a simple problem. func TestOptimizationProblem_AddBinaryVariable1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -161,12 +131,7 @@ func TestOptimizationProblem_AddBinaryVariable1(t *testing.T) { } } -/* -TestOptimizationProblem_AddVariableVector1 -Description: - - Tests the AddVariableVector function with a simple problem. -*/ +// TestOptimizationProblem_AddVariableVector1 Tests the AddVariableVector function with a simple problem. func TestOptimizationProblem_AddVariableVector1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -190,12 +155,7 @@ func TestOptimizationProblem_AddVariableVector1(t *testing.T) { } } -/* -TestOptimizationProblem_AddVariableVectorClassic1 -Description: - - Tests the AddVariableVectorClassic function with a simple problem. -*/ +// TestOptimizationProblem_AddVariableVectorClassic1 Tests the AddVariableVectorClassic function with a simple problem. func TestOptimizationProblem_AddVariableVectorClassic1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -219,12 +179,7 @@ func TestOptimizationProblem_AddVariableVectorClassic1(t *testing.T) { } } -/* -TestOptimizationProblem_AddBinaryVariableVector1 -Description: - - Tests the AddBinaryVariableVector function with a simple problem. -*/ +// TestOptimizationProblem_AddBinaryVariableVector1 Tests the AddBinaryVariableVector function with a simple problem. func TestOptimizationProblem_AddBinaryVariableVector1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -248,12 +203,7 @@ func TestOptimizationProblem_AddBinaryVariableVector1(t *testing.T) { } } -/* -TestOptimizationProblem_AddVariableMatrix1 -Description: - - Tests the AddVariableMatrix function with a simple problem. -*/ +// TestOptimizationProblem_AddVariableMatrix1 Tests the AddVariableMatrix function with a simple problem. func TestOptimizationProblem_AddVariableMatrix1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -278,12 +228,7 @@ func TestOptimizationProblem_AddVariableMatrix1(t *testing.T) { } } -/* -TestOptimizationProblem_AddBinaryVariableMatrix1 -Description: - - Tests the AddBinaryVariableMatrix function with a simple problem. -*/ +// TestOptimizationProblem_AddBinaryVariableMatrix1 Tests the AddBinaryVariableMatrix function with a simple problem. func TestOptimizationProblem_AddBinaryVariableMatrix1(t *testing.T) { // Constants p1 := problem.NewProblem("TestProblem1") @@ -308,12 +253,7 @@ func TestOptimizationProblem_AddBinaryVariableMatrix1(t *testing.T) { } } -/* -TestOptimizationProblem_SetObjective1 -Description: - - Tests the SetObjective function with a simple linear objective. -*/ +// TestOptimizationProblem_SetObjective1 Tests the SetObjective function with a simple linear objective. func TestOptimizationProblem_SetObjective1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_SetObjective1") @@ -333,13 +273,8 @@ func TestOptimizationProblem_SetObjective1(t *testing.T) { } } -/* -TestOptimizationProblem_SetObjective2 -Description: - - Tests the SetObjective function with a vector objective - which should cause an error. -*/ +// TestOptimizationProblem_SetObjective2 Tests the SetObjective function with a vector objective +// which should cause an error. func TestOptimizationProblem_SetObjective2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_SetObjective2") @@ -359,12 +294,7 @@ func TestOptimizationProblem_SetObjective2(t *testing.T) { } } -/* -TestOptimizationProblem_ToSymbolicConstraint1 -Description: - - Tests the ToSymbolicConstraint function with a simple problem. -*/ +// TestOptimizationProblem_ToSymbolicConstraint1 Tests the ToSymbolicConstraint function with a simple problem. func TestOptimizationProblem_ToSymbolicConstraint1(t *testing.T) { // Constants model1 := optim.NewModel("TestModel1") @@ -392,15 +322,10 @@ func TestOptimizationProblem_ToSymbolicConstraint1(t *testing.T) { } -/* -TestOptimizationProblem_ToSymbolicConstraint2 -Description: - - Tests the ToSymbolicConstraint function with a simple problem - that has a vector constraint. This vector constraint - will be a GreaterThanEqual vector constraint between - a vector variable and a vector variable. -*/ +// TestOptimizationProblem_ToSymbolicConstraint2 Tests the ToSymbolicConstraint function with a simple problem +// that has a vector constraint. This vector constraint +// will be a GreaterThanEqual vector constraint between +// a vector variable and a vector variable. func TestOptimizationProblem_ToSymbolicConstraint2(t *testing.T) { // Constants model1 := optim.NewModel("TestModel1") @@ -421,14 +346,9 @@ func TestOptimizationProblem_ToSymbolicConstraint2(t *testing.T) { } } -/* -TestOptimizationProblem_ToSymbolicConstraint3 -Description: - - Tests the ToSymbolicConstraint function with a simple problem - that has a LeftHandSide that is not well-defined (in this case, - a variable). This should cause an error. -*/ +// TestOptimizationProblem_ToSymbolicConstraint3 Tests the ToSymbolicConstraint function with a simple problem +// that has a LeftHandSide that is not well-defined (in this case, +// a variable). This should cause an error. func TestOptimizationProblem_ToSymbolicConstraint3(t *testing.T) { // Constants model1 := optim.NewModel("TestModel1") @@ -455,14 +375,9 @@ func TestOptimizationProblem_ToSymbolicConstraint3(t *testing.T) { } } -/* -TestOptimizationProblem_ToSymbolicConstraint4 -Description: - - Tests the ToSymbolicConstraint function with a simple constraint - that has a RightHandSide that is not well-defined (in this case, - a variable). This should cause an error. -*/ +// TestOptimizationProblem_ToSymbolicConstraint4 Tests the ToSymbolicConstraint function with a simple constraint +// that has a RightHandSide that is not well-defined (in this case, +// a variable). This should cause an error. func TestOptimizationProblem_ToSymbolicConstraint4(t *testing.T) { // Constants model1 := optim.NewModel("TestModel1") @@ -489,13 +404,8 @@ func TestOptimizationProblem_ToSymbolicConstraint4(t *testing.T) { } } -/* -TestOptimizationProblem_From1 -Description: - - Tests the From function with a simple - model that doesn't have an objective. -*/ +// TestOptimizationProblem_From1 Tests the From function with a simple +// model that doesn't have an objective. func TestOptimizationProblem_From1(t *testing.T) { // Constants model := optim.NewModel( @@ -521,13 +431,8 @@ func TestOptimizationProblem_From1(t *testing.T) { } } -/* -TestOptimizationProblem_From2 -Description: - - Tests the From function with a simple - model that doesn't have an objective. -*/ +// TestOptimizationProblem_From2 Tests the From function with a simple +// model that doesn't have an objective. func TestOptimizationProblem_From2(t *testing.T) { // Constants model := optim.NewModel( @@ -566,14 +471,9 @@ func TestOptimizationProblem_From2(t *testing.T) { } } -/* -TestOptimizationProblem_From3 -Description: - - Tests the From function with a convex optimization - model that has a quadratic objective and - at least two constraints. -*/ +// TestOptimizationProblem_From3 Tests the From function with a convex optimization +// model that has a quadratic objective and +// at least two constraints. func TestOptimizationProblem_From3(t *testing.T) { // Constants model := optim.NewModel( @@ -634,14 +534,9 @@ func TestOptimizationProblem_From3(t *testing.T) { } } -/* -TestOptimizationProblem_From4 -Description: - - Tests the From function with a convex optimization - problem that has a linear objective and - a vector inequality constraint. -*/ +// TestOptimizationProblem_From4 Tests the From function with a convex optimization +// problem that has a linear objective and +// a vector inequality constraint. func TestOptimizationProblem_From4(t *testing.T) { // Constants model := optim.NewModel( @@ -700,14 +595,9 @@ func TestOptimizationProblem_From4(t *testing.T) { } } -/* -TestOptimizationProblem_From5 -Description: - - Tests the From function with a convex optimization - problem that has a linear objective and - two vector inequality constraints. -*/ +// TestOptimizationProblem_From5 Tests the From function with a convex optimization +// problem that has a linear objective and +// two vector inequality constraints. func TestOptimizationProblem_From5(t *testing.T) { // Constants model := optim.NewModel( @@ -773,13 +663,8 @@ func TestOptimizationProblem_From5(t *testing.T) { } } -/* -TestOptimizationProblem_From6 -Description: - - Tests the From function properly produces an error - when the input model is not well-defined. -*/ +// TestOptimizationProblem_From6 Tests the From function properly produces an error +// when the input model is not well-defined. func TestOptimizationProblem_From6(t *testing.T) { // Constants model := optim.NewModel( @@ -800,13 +685,8 @@ func TestOptimizationProblem_From6(t *testing.T) { } } -/* -TestOptimizationProblem_From7 -Description: - - Tests the From function properly produces an error - when the input model has an improperly defined objective. -*/ +// TestOptimizationProblem_From7 Tests the From function properly produces an error +// when the input model has an improperly defined objective. func TestOptimizationProblem_From7(t *testing.T) { // Constants model := optim.NewModel( @@ -830,14 +710,9 @@ func TestOptimizationProblem_From7(t *testing.T) { } } -/* -TestOptimizationProblem_From8 -Description: - - Tests the From function properly produces an error - when the input model has an objective function that - is not well-defined. -*/ +// TestOptimizationProblem_From8 Tests the From function properly produces an error +// when the input model has an objective function that +// is not well-defined. func TestOptimizationProblem_From8(t *testing.T) { // Constants model := optim.NewModel( @@ -871,13 +746,8 @@ func TestOptimizationProblem_From8(t *testing.T) { } } -/* -TestOptimizationProblem_From9 -Description: - - Tests that the From function properly produces an error - when a constraint has been added to the problem that is not well-defined. -*/ +// TestOptimizationProblem_From9 Tests that the From function properly produces an error +// when a constraint has been added to the problem that is not well-defined. func TestOptimizationProblem_From9(t *testing.T) { // Constants model := optim.NewModel( @@ -911,13 +781,8 @@ func TestOptimizationProblem_From9(t *testing.T) { } } -/* -TestOptimizationProblem_From10 -Description: - - Tests that the From function properly produces an error - when the objective is not well-formed. -*/ +// TestOptimizationProblem_From10 Tests that the From function properly produces an error +// when the objective is not well-formed. func TestOptimizationProblem_From10(t *testing.T) { // Constants model := optim.NewModel( @@ -951,14 +816,9 @@ func TestOptimizationProblem_From10(t *testing.T) { } } -/* -TestOptimizationProblem_Check1 -Description: - - Tests the Check function with a simple problem - that has one variable, one constraint and an objective - that is not well-defined. -*/ +// TestOptimizationProblem_Check1 Tests the Check function with a simple problem +// that has one variable, one constraint and an objective +// that is not well-defined. func TestOptimizationProblem_Check1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_Check1") @@ -986,14 +846,9 @@ func TestOptimizationProblem_Check1(t *testing.T) { } } -/* -TestOptimizationProblem_Check2 -Description: - - Tests the Check function with a simple problem - that has one variable, one well-defined objective - and a set of constraints containing one bad constraint. -*/ +// TestOptimizationProblem_Check2 Tests the Check function with a simple problem +// that has one variable, one well-defined objective +// and a set of constraints containing one bad constraint. func TestOptimizationProblem_Check2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_Check2") @@ -1025,14 +880,9 @@ func TestOptimizationProblem_Check2(t *testing.T) { } } -/* -TestOptimizationProblem_Check3 -Description: - - Tests the Check function with a simple problem - that has one variable and no objective defined. - The mpiErrors.NoObjectiveDefinedError should be created. -*/ +// TestOptimizationProblem_Check3 Tests the Check function with a simple problem +// that has one variable and no objective defined. +// The mpiErrors.NoObjectiveDefinedError should be created. func TestOptimizationProblem_Check3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_Check3") @@ -1053,17 +903,12 @@ func TestOptimizationProblem_Check3(t *testing.T) { } } -/* -TestOptimizationProblem_Check4 -Description: - - Tests the Check function with a simple problem - that has: - - objective defined - - two variables (one is NOT well-defined) - - and no constraints defined. - The result should throw an error relating to the bad variable. -*/ +// TestOptimizationProblem_Check4 Tests the Check function with a simple problem +// that has: +// - objective defined +// - two variables (one is NOT well-defined) +// - and no constraints defined. +// The result should throw an error relating to the bad variable. func TestOptimizationProblem_Check4(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_Check4") @@ -1093,13 +938,8 @@ func TestOptimizationProblem_Check4(t *testing.T) { } } -/* -TestOptimizationProblem_IsLinear1 -Description: - - Tests the IsLinear function with a simple problem - that has a constant objective and a single, linear constraint. -*/ +// TestOptimizationProblem_IsLinear1 Tests the IsLinear function with a simple problem +// that has a constant objective and a single, linear constraint. func TestOptimizationProblem_IsLinear1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_IsLinear1") @@ -1121,14 +961,9 @@ func TestOptimizationProblem_IsLinear1(t *testing.T) { } } -/* -TestOptimizationProblem_IsLinear2 -Description: - - Tests the IsLinear function with a simple problem - that has a linear objective containing 3 variables and two lienar constraints, - each containing one variable. -*/ +// TestOptimizationProblem_IsLinear2 Tests the IsLinear function with a simple problem +// that has a linear objective containing 3 variables and two lienar constraints, +// each containing one variable. func TestOptimizationProblem_IsLinear2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_IsLinear2") @@ -1153,14 +988,9 @@ func TestOptimizationProblem_IsLinear2(t *testing.T) { } } -/* -TestOptimizationProblem_IsLinear3 -Description: - - Tests the IsLinear function with a simple problem - that has a quadratic objective containing 3 variables and two lienar constraints, - each containing one variable. -*/ +// TestOptimizationProblem_IsLinear3 Tests the IsLinear function with a simple problem +// that has a quadratic objective containing 3 variables and two lienar constraints, +// each containing one variable. func TestOptimizationProblem_IsLinear3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_IsLinear3") @@ -1185,14 +1015,9 @@ func TestOptimizationProblem_IsLinear3(t *testing.T) { } } -/* -TestOptimizationProblem_IsLinear4 -Description: - - Tests the IsLinear function with a simple problem - that has a constant objective and a single, quadratic constraint. - The problem should be non-linear. -*/ +// TestOptimizationProblem_IsLinear4 Tests the IsLinear function with a simple problem +// that has a constant objective and a single, quadratic constraint. +// The problem should be non-linear. func TestOptimizationProblem_IsLinear4(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_IsLinear4") @@ -1217,14 +1042,9 @@ func TestOptimizationProblem_IsLinear4(t *testing.T) { } } -/* -TestOptimizationProblem_IsLinear5 -Description: - - Tests the IsLinear function with an optimization problem - that is NOT well-defined. - The function should cause a panic. -*/ +// TestOptimizationProblem_IsLinear5 Tests the IsLinear function with an optimization problem +// that is NOT well-defined. +// The function should cause a panic. func TestOptimizationProblem_IsLinear5(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_IsLinear5") @@ -1277,17 +1097,12 @@ func TestOptimizationProblem_IsLinear5(t *testing.T) { t.Errorf("expected a panic; received none") } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices1 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 2 variables, - - and a single linear inequality constraint. - The result should be a matrix with 1 row and 2 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices1 Tests the LinearInequalityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and a single linear inequality constraint. +// The result should be a matrix with 1 row and 2 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices1") @@ -1328,17 +1143,12 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices1(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices2 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 2 variables, - - and two scalar linear inequality constraints. - The result should be a matrix with 2 rows and 2 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices2 Tests the LinearInequalityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and two scalar linear inequality constraints. +// The result should be a matrix with 2 rows and 2 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices2") @@ -1380,17 +1190,12 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices2(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices3 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 3 variables, - - and a single vector linear inequality constraint. - The result should be a matrix with 3 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices3 Tests the LinearInequalityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 3 variables, +// - and a single vector linear inequality constraint. +// The result should be a matrix with 3 rows and 3 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices3") @@ -1430,17 +1235,12 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices3(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices4 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 3 variables, - - and two vector linear inequality constraints. - The result should be a matrix with 6 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices4 Tests the LinearInequalityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 3 variables, +// - and two vector linear inequality constraints. +// The result should be a matrix with 6 rows and 3 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices4(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices4") @@ -1482,19 +1282,14 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices4(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices5 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem - that looks like the one in TestOptimizationProblem_LinearInequalityConstraintMatrices1. - The problem will have: - - a constant objective - - 2 variables, - - a single linear inequality constraint, - - and a single linear equality constraint. - The result should be a matrix with 1 row and 2 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices5 Tests the LinearInequalityConstraintMatrices function with a simple problem +// that looks like the one in TestOptimizationProblem_LinearInequalityConstraintMatrices1. +// The problem will have: +// - a constant objective +// - 2 variables, +// - a single linear inequality constraint, +// - and a single linear equality constraint. +// The result should be a matrix with 1 row and 2 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices5(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices5") @@ -1537,19 +1332,14 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices5(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices6 -Description: - - Tests the LinearInequalityConstraintMatrices function with a simple problem - that contains a mixture of scalar and vector inequality constraints. - The problem will have: - - a constant objective - - 3 variables, - - a single vector linear inequality constraint, - - and a single scalar linear inequality constraint. - The result should be a matrix with 4 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices6 Tests the LinearInequalityConstraintMatrices function with a simple problem +// that contains a mixture of scalar and vector inequality constraints. +// The problem will have: +// - a constant objective +// - 3 variables, +// - a single vector linear inequality constraint, +// - and a single scalar linear inequality constraint. +// The result should be a matrix with 4 rows and 3 columns. func TestOptimizationProblem_LinearInequalityConstraintMatrices6(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices6") @@ -1591,13 +1381,8 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices6(t *testing.T) { } } -/* -TestOptimizationProblem_LinearInequalityConstraintMatrices7 -Description: - - Tests that the LinearInequalityConstraintMatrices function - properly produces an error when the problem has NO inequality constraints. -*/ +// TestOptimizationProblem_LinearInequalityConstraintMatrices7 Tests that the LinearInequalityConstraintMatrices function +// properly produces an error when the problem has NO inequality constraints. func TestOptimizationProblem_LinearInequalityConstraintMatrices7(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearInequalityConstraintMatrices7") @@ -1627,17 +1412,12 @@ func TestOptimizationProblem_LinearInequalityConstraintMatrices7(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices1 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 2 variables, - - and a single linear equality constraint. - The result should be a matrix with 1 row and 2 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices1 Tests the LinearEqualityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and a single linear equality constraint. +// The result should be a matrix with 1 row and 2 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices1") @@ -1678,17 +1458,12 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices1(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices2 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 2 variables, - - and two scalar linear equality constraints. - The result should be a matrix with 2 rows and 2 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices2 Tests the LinearEqualityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and two scalar linear equality constraints. +// The result should be a matrix with 2 rows and 2 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices2") @@ -1730,17 +1505,12 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices2(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices3 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 3 variables, - - and a single vector linear equality constraint. - The result should be a matrix with 3 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices3 Tests the LinearEqualityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 3 variables, +// - and a single vector linear equality constraint. +// The result should be a matrix with 3 rows and 3 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices3") @@ -1780,17 +1550,12 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices3(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices4 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem. - The problem will have: - - a constant objective - - 3 variables, - - and two vector linear equality constraints. - The result should be a matrix with 6 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices4 Tests the LinearEqualityConstraintMatrices function with a simple problem. +// The problem will have: +// - a constant objective +// - 3 variables, +// - and two vector linear equality constraints. +// The result should be a matrix with 6 rows and 3 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices4(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices4") @@ -1832,19 +1597,14 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices4(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices5 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem - that looks like the one in TestOptimizationProblem_LinearEqualityConstraintMatrices1. - The problem will have: - - a constant objective - - 2 variables, - - a single linear equality constraint, - - and a single linear inequality constraint. - The result should be a matrix with 1 row and 2 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices5 Tests the LinearEqualityConstraintMatrices function with a simple problem +// that looks like the one in TestOptimizationProblem_LinearEqualityConstraintMatrices1. +// The problem will have: +// - a constant objective +// - 2 variables, +// - a single linear equality constraint, +// - and a single linear inequality constraint. +// The result should be a matrix with 1 row and 2 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices5(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices5") @@ -1887,19 +1647,14 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices5(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices6 -Description: - - Tests the LinearEqualityConstraintMatrices function with a simple problem - that contains a mixture of scalar and vector equality constraints. - The problem will have: - - a constant objective - - 3 variables, - - a single vector linear equality constraint, - - and a single scalar linear equality constraint. - The result should be a matrix with 4 rows and 3 columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices6 Tests the LinearEqualityConstraintMatrices function with a simple problem +// that contains a mixture of scalar and vector equality constraints. +// The problem will have: +// - a constant objective +// - 3 variables, +// - a single vector linear equality constraint, +// - and a single scalar linear equality constraint. +// The result should be a matrix with 4 rows and 3 columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices6(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices6") @@ -1941,20 +1696,15 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices6(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices7 -Description: - - Tests the LinearEqualityConstraintMatrices function with a problem - that led to panics in the field. - The problem is Problem3 from our examples file. - The problem will have: - - a linear objective - - 3 variables, - - and a single linear VECTOR equality constraint (n_ineq = 1). - Because each variable can be positive or negative, the resulting - linear equality constraint matrix should have 3 rows and 3*2+n_ineq columns. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices7 Tests the LinearEqualityConstraintMatrices function with a problem +// that led to panics in the field. +// The problem is Problem3 from our examples file. +// The problem will have: +// - a linear objective +// - 3 variables, +// - and a single linear VECTOR equality constraint (n_ineq = 1). +// Because each variable can be positive or negative, the resulting +// linear equality constraint matrix should have 3 rows and 3*2+n_ineq columns. func TestOptimizationProblem_LinearEqualityConstraintMatrices7(t *testing.T) { // Constants p1 := problem.GetExampleProblem3() @@ -1992,13 +1742,8 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices7(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices8 -Description: - - Tests the LinearEqualityConstraintMatrices function properly produces - an NoEqualityConstraintsFoundError when the problem has NO equality constraints. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices8 Tests the LinearEqualityConstraintMatrices function properly produces +// an NoEqualityConstraintsFoundError when the problem has NO equality constraints. func TestOptimizationProblem_LinearEqualityConstraintMatrices8(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_LinearEqualityConstraintMatrices8") @@ -2028,18 +1773,13 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices8(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices9 -Description: - - Tests the LinearEqualityConstraintMatrices function with a problem - that led to panics in the field. - The problem is Problem4 from our examples file. - The problem will have: - - a linear objective - - 3 variables (each labeled as positive via the LB input to AddVariableVectorClassic), - - and a single linear VECTOR equality constraint. -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices9 Tests the LinearEqualityConstraintMatrices function with a problem +// that led to panics in the field. +// The problem is Problem4 from our examples file. +// The problem will have: +// - a linear objective +// - 3 variables (each labeled as positive via the LB input to AddVariableVectorClassic), +// - and a single linear VECTOR equality constraint. func TestOptimizationProblem_LinearEqualityConstraintMatrices9(t *testing.T) { // Constants p1 := problem.GetExampleProblem4() @@ -2077,22 +1817,17 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices9(t *testing.T) { } } -/* -TestOptimizationProblem_LinearEqualityConstraintMatrices10 -Description: - - Tests the LinearEqualityConstraintMatrices function with a problem - that led to panics in the field. - The problem is Problem4 from our examples file. - The problem will have: - - a linear objective - - 3 variables (each labeled as positive implicitly via the final 3 constraints), - - and a single linear VECTOR equality constraint. - The resulting problem should have 6 constraints (3 coming from inequality constraint) - and 3 from the positivity constraints. - The resulting linear equality constraint matrix should have 3 rows and 3+3 columns - (3 variables, 3 inequality constraints, and 3 positivity constraints). -*/ +// TestOptimizationProblem_LinearEqualityConstraintMatrices10 Tests the LinearEqualityConstraintMatrices function with a problem +// that led to panics in the field. +// The problem is Problem4 from our examples file. +// The problem will have: +// - a linear objective +// - 3 variables (each labeled as positive implicitly via the final 3 constraints), +// - and a single linear VECTOR equality constraint. +// The resulting problem should have 6 constraints (3 coming from inequality constraint) +// and 3 from the positivity constraints. +// The resulting linear equality constraint matrix should have 3 rows and 3+3 columns +// (3 variables, 3 inequality constraints, and 3 positivity constraints). func TestOptimizationProblem_LinearEqualityConstraintMatrices10(t *testing.T) { // Constants p1 := problem.GetExampleProblem5() @@ -2132,17 +1867,12 @@ func TestOptimizationProblem_LinearEqualityConstraintMatrices10(t *testing.T) { } } -/* -TestOptimizationProblem_ToProblemWithAllPositiveVariables1 -Description: - - Tests the ToProblemWithAllPositiveVariables function with a simple problem - that has: - - a constant objective - - 2 variables, - - and a single linear inequality constraint. - The result should be a problem with 4 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToProblemWithAllPositiveVariables1 Tests the ToProblemWithAllPositiveVariables function with a simple problem +// that has: +// - a constant objective +// - 2 variables, +// - and a single linear inequality constraint. +// The result should be a problem with 4 variables and 1 constraint. func TestOptimizationProblem_ToProblemWithAllPositiveVariables1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToProblemWithAllPositiveVariables1") @@ -2183,18 +1913,13 @@ func TestOptimizationProblem_ToProblemWithAllPositiveVariables1(t *testing.T) { } } -/* -TestOptimizationProblem_ToProblemWithAllPositiveVariables2 -Description: - - Tests the ToProblemWithAllPositiveVariables function with a simple problem - that has: - - a constant objective - - 2 variables, - - and two scalar linear inequality constraints. - One of the variables is purely positive, while the other is purely negative. - The result should be a problem with 2 variables and 2 constraints. -*/ +// TestOptimizationProblem_ToProblemWithAllPositiveVariables2 Tests the ToProblemWithAllPositiveVariables function with a simple problem +// that has: +// - a constant objective +// - 2 variables, +// - and two scalar linear inequality constraints. +// One of the variables is purely positive, while the other is purely negative. +// The result should be a problem with 2 variables and 2 constraints. func TestOptimizationProblem_ToProblemWithAllPositiveVariables2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToProblemWithAllPositiveVariables2") @@ -2239,17 +1964,12 @@ func TestOptimizationProblem_ToProblemWithAllPositiveVariables2(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_1 -Description: - - Tests the ToLPStandardForm function with a simple problem - that contains: - - a constant objective - - 1 variable, - - and a single linear inequality constraint (SenseGreaterThanEqual). - The result should be a problem with 2 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_1 Tests the ToLPStandardForm function with a simple problem +// that contains: +// - a constant objective +// - 1 variable, +// - and a single linear inequality constraint (SenseGreaterThanEqual). +// The result should be a problem with 2 variables and 1 constraint. func TestOptimizationProblem_ToLPStandardForm1_1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_1") @@ -2294,17 +2014,12 @@ func TestOptimizationProblem_ToLPStandardForm1_1(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_2 -Description: - - Tests the ToLPStandardForm function with a simple problem - that contains: - - a constant objective - - 3 variables, - - and a single vector linear inequality constraint (SenseGreaterThanEqual) of 5 dimensions. - The result should be a problem with 3*2+5 = 11 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_2 Tests the ToLPStandardForm function with a simple problem +// that contains: +// - a constant objective +// - 3 variables, +// - and a single vector linear inequality constraint (SenseGreaterThanEqual) of 5 dimensions. +// The result should be a problem with 3*2+5 = 11 variables and 1 constraint. func TestOptimizationProblem_ToLPStandardForm1_2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_2") @@ -2364,17 +2079,12 @@ func TestOptimizationProblem_ToLPStandardForm1_2(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_3 -Description: - - Tests the ToLPStandardForm function with a simple problem - that contains: - - a constant objective - - 3 variables, - - and a single vector linear inequality constraint (SenseLessThanEqual) of 5 dimensions. - The result should be a problem with 3*2+5 = 11 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_3 Tests the ToLPStandardForm function with a simple problem +// that contains: +// - a constant objective +// - 3 variables, +// - and a single vector linear inequality constraint (SenseLessThanEqual) of 5 dimensions. +// The result should be a problem with 3*2+5 = 11 variables and 1 constraint. func TestOptimizationProblem_ToLPStandardForm1_3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_3") @@ -2436,18 +2146,13 @@ func TestOptimizationProblem_ToLPStandardForm1_3(t *testing.T) { } -/* -TestOptimizationProblem_ToLPStandardForm1_4 -Description: - - This test verifies that the ToLPStandardForm function throws an error - when called on a problem that is not linear. - In this case, we will define a problem with a quadratic objective function. - The problem will have: - - a quadratic objective - - 2 variables, - - and a single linear inequality constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_4 This test verifies that the ToLPStandardForm function throws an error +// when called on a problem that is not linear. +// In this case, we will define a problem with a quadratic objective function. +// The problem will have: +// - a quadratic objective +// - 2 variables, +// - and a single linear inequality constraint. func TestOptimizationProblem_ToLPStandardForm1_4(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_4") @@ -2482,18 +2187,13 @@ func TestOptimizationProblem_ToLPStandardForm1_4(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_5 -Description: - - This test verifies that the ToLPStandardForm function throws an error - when called on a problem that is not linear. - In this case, we will define a problem with a quadratic constraint. - The problem will have: - - a constant objective - - 2 variables, - - and a single quadratic inequality constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_5 This test verifies that the ToLPStandardForm function throws an error +// when called on a problem that is not linear. +// In this case, we will define a problem with a quadratic constraint. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and a single quadratic inequality constraint. func TestOptimizationProblem_ToLPStandardForm1_5(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_5") @@ -2528,18 +2228,13 @@ func TestOptimizationProblem_ToLPStandardForm1_5(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_6 -Description: - - This test verifies that the ToLPStandardForm function properly handles - a simple problem with a single, scalar linear inequality constraint. - The problem will have: - - a constant objective - - 2 variables, - - and a single scalar linear inequality constraint (SenseLessThanEqual). - The result should be a problem with 2*2+1 = 5 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_6 This test verifies that the ToLPStandardForm function properly handles +// a simple problem with a single, scalar linear inequality constraint. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and a single scalar linear inequality constraint (SenseLessThanEqual). +// The result should be a problem with 2*2+1 = 5 variables and 1 constraint. func TestOptimizationProblem_ToLPStandardForm1_6(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_6") @@ -2585,18 +2280,13 @@ func TestOptimizationProblem_ToLPStandardForm1_6(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_7 -Description: - - This test verifies that the ToLPStandardForm function properly handles - a simple problem with a single, scalar equality constraint. - The problem will have: - - a constant objective - - 2 variables, - - and a single scalar linear equality constraint (SenseEqual). - The result should be a problem with 2*2 = 4 variables and 1 constraint. -*/ +// TestOptimizationProblem_ToLPStandardForm1_7 This test verifies that the ToLPStandardForm function properly handles +// a simple problem with a single, scalar equality constraint. +// The problem will have: +// - a constant objective +// - 2 variables, +// - and a single scalar linear equality constraint (SenseEqual). +// The result should be a problem with 2*2 = 4 variables and 1 constraint. func TestOptimizationProblem_ToLPStandardForm1_7(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_7") @@ -2641,21 +2331,16 @@ func TestOptimizationProblem_ToLPStandardForm1_7(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_8 -Description: - - Tests the LinearEqualityConstraintMatrices function properly produces - a matrix: - [ 1 -1 0 0 0 0 1 0 0 ] - C = [ 0 0 1 -1 0 0 0 1 0 ] - [ 0 0 0 0 1 -1 0 0 1 ] - and - b = [ 1 2 3 ] - By creating a problem with 3 variables and 3 linear inequality constraints. - The results should produce equality constraint matrix C - with 3 rows and 6 columns and a vector b with 3 elements. -*/ +// TestOptimizationProblem_ToLPStandardForm1_8 Tests the LinearEqualityConstraintMatrices function properly produces +// a matrix: +// [ 1 -1 0 0 0 0 1 0 0 ] +// C = [ 0 0 1 -1 0 0 0 1 0 ] +// [ 0 0 0 0 1 -1 0 0 1 ] +// and +// b = [ 1 2 3 ] +// By creating a problem with 3 variables and 3 linear inequality constraints. +// The results should produce equality constraint matrix C +// with 3 rows and 6 columns and a vector b with 3 elements. func TestOptimizationProblem_ToLPStandardForm1_8(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_8") @@ -2722,21 +2407,16 @@ func TestOptimizationProblem_ToLPStandardForm1_8(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_9 -Description: - - Tests the LinearEqualityConstraintMatrices function properly produces - a matrix: - [ 1 -1 0 0 0 0 -1 0 0 ] - C = [ 0 0 1 -1 0 0 0 -1 0 ] - [ 0 0 0 0 1 -1 0 0 -1 ] - and - b = [ -1 -2 -3 ] - By creating a problem with 3 variables and 3 linear inequality constraints. - The results should produce equality constraint matrix C - with 3 rows and 6 columns and a vector b with 3 elements. -*/ +// TestOptimizationProblem_ToLPStandardForm1_9 Tests the LinearEqualityConstraintMatrices function properly produces +// a matrix: +// [ 1 -1 0 0 0 0 -1 0 0 ] +// C = [ 0 0 1 -1 0 0 0 -1 0 ] +// [ 0 0 0 0 1 -1 0 0 -1 ] +// and +// b = [ -1 -2 -3 ] +// By creating a problem with 3 variables and 3 linear inequality constraints. +// The results should produce equality constraint matrix C +// with 3 rows and 6 columns and a vector b with 3 elements. func TestOptimizationProblem_ToLPStandardForm1_9(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_9") @@ -2803,15 +2483,10 @@ func TestOptimizationProblem_ToLPStandardForm1_9(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_10 -Description: - - This method verifies that the method will return an error - if the optimization problem is not well-defined. - In this case, we will create a problem with a constraint - that has mismatched dimensions. -*/ +// TestOptimizationProblem_ToLPStandardForm1_10 This method verifies that the method will return an error +// if the optimization problem is not well-defined. +// In this case, we will create a problem with a constraint +// that has mismatched dimensions. func TestOptimizationProblem_ToLPStandardForm1_10(t *testing.T) { // Setup N := 10 @@ -2846,19 +2521,14 @@ func TestOptimizationProblem_ToLPStandardForm1_10(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_11 -Description: - - This method verifies that the map from original variables to - standard form variables is correct for a small problem. - In this problem, we will have: - - a constant objective - - 1 variable, - - and a single linear inequality constraint. - The resulting map should contain 1 entry, mapping the original - variable to the positive half and negative half variables in the standard form. -*/ +// TestOptimizationProblem_ToLPStandardForm1_11 This method verifies that the map from original variables to +// standard form variables is correct for a small problem. +// In this problem, we will have: +// - a constant objective +// - 1 variable, +// - and a single linear inequality constraint. +// The resulting map should contain 1 entry, mapping the original +// variable to the positive half and negative half variables in the standard form. func TestOptimizationProblem_ToLPStandardForm1_11(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_11") @@ -2902,21 +2572,16 @@ func TestOptimizationProblem_ToLPStandardForm1_11(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm1_12 -Description: - - This method verifies that the map from original variables to - standard form variables is correct for a small problem. - In this problem, we will have: - - a constant objective - - 2 variables, - - and two linear inequality constraints. - One of the variables is purely positive, while the other is purely negative. - The resulting map should contain 2 entries, one mapping the purely positive - variable to itself, and the other mapping the purely negative variable to - the negative half variables in the standard form. -*/ +// TestOptimizationProblem_ToLPStandardForm1_12 This method verifies that the map from original variables to +// standard form variables is correct for a small problem. +// In this problem, we will have: +// - a constant objective +// - 2 variables, +// - and two linear inequality constraints. +// One of the variables is purely positive, while the other is purely negative. +// The resulting map should contain 2 entries, one mapping the purely positive +// variable to itself, and the other mapping the purely negative variable to +// the negative half variables in the standard form. func TestOptimizationProblem_ToLPStandardForm1_12(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm1_12") @@ -2983,14 +2648,9 @@ func TestOptimizationProblem_ToLPStandardForm1_12(t *testing.T) { // } } -/* -TestOptimizationProblem_CheckIfLinear1 -Description: - - This test verifies that the CheckIfLinear function properly identifies - a NOT well-defined problem is not linear. - The problem will have a vector constraint with mismatched dimensions. -*/ +// TestOptimizationProblem_CheckIfLinear1 This test verifies that the CheckIfLinear function properly identifies +// a NOT well-defined problem is not linear. +// The problem will have a vector constraint with mismatched dimensions. func TestOptimizationProblem_CheckIfLinear1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_CheckIfLinear1") @@ -3032,21 +2692,16 @@ func TestOptimizationProblem_CheckIfLinear1(t *testing.T) { } } -/* -TestOptimizationProblem_SimplifyConstraints1 -Description: - - This test verifies that the SimplifyConstraints function properly simplifies - a problem with redundant constraints. - The problem will have: - - a constant objective - - 1 variable1, - - and 2 linear inequality constraints: - x1 <= 1 - x1 <= 2 - The second constraint is redundant and should be removed. - The result should be a problem with 1 variable and 1 constraint. -*/ +// TestOptimizationProblem_SimplifyConstraints1 This test verifies that the SimplifyConstraints function properly simplifies +// a problem with redundant constraints. +// The problem will have: +// - a constant objective +// - 1 variable1, +// - and 2 linear inequality constraints: +// x1 <= 1 +// x1 <= 2 +// The second constraint is redundant and should be removed. +// The result should be a problem with 1 variable and 1 constraint. func TestOptimizationProblem_SimplifyConstraints1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_SimplifyConstraints1") @@ -3093,18 +2748,13 @@ func TestOptimizationProblem_SimplifyConstraints1(t *testing.T) { } } -/* -TestOptimizationProblem_SimplifyConstraints2 -Description: - - This test verifies that the SimplifyConstraints function properly handles - a problem with no constraints. - The problem will have: - - a constant objective - - 1 variable, - - and no constraints. - The result should be a problem with 1 variable and no constraints. -*/ +// TestOptimizationProblem_SimplifyConstraints2 This test verifies that the SimplifyConstraints function properly handles +// a problem with no constraints. +// The problem will have: +// - a constant objective +// - 1 variable, +// - and no constraints. +// The result should be a problem with 1 variable and no constraints. func TestOptimizationProblem_SimplifyConstraints2(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_SimplifyConstraints2") @@ -3134,18 +2784,13 @@ func TestOptimizationProblem_SimplifyConstraints2(t *testing.T) { } } -/* -TestOptimizationProblem_SimplifyConstraints3 -Description: - - This test verifies that the SimplifyConstraints function properly handles - a problem with a single constraint that is not redundant. - The problem will have: - - a constant objective - - 1 variable, - - and a single linear inequality constraint. - The result should be a problem with 1 variable and 1 constraint. -*/ +// TestOptimizationProblem_SimplifyConstraints3 This test verifies that the SimplifyConstraints function properly handles +// a problem with a single constraint that is not redundant. +// The problem will have: +// - a constant objective +// - 1 variable, +// - and a single linear inequality constraint. +// The result should be a problem with 1 variable and 1 constraint. func TestOptimizationProblem_SimplifyConstraints3(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_SimplifyConstraints3") @@ -3190,19 +2835,14 @@ func TestOptimizationProblem_SimplifyConstraints3(t *testing.T) { } } -/* -TestOptimizationProblem_ToLPStandardForm2_1 -Description: - - Tests the ToLPStandardForm2 function with a simple problem - that contains: - - a linear objective, - - a MINIMIZATION sense - - 1 variable, - - and a single linear inequality constraint (SenseGreaterThanEqual). - The result should be a problem with 2 variables and 1 constraint. - The sense of the resulting problem should be MAXIMIZATION. -*/ +// TestOptimizationProblem_ToLPStandardForm2_1 Tests the ToLPStandardForm2 function with a simple problem +// that contains: +// - a linear objective, +// - a MINIMIZATION sense +// - 1 variable, +// - and a single linear inequality constraint (SenseGreaterThanEqual). +// The result should be a problem with 2 variables and 1 constraint. +// The sense of the resulting problem should be MAXIMIZATION. func TestOptimizationProblem_ToLPStandardForm2_1(t *testing.T) { // Constants p1 := problem.NewProblem("TestOptimizationProblem_ToLPStandardForm2_1") @@ -3253,16 +2893,11 @@ func TestOptimizationProblem_ToLPStandardForm2_1(t *testing.T) { } } -/* -TestOptimizationProblem_CopyVariable1 -Description: - - This method tests that the CopyVariable method for OptimizationProblem - properly creates a copy of one variable in an optimization problem. - Check that: - - the new variable has a different ID than the one that is copied - - the new variable has a slightly different name than the one that is copied -*/ +// TestOptimizationProblem_CopyVariable1 This method tests that the CopyVariable method for OptimizationProblem +// properly creates a copy of one variable in an optimization problem. +// Check that: +// - the new variable has a different ID than the one that is copied +// - the new variable has a slightly different name than the one that is copied func TestOptimizationProblem_CopyVariable1(t *testing.T) { p1 := problem.NewProblem("TestOptimizationProblem_CopyVariable1") v1 := p1.AddVariable() @@ -3287,16 +2922,11 @@ func TestOptimizationProblem_CopyVariable1(t *testing.T) { } } -/* -TestOptimizationProblem_String1 -Description: - - Tests that a small optimization problem with all scalar constraints gets represented - as a string with: - - Minimize sense of objective - - The objective expression is completely contained in the string - - the string describes that there are 0 vector constraints and 0 matrix constraints -*/ +// TestOptimizationProblem_String1 Tests that a small optimization problem with all scalar constraints gets represented +// as a string with: +// - Minimize sense of objective +// - The objective expression is completely contained in the string +// - the string describes that there are 0 vector constraints and 0 matrix constraints func TestOptimizationProblem_String1(t *testing.T) { // Create Optimization Problem p := problem.NewProblem("TestOptimizationProblem_String1") @@ -3340,15 +2970,10 @@ func TestOptimizationProblem_String1(t *testing.T) { } } -/* -TestOptimizationProblem_String2 -Description: - - Tests that a small optimization problem with all scalar constraints gets represented - as a string with: - - Maximize sense of objective - - the string describes that there are 2 vector constraints and 1 matrix constraints -*/ +// TestOptimizationProblem_String2 Tests that a small optimization problem with all scalar constraints gets represented +// as a string with: +// - Maximize sense of objective +// - the string describes that there are 2 vector constraints and 1 matrix constraints func TestOptimizationProblem_String2(t *testing.T) { // Create Optimization Problem p := problem.NewProblem("TestOptimizationProblem_String1") diff --git a/testing/solution/solution_test.go b/testing/solution/solution_test.go index 804adf1..7a2be98 100644 --- a/testing/solution/solution_test.go +++ b/testing/solution/solution_test.go @@ -10,14 +10,10 @@ import ( "github.com/MatProGo-dev/SymbolicMath.go/symbolic" ) -/* -solution_test.go -Description: - Testing for the solution object. - (This seems like it is highly representative of the Gurobi solver; is there a reason to make it this way?) -*/ - -// Helper function to convert a symbolic.Expression to float64 +// Testing for the solution object. +// (This seems like it is highly representative of the Gurobi solver; is there a reason to make it this way?) + +// exprToFloat64 Helper function to convert a symbolic.Expression to float64 func exprToFloat64(t *testing.T, expr symbolic.Expression) float64 { resultK, ok := expr.(symbolic.K) if !ok { @@ -97,12 +93,7 @@ func TestSolution_ToMessage2(t *testing.T) { } } -/* -TestSolution_Value1 -Description: - - This function tests whether or not we can properly retrieve values from a solution object. -*/ +// TestSolution_Value1 This function tests whether or not we can properly retrieve values from a solution object. func TestSolution_Value1(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -143,13 +134,8 @@ func TestSolution_Value1(t *testing.T) { } -/* -TestSolution_FindValueOfExpression1 -Description: - - This function tests whether we can evaluate a simple linear expression - using the solution values. -*/ +// TestSolution_FindValueOfExpression1 This function tests whether we can evaluate a simple linear expression +// using the solution values. func TestSolution_FindValueOfExpression1(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -184,12 +170,7 @@ func TestSolution_FindValueOfExpression1(t *testing.T) { } } -/* -TestSolution_FindValueOfExpression2 -Description: - - This function tests whether we can evaluate a constant expression. -*/ +// TestSolution_FindValueOfExpression2 This function tests whether we can evaluate a constant expression. func TestSolution_FindValueOfExpression2(t *testing.T) { // Constants tempSol := solution.DummySolution{ @@ -219,12 +200,7 @@ func TestSolution_FindValueOfExpression2(t *testing.T) { } } -/* -TestSolution_FindValueOfExpression3 -Description: - - This function tests whether we can evaluate an expression with a single variable. -*/ +// TestSolution_FindValueOfExpression3 This function tests whether we can evaluate an expression with a single variable. func TestSolution_FindValueOfExpression3(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -258,13 +234,8 @@ func TestSolution_FindValueOfExpression3(t *testing.T) { } } -/* -TestSolution_FindValueOfExpression4 -Description: - - This function tests whether we get an error when a variable is missing - from the solution. -*/ +// TestSolution_FindValueOfExpression4 This function tests whether we get an error when a variable is missing +// from the solution. func TestSolution_FindValueOfExpression4(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -289,13 +260,8 @@ func TestSolution_FindValueOfExpression4(t *testing.T) { } } -/* -TestSolution_FindValueOfExpression5 -Description: - - This function tests whether we can evaluate a more complex expression - with multiple operations. -*/ +// TestSolution_FindValueOfExpression5 This function tests whether we can evaluate a more complex expression +// with multiple operations. func TestSolution_FindValueOfExpression5(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -333,12 +299,7 @@ func TestSolution_FindValueOfExpression5(t *testing.T) { } } -/* -TestSolution_GetProblem1 -Description: - - This function tests whether we can retrieve the problem from a solution. -*/ +// TestSolution_GetProblem1 This function tests whether we can retrieve the problem from a solution. func TestSolution_GetProblem1(t *testing.T) { // Constants p := problem.NewProblem("TestProblem1") @@ -366,12 +327,7 @@ func TestSolution_GetProblem1(t *testing.T) { } } -/* -TestSolution_GetProblem2 -Description: - - This function tests whether GetProblem returns nil when no problem is set. -*/ +// TestSolution_GetProblem2 This function tests whether GetProblem returns nil when no problem is set. func TestSolution_GetProblem2(t *testing.T) { // Constants tempSol := solution.DummySolution{ @@ -392,13 +348,8 @@ func TestSolution_GetProblem2(t *testing.T) { } } -/* -TestSolution_GetOptimalObjectiveValue1 -Description: - - This function tests whether we can compute the objective value at the solution point - for a simple linear objective. -*/ +// TestSolution_GetOptimalObjectiveValue1 This function tests whether we can compute the objective value at the solution point +// for a simple linear objective. func TestSolution_GetOptimalObjectiveValue1(t *testing.T) { // Constants p := problem.NewProblem("TestProblem") @@ -439,13 +390,8 @@ func TestSolution_GetOptimalObjectiveValue1(t *testing.T) { } } -/* -TestSolution_GetOptimalObjectiveValue2 -Description: - - This function tests whether GetOptimalObjectiveValue returns an error - when the solution has no associated problem. -*/ +// TestSolution_GetOptimalObjectiveValue2 This function tests whether GetOptimalObjectiveValue returns an error +// when the solution has no associated problem. func TestSolution_GetOptimalObjectiveValue2(t *testing.T) { // Constants v1 := symbolic.NewVariable() @@ -466,13 +412,8 @@ func TestSolution_GetOptimalObjectiveValue2(t *testing.T) { } } -/* -TestSolution_GetOptimalObjectiveValue3 -Description: - - This function tests whether we can compute the objective value - for a constant objective function. -*/ +// TestSolution_GetOptimalObjectiveValue3 This function tests whether we can compute the objective value +// for a constant objective function. func TestSolution_GetOptimalObjectiveValue3(t *testing.T) { // Constants p := problem.NewProblem("TestProblem") @@ -510,13 +451,8 @@ func TestSolution_GetOptimalObjectiveValue3(t *testing.T) { } } -/* -TestSolution_GetOptimalObjectiveValue4 -Description: - - This function tests whether we can compute the objective value - for a more complex objective with multiple variables and operations. -*/ +// TestSolution_GetOptimalObjectiveValue4 This function tests whether we can compute the objective value +// for a more complex objective with multiple variables and operations. func TestSolution_GetOptimalObjectiveValue4(t *testing.T) { // Constants p := problem.NewProblem("TestProblem") diff --git a/testing/util_test.go b/testing/util_test.go index 721196b..51ab118 100644 --- a/testing/util_test.go +++ b/testing/util_test.go @@ -30,12 +30,7 @@ func TestSumVars(t *testing.T) { } } -/* -TestUtil_Identity1 -Description: - - Create identity matrix of dimension 1 (scalar?). -*/ +// TestUtil_Identity1 Create identity matrix of dimension 1 (scalar?). func TestUtil_Identity1(t *testing.T) { // Constants n := 1 @@ -52,12 +47,7 @@ func TestUtil_Identity1(t *testing.T) { } -/* -TestUtil_Identity2 -Description: - - Create identity matrix of dimension 10. -*/ +// TestUtil_Identity2 Create identity matrix of dimension 10. func TestUtil_Identity2(t *testing.T) { // Constants n := 10 @@ -74,13 +64,8 @@ func TestUtil_Identity2(t *testing.T) { } -/* -TestUtil_FindInSlice1 -Description: - - Tests the find in slice function for strings! - (string in slice) -*/ +// TestUtil_FindInSlice1 Tests the find in slice function for strings! +// (string in slice) func TestUtil_FindInSlice1(t *testing.T) { // Constant slice0 := []string{"Why", "test", "this", "?"} @@ -98,13 +83,8 @@ func TestUtil_FindInSlice1(t *testing.T) { } } -/* -TestUtil_FindInSlice2 -Description: - - Tests the find in slice function for strings! - (string NOT in slice) -*/ +// TestUtil_FindInSlice2 Tests the find in slice function for strings! +// (string NOT in slice) func TestUtil_FindInSlice2(t *testing.T) { // Constant slice0 := []string{"Why", "test", "this", "?"} @@ -122,13 +102,8 @@ func TestUtil_FindInSlice2(t *testing.T) { } } -/* -TestUtil_FindInSlice3 -Description: - - Tests the find in slice function for ints! - (int in slice) -*/ +// TestUtil_FindInSlice3 Tests the find in slice function for ints! +// (int in slice) func TestUtil_FindInSlice3(t *testing.T) { // Constant slice0 := []int{1, 3, 7, 11} @@ -146,13 +121,8 @@ func TestUtil_FindInSlice3(t *testing.T) { } } -/* -TestUtil_FindInSlice4 -Description: - - Tests the find in slice function for ints! - (int NOT in slice) -*/ +// TestUtil_FindInSlice4 Tests the find in slice function for ints! +// (int NOT in slice) func TestUtil_FindInSlice4(t *testing.T) { // Constant slice0 := []int{1, 3, 7, 11} @@ -170,13 +140,8 @@ func TestUtil_FindInSlice4(t *testing.T) { } } -/* -TestUtil_FindInSlice5 -Description: - - Tests the find in slice function for uint64! - (uint64 in slice) -*/ +// TestUtil_FindInSlice5 Tests the find in slice function for uint64! +// (uint64 in slice) func TestUtil_FindInSlice5(t *testing.T) { // Constant slice0 := []uint64{1, 3, 7, 11} @@ -195,13 +160,8 @@ func TestUtil_FindInSlice5(t *testing.T) { } } -/* -TestUtil_FindInSlice6 -Description: - - Tests the find in slice function for uint64! - (uint64 NOT in slice) -*/ +// TestUtil_FindInSlice6 Tests the find in slice function for uint64! +// (uint64 NOT in slice) func TestUtil_FindInSlice6(t *testing.T) { // Constant slice0 := []uint64{1, 3, 7, 11} @@ -220,13 +180,8 @@ func TestUtil_FindInSlice6(t *testing.T) { } } -/* -TestUtil_FindInSlice7 -Description: - - Tests the find in slice function for strings! - (Variable in slice) -*/ +// TestUtil_FindInSlice7 Tests the find in slice function for strings! +// (Variable in slice) func TestUtil_FindInSlice7(t *testing.T) { // Constant m := optim.NewModel("test-util-findinslice7") @@ -248,13 +203,8 @@ func TestUtil_FindInSlice7(t *testing.T) { } } -/* -TestUtil_FindInSlice4 -Description: - - Tests the find in slice function for strings! - (int NOT in slice) -*/ +// TestUtil_FindInSlice8 Tests the find in slice function for strings! +// (int NOT in slice) func TestUtil_FindInSlice8(t *testing.T) { // Constant m := optim.NewModel("test-util-findinslice7")