This function adds a new constraint from scratch. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+
The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
+
+
Arguments
+
+
coeff
+
Sparse matrix representing coefficients of the variables in the new constraint (must have 1 row and number of columns equal to number of variables)
+
type
+
Type of the new constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
+
bound1
+
The first (or only) bound for the constraint
+
bound2
+
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
Sparse matrix representing coefficients of the new variable in the existing constraints (must have 1 column and number of rows equal to number of constraints)
+
lower
+
Lower bound of the new variable
+
upper
+
Upper bound of the new variable
+
obj
+
Coefficient of the variable in the objective function
+
isInt
+
Wether the variable is constrainted to be an integer (boolean %t or %f)
This routine is used to delete columns from the original problem description.
+
+
Calling Sequence
+
sym_deleteVars(indices)
+
+
Description
+
+
Arguments
+
+
indices
+
Pointer to an integer type array indicating the indices of the column numbers(variables) to be deleted.
+
+
Return value
+
+
Returns 0 if the column numbers specified are deleted successfully and 0 if the deletion of column indices did not execute successfully and it returns with an error return value
This routine is used to get the value of a double type parameter.
+
+
Calling Sequence
+
sym_getDblParam(key)
+
+
Description
+
+
Arguments
+
+
key
+
The name of the double parameter whose value has to be retrieved. Note: should be given within " "
+
+
Return value
+
+
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to get the value of an integer type parameter.
+
+
Calling Sequence
+
sym_getIntParam(key)
+
+
Description
+
+
Arguments
+
+
key
+
The name of the integer parameter whose value has to be retrieved. Note: should be given within " "
+
+
Return value
+
+
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to get the value of a string type parameter.
+
+
Calling Sequence
+
sym_getStrParam(key)
+
+
Description
+
+
Arguments
+
+
key
+
The name of the strung parameter whose value has to be retrieved. Note: should be given within " "
+
+
Return value
+
+
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to load an instance from an MPS file.
+
+
Calling Sequence
+
sym_loadMPS(filename)
+
+
Description
+
+
Arguments
+
+
filename
+
It is a string that has the path of the .mps file to loaded.It has to be given within double quotes ("")
+
+
Return value
+
+
Returns 0 if the .mps file is loaded properly to symphony and 0 if there is an error reading the mps file or the function returns with an error return value
This function completely modifies the type of a constraint. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+
The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
+
+
Arguments
+
+
index
+
Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
+
type
+
New type of the constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
+
bound1
+
The first (or only) bound for the constraint
+
bound2
+
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
+
+
diff --git a/help/en_US/scilab_en_US_help/xml_code.css b/help/en_US/scilab_en_US_help/xml_code.css
new file mode 100644
index 0000000..9e4c27f
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/xml_code.css
@@ -0,0 +1,94 @@
+.xmlcomment {
+ font-style: italic;
+ color: #01a801
+}
+
+.xmldefault {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlentity {
+ font-style: normal;
+ color: #ffaa00
+}
+
+.xmlopeninstr {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlcloseinstr {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlinstrname {
+ font-style: normal;
+ color: #9965a6
+}
+
+.xmllowtag {
+ font-style: normal;
+ color: #000000
+}
+
+.xmltagname {
+ font-style: normal;
+ color: #0303ff
+}
+
+.xmllowclose {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlopencomment {
+ font-style: italic;
+ color: #01a801
+}
+
+.xmlcommentend {
+ font-style: italic;
+ color: #01a801
+}
+
+.xmlcomment {
+ font-style: italic;
+ color: #01a801
+}
+
+.xmlopencdata {
+ font-style: normal;
+ color: #c45555
+}
+
+.xmlcdataend {
+ font-style: normal;
+ color: #c45555
+}
+
+.xmlcdata {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlattributename {
+ font-style: normal;
+ color: #9965a6
+}
+
+.xmlequal {
+ font-style: normal;
+ color: #000000
+}
+
+.xmlattributevalue {
+ font-style: normal;
+ color: #973964
+}
+
+.xmlautoclose {
+ font-style: normal;
+ color: #000000
+}
diff --git a/help/en_US/sym_addConstr.xml b/help/en_US/sym_addConstr.xml
new file mode 100644
index 0000000..89ec114
--- /dev/null
+++ b/help/en_US/sym_addConstr.xml
@@ -0,0 +1,76 @@
+
+
+
+
+ sym_addConstr
+ Add a new constraint
+
+
+
+ Calling Sequence
+ sym_addConstr(coeff,type,bound1[,bound2])
+
+
+
+ Description
+
+ This function adds a new constraint from scratch. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+ The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
+
+
+
+
+ Arguments
+
+
+
+ coeff
+ Sparse matrix representing coefficients of the variables in the new constraint (must have 1 row and number of columns equal to number of variables)
+
+
+ type
+ Type of the new constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
+
+
+ bound1
+ The first (or only) bound for the constraint
+
+
+ bound2
+ The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_addConstr(sparse([0,0,1,0,2]),"R",0,10)
+ sym_addConstr(sparse([0,0,1,1,0]),"G",4)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_addVar.xml b/help/en_US/sym_addVar.xml
new file mode 100644
index 0000000..7ba5c74
--- /dev/null
+++ b/help/en_US/sym_addVar.xml
@@ -0,0 +1,82 @@
+
+
+
+
+ sym_addVar
+ Add a new variable
+
+
+
+ Calling Sequence
+ sym_addVar(coeff,lower,upper,obj,isInt,name)
+
+
+
+ Description
+
+ This function adds a new variable from scratch.
+
+
+
+
+ Arguments
+
+
+
+ coeff
+ Sparse matrix representing coefficients of the new variable in the existing constraints (must have 1 column and number of rows equal to number of constraints)
+
+
+ lower
+ Lower bound of the new variable
+
+
+ upper
+ Upper bound of the new variable
+
+
+ obj
+ Coefficient of the variable in the objective function
+
+
+ isInt
+ Wether the variable is constrainted to be an integer (boolean %t or %f)
+
+
+ name
+ Name of the new variable
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_addVar(sparse([0;0;1;2;0;0]),0,%inf,1.2,%t,"part1")
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_close.xml b/help/en_US/sym_close.xml
new file mode 100644
index 0000000..5f2e903
--- /dev/null
+++ b/help/en_US/sym_close.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ sym_close
+ Close the Symphony environment
+
+
+
+ Calling Sequence
+ sym_close()
+
+
+
+ Description
+
+ Closes the already open Symphony environment.
+ Warning: All data loaded into the environment is deleted.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns 1 if the environment was successfully closed and 0 otherwise
+
+
+
+
+ Examples
+
+ sym_close()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+ Iswarya
+
+
+
+
+
diff --git a/help/en_US/sym_deleteConstrs.xml b/help/en_US/sym_deleteConstrs.xml
new file mode 100644
index 0000000..7c1aaa7
--- /dev/null
+++ b/help/en_US/sym_deleteConstrs.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_deleteConstrs
+ This routine is used to delete rows from the original constraint matrix.
+
+
+
+ Calling Sequence
+ sym_deleteConstrs(indices)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ indices
+ An array indicating the indices of the rows to be deleted.
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the constraints specified in the indices are deleted successfully and 0 if it returns corresponding to an error value.
+
+
+
+
+ Examples
+
+ status=sym_deleteConstrs([1,2])
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_deleteVars.xml b/help/en_US/sym_deleteVars.xml
new file mode 100644
index 0000000..3ce1fe7
--- /dev/null
+++ b/help/en_US/sym_deleteVars.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_deleteVars
+ This routine is used to delete columns from the original problem description.
+
+
+
+ Calling Sequence
+ sym_deleteVars(indices)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ indices
+ Pointer to an integer type array indicating the indices of the column numbers(variables) to be deleted.
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the column numbers specified are deleted successfully and 0 if the deletion of column indices did not execute successfully and it returns with an error return value
+
+
+
+
+ Examples
+
+ status=sym_deleteVars([1,2])
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_getConstrActivity.xml b/help/en_US/sym_getConstrActivity.xml
new file mode 100644
index 0000000..7323a48
--- /dev/null
+++ b/help/en_US/sym_getConstrActivity.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getConstrActivity
+ Get the activity of the constraints in the solution
+
+
+
+ Calling Sequence
+ sym_getConstrActivity()
+
+
+
+ Description
+
+ Get the activity of the constraints in the solution.
+ This function may fail if the problem has not been solved already. Use sym_solve() in this case.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns a matrix with 1 column and number of rows equal to number of constraints, that represents the activities of those constraints
+
+
+
+
+ Examples
+
+ sym_getConstrActivity()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getConstrLower.xml b/help/en_US/sym_getConstrLower.xml
new file mode 100644
index 0000000..8274813
--- /dev/null
+++ b/help/en_US/sym_getConstrLower.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getConstrLower
+ To get the lower bounds of the constraints.
+
+
+
+ Calling Sequence
+ sym_getConstrLower()
+
+
+
+ Description
+
+ This routine is used to get lower bounds of constraints.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a column vector of lower bounds of constraints.
+
+
+
+
+ Examples
+
+ ans=sym_getConstrLower()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getConstrRange.xml b/help/en_US/sym_getConstrRange.xml
new file mode 100644
index 0000000..402f313
--- /dev/null
+++ b/help/en_US/sym_getConstrRange.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getConstrRange
+ To to get the constraint ranges.
+
+
+
+ Calling Sequence
+ sym_getConstrRange()
+
+
+
+ Description
+
+ This routine is used to get the constraint ranges.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a column vector of the constraint ranges.
+
+
+
+
+ Examples
+
+ ans=sym_getConstrRange()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getConstrSense.xml b/help/en_US/sym_getConstrSense.xml
new file mode 100644
index 0000000..85d358c
--- /dev/null
+++ b/help/en_US/sym_getConstrSense.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getConstrSense
+ To get the row senses.
+
+
+
+ Calling Sequence
+ sym_getConstrSense()
+
+
+
+ Description
+
+ This routine is used to get the row senses.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a column vector of the row senses.
+
+
+
+
+ Examples
+
+ ans=sym_getConstrSense()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getConstrUpper.xml b/help/en_US/sym_getConstrUpper.xml
new file mode 100644
index 0000000..5422d96
--- /dev/null
+++ b/help/en_US/sym_getConstrUpper.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getConstrUpper
+ To get the upper bounds of the constraints.
+
+
+
+ Calling Sequence
+ sym_getConstrUpper()
+
+
+
+ Description
+
+ This routine is used to get upper bounds of the constraints.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a column vector of upper bounds of constraints.
+
+
+
+
+ Examples
+
+ ans=sym_getConstrUpper()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getDblParam.xml b/help/en_US/sym_getDblParam.xml
new file mode 100644
index 0000000..4e5d8f3
--- /dev/null
+++ b/help/en_US/sym_getDblParam.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_getDblParam
+ This routine is used to get the value of a double type parameter.
+
+
+
+ Calling Sequence
+ sym_getDblParam(key)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the double parameter whose value has to be retrieved. Note: should be given within " "
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
+
+
+
+
+ Examples
+
+ status=sym_getDblParam("time_limit")
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_getInfinity.xml b/help/en_US/sym_getInfinity.xml
new file mode 100644
index 0000000..295fd17
--- /dev/null
+++ b/help/en_US/sym_getInfinity.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getInfinity
+ Get Symphony's infinity value
+
+
+
+ Calling Sequence
+ sym_getInfinity()
+
+
+
+ Description
+
+ Get the value that Symphony considers to be infinity. This is equal to 10^20.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns the infinity value of Symphony
+
+
+
+
+ Examples
+
+ sym_getInfinity()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getIntParam.xml b/help/en_US/sym_getIntParam.xml
new file mode 100644
index 0000000..a6626af
--- /dev/null
+++ b/help/en_US/sym_getIntParam.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_getIntParam
+ This routine is used to get the value of an integer type parameter.
+
+
+
+ Calling Sequence
+ sym_getIntParam(key)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the integer parameter whose value has to be retrieved. Note: should be given within " "
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
+
+
+
+
+ Examples
+
+ status=sym_getIntParam("verbosity")
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_getIterCount.xml b/help/en_US/sym_getIterCount.xml
new file mode 100644
index 0000000..ab7f42e
--- /dev/null
+++ b/help/en_US/sym_getIterCount.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getIterCount
+ To get the number of the analyzed nodes of the branching tree after solving the problem.
+
+
+
+ Calling Sequence
+ sym_getIterCount()
+
+
+
+ Description
+
+ This routine is used to get the number of the analyzed nodes of the branching tree after solving the problem.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns iteration count.
+
+
+
+
+ Examples
+
+ ans=sym_getIterCount()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getMatrix.xml b/help/en_US/sym_getMatrix.xml
new file mode 100644
index 0000000..fbcd87f
--- /dev/null
+++ b/help/en_US/sym_getMatrix.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getMatrix
+ To get the constraint matrix.
+
+
+
+ Calling Sequence
+ sym_getMatrix()
+
+
+
+ Description
+
+ This routine is used to get the constraint matrix as sparse matrix in a standard row-ordered format.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a row-ordered sparse matrix.
+
+
+
+
+ Examples
+
+ ans=sym_getMatrix()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getNumConstr.xml b/help/en_US/sym_getNumConstr.xml
new file mode 100644
index 0000000..63715fb
--- /dev/null
+++ b/help/en_US/sym_getNumConstr.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getNumConstr
+ To get the number of the constraints of the current problem.
+
+
+
+ Calling Sequence
+ sym_getNumConstr()
+
+
+
+ Description
+
+ This routine is used to get the number of the constraints of the current problem.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ If there was an error it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of constraints.
+
+
+
+
+ Examples
+
+ ans=sym_getNumConstr()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getNumElements.xml b/help/en_US/sym_getNumElements.xml
new file mode 100644
index 0000000..5ce71a9
--- /dev/null
+++ b/help/en_US/sym_getNumElements.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getNumElements
+ To get the number of non-zero entries of the constraint matrix of the current problem.
+
+
+
+ Calling Sequence
+ sym_getNumElements()
+
+
+
+ Description
+
+ This routine is used to get the number of non-zero entries of the constraint matrix of the current problem.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ If there was an error, it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of non-zero elements.
+
+
+
+
+ Examples
+
+ ans=sym_getNumElements()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getNumVar.xml b/help/en_US/sym_getNumVar.xml
new file mode 100644
index 0000000..5602811
--- /dev/null
+++ b/help/en_US/sym_getNumVar.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getNumVar
+ To get the number of the variables of the current problem.
+
+
+
+ Calling Sequence
+ sym_getNumVar()
+
+
+
+ Description
+
+ This routine is used to get the number of the variables of the current problem.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ If there was an error it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of variables.
+
+
+
+
+ Examples
+
+ ans=sym_getNumVar()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getObjCoeff.xml b/help/en_US/sym_getObjCoeff.xml
new file mode 100644
index 0000000..194d3cd
--- /dev/null
+++ b/help/en_US/sym_getObjCoeff.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getObjCoeff
+ To get the objective vector.
+
+
+
+ Calling Sequence
+ sym_getObjCoeff()
+
+
+
+ Description
+
+ This routine is used to get the objective vector.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a row vector of coefficients of variables in objective.
+
+
+
+
+ Examples
+
+ ans=sym_getObjCoeff()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getObjSense.xml b/help/en_US/sym_getObjSense.xml
new file mode 100644
index 0000000..1d4f0fa
--- /dev/null
+++ b/help/en_US/sym_getObjSense.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getObjSense
+ Get the objective sense
+
+
+
+ Calling Sequence
+ sym_getObjSense()
+
+
+
+ Description
+
+ This function gets the sense of the objective function (minimization/maximization).
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns 1 if the objective is to be minimized and -1 if the objective is to be maximized
+
+
+
+
+ Examples
+
+ sym_getObjSense()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getObjVal.xml b/help/en_US/sym_getObjVal.xml
new file mode 100644
index 0000000..9a65646
--- /dev/null
+++ b/help/en_US/sym_getObjVal.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getObjVal
+ Get the optimized objective value
+
+
+
+ Calling Sequence
+ sym_getObjVal()
+
+
+
+ Description
+
+ Get the optimized objective value after after solving the problem.
+ This function may fail if the problem has not been solved already. Use sym_solve() in this case.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns the optimized objective value
+
+
+
+
+ Examples
+
+ sym_getObjVal()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getPrimalBound.xml b/help/en_US/sym_getPrimalBound.xml
new file mode 100644
index 0000000..3b9db8d
--- /dev/null
+++ b/help/en_US/sym_getPrimalBound.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_getPrimalBound
+ Get the primal bound of the problem
+
+
+
+ Calling Sequence
+ sym_getPrimalBound()
+
+
+
+ Description
+
+ Get the primal bound of the loaded problem.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns the primal bound of the problem
+
+
+
+
+ Examples
+
+ sym_getPrimalBound()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getRhs.xml b/help/en_US/sym_getRhs.xml
new file mode 100644
index 0000000..a0d1a76
--- /dev/null
+++ b/help/en_US/sym_getRhs.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getRhs
+ To to get the right hand side vector(column vector).
+
+
+
+ Calling Sequence
+ sym_getRhs()
+
+
+
+ Description
+
+ This routine is used to get the right hand side vector(coumn vector).
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a column vector of the right hand side values of constraints.
+
+
+
+
+ Examples
+
+ ans=sym_getRhs()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getStatus.xml b/help/en_US/sym_getStatus.xml
new file mode 100644
index 0000000..f13e59e
--- /dev/null
+++ b/help/en_US/sym_getStatus.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getStatus
+ To get status of the problem solver.
+
+
+
+ Calling Sequence
+ sym_getStatus()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn the termination status of the solution procedure.
+ It prints status of the problem solver to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if it receives any return-value indicating an error message or 0 if it receives any return-value indicating a non-error message.
+
+
+
+
+ Examples
+
+ status=sym_getStatus()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getStrParam.xml b/help/en_US/sym_getStrParam.xml
new file mode 100644
index 0000000..b261053
--- /dev/null
+++ b/help/en_US/sym_getStrParam.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_getStrParam
+ This routine is used to get the value of a string type parameter.
+
+
+
+ Calling Sequence
+ sym_getStrParam(key)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the strung parameter whose value has to be retrieved. Note: should be given within " "
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
+
+
+
+
+ Examples
+
+ status=sym_getStrParam("source_path")
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_getVarLower.xml b/help/en_US/sym_getVarLower.xml
new file mode 100644
index 0000000..771d095
--- /dev/null
+++ b/help/en_US/sym_getVarLower.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getVarLower
+ To get the lower bounds of the variables.
+
+
+
+ Calling Sequence
+ sym_getVarLower()
+
+
+
+ Description
+
+ This routine is used to get the lower bounds of the variables.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a row vector of lower bounds of the variables.
+
+
+
+
+ Examples
+
+ ans=sym_getVarLower()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_getVarSoln.xml b/help/en_US/sym_getVarSoln.xml
new file mode 100644
index 0000000..5500c57
--- /dev/null
+++ b/help/en_US/sym_getVarSoln.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getVarSoln
+ Get the solution for the problem
+
+
+
+ Calling Sequence
+ sym_getVarSoln()
+
+
+
+ Description
+
+ Get the solution for the problem after solving it.
+ This function may fail if the problem has not been solved already. Use sym_solve() in this case.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns a matrix with 1 row and number of columns equal to number of variables, that represents the solutions for those variables
+
+
+
+
+ Examples
+
+ sym_getVarSoln()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_getVarUpper.xml b/help/en_US/sym_getVarUpper.xml
new file mode 100644
index 0000000..a447a54
--- /dev/null
+++ b/help/en_US/sym_getVarUpper.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_getVarUpper
+ To get the upper bounds of the variables.
+
+
+
+ Calling Sequence
+ sym_getVarUpper()
+
+
+
+ Description
+
+ This routine is used to get the upper bounds of the variables.
+ If there was an error it prints to Scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns a row vector of upper bounds of the variables.
+
+
+
+
+ Examples
+
+ ans=sym_getVarUpper()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isAbandoned.xml b/help/en_US/sym_isAbandoned.xml
new file mode 100644
index 0000000..1009201
--- /dev/null
+++ b/help/en_US/sym_isAbandoned.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_isAbandoned
+ To check whether the problem was abandoned for some reason.
+
+
+
+ Calling Sequence
+ sym_isAbandoned()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the problem was abandoned for some reason.
+ It prints whether or not the problem was abandoned for some reason to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the problem was abandoned or 0 if the problem was not abandoned or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isAbandoned()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isBinary.xml b/help/en_US/sym_isBinary.xml
new file mode 100644
index 0000000..57a6cf3
--- /dev/null
+++ b/help/en_US/sym_isBinary.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ sym_isBinary
+ Check if a variable is constrained to be binary
+
+
+
+ Calling Sequence
+ sym_isBinary(index)
+
+
+
+ Description
+
+ This function checks if a variable is constrained to be binary (0 or 1).
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+
+
+
+
+ Return value
+
+ Returns 1 if the variable is constrained to be binary and 0 if it is not.
+
+
+
+
+ Examples
+
+ sym_isBinary(2)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_isContinuous.xml b/help/en_US/sym_isContinuous.xml
new file mode 100644
index 0000000..8c6a77b
--- /dev/null
+++ b/help/en_US/sym_isContinuous.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ sym_isContinuous
+ Check if a variable is continuous
+
+
+
+ Calling Sequence
+ sym_isContinuous(index)
+
+
+
+ Description
+
+ This function checks if a variable is continuous.
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+
+
+
+
+ Return value
+
+ Returns 1 if the variable is continuous and 0 if it is not.
+
+
+
+
+ Examples
+
+ sym_isContinuous(2)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_isEnvActive.xml b/help/en_US/sym_isEnvActive.xml
new file mode 100644
index 0000000..b47e28b
--- /dev/null
+++ b/help/en_US/sym_isEnvActive.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ sym_isEnvActive
+ Check if Symphony environment is active
+
+
+
+ Calling Sequence
+ sym_isEnvActive()
+
+
+
+ Description
+
+ Check if Symphony environment is active (open). Most Symphony functions will require the environment to be open.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns 1 if the environment is active and 0 otherwise
+
+
+
+
+ Examples
+
+ sym_isEnvActive()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_isInfeasible.xml b/help/en_US/sym_isInfeasible.xml
new file mode 100644
index 0000000..88a4f43
--- /dev/null
+++ b/help/en_US/sym_isInfeasible.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_isInfeasible
+ To check whether the problem was proven to be infeasible.
+
+
+
+ Calling Sequence
+ sym_isInfeasible()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the problem was proven to be infeasible.
+ It prints whether or not the problem was proven to be infeasible to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the problem was solved proven to be infeasible or 0 if it was not proven to be infeasible or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isInfeasible()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isInteger.xml b/help/en_US/sym_isInteger.xml
new file mode 100644
index 0000000..e104039
--- /dev/null
+++ b/help/en_US/sym_isInteger.xml
@@ -0,0 +1,46 @@
+
+
+
+
+ sym_isInteger
+
+ Check if a variable is constrained to be an integer
+
+
+
+ Calling Sequence
+
+ sym_isInteger(index)
+
+
+
+ Description
+
+ This function checks if a variable is constrained to be an integer.
+ index : Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+
+
+ Examples
+
+ sym_isInteger(2)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_isIterLimitReached.xml b/help/en_US/sym_isIterLimitReached.xml
new file mode 100644
index 0000000..013f984
--- /dev/null
+++ b/help/en_US/sym_isIterLimitReached.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ sym_isIterLimitReached
+ To know whether the iteration limit (node limit) was reached.
+
+
+
+ Calling Sequence
+ sym_isIterLimitReached()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the iteration limit(node limit) was reached.
+ It prints whether or not the iteration limit (node limit) was reached to scilab console.
+ It can also be used if "find first feasible" parameter was set to true before solving the problem.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the iteration limit is reached or 0 if the iteration limit is not reached or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isIterLimitReached()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isOptimal.xml b/help/en_US/sym_isOptimal.xml
new file mode 100644
index 0000000..889aa02
--- /dev/null
+++ b/help/en_US/sym_isOptimal.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ sym_isOptimal
+ To check whether the problem was solved to optimality.
+
+
+
+ Calling Sequence
+ sym_isOptimal()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the problem was solved to
+ optimality.
+ It prints whether or not the problem was solved to optimality to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the problem was solved to optimality or 0 if it was not solved to optimality or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isOptimal()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isTargetGapAchieved.xml b/help/en_US/sym_isTargetGapAchieved.xml
new file mode 100644
index 0000000..81c99b4
--- /dev/null
+++ b/help/en_US/sym_isTargetGapAchieved.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_isTargetGapAchieved
+ To know whether the target gap was reached.
+
+
+
+ Calling Sequence
+ sym_isTargetGapAchieved()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the target gap was reached.
+ It print whether or not the target gap was reached.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the target gap was reached or 0 if the target gap was not reached or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isTargetGapAchieved()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_isTimeLimitReached.xml b/help/en_US/sym_isTimeLimitReached.xml
new file mode 100644
index 0000000..42889de
--- /dev/null
+++ b/help/en_US/sym_isTimeLimitReached.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_isTimeLimitReached
+ To know whether the time limit was reached.
+
+
+
+ Calling Sequence
+ sym_isTimeLimitReached()
+
+
+
+ Description
+
+ This post-solution query routine is used to learn whether the time limit was reached.
+ It prints whether or not the time limit was reached to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if the time limit was reached or 0 if the time limit was not reached or -1 if there was an error.
+
+
+
+
+ Examples
+
+ status=sym_isTimeLimitReached()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/help/en_US/sym_loadMPS.xml b/help/en_US/sym_loadMPS.xml
new file mode 100644
index 0000000..6e55cff
--- /dev/null
+++ b/help/en_US/sym_loadMPS.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ sym_loadMPS
+ This routine is used to load an instance from an MPS file.
+
+
+
+ Calling Sequence
+ sym_loadMPS(filename)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ filename
+ It is a string that has the path of the .mps file to loaded.It has to be given within double quotes ("")
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the .mps file is loaded properly to symphony and 0 if there is an error reading the mps file or the function returns with an error return value
+
+
+
+
+ Examples
+
+ status=sym_loadMPS("./sample.mps") -mps file present in the current directory of execution can be mentioned this way also
+ status=sym_loadMPS("/home/Desktop/sample.mps") -mps file present at a different location must be specified with their entire path
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_loadProblem.xml b/help/en_US/sym_loadProblem.xml
new file mode 100644
index 0000000..e2409c5
--- /dev/null
+++ b/help/en_US/sym_loadProblem.xml
@@ -0,0 +1,99 @@
+
+
+
+
+ sym_loadProblem
+ Load a problem into Symphony
+
+
+
+ Calling Sequence
+ sym_loadProblem(nbVar,nbConstr,varLB,varUB,objCoeff,isInt,objSense,conMatrix,conLB,conUB)
+
+
+
+ Description
+
+ Loads a MIP problem into Symphony. All the necessary data can be given through a single function call.
+ The type of constraint is automatically deduced from the constraint bounds.
+
+
+
+
+ Arguments
+
+
+
+ nbVar
+ Number of variables
+
+
+ nbConstr
+ Number of constraints
+
+
+ varLB
+ Matrix containing lower bounds of the variables (must have size 1 row and nbVar columns). Bound can be negative infinity
+
+
+ varUB
+ Matrix containing upper bounds of the variables (must have size 1 row and nbVar columns). Bound can be infinity
+
+
+ objCoeff
+ Matrix containing coefficients of the variables in the objective (must have size 1 row and nbVar columns)
+
+
+ isInt
+ Boolean matrix representing wether a variable is constrained to be an integer (must have size 1 row and nbVar columns)
+
+
+ objSense
+ The sense (maximization/minimization) of the objective. Use sym_minimize or sym_maximize here
+
+
+ conMatrix
+ Sparse matrix representing the constraint matrix (must have size nbConstr rows and nbVar columns)
+
+
+ conLB
+ Matrix containing lower bounds of the constraints (must have size nbConstr rows and 1 column)
+
+
+ conUB
+ Matrix containing upper bounds of the constraints (must have size nbConstr rows and 1 column)
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the problem was successfully loaded into Symphony
+
+
+
+
+ Examples
+
+ sym_loadProblem(2,2,[0,0],[%inf,%inf],[1,1],[%t,%t],sym_maximize,sparse([1,2;2,1]),[0;0],[7;6.5])
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_loadProblemBasic.xml b/help/en_US/sym_loadProblemBasic.xml
new file mode 100644
index 0000000..90a5995
--- /dev/null
+++ b/help/en_US/sym_loadProblemBasic.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ sym_loadProblemBasic
+ Load a problem into Symphony (basic version)
+
+
+
+ Calling Sequence
+ sym_loadProblemBasic(nbVar,nbConstr,varLB,varUB,objCoeff,isInt,objSense,conMatrix,conLB,conUB)
+
+
+
+ Description
+
+ Loads a MIP problem into Symphony. All the necessary data can be given through a single function call.
+ The type of constraint is automatically deduced from the constraint bounds.
+ This version of the problem loader does not support sparse matrices and hence is only useful for small problems.
+
+
+
+
+ Arguments
+
+
+
+ nbVar
+ Number of variables
+
+
+ nbConstr
+ Number of constraints
+
+
+ varLB
+ Matrix containing lower bounds of the variables (must have size 1 row and nbVar columns). Bound can be negative infinity
+
+
+ varUB
+ Matrix containing upper bounds of the variables (must have size 1 row and nbVar columns). Bound can be infinity
+
+
+ objCoeff
+ Matrix containing coefficients of the variables in the objective (must have size 1 row and nbVar columns)
+
+
+ isInt
+ Boolean matrix representing wether a variable is constrained to be an integer (must have size 1 row and nbVar columns)
+
+
+ objSense
+ The sense (maximization/minimization) of the objective. Use sym_minimize or sym_maximize here
+
+
+ conMatrix
+ Matrix (normal) representing the constraint matrix (must have size nbConstr rows and nbVar columns)
+
+
+ conLB
+ Matrix containing lower bounds of the constraints (must have size nbConstr rows and 1 column)
+
+
+ conUB
+ Matrix containing upper bounds of the constraints (must have size nbConstr rows and 1 column)
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the problem was successfully loaded into Symphony
+
+
+
+
+ Examples
+
+ sym_loadProblemBasic(2,2,[0,0],[%inf,%inf],[1,1],[%t,%t],sym_maximize,[1,2;2,1],[0;0],[7;6.5])
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_open.xml b/help/en_US/sym_open.xml
new file mode 100644
index 0000000..92b3dec
--- /dev/null
+++ b/help/en_US/sym_open.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ sym_open
+ Open the Symphony environment
+
+
+
+ Calling Sequence
+ sym_open()
+
+
+
+ Description
+
+ Opens the Symphony environment. The environment and all data loaded into it is maintained across function calls.
+ This function fails if the environment is already open.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns 1 if the environment was successfully opened and 0 otherwise
+
+
+
+
+ Examples
+
+ sym_open()
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+ Iswarya
+
+
+
+
+
diff --git a/help/en_US/sym_resetParams.xml b/help/en_US/sym_resetParams.xml
new file mode 100644
index 0000000..a73fdbd
--- /dev/null
+++ b/help/en_US/sym_resetParams.xml
@@ -0,0 +1,56 @@
+
+
+
+
+ sym_resetParams
+ This routine sets all the environment variables and parameters to their default values.
+
+
+
+ Calling Sequence
+ sym_resetParams()
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ Returns 0 if the environment variables and parameters are set to their default value and 1 if a value corresponding to an error is returned
+
+
+
+
+ Examples
+
+ status=sym_resetParams()
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setConstrLower.xml b/help/en_US/sym_setConstrLower.xml
new file mode 100644
index 0000000..ae68046
--- /dev/null
+++ b/help/en_US/sym_setConstrLower.xml
@@ -0,0 +1,66 @@
+
+
+
+
+ sym_setConstrLower
+ Set the lower bound of a constraint
+
+
+
+ Calling Sequence
+ sym_setConstrLower(index,newBound)
+
+
+
+ Description
+
+ This function changes the lower bound of a constraint
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
+
+
+ newBound
+ The new lower bound for the constraint
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setConstrLower(2,-100)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setConstrType.xml b/help/en_US/sym_setConstrType.xml
new file mode 100644
index 0000000..18afed0
--- /dev/null
+++ b/help/en_US/sym_setConstrType.xml
@@ -0,0 +1,76 @@
+
+
+
+
+ sym_setConstrType
+ Set the type of a constraint
+
+
+
+ Calling Sequence
+ sym_setConstrType(index,type,bound1[,bound2])
+
+
+
+ Description
+
+ This function completely modifies the type of a constraint. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+ The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
+
+
+ type
+ New type of the constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
+
+
+ bound1
+ The first (or only) bound for the constraint
+
+
+ bound2
+ The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setConstrType(2,"R",-10,10)
+ sym_setConstrType(3,"E",100)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setConstrUpper.xml b/help/en_US/sym_setConstrUpper.xml
new file mode 100644
index 0000000..676454c
--- /dev/null
+++ b/help/en_US/sym_setConstrUpper.xml
@@ -0,0 +1,66 @@
+
+
+
+
+ sym_setConstrUpper
+ Set the upper bound of a constraint
+
+
+
+ Calling Sequence
+ sym_setConstrUpper(index,newBound)
+
+
+
+ Description
+
+ This function changes the upper bound of a constraint
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
+
+
+ newBound
+ The new upper bound for the constraint
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setConstrUpper(2,-100)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setContinuous.xml b/help/en_US/sym_setContinuous.xml
new file mode 100644
index 0000000..f4948d9
--- /dev/null
+++ b/help/en_US/sym_setContinuous.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_setContinuous
+ This routine is used to set the type of a variable to be continuous.
+
+
+
+ Calling Sequence
+ sym_setContinuous(index)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to be set continuous
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the variable type has been set as continuous and 0 if an error value is returned.
+
+
+
+
+ Examples
+
+ status=sym_setContinuous(1)
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setDblParam.xml b/help/en_US/sym_setDblParam.xml
new file mode 100644
index 0000000..464d29e
--- /dev/null
+++ b/help/en_US/sym_setDblParam.xml
@@ -0,0 +1,65 @@
+
+
+
+
+ sym_setDblParam
+ This routine is used to set a double type parameter.
+
+
+
+ Calling Sequence
+ sym_setDblParam(key,value)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the double type parameter to be set. Note: should be given within " "
+
+
+ value
+ New value of the corresponding double parameter
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the double parameter was unsuccessful due to invalid inputs
+
+
+
+
+ Examples
+
+ status=sym_setDblParam("time_limit",5)
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setIntParam.xml b/help/en_US/sym_setIntParam.xml
new file mode 100644
index 0000000..e20dfb5
--- /dev/null
+++ b/help/en_US/sym_setIntParam.xml
@@ -0,0 +1,65 @@
+
+
+
+
+ sym_setIntParam
+ This routine is used to set an integer type parameter.
+
+
+
+ Calling Sequence
+ sym_setIntParam(key,value)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the parameter to be set. Note:should be given within " "
+
+
+ value
+ New value of the corresponding integer parameter
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the integer parameter was unsuccessful due to invalid inputs
+
+
+
+
+ Examples
+
+ status=sym_setIntParam("verbosity",5)
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setInteger.xml b/help/en_US/sym_setInteger.xml
new file mode 100644
index 0000000..cebb83f
--- /dev/null
+++ b/help/en_US/sym_setInteger.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ sym_setInteger
+ This routine is used to set the type of a variable to be integer.
+
+
+
+ Calling Sequence
+ sym_setInteger(index)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ index
+ The index of the variable type to be modified as integer. Note that, it has to be at most the number of columns.
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the variable type has been set as integer and 0 if an error value is returned.
+
+
+
+
+ Examples
+
+ status=sym_setInteger(1)
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setObjCoeff.xml b/help/en_US/sym_setObjCoeff.xml
new file mode 100644
index 0000000..5251b4c
--- /dev/null
+++ b/help/en_US/sym_setObjCoeff.xml
@@ -0,0 +1,66 @@
+
+
+
+
+ sym_setObjCoeff
+ Set coefficient of a variable in the objective
+
+
+
+ Calling Sequence
+ sym_setObjCoeff(index,newCoeff)
+
+
+
+ Description
+
+ This function changes the coefficient of a variable in the objective function
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+ newCoeff
+ The new coefficient of the variable
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setObjCoeff(2,1.5)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setObjSense.xml b/help/en_US/sym_setObjSense.xml
new file mode 100644
index 0000000..356ea97
--- /dev/null
+++ b/help/en_US/sym_setObjSense.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ sym_setObjSense
+ Set the objective sense
+
+
+
+ Calling Sequence
+ sym_setObjSense(sense)
+
+
+
+ Description
+
+ This function sets the sense of the objective function (minimization/maximization).
+
+
+
+
+ Arguments
+
+
+
+ sense
+ The new sense of the objective function. Use sym_minimize or sym_maximize here
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setObjSense(sym_minimize)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setPrimalBound.xml b/help/en_US/sym_setPrimalBound.xml
new file mode 100644
index 0000000..c2f29a7
--- /dev/null
+++ b/help/en_US/sym_setPrimalBound.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ sym_setPrimalBound
+ Set the primal bound of the problem
+
+
+
+ Calling Sequence
+ sym_setPrimalBound(bound)
+
+
+
+ Description
+
+ Set the primal bound of the loaded problem.
+
+
+
+
+ Arguments
+
+
+
+ bound
+ The new primal bound for the problem
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setPrimalBound(10)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setStrParam.xml b/help/en_US/sym_setStrParam.xml
new file mode 100644
index 0000000..09c5ea8
--- /dev/null
+++ b/help/en_US/sym_setStrParam.xml
@@ -0,0 +1,65 @@
+
+
+
+
+ sym_setStrParam
+ This routine is used to set a string type parameter.
+
+
+
+ Calling Sequence
+ sym_setStrParam(key,value)
+
+
+
+ Description
+
+
+
+
+
+ Arguments
+
+
+
+ key
+ The name of the string type parameter to be set. Note: should be given within " "
+
+
+ value
+ New value of the corresponding string parameter. Note: should be given within " "
+
+
+
+
+
+
+ Return value
+
+ Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the string parameter was unsuccessful due to invalid inputs
+
+
+
+
+ Examples
+
+ status=sym_setStrParam("source_path","..")
+
+
+
+
+ Authors
+
+
+ Iswarya Hariharan
+
+
+
+
+
diff --git a/help/en_US/sym_setVarLower.xml b/help/en_US/sym_setVarLower.xml
new file mode 100644
index 0000000..1f24813
--- /dev/null
+++ b/help/en_US/sym_setVarLower.xml
@@ -0,0 +1,66 @@
+
+
+
+
+ sym_setVarLower
+ Set lower bound of a variable
+
+
+
+ Calling Sequence
+ sym_setVarLower(index,newBound)
+
+
+
+ Description
+
+ This function changes the lower bound of a variable to a new value
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+ newBound
+ The new lower bound for the variable
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setVarLower(2,-%inf)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setVarSoln.xml b/help/en_US/sym_setVarSoln.xml
new file mode 100644
index 0000000..5fe6f3c
--- /dev/null
+++ b/help/en_US/sym_setVarSoln.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ sym_setVarSoln
+ Set a solution for the problem
+
+
+
+ Calling Sequence
+ sym_setVarSoln(solution)
+
+
+
+ Description
+
+ Sets a known solution for the problem.
+ This function fails if the solution entered does not satisfy all bounds or is worse than another currently known solution.
+
+
+
+
+ Arguments
+
+
+
+ solution
+ Matrix containing solutions for the variables (must have size 1 row and number of columns equal to number of variables)
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setVarSoln([1,2,3.2,4])
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_setVarUpper.xml b/help/en_US/sym_setVarUpper.xml
new file mode 100644
index 0000000..286c45f
--- /dev/null
+++ b/help/en_US/sym_setVarUpper.xml
@@ -0,0 +1,66 @@
+
+
+
+
+ sym_setVarUpper
+ Set upper bound of a variable
+
+
+
+ Calling Sequence
+ sym_setVarUpper(index,newBound)
+
+
+
+ Description
+
+ This function changes the upper bound of a variable to a new value
+
+
+
+
+ Arguments
+
+
+
+ index
+ Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
+
+
+ newBound
+ The new upper bound for the variable
+
+
+
+
+
+
+ Return value
+
+ Returns 0
+
+
+
+
+ Examples
+
+ sym_setVarUpper(2,100)
+
+
+
+
+ Authors
+
+
+ Keyur Joshi
+
+
+
+
+
diff --git a/help/en_US/sym_solve.xml b/help/en_US/sym_solve.xml
new file mode 100644
index 0000000..587b26a
--- /dev/null
+++ b/help/en_US/sym_solve.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ sym_solve
+ To solve the currently loaded MILP problem from scratch.
+
+
+
+ Calling Sequence
+ sym_solve()
+
+
+
+ Description
+
+ This routine solves the currently loaded MILP problem from scratch.
+ It prints status of the problem solver to scilab console.
+
+
+
+
+ Arguments
+
+ This function takes no arguments
+
+
+
+
+ Return value
+
+ It returns 1 if it receives any return-value indicating an error message or 0 if it receives any return-value indicating a non-error message.
+
+
+
+
+ Examples
+
+ status=sym_solve()
+
+
+
+
+ Authors
+
+
+ Sai Kiran Naragam
+
+
+
+
+
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
new file mode 100644
index 0000000..0046f71
Binary files /dev/null and b/jar/scilab_en_US_help.jar differ
diff --git a/license.txt b/license.txt
new file mode 100644
index 0000000..fcc8df2
--- /dev/null
+++ b/license.txt
@@ -0,0 +1,506 @@
+
+CeCILL FREE SOFTWARE LICENSE AGREEMENT
+
+
+ Notice
+
+This Agreement is a Free Software license agreement that is the result
+of discussions between its authors in order to ensure compliance with
+the two main principles guiding its drafting:
+
+ * firstly, compliance with the principles governing the distribution
+ of Free Software: access to source code, broad rights granted to
+ users,
+ * secondly, the election of a governing law, French law, with which
+ it is conformant, both as regards the law of torts and
+ intellectual property law, and the protection that it offers to
+ both authors and holders of the economic rights over software.
+
+The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
+license are:
+
+Commissariat à l'Energie Atomique - CEA, a public scientific, technical
+and industrial research establishment, having its principal place of
+business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
+
+Centre National de la Recherche Scientifique - CNRS, a public scientific
+and technological establishment, having its principal place of business
+at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, a public scientific and technological establishment, having its
+principal place of business at Domaine de Voluceau, Rocquencourt, BP
+105, 78153 Le Chesnay cedex, France.
+
+
+ Preamble
+
+The purpose of this Free Software license agreement is to grant users
+the right to modify and redistribute the software governed by this
+license within the framework of an open source distribution model.
+
+The exercising of these rights is conditional upon certain obligations
+for users so as to preserve this status for all subsequent redistributions.
+
+In consideration of access to the source code and the rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty and the software's author, the holder of the
+economic rights, and the successive licensors only have limited liability.
+
+In this respect, the risks associated with loading, using, modifying
+and/or developing or reproducing the software by the user are brought to
+the user's attention, given its Free Software status, which may make it
+complicated to use, with the result that its use is reserved for
+developers and experienced professionals having in-depth computer
+knowledge. Users are therefore encouraged to load and test the
+suitability of the software as regards their requirements in conditions
+enabling the security of their systems and/or data to be ensured and,
+more generally, to use and operate it in the same conditions of
+security. This Agreement may be freely reproduced and published,
+provided it is not altered, and that no provisions are either added or
+removed herefrom.
+
+This Agreement may apply to any or all software for which the holder of
+the economic rights decides to submit the use thereof to its provisions.
+
+
+ Article 1 - DEFINITIONS
+
+For the purpose of this Agreement, when the following expressions
+commence with a capital letter, they shall have the following meaning:
+
+Agreement: means this license agreement, and its possible subsequent
+versions and annexes.
+
+Software: means the software in its Object Code and/or Source Code form
+and, where applicable, its documentation, "as is" when the Licensee
+accepts the Agreement.
+
+Initial Software: means the Software in its Source Code and possibly its
+Object Code form and, where applicable, its documentation, "as is" when
+it is first distributed under the terms and conditions of the Agreement.
+
+Modified Software: means the Software modified by at least one
+Contribution.
+
+Source Code: means all the Software's instructions and program lines to
+which access is required so as to modify the Software.
+
+Object Code: means the binary files originating from the compilation of
+the Source Code.
+
+Holder: means the holder(s) of the economic rights over the Initial
+Software.
+
+Licensee: means the Software user(s) having accepted the Agreement.
+
+Contributor: means a Licensee having made at least one Contribution.
+
+Licensor: means the Holder, or any other individual or legal entity, who
+distributes the Software under the Agreement.
+
+Contribution: means any or all modifications, corrections, translations,
+adaptations and/or new functions integrated into the Software by any or
+all Contributors, as well as any or all Internal Modules.
+
+Module: means a set of sources files including their documentation that
+enables supplementary functions or services in addition to those offered
+by the Software.
+
+External Module: means any or all Modules, not derived from the
+Software, so that this Module and the Software run in separate address
+spaces, with one calling the other when they are run.
+
+Internal Module: means any or all Module, connected to the Software so
+that they both execute in the same address space.
+
+GNU GPL: means the GNU General Public License version 2 or any
+subsequent version, as published by the Free Software Foundation Inc.
+
+Parties: mean both the Licensee and the Licensor.
+
+These expressions may be used both in singular and plural form.
+
+
+ Article 2 - PURPOSE
+
+The purpose of the Agreement is the grant by the Licensor to the
+Licensee of a non-exclusive, transferable and worldwide license for the
+Software as set forth in Article 5 hereinafter for the whole term of the
+protection granted by the rights over said Software.
+
+
+ Article 3 - ACCEPTANCE
+
+3.1 The Licensee shall be deemed as having accepted the terms and
+conditions of this Agreement upon the occurrence of the first of the
+following events:
+
+ * (i) loading the Software by any or all means, notably, by
+ downloading from a remote server, or by loading from a physical
+ medium;
+ * (ii) the first time the Licensee exercises any of the rights
+ granted hereunder.
+
+3.2 One copy of the Agreement, containing a notice relating to the
+characteristics of the Software, to the limited warranty, and to the
+fact that its use is restricted to experienced users has been provided
+to the Licensee prior to its acceptance as set forth in Article 3.1
+hereinabove, and the Licensee hereby acknowledges that it has read and
+understood it.
+
+
+ Article 4 - EFFECTIVE DATE AND TERM
+
+
+ 4.1 EFFECTIVE DATE
+
+The Agreement shall become effective on the date when it is accepted by
+the Licensee as set forth in Article 3.1.
+
+
+ 4.2 TERM
+
+The Agreement shall remain in force for the entire legal term of
+protection of the economic rights over the Software.
+
+
+ Article 5 - SCOPE OF RIGHTS GRANTED
+
+The Licensor hereby grants to the Licensee, who accepts, the following
+rights over the Software for any or all use, and for the term of the
+Agreement, on the basis of the terms and conditions set forth hereinafter.
+
+Besides, if the Licensor owns or comes to own one or more patents
+protecting all or part of the functions of the Software or of its
+components, the Licensor undertakes not to enforce the rights granted by
+these patents against successive Licensees using, exploiting or
+modifying the Software. If these patents are transferred, the Licensor
+undertakes to have the transferees subscribe to the obligations set
+forth in this paragraph.
+
+
+ 5.1 RIGHT OF USE
+
+The Licensee is authorized to use the Software, without any limitation
+as to its fields of application, with it being hereinafter specified
+that this comprises:
+
+ 1. permanent or temporary reproduction of all or part of the Software
+ by any or all means and in any or all form.
+
+ 2. loading, displaying, running, or storing the Software on any or
+ all medium.
+
+ 3. entitlement to observe, study or test its operation so as to
+ determine the ideas and principles behind any or all constituent
+ elements of said Software. This shall apply when the Licensee
+ carries out any or all loading, displaying, running, transmission
+ or storage operation as regards the Software, that it is entitled
+ to carry out hereunder.
+
+
+ 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
+
+The right to make Contributions includes the right to translate, adapt,
+arrange, or make any or all modifications to the Software, and the right
+to reproduce the resulting software.
+
+The Licensee is authorized to make any or all Contributions to the
+Software provided that it includes an explicit notice that it is the
+author of said Contribution and indicates the date of the creation thereof.
+
+
+ 5.3 RIGHT OF DISTRIBUTION
+
+In particular, the right of distribution includes the right to publish,
+transmit and communicate the Software to the general public on any or
+all medium, and by any or all means, and the right to market, either in
+consideration of a fee, or free of charge, one or more copies of the
+Software by any means.
+
+The Licensee is further authorized to distribute copies of the modified
+or unmodified Software to third parties according to the terms and
+conditions set forth hereinafter.
+
+
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
+
+The Licensee is authorized to distribute true copies of the Software in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Software is
+redistributed, the Licensee allows future Licensees unhindered access to
+the full Source Code of the Software by indicating how to access it, it
+being understood that the additional cost of acquiring the Source Code
+shall not exceed the cost of transferring the data.
+
+
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
+
+When the Licensee makes a Contribution to the Software, the terms and
+conditions for the distribution of the resulting Modified Software
+become subject to all the provisions of this Agreement.
+
+The Licensee is authorized to distribute the Modified Software, in
+source code or object code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the object code of the Modified
+Software is redistributed, the Licensee allows future Licensees
+unhindered access to the full source code of the Modified Software by
+indicating how to access it, it being understood that the additional
+cost of acquiring the source code shall not exceed the cost of
+transferring the data.
+
+
+ 5.3.3 DISTRIBUTION OF EXTERNAL MODULES
+
+When the Licensee has developed an External Module, the terms and
+conditions of this Agreement do not apply to said External Module, that
+may be distributed under a separate license agreement.
+
+
+ 5.3.4 COMPATIBILITY WITH THE GNU GPL
+
+The Licensee can include a code that is subject to the provisions of one
+of the versions of the GNU GPL in the Modified or unmodified Software,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+The Licensee can include the Modified or unmodified Software in a code
+that is subject to the provisions of one of the versions of the GNU GPL,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+
+ Article 6 - INTELLECTUAL PROPERTY
+
+
+ 6.1 OVER THE INITIAL SOFTWARE
+
+The Holder owns the economic rights over the Initial Software. Any or
+all use of the Initial Software is subject to compliance with the terms
+and conditions under which the Holder has elected to distribute its work
+and no one shall be entitled to modify the terms and conditions for the
+distribution of said Initial Software.
+
+The Holder undertakes that the Initial Software will remain ruled at
+least by this Agreement, for the duration set forth in Article 4.2.
+
+
+ 6.2 OVER THE CONTRIBUTIONS
+
+The Licensee who develops a Contribution is the owner of the
+intellectual property rights over this Contribution as defined by
+applicable law.
+
+
+ 6.3 OVER THE EXTERNAL MODULES
+
+The Licensee who develops an External Module is the owner of the
+intellectual property rights over this External Module as defined by
+applicable law and is free to choose the type of agreement that shall
+govern its distribution.
+
+
+ 6.4 JOINT PROVISIONS
+
+The Licensee expressly undertakes:
+
+ 1. not to remove, or modify, in any manner, the intellectual property
+ notices attached to the Software;
+
+ 2. to reproduce said notices, in an identical manner, in the copies
+ of the Software modified or not.
+
+The Licensee undertakes not to directly or indirectly infringe the
+intellectual property rights of the Holder and/or Contributors on the
+Software and to take, where applicable, vis-à-vis its staff, any and all
+measures required to ensure respect of said intellectual property rights
+of the Holder and/or Contributors.
+
+
+ Article 7 - RELATED SERVICES
+
+7.1 Under no circumstances shall the Agreement oblige the Licensor to
+provide technical assistance or maintenance services for the Software.
+
+However, the Licensor is entitled to offer this type of services. The
+terms and conditions of such technical assistance, and/or such
+maintenance, shall be set forth in a separate instrument. Only the
+Licensor offering said maintenance and/or technical assistance services
+shall incur liability therefor.
+
+7.2 Similarly, any Licensor is entitled to offer to its licensees, under
+its sole responsibility, a warranty, that shall only be binding upon
+itself, for the redistribution of the Software and/or the Modified
+Software, under terms and conditions that it is free to decide. Said
+warranty, and the financial terms and conditions of its application,
+shall be subject of a separate instrument executed between the Licensor
+and the Licensee.
+
+
+ Article 8 - LIABILITY
+
+8.1 Subject to the provisions of Article 8.2, the Licensee shall be
+entitled to claim compensation for any direct loss it may have suffered
+from the Software as a result of a fault on the part of the relevant
+Licensor, subject to providing evidence thereof.
+
+8.2 The Licensor's liability is limited to the commitments made under
+this Agreement and shall not be incurred as a result of in particular:
+(i) loss due the Licensee's total or partial failure to fulfill its
+obligations, (ii) direct or consequential loss that is suffered by the
+Licensee due to the use or performance of the Software, and (iii) more
+generally, any consequential loss. In particular the Parties expressly
+agree that any or all pecuniary or business loss (i.e. loss of data,
+loss of profits, operating loss, loss of customers or orders,
+opportunity cost, any disturbance to business activities) or any or all
+legal proceedings instituted against the Licensee by a third party,
+shall constitute consequential loss and shall not provide entitlement to
+any or all compensation from the Licensor.
+
+
+ Article 9 - WARRANTY
+
+9.1 The Licensee acknowledges that the scientific and technical
+state-of-the-art when the Software was distributed did not enable all
+possible uses to be tested and verified, nor for the presence of
+possible defects to be detected. In this respect, the Licensee's
+attention has been drawn to the risks associated with loading, using,
+modifying and/or developing and reproducing the Software which are
+reserved for experienced users.
+
+The Licensee shall be responsible for verifying, by any or all means,
+the suitability of the product for its requirements, its good working
+order, and for ensuring that it shall not cause damage to either persons
+or properties.
+
+9.2 The Licensor hereby represents, in good faith, that it is entitled
+to grant all the rights over the Software (including in particular the
+rights set forth in Article 5).
+
+9.3 The Licensee acknowledges that the Software is supplied "as is" by
+the Licensor without any other express or tacit warranty, other than
+that provided for in Article 9.2 and, in particular, without any warranty
+as to its commercial value, its secured, safe, innovative or relevant
+nature.
+
+Specifically, the Licensor does not warrant that the Software is free
+from any error, that it will operate without interruption, that it will
+be compatible with the Licensee's own equipment and software
+configuration, nor that it will meet the Licensee's requirements.
+
+9.4 The Licensor does not either expressly or tacitly warrant that the
+Software does not infringe any third party intellectual property right
+relating to a patent, software or any other property right. Therefore,
+the Licensor disclaims any and all liability towards the Licensee
+arising out of any or all proceedings for infringement that may be
+instituted in respect of the use, modification and redistribution of the
+Software. Nevertheless, should such proceedings be instituted against
+the Licensee, the Licensor shall provide it with technical and legal
+assistance for its defense. Such technical and legal assistance shall be
+decided on a case-by-case basis between the relevant Licensor and the
+Licensee pursuant to a memorandum of understanding. The Licensor
+disclaims any and all liability as regards the Licensee's use of the
+name of the Software. No warranty is given as regards the existence of
+prior rights over the name of the Software or as regards the existence
+of a trademark.
+
+
+ Article 10 - TERMINATION
+
+10.1 In the event of a breach by the Licensee of its obligations
+hereunder, the Licensor may automatically terminate this Agreement
+thirty (30) days after notice has been sent to the Licensee and has
+remained ineffective.
+
+10.2 A Licensee whose Agreement is terminated shall no longer be
+authorized to use, modify or distribute the Software. However, any
+licenses that it may have granted prior to termination of the Agreement
+shall remain valid subject to their having been granted in compliance
+with the terms and conditions hereof.
+
+
+ Article 11 - MISCELLANEOUS
+
+
+ 11.1 EXCUSABLE EVENTS
+
+Neither Party shall be liable for any or all delay, or failure to
+perform the Agreement, that may be attributable to an event of force
+majeure, an act of God or an outside cause, such as defective
+functioning or interruptions of the electricity or telecommunications
+networks, network paralysis following a virus attack, intervention by
+government authorities, natural disasters, water damage, earthquakes,
+fire, explosions, strikes and labor unrest, war, etc.
+
+11.2 Any failure by either Party, on one or more occasions, to invoke
+one or more of the provisions hereof, shall under no circumstances be
+interpreted as being a waiver by the interested Party of its right to
+invoke said provision(s) subsequently.
+
+11.3 The Agreement cancels and replaces any or all previous agreements,
+whether written or oral, between the Parties and having the same
+purpose, and constitutes the entirety of the agreement between said
+Parties concerning said purpose. No supplement or modification to the
+terms and conditions hereof shall be effective as between the Parties
+unless it is made in writing and signed by their duly authorized
+representatives.
+
+11.4 In the event that one or more of the provisions hereof were to
+conflict with a current or future applicable act or legislative text,
+said act or legislative text shall prevail, and the Parties shall make
+the necessary amendments so as to comply with said act or legislative
+text. All other provisions shall remain effective. Similarly, invalidity
+of a provision of the Agreement, for any reason whatsoever, shall not
+cause the Agreement as a whole to be invalid.
+
+
+ 11.5 LANGUAGE
+
+The Agreement is drafted in both French and English and both versions
+are deemed authentic.
+
+
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
+
+12.1 Any person is authorized to duplicate and distribute copies of this
+Agreement.
+
+12.2 So as to ensure coherence, the wording of this Agreement is
+protected and may only be modified by the authors of the License, who
+reserve the right to periodically publish updates or new versions of the
+Agreement, each with a separate number. These subsequent versions may
+address new issues encountered by Free Software.
+
+12.3 Any Software distributed under a given version of the Agreement may
+only be subsequently distributed under the same version of the Agreement
+or a subsequent version, subject to the provisions of Article 5.3.4.
+
+
+ Article 13 - GOVERNING LAW AND JURISDICTION
+
+13.1 The Agreement is governed by French law. The Parties agree to
+endeavor to seek an amicable solution to any disagreements or disputes
+that may arise during the performance of the Agreement.
+
+13.2 Failing an amicable solution within two (2) months as from their
+occurrence, and unless emergency proceedings are necessary, the
+disagreements or disputes shall be referred to the Paris Courts having
+jurisdiction, by the more diligent Party.
+
+
+Version 2.0 dated 2006-09-05.
diff --git a/loader.sce b/loader.sce
new file mode 100644
index 0000000..01a4c5f
--- /dev/null
+++ b/loader.sce
@@ -0,0 +1,10 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// Generated by builder.sce: Please, do not edit this file
+
+try
+ getversion("scilab");
+catch
+ error("Scilab 5.0 or more is required.");
+end;
+
+exec(get_absolute_file_path("loader.sce")+"etc/"+"Symphony.start");
diff --git a/macros/buildmacros.sce b/macros/buildmacros.sce
new file mode 100644
index 0000000..656ff4a
--- /dev/null
+++ b/macros/buildmacros.sce
@@ -0,0 +1,15 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+tbx_build_macros("Symphony", get_absolute_file_path("buildmacros.sce"));
+
+clear tbx_build_macros;
+
diff --git a/macros/lib b/macros/lib
new file mode 100644
index 0000000..70449c8
Binary files /dev/null and b/macros/lib differ
diff --git a/macros/names b/macros/names
new file mode 100644
index 0000000..8f806cf
--- /dev/null
+++ b/macros/names
@@ -0,0 +1,3 @@
+setOptions
+symphony
+symphony_call
diff --git a/macros/setOptions.bin b/macros/setOptions.bin
new file mode 100644
index 0000000..14d0467
Binary files /dev/null and b/macros/setOptions.bin differ
diff --git a/macros/setOptions.sci b/macros/setOptions.sci
new file mode 100644
index 0000000..8bf44a0
--- /dev/null
+++ b/macros/setOptions.sci
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+function setOptions(varagin)
+
+ options = varagin(1);
+ nbOpt = size(options,2);
+ //Check the number of options which should be even
+ if(pmodulo(nbOpt,2)) then
+ errmsg = msprintf(gettext("%s: Odd number of arguments, the number should be even"), "setOptions");
+ error(errmsg)
+ end
+
+ if (nbOpt~=0) then
+ for i = 1:(nbOpt/2)
+
+ //Setting the parameters
+
+ //Check if the given parameter is String
+ if (type(options(2*i))==10) then
+ sym_setStrParam(options(2*i - 1),options(2*i));
+
+ //Check if the given parameter is Double
+ elseif(type(options(2*i))==1) then
+ sym_setDblParam(options(2*i - 1),options(2*i));
+
+ //Check if the given parameter is Integer
+ elseif(type(options(2*i))==8)
+ sym_setIntParam(options(2*i - 1),options(2*i));
+ end
+
+ end
+ end
+
+
+endfunction
+
diff --git a/macros/symphony.bin b/macros/symphony.bin
new file mode 100644
index 0000000..08065bf
Binary files /dev/null and b/macros/symphony.bin differ
diff --git a/macros/symphony.sci b/macros/symphony.sci
new file mode 100644
index 0000000..f0a0618
--- /dev/null
+++ b/macros/symphony.sci
@@ -0,0 +1,80 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+function [xopt,fopt,iter] = symphony (varargin)
+
+ // Solves a linearily constrained optimization problem.
+ //
+ // Calling Sequence
+ // x = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB)
+ // x = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense)
+ // x = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options)
+ // [xopt,fopt,status,iter] = symphony( ... )
+
+//To check the number of input and output argument
+ [lhs , rhs] = argn();
+
+//To check the number of argument given by user
+ if ( rhs < 9 | rhs > 11 ) then
+ errmsg = msprintf(gettext("%s: Unexpected number of input arguments : %d provided while should be in the set [9 10 11]"), "Symphony", rhs);
+ error(errmsg)
+ end
+
+ nbVar = varargin(1);
+ nbCon = varargin(2);
+ objCoef = varargin(3);
+ isInt = varargin(4);
+ LB = varargin(5);
+ UB = varargin(6);
+ conMatrix = varargin(7);
+ conLB = varargin(8);
+ conUB = varargin(9);
+
+ if ( rhs<10 ) then
+ objSense = 1;
+ else
+ objSense = varargin(10);
+ end
+
+ if (rhs<11) then
+ options = [];
+ else
+ options = varargin(11);
+ end
+
+
+//Check the size of Lower Bound which should equal to the number of variables
+ if ( size(LB) ~= nbVar) then
+ errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphony");
+ error(errmsg);
+ end
+
+//Check the size of Upper Bound which should equal to the number of variables
+ if ( size(UB) ~= nbVar) then
+ errmsg = msprintf(gettext("%s: The Upper Bound is not equal to the number of variables"), "Symphony");
+ error(errmsg);
+ end
+
+//Check the size of Lower Bound which should equal to the number of constraints
+ if ( size(conLB) ~= nbCon) then
+ errmsg = msprintf(gettext("%s: The Lower Bound of constraints is not equal to the number of constraints"), "Symphony");
+ error(errmsg);
+ end
+
+//Check the size of Upper Bound which should equal to the number of constraints
+ if ( size(conUB) ~= nbCon) then
+ errmsg = msprintf(gettext("%s: The Upper Bound of constraints is not equal to the number of constraints"), "Symphony");
+ error(errmsg);
+ end
+
+ [xopt,fopt,iter] = symphony_call(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options);
+
+endfunction
diff --git a/macros/symphony_call.bin b/macros/symphony_call.bin
new file mode 100644
index 0000000..27d7f4a
Binary files /dev/null and b/macros/symphony_call.bin differ
diff --git a/macros/symphony_call.sci b/macros/symphony_call.sci
new file mode 100644
index 0000000..e181b96
--- /dev/null
+++ b/macros/symphony_call.sci
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+function [xopt,fopt,iter] = symphony_call(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options)
+
+ //Opening Symphony environment
+ sym_open();
+
+ //Choosing to launch basic or advanced version
+ if(~issparse(conMatrix)) then
+ sym_loadProblemBasic(nbVar,nbCon,LB,UB,objCoef,isInt,objSense,conMatrix,conLB,conUB);
+ else
+ // Changing to Constraint Matrix into sparse matrix
+ conMatrix_advanced=sparse(conMatrix);
+ sym_loadProblem(nbVar,nbCon,LB,UB,objCoef,isInt,objSense,conMatrix_advanced,conLB,conUB);
+ end
+
+
+ //Setting Options for the Symphpony
+ setOptions(options);
+
+ op = sym_solve();
+
+ xopt = [];
+ fopt = [];
+ status = [];
+ iter = [];
+
+ if (~op) then
+ xopt = sym_getVarSoln();
+ fopt = sym_getObjVal();
+ iter = sym_getIterCount();
+ end
+
+// //Closing Symphony Environment
+// sym_close();
+
+endfunction
diff --git a/sci_gateway/.files.txt.swp b/sci_gateway/.files.txt.swp
new file mode 100644
index 0000000..c00e271
Binary files /dev/null and b/sci_gateway/.files.txt.swp differ
diff --git a/sci_gateway/builder_gateway.sce b/sci_gateway/builder_gateway.sce
new file mode 100644
index 0000000..514d206
--- /dev/null
+++ b/sci_gateway/builder_gateway.sce
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+sci_gateway_dir = get_absolute_file_path('builder_gateway.sce');
+
+tbx_builder_gateway_lang('cpp', sci_gateway_dir);
+tbx_build_gateway_loader(['cpp'], sci_gateway_dir);
+
+clear tbx_builder_gateway_lang tbx_build_gateway_loader;
+clear sci_gateway_dir;
diff --git a/sci_gateway/cpp/.sci_sym_loadproblem.cpp.swp b/sci_gateway/cpp/.sci_sym_loadproblem.cpp.swp
new file mode 100644
index 0000000..d71df08
Binary files /dev/null and b/sci_gateway/cpp/.sci_sym_loadproblem.cpp.swp differ
diff --git a/sci_gateway/cpp/builder_gateway_cpp.sce b/sci_gateway/cpp/builder_gateway_cpp.sce
new file mode 100644
index 0000000..1b8b117
--- /dev/null
+++ b/sci_gateway/cpp/builder_gateway_cpp.sce
@@ -0,0 +1,142 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Keyur Joshi, Sai Kiran, Iswarya and Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+mode(-1)
+lines(0)
+
+WITHOUT_AUTO_PUTLHSVAR = %t;
+toolbox_title = "symphonytools"
+
+[a, opt] = getversion();
+Version = opt(2);
+
+path_builder = get_absolute_file_path('builder_gateway_cpp.sce');
+
+tools_path = path_builder + "../../thirdparty/linux/";
+
+C_Flags=["-w -fpermissive -I"+tools_path+"include/coin -Wl,-rpath="+tools_path+"lib/"+Version+filesep()+" "]
+
+Linker_Flag = ["-L"+tools_path+"lib/"+Version+filesep()+"libSym"]
+
+//Name of All the Functions
+Function_Names = [
+ //for opening/closing environment and checking if it is open/close
+ "sym_open","sci_sym_open";
+ "sym_close","sci_sym_close";
+ "sym_isEnvActive","sci_sym_isEnvActive";
+
+ //run time parameters
+ "sym_resetParams","sci_sym_set_defaults";
+ "sym_setIntParam","sci_sym_set_int_param";
+ "sym_getIntParam","sci_sym_get_int_param";
+ "sym_setDblParam","sci_sym_set_dbl_param";
+ "sym_getDblParam","sci_sym_get_dbl_param";
+ "sym_setStrParam","sci_sym_set_str_param";
+ "sym_getStrParam","sci_sym_get_str_param";
+ "sym_getInfinity","sci_sym_getInfinity";
+
+ //problem loaders
+ "sym_loadProblemBasic","sci_sym_loadProblemBasic";
+ "sym_loadProblem","sci_sym_loadProblem";
+ "sym_loadMPS","sci_sym_load_mps";
+
+ //basic data
+ "sym_getNumConstr","sci_sym_get_num_int";
+ "sym_getNumVar","sci_sym_get_num_int";
+ "sym_getNumElements","sci_sym_get_num_int";
+
+ //variable and objective data
+ "sym_isContinuous","sci_sym_isContinuous";
+ "sym_isBinary","sci_sym_isBinary";
+ "sym_isInteger","sci_sym_isInteger";
+ "sym_setContinuous","sci_sym_set_continuous";
+ "sym_setInteger","sci_sym_set_integer";
+ "sym_getVarLower","sci_sym_get_dbl_arr";
+ "sym_getVarUpper","sci_sym_get_dbl_arr";
+ "sym_setVarLower","sci_sym_setVarBound";
+ "sym_setVarUpper","sci_sym_setVarBound";
+ "sym_getObjCoeff","sci_sym_get_dbl_arr";
+ "sym_setObjCoeff","sci_sym_setObjCoeff";
+ "sym_getObjSense","sci_sym_getObjSense";
+ "sym_setObjSense","sci_sym_setObjSense";
+
+ //constraint data
+ "sym_getRhs","sci_sym_get_dbl_arr";
+ "sym_getConstrRange","sci_sym_get_dbl_arr";
+ "sym_getConstrLower","sci_sym_get_dbl_arr";
+ "sym_getConstrUpper","sci_sym_get_dbl_arr";
+ "sym_setConstrLower","sci_sym_setConstrBound";
+ "sym_setConstrUpper","sci_sym_setConstrBound";
+ "sym_setConstrType","sci_sym_setConstrType";
+ "sym_getMatrix","sci_sym_get_matrix";
+ "sym_getConstrSense","sci_sym_get_row_sense";
+
+ //add/remove variables and constraints
+ "sym_addConstr","sci_sym_addConstr";
+ "sym_addVar","sci_sym_addVar";
+ "sym_deleteVars","sci_sym_delete_cols";
+ "sym_deleteConstrs","sci_sym_delete_rows";
+
+ //primal bound
+ "sym_getPrimalBound","sci_sym_getPrimalBound";
+ "sym_setPrimalBound","sci_sym_setPrimalBound";
+
+ //set preliminary solution
+ "sym_setVarSoln","sci_sym_setColSoln";
+
+ //solve
+ "sym_solve","sci_sym_solve";
+
+ //post solve functions
+ "sym_getStatus","sci_sym_get_status";
+ "sym_isOptimal","sci_sym_get_solver_status";
+ "sym_isInfeasible","sci_sym_get_solver_status";
+ "sym_isAbandoned","sci_sym_get_solver_status";
+ "sym_isIterLimitReached","sci_sym_get_solver_status";
+ "sym_isTimeLimitReached","sci_sym_get_solver_status";
+ "sym_isTargetGapAchieved","sci_sym_get_solver_status";
+ "sym_getVarSoln","sci_sym_getVarSoln";
+ "sym_getObjVal","sci_sym_getObjVal";
+ "sym_getIterCount","sci_sym_get_iteration_count";
+ "sym_getConstrActivity","sci_sym_getRowActivity";
+ ];
+
+//Name of all the files to be compiled
+Files = [
+ "globals.cpp",
+ "sci_iofunc.hpp",
+ "sci_iofunc.cpp",
+ "sci_sym_openclose.cpp",
+ "sci_solver_status_query_functions.cpp",
+ "sci_sym_solve.cpp",
+ "sci_sym_loadproblem.cpp",
+ "sci_sym_isenvactive.cpp",
+ "sci_sym_load_mps.cpp",
+ "sci_vartype.cpp",
+ "sci_sym_getinfinity.cpp",
+ "sci_sym_solution.cpp",
+ "sym_data_query_functions.cpp"
+ "sci_sym_set_variables.cpp",
+ "sci_sym_setobj.cpp",
+ "sci_sym_varbounds.cpp",
+ "sci_sym_rowmod.cpp",
+ "sci_sym_set_indices.cpp",
+ "sci_sym_addrowcol.cpp",
+ "sci_sym_primalbound.cpp",
+ "sci_sym_setcolsoln.cpp",
+ "sci_sym_getrowact.cpp",
+ "sci_sym_getobjsense.cpp",
+ "sci_sym_remove.cpp",
+ ]
+
+tbx_build_gateway(toolbox_title,Function_Names,Files,get_absolute_file_path("builder_gateway_cpp.sce"), [], Linker_Flag, C_Flags, [], "g++");
+
+clear WITHOUT_AUTO_PUTLHSVAR toolbox_title Function_Names Files Linker_Flag C_Flags;
diff --git a/sci_gateway/cpp/cleaner.sce b/sci_gateway/cpp/cleaner.sce
new file mode 100644
index 0000000..45a256d
--- /dev/null
+++ b/sci_gateway/cpp/cleaner.sce
@@ -0,0 +1,22 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// Generated by builder.sce : Please, do not edit this file
+// cleaner.sce
+// ------------------------------------------------------
+curdir = pwd();
+cleaner_path = get_file_path('cleaner.sce');
+chdir(cleaner_path);
+// ------------------------------------------------------
+if fileinfo('loader.sce') <> [] then
+ mdelete('loader.sce');
+end
+// ------------------------------------------------------
+if fileinfo('libsymphonytools.so') <> [] then
+ mdelete('libsymphonytools.so');
+end
+// ------------------------------------------------------
+if fileinfo('libsymphonytools.c') <> [] then
+ mdelete('libsymphonytools.c');
+end
+// ------------------------------------------------------
+chdir(curdir);
+// ------------------------------------------------------
diff --git a/sci_gateway/cpp/globals.cpp b/sci_gateway/cpp/globals.cpp
new file mode 100644
index 0000000..4b5d99c
--- /dev/null
+++ b/sci_gateway/cpp/globals.cpp
@@ -0,0 +1,101 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * globals.cpp
+ * contains definitions of global variables and functions
+ * By Keyur Joshi and Sai Kiran
+ */
+#include
+#include
+
+sym_environment *global_sym_env=0;
+
+extern "C"{
+int process_ret_val(int ret_val){
+ int status=0;
+ sciprint("\n");
+ switch(ret_val){
+ case TM_NO_PROBLEM:
+ sciprint("No problem has been loaded.");
+ break;
+ case TM_NO_SOLUTION:
+ sciprint("This problem is infeasible.");
+ break;
+ case TM_FINISHED:
+ sciprint("The solver has finished working.");
+ break;
+ case TM_UNFINISHED:
+ sciprint("The solver has NOT finished working.");
+ break;
+ case TM_FEASIBLE_SOLUTION_FOUND:
+ sciprint("A feasible solution has been found. It may not be optimal.");
+ break;
+ case TM_SIGNAL_CAUGHT:
+ sciprint("TM_SIGNAL_CAUGHT");
+ break;
+ case TM_UNBOUNDED:
+ sciprint("This problem or its solution is unbounded.");
+ break;
+ case PREP_OPTIMAL_SOLUTION_FOUND:
+ sciprint("An optimal solution has been found.");
+ break;
+ case PREP_NO_SOLUTION:
+ sciprint("This problem is infeasible.");
+ break;
+ case PREP_ERROR:
+ sciprint("An error occured during preprocessing.");
+ status=1;
+ break;
+ case ERROR__USER:
+ sciprint("Error: user error detected in one of "
+ "sci_user_send_lp_data(), "
+ "sci_user_send_cg_data(), "
+ "user_send_cp_data(), "
+ "user_receive_feasible_solution(), "
+ "user_display_solution(), "
+ "user_process_own_messages() functions.");
+ status=1;
+ break;
+ case TM_OPTIMAL_SOLUTION_FOUND:
+ sciprint("An optimal solution has been found.");
+ break;
+ case TM_TIME_LIMIT_EXCEEDED:
+ sciprint("The solver stopped after the time limit was reached.");
+ break;
+ case TM_NODE_LIMIT_EXCEEDED:
+ sciprint("The solver stopped after the node limit was reached.");
+ break;
+ case TM_TARGET_GAP_ACHIEVED:
+ sciprint("The solver stopped after achieving the target gap.");
+ break;
+ case TM_FOUND_FIRST_FEASIBLE:
+ sciprint("A feasible solution has been found. It may not be optimal.");
+ break;
+ case TM_ERROR__NO_BRANCHING_CANDIDATE:
+ sciprint("Error: user didn’t select branching candidate in user_select_candidates()");
+ status=1;
+ break;
+ case TM_ERROR__ILLEGAL_RETURN_CODE:
+ sciprint("Error: illegal return code.");
+ status=1;
+ break;
+ case TM_ERROR__NUMERICAL_INSTABILITY:
+ sciprint("Error: solver stopped due to some numerical difficulties.");
+ status=1;
+ break;
+ case TM_ERROR__COMM_ERROR:
+ sciprint("Error: solver stopped due to communication error.");
+ status=1;
+ break;
+ case TM_ERROR__USER:
+ sciprint("Error: user error detected in one of user callbacks called during TM processes.");
+ break;
+ default:
+ sciprint("Error: undefined return value.");
+ status=1;
+ break;
+ }
+ sciprint("\n");
+ return status;
+}
+
+}
diff --git a/sci_gateway/cpp/libsymphonytools.c b/sci_gateway/cpp/libsymphonytools.c
new file mode 100644
index 0000000..1007284
--- /dev/null
+++ b/sci_gateway/cpp/libsymphonytools.c
@@ -0,0 +1,144 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include
+#include
+#include
+#include
+static int direct_gateway(char *fname,void F(void)) { F();return 0;};
+extern Gatefunc sci_sym_open;
+extern Gatefunc sci_sym_close;
+extern Gatefunc sci_sym_isEnvActive;
+extern Gatefunc sci_sym_set_defaults;
+extern Gatefunc sci_sym_set_int_param;
+extern Gatefunc sci_sym_get_int_param;
+extern Gatefunc sci_sym_set_dbl_param;
+extern Gatefunc sci_sym_get_dbl_param;
+extern Gatefunc sci_sym_set_str_param;
+extern Gatefunc sci_sym_get_str_param;
+extern Gatefunc sci_sym_getInfinity;
+extern Gatefunc sci_sym_loadProblemBasic;
+extern Gatefunc sci_sym_loadProblem;
+extern Gatefunc sci_sym_load_mps;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_isContinuous;
+extern Gatefunc sci_sym_isBinary;
+extern Gatefunc sci_sym_isInteger;
+extern Gatefunc sci_sym_set_continuous;
+extern Gatefunc sci_sym_set_integer;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setVarBound;
+extern Gatefunc sci_sym_setVarBound;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setObjCoeff;
+extern Gatefunc sci_sym_getObjSense;
+extern Gatefunc sci_sym_setObjSense;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setConstrBound;
+extern Gatefunc sci_sym_setConstrBound;
+extern Gatefunc sci_sym_setConstrType;
+extern Gatefunc sci_sym_get_matrix;
+extern Gatefunc sci_sym_get_row_sense;
+extern Gatefunc sci_sym_addConstr;
+extern Gatefunc sci_sym_addVar;
+extern Gatefunc sci_sym_delete_cols;
+extern Gatefunc sci_sym_delete_rows;
+extern Gatefunc sci_sym_getPrimalBound;
+extern Gatefunc sci_sym_setPrimalBound;
+extern Gatefunc sci_sym_setColSoln;
+extern Gatefunc sci_sym_solve;
+extern Gatefunc sci_sym_get_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_getVarSoln;
+extern Gatefunc sci_sym_getObjVal;
+extern Gatefunc sci_sym_get_iteration_count;
+extern Gatefunc sci_sym_getRowActivity;
+static GenericTable Tab[]={
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_open,"sym_open"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_close,"sym_close"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isEnvActive,"sym_isEnvActive"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_defaults,"sym_resetParams"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_int_param,"sym_setIntParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_int_param,"sym_getIntParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_dbl_param,"sym_setDblParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_param,"sym_getDblParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_str_param,"sym_setStrParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_str_param,"sym_getStrParam"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getInfinity,"sym_getInfinity"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_loadProblemBasic,"sym_loadProblemBasic"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_loadProblem,"sym_loadProblem"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_load_mps,"sym_loadMPS"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumConstr"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumVar"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumElements"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isContinuous,"sym_isContinuous"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isBinary,"sym_isBinary"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isInteger,"sym_isInteger"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_continuous,"sym_setContinuous"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_integer,"sym_setInteger"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getVarLower"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getVarUpper"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setVarBound,"sym_setVarLower"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setVarBound,"sym_setVarUpper"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getObjCoeff"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setObjCoeff,"sym_setObjCoeff"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getObjSense,"sym_getObjSense"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setObjSense,"sym_setObjSense"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getRhs"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrRange"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrLower"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrUpper"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrBound,"sym_setConstrLower"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrBound,"sym_setConstrUpper"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrType,"sym_setConstrType"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_matrix,"sym_getMatrix"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_row_sense,"sym_getConstrSense"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_addConstr,"sym_addConstr"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_addVar,"sym_addVar"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_delete_cols,"sym_deleteVars"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_delete_rows,"sym_deleteConstrs"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getPrimalBound,"sym_getPrimalBound"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setPrimalBound,"sym_setPrimalBound"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setColSoln,"sym_setVarSoln"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_solve,"sym_solve"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_status,"sym_getStatus"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isOptimal"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isInfeasible"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isAbandoned"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isIterLimitReached"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isTimeLimitReached"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isTargetGapAchieved"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getVarSoln,"sym_getVarSoln"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getObjVal,"sym_getObjVal"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_iteration_count,"sym_getIterCount"},
+ {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getRowActivity,"sym_getConstrActivity"},
+};
+
+int C2F(libsymphonytools)()
+{
+ Rhs = Max(0, Rhs);
+ if (*(Tab[Fin-1].f) != NULL)
+ {
+ if(pvApiCtx == NULL)
+ {
+ pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
+ }
+ pvApiCtx->pstName = (char*)Tab[Fin-1].name;
+ (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);
+ }
+ return 0;
+}
+#ifdef __cplusplus
+}
+#endif
diff --git a/sci_gateway/cpp/libsymphonytools.so b/sci_gateway/cpp/libsymphonytools.so
new file mode 100755
index 0000000..31e63b1
Binary files /dev/null and b/sci_gateway/cpp/libsymphonytools.so differ
diff --git a/sci_gateway/cpp/loader.sce b/sci_gateway/cpp/loader.sce
new file mode 100644
index 0000000..561a415
--- /dev/null
+++ b/sci_gateway/cpp/loader.sce
@@ -0,0 +1,78 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// Generated by builder.sce : Please, do not edit this file
+// ----------------------------------------------------------------------------
+//
+libsymphonytools_path = get_absolute_file_path('loader.sce');
+//
+// ulink previous function with same name
+[bOK, ilib] = c_link('libsymphonytools');
+if bOK then
+ ulink(ilib);
+end
+//
+list_functions = [ 'sym_open';
+ 'sym_close';
+ 'sym_isEnvActive';
+ 'sym_resetParams';
+ 'sym_setIntParam';
+ 'sym_getIntParam';
+ 'sym_setDblParam';
+ 'sym_getDblParam';
+ 'sym_setStrParam';
+ 'sym_getStrParam';
+ 'sym_getInfinity';
+ 'sym_loadProblemBasic';
+ 'sym_loadProblem';
+ 'sym_loadMPS';
+ 'sym_getNumConstr';
+ 'sym_getNumVar';
+ 'sym_getNumElements';
+ 'sym_isContinuous';
+ 'sym_isBinary';
+ 'sym_isInteger';
+ 'sym_setContinuous';
+ 'sym_setInteger';
+ 'sym_getVarLower';
+ 'sym_getVarUpper';
+ 'sym_setVarLower';
+ 'sym_setVarUpper';
+ 'sym_getObjCoeff';
+ 'sym_setObjCoeff';
+ 'sym_getObjSense';
+ 'sym_setObjSense';
+ 'sym_getRhs';
+ 'sym_getConstrRange';
+ 'sym_getConstrLower';
+ 'sym_getConstrUpper';
+ 'sym_setConstrLower';
+ 'sym_setConstrUpper';
+ 'sym_setConstrType';
+ 'sym_getMatrix';
+ 'sym_getConstrSense';
+ 'sym_addConstr';
+ 'sym_addVar';
+ 'sym_deleteVars';
+ 'sym_deleteConstrs';
+ 'sym_getPrimalBound';
+ 'sym_setPrimalBound';
+ 'sym_setVarSoln';
+ 'sym_solve';
+ 'sym_getStatus';
+ 'sym_isOptimal';
+ 'sym_isInfeasible';
+ 'sym_isAbandoned';
+ 'sym_isIterLimitReached';
+ 'sym_isTimeLimitReached';
+ 'sym_isTargetGapAchieved';
+ 'sym_getVarSoln';
+ 'sym_getObjVal';
+ 'sym_getIterCount';
+ 'sym_getConstrActivity';
+];
+addinter(libsymphonytools_path + filesep() + 'libsymphonytools' + getdynlibext(), 'libsymphonytools', list_functions);
+// remove temp. variables on stack
+clear libsymphonytools_path;
+clear bOK;
+clear ilib;
+clear list_functions;
+// ----------------------------------------------------------------------------
diff --git a/sci_gateway/cpp/sci_iofunc.cpp b/sci_gateway/cpp/sci_iofunc.cpp
new file mode 100644
index 0000000..8895010
--- /dev/null
+++ b/sci_gateway/cpp/sci_iofunc.cpp
@@ -0,0 +1,194 @@
+// Symphony Toolbox for Scilab
+// (Definition of) Functions for input and output from Scilab
+// By Keyur Joshi
+
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int getDoubleFromScilab(int argNum, double *dest)
+{
+ //data declarations
+ SciErr sciErr;
+ int iRet,*varAddress;
+ const char errMsg[]="Wrong type for input argument #%d: A double is expected.\n";
+ const int errNum=999;
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ //check that it is a non-complex double
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ //retrieve and store
+ iRet = getScalarDouble(pvApiCtx, varAddress, dest);
+ if(iRet)
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ return 0;
+}
+
+int getUIntFromScilab(int argNum, int *dest)
+{
+ SciErr sciErr;
+ int iRet,*varAddress;
+ double inputDouble;
+ const char errMsg[]="Wrong type for input argument #%d: A nonnegative integer is expected.\n";
+ const int errNum=999;
+ //same steps as above
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ iRet = getScalarDouble(pvApiCtx, varAddress, &inputDouble);
+ //check that an unsigned int is stored in the double by casting and recasting
+ if(iRet || ((double)((unsigned int)inputDouble))!=inputDouble)
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ *dest=(unsigned int)inputDouble;
+ return 0;
+}
+
+int getIntFromScilab(int argNum, int *dest)
+{
+ SciErr sciErr;
+ int iRet,*varAddress;
+ double inputDouble;
+ const char errMsg[]="Wrong type for input argument #%d: An integer is expected.\n";
+ const int errNum=999;
+ //same steps as above
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ iRet = getScalarDouble(pvApiCtx, varAddress, &inputDouble);
+ //check that an int is stored in the double by casting and recasting
+ if(iRet || ((double)((int)inputDouble))!=inputDouble)
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ *dest=(int)inputDouble;
+ return 0;
+}
+
+int getFixedSizeDoubleMatrixFromScilab(int argNum, int rows, int cols, double **dest)
+{
+ int *varAddress,inputMatrixRows,inputMatrixCols;
+ SciErr sciErr;
+ const char errMsg[]="Wrong type for input argument #%d: A matrix of double of size %d by %d is expected.\n";
+ const int errNum=999;
+ //same steps as above
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(errNum,errMsg,argNum,rows,cols);
+ return 1;
+ }
+ sciErr = getMatrixOfDouble(pvApiCtx, varAddress, &inputMatrixRows, &inputMatrixCols,NULL);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ //check that the matrix has the correct number of rows and columns
+ if(inputMatrixRows!=rows || inputMatrixCols!=cols)
+ {
+ Scierror(errNum,errMsg,argNum,rows,cols);
+ return 1;
+ }
+ getMatrixOfDouble(pvApiCtx, varAddress, &inputMatrixRows, &inputMatrixCols, dest);
+ return 0;
+}
+
+int getDoubleMatrixFromScilab(int argNum, int *rows, int *cols, double **dest)
+{
+ int *varAddress;
+ SciErr sciErr;
+ const char errMsg[]="Wrong type for input argument #%d: A matrix of double is expected.\n";
+ const int errNum=999;
+ //same steps as above
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(errNum,errMsg,argNum);
+ return 1;
+ }
+ getMatrixOfDouble(pvApiCtx, varAddress, rows, cols, dest);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ return 0;
+}
+
+int return0toScilab()
+{
+ int iRet;
+ //create variable in scilab
+ iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx)+1,0);
+ if(iRet)
+ {
+ /* If error, no return variable */
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+ //make it the output variable
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
+ //return it to scilab
+ ReturnArguments(pvApiCtx);
+ return 0;
+}
+
+int returnDoubleToScilab(double retVal)
+{
+ int iRet;
+ //same steps as above
+ iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx)+1,retVal);
+ if(iRet)
+ {
+ /* If error, no return variable */
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+}
diff --git a/sci_gateway/cpp/sci_iofunc.hpp b/sci_gateway/cpp/sci_iofunc.hpp
new file mode 100644
index 0000000..1cf9a1a
--- /dev/null
+++ b/sci_gateway/cpp/sci_iofunc.hpp
@@ -0,0 +1,19 @@
+// Symphony Toolbox for Scilab
+// (Declaration of) Functions for input and output from Scilab
+// By Keyur Joshi
+
+#ifndef SCI_IOFUNCHEADER
+#define SCI_IOFUNCHEADER
+
+//input
+int getDoubleFromScilab(int argNum, double *dest);
+int getUIntFromScilab(int argNum, int *dest);
+int getIntFromScilab(int argNum, int *dest);
+int getFixedSizeDoubleMatrixFromScilab(int argNum, int rows, int cols, double **dest);
+int getDoubleMatrixFromScilab(int argNum, int *rows, int *cols, double **dest);
+
+//output
+int return0toScilab();
+int returnDoubleToScilab(double retVal);
+
+#endif //SCI_IOFUNCHEADER
diff --git a/sci_gateway/cpp/sci_solver_status_query_functions.cpp b/sci_gateway/cpp/sci_solver_status_query_functions.cpp
new file mode 100644
index 0000000..eb64bd1
--- /dev/null
+++ b/sci_gateway/cpp/sci_solver_status_query_functions.cpp
@@ -0,0 +1,117 @@
+/*
+ * Implementation of Symphony Tool Box for Scilab
+ * solver_status_query_functions.cpp
+ * contains Solver Status Query Functions (7 functions)
+ * Author: Sai Kiran
+ */
+
+#include
+#include
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+#include
+
+int process_ret_val(int);
+
+/*
+ * This function returns the status of problem that has been solved.
+ */
+int sci_sym_get_status(char *fname, unsigned long fname_len){
+
+ int status=0;
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument
+
+ // Check environment
+ if(global_sym_env==NULL)
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else // There is an environment opened
+ status=sym_get_status(global_sym_env);// Call function
+ // Return result to scilab
+ return returnDoubleToScilab(status);
+ }
+
+
+/* This is a generelized function for
+ * sym_isOptimal,sym_isInfeasible,sym_isAbandoned,
+ * sym_isIterLimitReached,sym_isTimeLimitReached,
+ * and sym_isTargetGapAchieved.
+ * All the above functions have same return value and input argument.
+ *
+ * It returns (to scilab)
+ * 1 if the function is proved true.
+ * 0 if the function is proved false.
+ * -1 if there is an error.
+ */
+int sci_sym_get_solver_status(char *fname, unsigned long fname_len){
+ int result= -1 ;// Result to caller. Set to error.
+
+ // Check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ;// No input argument
+
+ // One output argument (For scilab 1 o/p argument is fixed)
+ CheckOutputArgument(pvApiCtx, 1, 1) ;
+
+ /* Array of possible callers of this function */
+ char *arr_caller[]={"sym_isOptimal","sym_isInfeasible","sym_isAbandoned",
+ "sym_isIterLimitReached","sym_isTimeLimitReached",
+ "sym_isTargetGapAchieved" };
+
+ /* Array of functions to be called */
+ int (*fun[])(sym_environment *)= { sym_is_proven_optimal,
+ sym_is_proven_primal_infeasible,
+ sym_is_abandoned,sym_is_iteration_limit_reached,
+ sym_is_time_limit_reached,sym_is_target_gap_achieved
+ };
+ /* Output values if functions return TRUE */
+ char *output_true[] = {"The problem is solved to optimality.",
+ "The problem is proved to be infeasible.",
+ "The problem is abandoned.",
+ "Iteration limit is reached.",
+ "Time limit is reached.","Target gap is reached."};
+
+ /* Output values if functions return FALSE */
+ char *output_false[] = {"The problem is not solved to optimality.",
+ "The problem is not proved to be infeasible.",
+ "The problem is not abandoned.",
+ "Iteration limit is not reached.",
+ "Time limit is not reached.","Target gap is not reached."};
+ // Check environment
+ if(global_sym_env==NULL)
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else {//there is an environment opened
+ int iter = 0, length= sizeof(arr_caller) / sizeof(char *),found_at= -1;
+
+ for (;iter < length ;++iter)
+ if (!strcmp(fname,arr_caller[iter])) //Find caller
+ found_at=iter;
+ if (found_at != -1 ) {
+ result = fun[found_at](global_sym_env);
+ sciprint("\n");
+ switch (result) {
+ case TRUE: // TRUE = 1
+ sciprint(output_true[found_at]);
+ break;
+ case FALSE: // FALSE = 0
+ sciprint(output_false[found_at]);
+ break;
+ default:
+ sciprint("Undefined return value.");
+ result = -1;
+ }
+ sciprint("\n");
+ }
+ else // Very rare case
+ sciprint("\nError in function mapping in scilab script\n");
+ }
+ return returnDoubleToScilab(result);
+ }
+}
diff --git a/sci_gateway/cpp/sci_sym_addrowcol.cpp b/sci_gateway/cpp/sci_sym_addrowcol.cpp
new file mode 100644
index 0000000..4e1d76e
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_addrowcol.cpp
@@ -0,0 +1,281 @@
+/*
+ * Symphony Toolbox
+ * Functions to add a new row or column
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_addConstr(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,numVars,nonZeros,*itemsPerRow,*colIndex,inputRows,inputCols,colIter;
+ double inputDouble,*matrix,conRHS,conRHS2,conRange;
+ char conType,*conTypeInput;
+ bool isRangedConstr=false;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,3,4) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get number of columns
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }
+
+ //get input 1: sparse matrix of variable coefficients in new constraint
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isSparseType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #1: A sparse matrix of doubles is expected.\n");
+ return 1;
+ }
+ sciErr = getSparseMatrix(pvApiCtx,varAddress,&inputRows,&inputCols,&nonZeros,&itemsPerRow,&colIndex,&matrix);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if(inputRows!=1 || inputCols!=numVars)
+ {
+ Scierror(999, "Wrong type for input argument #1: Incorrectly sized matrix.\n");
+ return 1;
+ }
+ //scilab has 1-based column indices, convert to 0-based for Symphony
+ for(colIter=0;colIter=conRHS2){
+ conRange=conRHS-conRHS2;
+ }else{
+ conRange=conRHS2-conRHS;
+ conRHS=conRHS2;
+ }
+ }else{
+ //if not ranged constraint, just set it to 0, the value probably does not matter anyway
+ conRange=0;
+ }
+
+ iRet=sym_add_row(global_sym_env,nonZeros,colIndex,matrix,conType,conRHS,conRange);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured.\n");
+ return 1;
+ }else{
+ sciprint("Constraint successfully added.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_addVar(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,numConstr,nonZeros,*itemsPerRow,*colIndex,*rowIndex,inputRows,inputCols,rowIter,arrayIter,isInt;
+ double inputDouble,*matrix,uBound,lBound,objCoeff;
+ char *varName,isIntChar;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,6,6) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get number of rows
+ iRet=sym_get_num_rows(global_sym_env,&numConstr);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }
+
+ //get input 1: sparse matrix of new variable coefficients constraints
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isSparseType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #1: A sparse matrix of doubles is expected.\n");
+ return 1;
+ }
+ sciErr = getSparseMatrix(pvApiCtx,varAddress,&inputRows,&inputCols,&nonZeros,&itemsPerRow,&colIndex,&matrix);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if(inputRows!=numConstr || inputCols!=1)
+ {
+ Scierror(999, "Wrong type for input argument #1: Incorrectly sized matrix.\n");
+ return 1;
+ }
+
+ //get argument 2: lower bound of new variable
+ if(getDoubleFromScilab(2,&lBound))
+ return 1;
+
+ //get argument 3: upper bound of new variable
+ if(getDoubleFromScilab(3,&uBound))
+ return 1;
+
+ //get argument 4: coefficient of new variable in objective
+ if(getDoubleFromScilab(4,&objCoeff))
+ return 1;
+
+ //get argument 5: wether the variable is constrained to be an integer
+ sciErr = getVarAddressFromPosition(pvApiCtx, 5, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isBooleanType(pvApiCtx, varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #5: A boolean is expected.\n");
+ return 1;
+ }
+ iRet = getScalarBoolean(pvApiCtx, varAddress, &isInt);
+ if(iRet)
+ {
+ Scierror(999, "Wrong type for input argument #5: A boolean is expected.\n");
+ return 1;
+ }
+ isIntChar=isInt?TRUE:FALSE;
+
+ //get argument 6: name of new variable
+ sciErr = getVarAddressFromPosition(pvApiCtx, 6, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isStringType(pvApiCtx,varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #6: A string is expected.\n");
+ return 1;
+ }
+ iRet = getAllocatedSingleString(pvApiCtx, varAddress, &varName);
+ if(iRet)
+ {
+ Scierror(999, "Wrong type for input argument #6: A string is expected.\n");
+ return 1;
+ }
+
+ //convert to form required by Symphony
+ rowIndex=new int[nonZeros];
+ for(rowIter=0,arrayIter=0;rowIter
+
+int sci_sym_getInfinity(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to give output
+ if(returnDoubleToScilab(sym_get_infinity()))
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_getobjsense.cpp b/sci_gateway/cpp/sci_sym_getobjsense.cpp
new file mode 100644
index 0000000..3df325c
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_getobjsense.cpp
@@ -0,0 +1,54 @@
+/*
+ * Symphony Toolbox
+ *
+ *
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_getObjSense(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int objSense;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to give output
+ iRet=sym_get_obj_sense(global_sym_env,&objSense);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }
+ if(objSense==1)
+ sciprint("Symphony has been set to minimize the objective.\n");
+ else
+ sciprint("Symphony has been set to maximize the objective.\n");
+
+ if(returnDoubleToScilab(objSense))
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_getrowact.cpp b/sci_gateway/cpp/sci_sym_getrowact.cpp
new file mode 100644
index 0000000..fac3ddf
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_getrowact.cpp
@@ -0,0 +1,68 @@
+/*
+ * Symphony Toolbox
+ * Function to get the row activity after solving
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_getRowActivity(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int numConstr;
+ double *rowAct;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ iRet=sym_get_num_rows(global_sym_env,&numConstr);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
+ return 1;
+ }
+ rowAct=new double[numConstr];
+ iRet=sym_get_row_activity(global_sym_env,rowAct);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
+ delete[] rowAct;
+ return 1;
+ }
+
+ //code to give output
+ sciErr=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,numConstr,1,rowAct);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ delete[] rowAct;
+ return 1;
+ }
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
+ ReturnArguments(pvApiCtx);
+
+ delete[] rowAct;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_isenvactive.cpp b/sci_gateway/cpp/sci_sym_isenvactive.cpp
new file mode 100644
index 0000000..96d5976
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_isenvactive.cpp
@@ -0,0 +1,47 @@
+/*
+ * Symphony Toolbox
+ * Check if Symphony environment is active
+ * Made by Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_isEnvActive(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ double returnVal;
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ if(global_sym_env==NULL){
+ sciprint("Symphony environment is not initialized. Please run 'sym_open()' first.\n");
+ returnVal=0.0;
+ }else{
+ sciprint("Symphony environment is active and ready for use.\n");
+ returnVal=1.0;
+ }
+
+ //code to give output
+ if(returnDoubleToScilab(returnVal))
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_load_mps.cpp b/sci_gateway/cpp/sci_sym_load_mps.cpp
new file mode 100644
index 0000000..7f000fb
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_load_mps.cpp
@@ -0,0 +1,75 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * template.cpp
+ * contains function for loading .mps file to symphony
+ * By Iswarya
+ */
+#include
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C"{
+#include
+#include
+#include
+#include
+#include
+
+//This function is for loading a mps file to symphony
+int sci_sym_load_mps(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr;
+
+ //data declarations
+ double status=1.0;//assume error status
+ int *piAddressVarOne = NULL;//pointer used to access argument of the function
+ char file[100];//string to hold the name of .mps file
+ char* ptr=file;//pointer to point to address of file name
+ int output=0;//out parameter for the load mps function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+
+ //check whether there is an error or not.
+ if (sciErr.iErr){
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isStringType(pvApiCtx,piAddressVarOne) )
+ {
+ Scierror(999,"Wrong type for input argument 1: A file name is expected.\n");
+ return 1;
+ }
+
+ //read the value in that pointer pointing to file name
+ int err=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }else{
+ output=sym_read_mps(global_sym_env,ptr);//loading .mps file to symphony
+ if(output==FUNCTION_TERMINATED_ABNORMALLY || output==ERROR__READING_MPS_FILE)
+ {
+ status=1.0;//function did not invoke successfully
+ sciprint("Error while reading file\n");
+ }
+ else if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ status=0.0;//no error in executing the function
+ sciprint("File read successfully\n");
+ }
+ }
+
+ if(returnDoubleToScilab(status))
+ return 1;
+
+ return 0;
+}
+
+}
+
diff --git a/sci_gateway/cpp/sci_sym_loadproblem.cpp b/sci_gateway/cpp/sci_sym_loadproblem.cpp
new file mode 100644
index 0000000..6d7f538
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_loadproblem.cpp
@@ -0,0 +1,346 @@
+/*
+ * Symphony Toolbox
+ * Explicit problem loaders
+ * Made by Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+#include
+
+//error management variables
+static SciErr sciErr;
+static int iRet;
+
+//data declarations
+static int *varAddress=NULL,numVars,numConstr,*conMatrixColStart=NULL,*conMatrixRowIndex=NULL,*isIntVarBool=NULL,colIter,rowIter,inputMatrixCols,inputMatrixRows;
+static double inputDouble,objSense,*objective=NULL,*lowerBounds=NULL,*upperBounds=NULL,*conLower=NULL,*conUpper=NULL,*conRange=NULL,*conRHS=NULL,*conMatrix=NULL;
+static char *conType=NULL,*isIntVar=NULL;
+
+//delete all allocd arrays before exit, and return output argument
+static void cleanupBeforeExit()
+ {
+ if(conMatrixColStart) delete[] conMatrixColStart;
+ if(conMatrixRowIndex) delete[] conMatrixRowIndex;
+ if(isIntVar) delete[] isIntVar;
+ if(conType) delete[] conType;
+ if(conRange) delete[] conRange;
+ if(conRHS) delete[] conRHS;
+ iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx)+1,0);
+ if(iRet)
+ {
+ /* If error, no return variable */
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return;
+ }
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
+ ReturnArguments(pvApiCtx);
+}
+
+static int checkNumArgs()
+{
+ CheckInputArgument(pvApiCtx,10,10);
+ CheckOutputArgument(pvApiCtx,1,1);
+ return 1;
+}
+
+//both basic and advanced loader use this code
+static int commonCodePart1()
+{
+
+ //ensure that environment is active
+ if(global_sym_env==NULL)
+ {
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ if(checkNumArgs()==0)
+ return 1;
+
+ //get input 1: number of variables
+ if(getUIntFromScilab(1,&numVars))
+ return 1;
+
+ //get input 2: number of constraints
+ if(getUIntFromScilab(2,&numConstr))
+ return 1;
+
+ //allocate and prepare some arrays
+ isIntVar=new char[numVars]; //is the variable constrained to be an integer?
+ conType=new char[numConstr]; //char representing constraint type
+ conRange=new double[numConstr]; //range of each constraint
+ conRHS=new double[numConstr]; //RHS to be given to Symphony
+
+ return 0;
+}
+
+//both basic and advanced loader use this code
+static int commonCodePart2()
+{
+ //get input 3: lower bounds of variables
+ if(getFixedSizeDoubleMatrixFromScilab(3,1,numVars,&lowerBounds))
+ {
+ cleanupBeforeExit();
+ return 1;
+ }
+
+ //get input 4: upper bounds of variables
+ if(getFixedSizeDoubleMatrixFromScilab(4,1,numVars,&upperBounds))
+ {
+ cleanupBeforeExit();
+ return 1;
+ }
+
+ //get input 5: coefficients of variables in objective function to be minimized
+ if(getFixedSizeDoubleMatrixFromScilab(5,1,numVars,&objective))
+ {
+ cleanupBeforeExit();
+ return 1;
+ }
+
+ //get input 6: array that specifies wether a variable is constrained to be an integer
+ sciErr = getVarAddressFromPosition(pvApiCtx, 6, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ cleanupBeforeExit();return 1;
+ }
+ if ( !isBooleanType(pvApiCtx, varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #6: A matrix of booleans is expected.\n");
+ cleanupBeforeExit();return 1;
+ }
+ sciErr = getMatrixOfBoolean(pvApiCtx, varAddress, &inputMatrixRows, &inputMatrixCols, &isIntVarBool);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ cleanupBeforeExit();return 1;
+ }
+ if(inputMatrixRows!=1 || inputMatrixCols!=numVars)
+ {
+ Scierror(999, "Wrong type for input argument #6: Incorrectly sized matrix.\n");
+ cleanupBeforeExit();return 1;
+ }
+ for(colIter=0;colIterconUpper[rowIter])
+ {
+ Scierror(999, "Error: the lower bound of constraint %d is more than its upper bound.\n",rowIter);
+ cleanupBeforeExit();
+ return 1;
+ }
+ if(conLower[rowIter]==(-INFINITY) && conUpper[rowIter]==INFINITY){
+ conType[rowIter]='N';
+ conRange[rowIter]=0;
+ conRHS[rowIter]=0;
+ }else if(conLower[rowIter]==(-INFINITY)){
+ conType[rowIter]='L';
+ conRange[rowIter]=0;
+ conRHS[rowIter]=conUpper[rowIter];
+ }else if(conUpper[rowIter]==INFINITY){
+ conType[rowIter]='G';
+ conRange[rowIter]=0;
+ conRHS[rowIter]=conLower[rowIter];
+ }else if(conUpper[rowIter]==conLower[rowIter]){
+ conType[rowIter]='E';
+ conRange[rowIter]=0;
+ conRHS[rowIter]=conLower[rowIter];
+ }else{
+ conType[rowIter]='R';
+ conRange[rowIter]=conUpper[rowIter]-conLower[rowIter];
+ conRHS[rowIter]=conUpper[rowIter];
+ }
+ }
+
+ /*
+ //for debug: show all data
+ sciprint("Vars: %d Constr: %d ObjType: %lf\n",numVars,numConstr,objSense);
+ for(colIter=0;colIter10 vars)
+int sci_sym_loadProblem(char *fname)
+{
+ int retVal,nonZeros,*itemsPerRow,*colIndex,matrixIter,newPos,*oldRowIndex,*colStartCopy;
+ double *data;
+
+ if(commonCodePart1())
+ return 1;
+
+ //get input 8: matrix of constraint equation coefficients
+ sciErr = getVarAddressFromPosition(pvApiCtx, 8, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ cleanupBeforeExit();return 1;
+ }
+
+ if(!(numConstr == 0))
+ {
+
+ if ( (!isSparseType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress)) && (numConstr == 0))
+ {
+ Scierror(999, "Wrong type for input argument #8: A sparse matrix of doubles is expected.\n");
+ cleanupBeforeExit();return 1;
+ }
+ }
+ sciErr = getSparseMatrix(pvApiCtx,varAddress,&inputMatrixRows,&inputMatrixCols,&nonZeros,&itemsPerRow,&colIndex,&data);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ cleanupBeforeExit();return 1;
+ }
+ if(inputMatrixRows!=numConstr || inputMatrixCols!=numVars)
+ {
+ Scierror(999, "Wrong type for input argument #8: Incorrectly sized matrix.\n");
+ cleanupBeforeExit();return 1;
+ }
+
+ //convert SciLab format sparse matrix into the format required by Symphony
+ conMatrix=new double[nonZeros]; //matrix contents
+ conMatrixColStart=new int[numVars+1]; //where each column of the matrix starts
+ conMatrixRowIndex=new int[nonZeros]; //row number of each element
+ oldRowIndex=new int[nonZeros]; //row number in old matrix
+ colStartCopy=new int[numVars+1]; //temporary copy of conMatrixColStart
+ for(rowIter=matrixIter=0;rowIter
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+
+/* Function that initializes the symphony environment
+ * Returns 1 on success , 0 on failure
+ */
+int sci_sym_open(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr;
+ double status=0;
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument
+
+ //check environment
+ if(global_sym_env!=NULL){
+ sciprint("Warning: Symphony environment is already initialized.\n");
+ }else{
+ global_sym_env = sym_open_environment();//open an environment
+ if (!global_sym_env)
+ sciprint("Error: Unable to create symphony environment.\n");
+ else{
+ status=1;
+ //sciprint("Symphony environment is created successfully. Please run 'sym_close()' to close.\n");
+ //create useful variables for user
+ createNamedScalarDouble(pvApiCtx,"sym_minimize",1);
+ createNamedScalarDouble(pvApiCtx,"sym_maximize",-1);
+ }
+ }
+
+ /*write satus of function (success-1 or failure-0) as output argument to scilab*/
+ if(returnDoubleToScilab(status))
+ return 1;
+
+ return 0;
+}
+
+/*Function that closes symphony environment
+ * Returns 1 on success , 0 on failure
+*/
+int sci_sym_close(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr;
+ double status=0;
+ int output;//output parameter for closing the environment
+
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument
+
+ if (global_sym_env==NULL){//check for environment
+ sciprint("Error: symphony environment is not initialized.\n");
+ }else{
+ output=sym_close_environment(global_sym_env);//close environment
+ if(output==ERROR__USER){
+ status=0;//User error detected in user_free_master() function or when function invoked unsuccessfully
+ sciprint("Error in user_free_master()\n");
+ }else if(output==FUNCTION_TERMINATED_ABNORMALLY){
+ status=0;//function invoked unsuccessfully
+ sciprint("Symphony environment could not be closed.\n");
+ }else if(output==FUNCTION_TERMINATED_NORMALLY){
+ status=1;//function invoked successfully and no error
+ global_sym_env=NULL;//important to set to NULL, so that other functions can detect that environment is not open.
+ //sciprint("Symphony environement closed successfully. Please run 'sym_open()' to restart.\n");
+ //delete the sym_ variables
+ deleteNamedVariable(pvApiCtx,"sym_minimize");
+ deleteNamedVariable(pvApiCtx,"sym_maximize");
+ }
+ }
+
+ /*write satus of function (success-1 or failure-0) as output argument to scilab*/
+ if(returnDoubleToScilab(status))
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_primalbound.cpp b/sci_gateway/cpp/sci_sym_primalbound.cpp
new file mode 100644
index 0000000..7e79d87
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_primalbound.cpp
@@ -0,0 +1,87 @@
+/*
+ * Symphony Toolbox
+ * Functions for getting/setting the primal bound
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_getPrimalBound(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ double retVal;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ iRet=sym_get_primal_bound(global_sym_env,&retVal);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been loaded?\n");
+ return 1;
+ }
+
+ //code to give output
+ if(returnDoubleToScilab(retVal))
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_setPrimalBound(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ double bound;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,1,1) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ if(getDoubleFromScilab(1,&bound))
+ return 1;
+
+ iRet=sym_set_primal_bound(global_sym_env,bound);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been loaded?\n");
+ return 1;
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_remove.cpp b/sci_gateway/cpp/sci_sym_remove.cpp
new file mode 100644
index 0000000..d4e9c49
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_remove.cpp
@@ -0,0 +1,254 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * set_sym_remove.cpp
+ * contains function for removing columns and rows
+ * By Iswarya
+ */
+#include
+
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+//function to remove specified columns
+int sci_sym_delete_cols(char *fname, unsigned long fname_len){
+
+ // Error management variables
+ SciErr sciErr1,sciErr2;
+ double status=1.0;//assume error status
+ double num;//variable to store the number of columns to be deleted obtained from user in scilab
+ int count=0;//iterator variable
+ int num_cols;//stores the number of columns in the loaded problem
+ int iType= 0;//stores the datatype of matrix
+ int rows=0,columns=0;//integer variables to denote the number of rows and columns in the array denoting the column numbers to be deleted
+ unsigned int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted
+ double *array_ptr=NULL;//double array pointer to the array denoting the column numbers to be deleted
+ int *piAddressVarOne = NULL;//pointer used to access first and second arguments of the function
+ int output=0;//output parameter for the symphony sym_delete_cols function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr2=getVarAddressFromPosition(pvApiCtx,1,&piAddressVarOne);
+
+
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+ //check if it is double type
+ sciErr2 = getVarType(pvApiCtx, piAddressVarOne, &iType);
+ if(sciErr2.iErr || iType != sci_matrix)
+ {
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+
+ //getting the first argument as a double array
+ sciErr2=getMatrixOfDouble(pvApiCtx,piAddressVarOne,&rows,&columns,&array_ptr);
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+ //dynamically allocate the integer array
+ value=(unsigned int *)malloc(sizeof(unsigned int)*columns);
+ //store double values in the integer array by typecasting
+ while(count=num_cols){
+ flag=1;
+ break;
+ }
+
+ }
+ if(flag==1)
+ {
+ Scierror(999,"Not valid indices..\n");
+ sciprint("valid indices are from 0 to %d",num_cols-1);
+ free(value);//freeing the memory of the allocated pointer
+ return 0;
+ }
+ //only when the number of columns to be deleted is lesser than the actual number of columns ,execution is proceeded with
+ if(columns<=num_cols){
+ output=sym_delete_cols(global_sym_env,(unsigned int)columns,value);//symphony function to delete the columns specified
+ if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ sciprint("Execution is successfull\n");
+ status=0.0;
+ }
+ else if(output==FUNCTION_TERMINATED_ABNORMALLY)
+ {
+ Scierror(999,"Problem occured while deleting the columns,Are the column numbers correct?\n");
+ sciprint("Function terminated abnormally\n");
+ status=1.0;
+ }
+ }
+ else{
+ sciprint("These many number of variables dont exist in the problem\n");
+ status=1.0;
+ }
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ free(value);//freeing the memory of the allocated pointer
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ free(value);//freeing the memory of the allocated pointer
+ return 0;
+ }
+
+
+//function to remove specified rows
+int sci_sym_delete_rows(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1,sciErr2;
+ double status=1.0;//assume error status
+ int count=0;//iterator variable
+ int num_rows;//stores the number of columns in the loaded problem
+ int iType= 0;//stores the datatype of matrix
+ int rows=0,columns=0;//integer variables to denote the number of rows and columns in the array denoting the row numbers to be deleted
+ unsigned int *value=NULL;//pointer to integer array allocated dynamically having the indices to be deleted
+ double *array_ptr=NULL;//double array pointer to the array denoting the rows numbers to be deleted
+ int *piAddressVarTwo = NULL;//pointer used to access first and second arguments of the function
+ int output=0;//output parameter for the symphony sym_delete_rows function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 2nd argument into piAddressVarTwo
+ sciErr2=getVarAddressFromPosition(pvApiCtx,1,&piAddressVarTwo);
+
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+ //check if it is double type
+ sciErr2 = getVarType(pvApiCtx, piAddressVarTwo, &iType);
+ if(sciErr2.iErr || iType != sci_matrix)
+ {
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+
+ //getting the second argument as a double array
+ sciErr2=getMatrixOfDouble(pvApiCtx,piAddressVarTwo,&rows,&columns,&array_ptr);
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+ //dynamically allocate the integer array
+ value=(unsigned int *)malloc(sizeof(unsigned int)*columns);
+ //store double values in the integer array by typecasting
+ while(count=num_rows){
+ flag=1;
+ break;
+ }
+
+ }
+ if(flag==1)
+ {
+ Scierror(999,"Not valid indices..\n");
+ sciprint("valid constraint indices are from 0 to %d",num_rows-1);
+ free(value);//freeing the memory of the allocated pointer
+ return 0;
+ }
+ //only when the number of rows to be deleted is lesser than the actual number of rows ,execution is proceeded with
+ if(columns<=num_rows){
+ output=sym_delete_rows(global_sym_env,(unsigned int)columns,value);//symphony function to delete the rows specified
+ if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ sciprint("Execution is successfull\n");
+ status=0.0;
+ }
+ else if(output==FUNCTION_TERMINATED_ABNORMALLY)
+ {
+ Scierror(999,"Problem occured while deleting the columns,Are the column numbers correct?\n");
+ sciprint("Function terminated abnormally\n");
+ status=1.0;
+ }
+ }
+ else{
+ sciprint("These many number of constraints dont exist in the problem\n");
+ status=1.0;
+ }
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ free(value);//freeing the memory of the allocated pointer
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ free(value);//freeing the memory of the allocated pointer
+ return 0;
+ }
+
+
+
+
+
+}
diff --git a/sci_gateway/cpp/sci_sym_rowmod.cpp b/sci_gateway/cpp/sci_sym_rowmod.cpp
new file mode 100644
index 0000000..ec966d0
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_rowmod.cpp
@@ -0,0 +1,192 @@
+/*
+ * Symphony Toolbox
+ * Functions for modifying constraints
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+#include
+
+int sci_sym_setConstrBound(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,conIndex,numConstr;
+ double inputDouble,newBound;
+ bool isLower;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,2,2) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get argument 1: index of constraint whose bound is to be changed
+ if(getUIntFromScilab(1,&conIndex))
+ return 1;
+ iRet=sym_get_num_rows(global_sym_env,&numConstr);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else if(conIndex>=numConstr){
+ Scierror(999, "An error occured. Constraint index must be a number between 0 and %d.\n",numConstr-1);
+ return 1;
+ }
+
+ //get argument 2: new bound
+ if(getDoubleFromScilab(2,&newBound))
+ return 1;
+
+ //decide which function to execute
+ isLower=(strcmp(fname,"sym_setConstrLower")==0);
+ if(isLower)
+ iRet=sym_set_row_lower(global_sym_env,conIndex,newBound);
+ else
+ iRet=sym_set_row_upper(global_sym_env,conIndex,newBound);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else{
+ sciprint("Bound successfully changed.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_setConstrType(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,conIndex,numConstr;
+ double inputDouble,conRHS,conRHS2,conRange;
+ bool isRangedConstr=false;
+ char conType,*conTypeInput;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,3,4) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get argument 1: index of constraint whose type is to be changed
+ if(getUIntFromScilab(1,&conIndex))
+ return 1;
+ iRet=sym_get_num_rows(global_sym_env,&numConstr);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else if(conIndex>=numConstr){
+ Scierror(999, "An error occured. Constraint index must be a number between 0 and %d.\n",numConstr-1);
+ return 1;
+ }
+
+ //get argument 2: type of constraint
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isStringType(pvApiCtx,varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #2: Either \"L\", \"E\", \"G\", or \"R\" is expected.\n");
+ return 1;
+ }
+ iRet = getAllocatedSingleString(pvApiCtx, varAddress, &conTypeInput);
+ if(iRet)
+ {
+ Scierror(999, "Wrong type for input argument #2: Either \"L\", \"E\", \"G\", or \"R\" is expected.\n");
+ return 1;
+ }
+ switch(conTypeInput[0]){
+ case 'l':case 'L':
+ conType='L';
+ break;
+ case 'e':case 'E':
+ conType='E';
+ break;
+ case 'g':case 'G':
+ conType='G';
+ break;
+ case 'r':case 'R':
+ conType='R';
+ isRangedConstr=true;
+ break;
+ default:
+ Scierror(999, "Wrong type for input argument #2: Either \"L\", \"E\", \"G\", or \"R\" is expected.\n");
+ return 1;
+ }
+ //check number of arguments for specific cases
+ if(isRangedConstr){
+ if(nbInputArgument(pvApiCtx)!=4){
+ Scierror(999, "4 Arguments are expected for ranged constraint.\n");
+ return 1;
+ }
+ }else if(nbInputArgument(pvApiCtx)!=3){
+ Scierror(999, "3 Arguments are expected for non-ranged constraint.\n");
+ return 1;
+ }
+
+ //get argument 3: constraint RHS
+ if(getDoubleFromScilab(3,&conRHS))
+ return 1;
+
+ //get argument 4: constraint range
+ if(isRangedConstr){
+ if(getDoubleFromScilab(4,&conRHS2))
+ return 1;
+ //conRHS should be the upper bound, and conRange should be positive
+ if(conRHS>=conRHS2){
+ conRange=conRHS-conRHS2;
+ }else{
+ conRange=conRHS2-conRHS;
+ conRHS=conRHS2;
+ }
+ }else{
+ //if not ranged constraint, just set it to 0, the value probably does not matter anyway
+ conRange=0;
+ }
+
+ iRet=sym_set_row_type(global_sym_env,conIndex,conType,conRHS,conRange);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else{
+ sciprint("Constraint successfully changed.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_set_indices.cpp b/sci_gateway/cpp/sci_sym_set_indices.cpp
new file mode 100644
index 0000000..6b8a35a
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_set_indices.cpp
@@ -0,0 +1,99 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * sci_sym_set_indices.cpp
+ * contains functions for setting index variables as continuous and integer values
+ * By Iswarya
+ */
+#include
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+
+//This function is for setting a index variable to be continuous
+int sci_sym_set_continuous(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr;
+ double status=1.0;//assume error status
+ int index;//to indicate the index of the variable to be set continuous
+ int output=0;//out parameter for the load mps function
+
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ getUIntFromScilab(1,&index);
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else
+ {
+ output=sym_set_continuous(global_sym_env,index);//setting the variable continuous
+ if(output==FUNCTION_TERMINATED_ABNORMALLY)
+ {
+ status=1.0;//function did not invoke successfully
+ sciprint("An error occured.\n");
+ }
+ else if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ status=0.0;//no error in executing the function
+ sciprint("Variable with index %d is now continuous.\n",index);
+ }
+ }
+
+ if(returnDoubleToScilab(status))
+ return 1;
+
+ return 0;
+}
+
+
+//This function is for setting a index variable to be integer
+int sci_sym_set_integer(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr;
+ double status=1.0;//assume error status
+ int index;//to indicate the index of the variable to be set continuous
+ int output=0;//out parameter for the load mps function
+
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ getUIntFromScilab(1,&index);
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else
+ {
+ output=sym_set_integer(global_sym_env,index);//setting the variable continuous
+ if(output==FUNCTION_TERMINATED_ABNORMALLY)
+ {
+ status=1.0;//function did not invoke successfully
+ sciprint("An error occured.\n");
+ }
+ else if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ status=0.0;//no error in executing the function
+ sciprint("Variable with index %d is now constrained to be an integer.\n",index);
+ }
+ }
+
+ if(returnDoubleToScilab(status))
+ return 1;
+
+ return 0;
+}
+
+}
+
diff --git a/sci_gateway/cpp/sci_sym_set_variables.cpp b/sci_gateway/cpp/sci_sym_set_variables.cpp
new file mode 100644
index 0000000..327bf84
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_set_variables.cpp
@@ -0,0 +1,430 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * set_variables.cpp
+ * contains function for setting environment variables to their default and userdefined values in symphony
+ * By Iswarya
+ */
+#include
+
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+//This function is for loading a mps file to symphony
+int sci_sym_set_defaults(char *fname, unsigned long fname_len){
+
+ double status=1.0;//assume error status
+ int *piAddressVarOne = NULL;//pointer used to access argument of the function
+ int output=0;//out parameter for the setting of default values function
+ CheckInputArgument(pvApiCtx, 0, 0);//Check we no argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ output=sym_set_defaults(global_sym_env);//setting all environment variables and parameters in this symphony environment passed to their default values
+ if(output==FUNCTION_TERMINATED_ABNORMALLY)
+ {
+ status=1.0;//function did not invoke successfully
+ sciprint("Function terminated abnormally, didnot execute");
+ }
+ else if(output==FUNCTION_TERMINATED_NORMALLY)
+ {
+ status=0.0;//no error in executing the function
+ sciprint("Function executed successfully");
+ }
+
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+
+int sci_sym_set_int_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1,sciErr2;
+ double status=1.0;//assume error status
+ double num;//to store and check the value obtained is pure unsigned integer
+ int output;//output variable to store the return value of symphony set integer function
+ int value;//to store the value of integer to be set
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ int *piAddressVarTwo=NULL;//pointer used to access second argument of the function
+ char variable_name[100];//string to hold the name of variable's value to be set
+ char *ptr=variable_name;//pointer to point to address of the variable name
+ CheckInputArgument(pvApiCtx, 2, 2);//Check we have exactly two argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly no argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+ sciErr2 = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+
+ //read the value in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+ //read the value of the variable to be set as a double value
+ int err2=getScalarDouble(pvApiCtx, piAddressVarTwo, &num);
+
+ //check for the integrity of integer value obtained
+ if((double)(unsigned int)num!=(double)num)
+ return 0;
+ else
+ value=(unsigned int)num;//if the value passed is an integer ,store it as an unsigned integer in value variable
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ output=sym_set_int_param(global_sym_env,ptr,value);//symphony function to set the variable name pointed by the ptr pointer to the integer value stored in value variable.
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("setting of integer parameter function executed successfully\n");
+ status=0.0;
+ }
+ else if(output==FUNCTION_TERMINATED_ABNORMALLY){
+ sciprint("setting of integer parameter was unsuccessful.....check your parameter and value\n");
+ status=1.0;
+ }
+ else
+ sciprint("\nerror while executing the setting integer function...check your parameter and value!!\n");
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+int sci_sym_get_int_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1;
+ double status=1.0;//assume error status
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ char variable_name[100];//string to hold the name of variable's value to be retrieved
+ char *ptr=variable_name;//pointer to point to address of the variable name
+ int output;//output parameter for the symphony get_int_param function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+
+
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+
+
+ //read the variable name in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ int a;//local variable to store the value of variable name we want to retrieve
+ output=sym_get_int_param(global_sym_env,ptr,&a);//symphony function to get the value of integer parameter pointed by ptr pointer and store it in 'a' variable
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("value of integer parameter %s is :: %d\n",ptr,a);
+ status=0.0;
+ }
+ else{
+ sciprint("Unable to get the value of the parameter...check the input values!!\n");
+ status=1.0;
+ }
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+
+int sci_sym_set_dbl_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1,sciErr2;
+ double status=1.0;//assume error status
+ double num;//to store the value of the double parameter to be set
+ int output;//output parameter for the symphomy setting double parameter function
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ int *piAddressVarTwo=NULL;//pointer used to access second argument of the function
+ char variable_name[100];//string to hold the name of variable's value to be set
+ char *ptr=variable_name;//pointer to point to address of the variable name
+ CheckInputArgument(pvApiCtx, 2, 2);//Check we have exactly two argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly no argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+ sciErr2 = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+
+ //read the value in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+ //read the value of the variable to be set as a double value
+ int err2=getScalarDouble(pvApiCtx, piAddressVarTwo, &num);
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ output=sym_set_dbl_param(global_sym_env,ptr,num);//symphony function to set the variable name pointed by the ptr pointer to the double value stored in 'value' variable.
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("setting of double parameter function executed successfully\n");
+ status=0.0;
+ }
+ else
+ sciprint("Function did not execute successfully...check your inputs!!!\n");
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+int sci_sym_get_dbl_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1;
+ double status=1.0;//assume error status
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ char variable_name[100];//string to hold the name of variable's value to be retrieved
+ char *ptr=variable_name;//pointer to point to address of the variable name
+ int output;//output parameter for the symphony get_dbl_param function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+
+
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+
+
+ //read the variable name in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ double a;//local variable to store the value of variable name we want to retrieve
+ output=sym_get_dbl_param(global_sym_env,ptr,&a);//symphony function to get the value of double parameter pointed by ptr pointer and store it in 'a' variable
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("value of double parameter %s is :: %lf\n",ptr,a);
+ status=1.0;
+ }
+ else{
+ sciprint("Unable to get the value of the parameter...check the input values!!\n");
+ status=1.0;
+ }
+
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+int sci_sym_set_str_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1,sciErr2;
+ double status=1.0;//assume error status
+ double num;//to store the value of the double parameter to be set
+ int output;//output return value of the setting of symphony string parameter function
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ int *piAddressVarTwo=NULL;//pointer used to access second argument of the function
+ char variable_name[100],value[100];//string to hold the name of variable's value to be set and the value to be set is stored in 'value' string
+ char *ptr=variable_name,*valptr=value;//pointer-'ptr' to point to address of the variable name and 'valptr' points to the address of the value to be set to the string parameter
+ CheckInputArgument(pvApiCtx, 2, 2);//Check we have exactly two argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly no argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+ sciErr2 = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+ if (sciErr2.iErr){
+ printError(&sciErr2, 0);
+ return 0;
+ }
+
+
+ //read the value in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+ //read the value of the string variable to be set
+ int err2=getAllocatedSingleString(pvApiCtx, piAddressVarTwo, &valptr);
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ output=sym_set_str_param(global_sym_env,ptr,valptr);//symphony function to set the variable name pointed by the ptr pointer to the double value stored in 'value' variable.
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("setting of string parameter function executed successfully\n");
+ status=0.0;
+ }
+ else
+ sciprint("Setting of the string parameter was unsuccessfull...check the input values!!\n");
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+int sci_sym_get_str_param(char *fname, unsigned long fname_len){
+
+ // Error management variable
+ SciErr sciErr1;
+ double status=1.0;//assume error status
+ int *piAddressVarOne = NULL;//pointer used to access first argument of the function
+ char variable_name[100];//string to hold the name of variable's value to be retrieved
+ char *ptr=variable_name;//pointer to point to address of the variable name
+ int output;//output parameter for the symphony get_dbl_param function
+ CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not
+
+ //load address of 1st argument into piAddressVarOne
+ sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+
+
+ //check whether there is an error or not.
+ if (sciErr1.iErr){
+ printError(&sciErr1, 0);
+ return 0;
+ }
+
+
+ //read the variable name in that pointer pointing to variable name
+ int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
+
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ }
+ else {
+ char value[100];//local variable to store the value of variable name we want to retrieve
+ char *p=value;//pointer to store the address of the character array that contains the value of the string parameter to be retrieved
+ output=sym_get_str_param(global_sym_env,ptr,&p);//symphony function to get the value of string parameter pointed by ptr pointer and store it in 'p' pointer variable
+ if(output==FUNCTION_TERMINATED_NORMALLY){
+ sciprint("value of string parameter %s is :: %s\n",ptr,p);
+ status=0.0;
+ }
+ else
+ sciprint("The string parameter value could not be retrieved successfully...check the input values!!\n");
+
+
+ }
+
+ int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
+ if (e){
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+ }
+
+
+}
diff --git a/sci_gateway/cpp/sci_sym_setcolsoln.cpp b/sci_gateway/cpp/sci_sym_setcolsoln.cpp
new file mode 100644
index 0000000..ca43779
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_setcolsoln.cpp
@@ -0,0 +1,61 @@
+/*
+ * Symphony Toolbox
+ * Function to set the solution to a known one
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_setColSoln(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int numVars;
+ double *solution;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,1,1) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }
+
+ if(getFixedSizeDoubleMatrixFromScilab(1,1,numVars,&solution))
+ return 1;
+
+ iRet=sym_set_col_solution(global_sym_env,solution);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. The given solution may be infeasible\nor worse than the current solution.\n");
+ return 1;
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_setobj.cpp b/sci_gateway/cpp/sci_sym_setobj.cpp
new file mode 100644
index 0000000..3a4691a
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_setobj.cpp
@@ -0,0 +1,126 @@
+/*
+ * Symphony Toolbox
+ * Functions for setting the coefficients of the objective and the sense (minimization/maximization)
+ * By Keyur Joshi
+ */
+
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_setObjCoeff(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,varIndex,numVars;
+ double inputDouble,newCoeff;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,2,2) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get argument 1: index of variable whose coefficient is to be changed
+ if(getUIntFromScilab(1,&varIndex))
+ return 1;
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else if(varIndex>=numVars){
+ Scierror(999, "An error occured. Variable index must be a number between 0 and %d.\n",numVars-1);
+ return 1;
+ }
+
+ //get argument 2: new coefficient
+ if(getDoubleFromScilab(2,&newCoeff))
+ return 1;
+
+ iRet=sym_set_obj_coeff(global_sym_env,varIndex,newCoeff);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else{
+ sciprint("Coefficient successfully changed.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_setObjSense(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress;
+ double objSense;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,1,1) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+ if ( !isDoubleType(pvApiCtx,varAddress) || isVarComplex(pvApiCtx,varAddress) )
+ {
+ Scierror(999, "Wrong type for input argument #1:\nEither 1 (sym_minimize) or -1 (sym_maximize) is expected.\n");
+ return 1;
+ }
+ iRet = getScalarDouble(pvApiCtx, varAddress, &objSense);
+ if(iRet || (objSense!=-1 && objSense!=1))
+ {
+ Scierror(999, "Wrong type for input argument #1:\nEither 1 (sym_minimize) or -1 (sym_maximize) is expected.\n");
+ return 1;
+ }
+ iRet=sym_set_obj_sense(global_sym_env,objSense);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured.\n");
+ return 1;
+ }else{
+ if(objSense==1)
+ sciprint("The solver has been set to minimize the objective.\n");
+ else
+ sciprint("The solver has been set to maximize the objective.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_solution.cpp b/sci_gateway/cpp/sci_sym_solution.cpp
new file mode 100644
index 0000000..a08e5b9
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_solution.cpp
@@ -0,0 +1,101 @@
+/*
+ * Symphony Toolbox
+ * Provides the solution after the problem is solved
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_sym_getVarSoln(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int numVars;
+ double *solution;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been loaded and solved?\n");
+ return 1;
+ }
+ solution=new double[numVars];
+ iRet=sym_get_col_solution(global_sym_env,solution);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ //Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
+ delete[] solution;
+ return 1;
+ }
+
+ //code to give output
+ sciErr=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,1,numVars,solution);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ delete[] solution;
+ return 1;
+ }
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
+ ReturnArguments(pvApiCtx);
+
+ delete[] solution;
+
+ return 0;
+}
+
+int sci_sym_getObjVal(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ double solution;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,0,0) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //code to process input
+ iRet=sym_get_obj_val(global_sym_env,&solution);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has the problem been loaded and solved? Is the problem feasible?\n");
+ return 1;
+ }
+
+ //code to give output
+ if(returnDoubleToScilab(solution))
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_sym_solve.cpp b/sci_gateway/cpp/sci_sym_solve.cpp
new file mode 100644
index 0000000..4abb268
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_solve.cpp
@@ -0,0 +1,49 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * Contains sym_solve function
+ * Author : Sai Kiran
+ */
+
+#include
+#include
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+#include
+int process_ret_val(int);
+
+int sci_sym_solve(char *fname, unsigned long fname_len){
+
+ int status=0;
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument
+
+ // Check environment
+ if(global_sym_env==NULL)
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else {// There is an environment opened
+ double time_limit = -1.0;
+ status = sym_get_dbl_param(global_sym_env,"time_limit",&time_limit);
+
+ if (status == FUNCTION_TERMINATED_NORMALLY) {
+ if ( time_limit < 0.0 )
+ sciprint("\nNote: There is no limit on time.\n");
+ else sciprint("\nNote: Time limit has been set to %lf.\n",time_limit);
+ status=process_ret_val(sym_solve(global_sym_env));// Call function
+ }
+ else {
+ sciprint("\nUnable to read time limit.\n");
+ status = 1; //Error state
+ }
+ }
+ // Return result to scilab
+ return returnDoubleToScilab(status);
+ }
+}
diff --git a/sci_gateway/cpp/sci_sym_varbounds.cpp b/sci_gateway/cpp/sci_sym_varbounds.cpp
new file mode 100644
index 0000000..e0fa6ab
--- /dev/null
+++ b/sci_gateway/cpp/sci_sym_varbounds.cpp
@@ -0,0 +1,76 @@
+/*
+ * Symphony Toolbox
+ * Functions for setting the upper and lower bounds of the variables
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+#include
+
+int sci_sym_setVarBound(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+ int *varAddress,varIndex,numVars;
+ double inputDouble,newBound;
+ bool isLower;
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx,2,2) ;
+ CheckOutputArgument(pvApiCtx,1,1) ;
+
+ //get argument 1: index of variable whose bound is to be changed
+ if(getUIntFromScilab(1,&varIndex))
+ return 1;
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else if(varIndex>=numVars){
+ Scierror(999, "An error occured. Variable index must be a number between 0 and %d.\n",numVars-1);
+ return 1;
+ }
+
+ //get argument 2: new bound
+ if(getDoubleFromScilab(2,&newBound))
+ return 1;
+
+ //decide which function to execute
+ isLower=(strcmp(fname,"sym_setVarLower")==0);
+ if(isLower)
+ iRet=sym_set_col_lower(global_sym_env,varIndex,newBound);
+ else
+ iRet=sym_set_col_upper(global_sym_env,varIndex,newBound);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else{
+ sciprint("Bound successfully changed.\n");
+ }
+
+ //code to give output
+ if(return0toScilab())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sci_vartype.cpp b/sci_gateway/cpp/sci_vartype.cpp
new file mode 100644
index 0000000..e6656a7
--- /dev/null
+++ b/sci_gateway/cpp/sci_vartype.cpp
@@ -0,0 +1,135 @@
+/*
+ * Symphony Toolbox
+ * Provides information about variables: is it continuous/integer/boolean?
+ * By Keyur Joshi
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+//error management variable
+static SciErr sciErr;
+static int iRet;
+
+//data declarations
+static int *varAddress,varIndex,numVars,retVal;
+static double inputDouble;
+
+static int checkNumArgs()
+{
+ CheckInputArgument(pvApiCtx,1,1);
+ CheckOutputArgument(pvApiCtx,1,1);
+ return 1;
+}
+
+static int commonCodePart1(){
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ if(checkNumArgs()==0)
+ return 1;
+
+ //code to process input
+ if(getUIntFromScilab(1,&varIndex))
+ return 1;
+ iRet=sym_get_num_cols(global_sym_env,&numVars);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else if(varIndex>=numVars){
+ Scierror(999, "An error occured. Variable index must be a number between 0 and %d.\n",numVars-1);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int commonCodePart2(){
+ if(returnDoubleToScilab(retVal))
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_isContinuous(char *fname){
+
+ if(commonCodePart1())
+ return 1;
+
+ iRet=sym_is_continuous(global_sym_env,varIndex,&retVal);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured. Has a problem been loaded?\n");
+ return 1;
+ }else{
+ if(retVal)
+ sciprint("This variable is continuous.\n");
+ else
+ sciprint("This variable is not continuous.\n");
+ }
+
+ if(commonCodePart2())
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_isBinary(char *fname){
+
+ if(commonCodePart1())
+ return 1;
+
+ iRet=sym_is_binary(global_sym_env,varIndex,&retVal);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured.\n");
+ return 1;
+ }else{
+ if(retVal)
+ sciprint("This variable is constrained to be binary.\n");
+ else
+ sciprint("This variable is not constrained to be binary.\n");
+ }
+
+ if(commonCodePart2())
+ return 1;
+
+ return 0;
+}
+
+int sci_sym_isInteger(char *fname){
+
+ char retValc; //for some wierd reason this function unlike the above 2 returns a char
+
+ if(commonCodePart1())
+ return 1;
+
+ iRet=sym_is_integer(global_sym_env,varIndex,&retValc);
+ if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
+ Scierror(999, "An error occured.\n");
+ return 1;
+ }else{
+ if(retValc)
+ sciprint("This variable is constrained to be an integer.\n");
+ else
+ sciprint("This variable is not constrained to be an integer.\n");
+ }
+ retVal=retValc;
+
+ if(commonCodePart2())
+ return 1;
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/cpp/sym_data_query_functions.cpp b/sci_gateway/cpp/sym_data_query_functions.cpp
new file mode 100644
index 0000000..b0d0989
--- /dev/null
+++ b/sci_gateway/cpp/sym_data_query_functions.cpp
@@ -0,0 +1,404 @@
+/*
+ * Implementation Symphony Tool Box for Scilab
+ * sym_data_query_functions.cpp
+ * contains Data Query Functions( 13 functions)
+ * Author: Sai Kiran
+ */
+
+#include
+#include
+extern sym_environment* global_sym_env;//defined in globals.cpp
+
+extern "C" {
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+// Function to print termination status of a function
+void show_termination_status(int status) {
+ if (status == FUNCTION_TERMINATED_ABNORMALLY)
+ sciprint("\nFunction invoked unsuccessfully.\n");
+ //else
+ //sciprint("\nFunction invoked successfully.\n");
+ }
+
+/*
+ * Generelized function for sym_getNumVars,
+ * sym_getNumConstrs,sym_get_NumElements
+*/
+int sci_sym_get_num_int(char *fname, unsigned long fname_len){
+
+ int result=-1;/* Result of the callar */
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ; //no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ; //one output argument
+
+ /* Array of possible callers of this function */
+ char* arr_caller[]={"sym_getNumConstr","sym_getNumVar","sym_getNumElements"};
+
+ /* Array of functions to be called */
+ int (*fun[])(sym_environment*,int*)= { sym_get_num_rows,
+ sym_get_num_cols,
+ sym_get_num_elements
+ };
+
+ if(global_sym_env==NULL) //There is no environment opened.
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else {
+ //There is an environment opened
+ int iter=0,length=sizeof(arr_caller)/sizeof(char*),found_at= -1;
+ for (;iter < length ;++iter){
+ if (!strcmp(fname,arr_caller[iter]))
+ found_at=iter;
+ }
+ if (found_at != -1) {
+ int ret_val=fun[found_at](global_sym_env,&result);
+ show_termination_status(ret_val);
+ if (ret_val == FUNCTION_TERMINATED_ABNORMALLY)
+ result=-1;
+ }
+ else //very rare case
+ sciprint("\nError in function mapping in scilab script\n");
+ }
+
+ //Copy the result to scilab. Location is position next to input arguments.
+ return returnDoubleToScilab(result);
+ }
+
+/* This is generelized function for
+ * sym_getVarLower,sym_getVarUpper,sym_getRhs,sym_getConstrRange,sym_getConstrLower,
+ * sym_getConstrUpper and sym_getObjCoeff .
+ * (Functions taking symphony env and pointer to array of doubles as arguments)
+*/
+int sci_sym_get_dbl_arr(char *fname, unsigned long fname_len){
+
+ int result_len=0;/* Length of the output double array */
+ double *result=NULL;/* Pointer to output double array */
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ; //no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ; //one output argument
+
+ /* Array of possible callers of this function */
+ char* arr_caller[]={"sym_getVarLower","sym_getVarUpper",
+ "sym_getRhs","sym_getConstrRange",
+ "sym_getConstrLower","sym_getConstrUpper",
+ "sym_getObjCoeff"};
+
+ /* Array of functions to be called */
+ int (*fun[])(sym_environment*,double*)= {sym_get_col_lower,sym_get_col_upper,
+ sym_get_rhs,sym_get_row_range,
+ sym_get_row_lower,sym_get_row_upper,
+ sym_get_obj_coeff };
+
+ /* Array of functions the above functions depend on */
+ int (*fun_depends[])(sym_environment*,int*) = {sym_get_num_cols,sym_get_num_cols,
+ sym_get_num_rows,sym_get_num_rows,
+ sym_get_num_rows,sym_get_num_rows,
+ sym_get_num_cols };
+
+ /* We want to ouput row-matrix if we are dealing with column data .
+ * column matrix if we are dealing with row data .
+ * 0 - output a row matrix.
+ * 1 - output a column matrix.
+ */
+ int representation = 0; //output a row matrix
+
+ /* Array of representations of output depending on the above functions.
+ * It's length is same as above arrays.
+ */
+ int matrix_representation[] = { 0 ,0 , 1, 1, 1, 1, 0};
+ if(global_sym_env==NULL) //There is no environment opened.
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else {
+ //There is an environment opened
+ int iter=0,length=sizeof(arr_caller)/sizeof(char*),found_at= -1;
+ for (;iter < length ;++iter){
+ if (!strcmp(fname,arr_caller[iter]))
+ found_at=iter;
+ }
+ if (found_at != -1){
+ int status1=fun_depends[found_at](global_sym_env,&result_len);
+ if ( status1 == FUNCTION_TERMINATED_NORMALLY && result_len ) {
+ result=(double*)malloc( sizeof(double) * result_len );
+ int ret_val=fun[found_at](global_sym_env,result);
+ show_termination_status(ret_val);
+ if (ret_val == FUNCTION_TERMINATED_ABNORMALLY)
+ result_len=0;
+ else {
+ if (found_at == 6) {//if called function is sym_getObjCoeff
+ int iter=0,sense=0,status2 = sym_get_obj_sense(global_sym_env,&sense);
+ if (sense == -1) // Multiply with -1 while showing
+ for (;iter < result_len;++iter) result[iter] *= -1;
+ }
+ representation = matrix_representation[found_at];
+ }
+ }
+ else
+ sciprint("\n Is a problem loaded ? \n");
+ }
+ else //very rare case
+ sciprint("\nError in function mapping in scilab script\n");
+ }
+
+ //Copy the result to scilab. Location is position next to input arguments.
+ SciErr err;
+ if (representation) // output a column-matrix
+ err=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,result_len,1,result);
+ else // output a row-matrix
+ err=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,1,result_len,result);
+ free(result); //Free the allocated space
+ result=NULL; //Set to NULL
+ if (err.iErr){ //Process error
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ printError(&err, 0);
+ return 1;
+ }
+
+ //assign result position to output argument
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+
+/* This function returns rows sense of the problem loaded
+*/
+int sci_sym_get_row_sense(char *fname, unsigned long fname_len) {
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ; //no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ; //one output argument
+
+ // Create a dummy string
+ char *dummy=(char*)malloc(sizeof(char));
+ char **correct=NULL; // Correct result of the function
+ dummy[0]='\0';
+ char **row_senses=&dummy;
+ int num_rows=0;
+ if(global_sym_env==NULL) //There is no environment opened.
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else {
+ int status=sym_get_num_rows(global_sym_env,&num_rows);
+ if (status != FUNCTION_TERMINATED_ABNORMALLY) { //If function terminated normally
+ char senses[num_rows];
+ char *ptr=senses;
+ // Take rows sense from symphony
+ int status1=sym_get_row_sense(global_sym_env,ptr);
+ if (status1 == FUNCTION_TERMINATED_ABNORMALLY) {
+ sciprint("\n Is a problem loaded ? \n");
+ show_termination_status(status1);
+ row_senses=&dummy;
+ num_rows=0;
+ }
+ else { // If function terminated normally
+ // Convert every character to string
+ correct=(char**)malloc(sizeof(char*) * num_rows);
+ int iter=0;
+ for (;iter < num_rows;++iter) {
+ correct[iter]=(char*)malloc(sizeof(char)*2);
+ correct[iter][0]=senses[iter];
+ correct[iter][1]='\0';
+ }
+ row_senses=correct;
+ show_termination_status(status1);// Show termination status of caller
+ }
+ }
+ else show_termination_status(status);
+ }
+ // Write output to scilab memory
+ SciErr err=createMatrixOfString(pvApiCtx,nbInputArgument(pvApiCtx)+1,num_rows,1,row_senses);
+ free(dummy); //free dummy variable
+ dummy=NULL;
+ if (correct){ // If we have allocated
+ int iter=0;
+ for (;iter < num_rows;++iter){
+ free(correct[iter]); // Free each element in it
+ }
+ free(correct); // Free it
+ correct=NULL;
+ }
+ if (err.iErr){ //Process error
+ printError(&err, 0);
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 0;
+ }
+
+ //assign result position to output argument
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+
+/*
+ * Proto-type of function that converts column-major (sparse) representation
+ * to row-major (sparse) representation .
+*/
+void column_major_to_row_major(int,int,int,double *,int *,int *,double *,int *,int *);
+
+
+/* This function is to retrieve the problem's constraint matrix (sparse) .
+ * Symphony uses column-major (sparse) representation.
+ * Scilab uses row-major (sparse) representation.
+ * So, This function takes column-major (sparse) representation from symphony ,
+ * converts that to row-major (sparse) representation and writes to scilab's memory.
+ *
+ **/
+int sci_sym_get_matrix(char *fname, unsigned long fname_len){
+ int nz_ele=0;// No.of non-zero elements of the matrix
+ int rows=0; //No. of rows in constraint matrix
+ int columns=0; //No. of columns in constraint matrix
+
+ /* Variables that store column-major representation of matrix.
+ * These variables will be filled by symphony
+ */
+ int *column_start=NULL;// Starting index(in elements array) of each column
+ int *row_indices=NULL;// Row indices corresponding to each non-zero element
+ double *elements=NULL;// Non-zero elements of matrix
+
+ /* Variables that store row-major representation of matrix.
+ * Filled by a function column_major_to_row_major.
+ */
+ double *new_list=NULL; // Non-zero elements of row-major representation
+ int *count_per_row=NULL; //Count of non-zero elements in earch row
+ int *column_position=NULL; //Column of each non-zero element
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ; //no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ; //one output argument
+
+ if(global_sym_env==NULL) //There is no environment opened.
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else { //There is an environment opened
+ int status1=sym_get_num_elements(global_sym_env,&nz_ele); //No. of non-zero elements
+ int status2=sym_get_num_cols(global_sym_env , &columns); //Columns
+ int status3=sym_get_num_rows(global_sym_env , &rows); //Rows
+ int status4=FUNCTION_TERMINATED_ABNORMALLY;
+
+ //Make sure functions terminated normally
+ if (status1 == status2 && status1 == status3 && status1 == FUNCTION_TERMINATED_NORMALLY){
+ //Allocate memory for column-major representation
+ column_start=(int*)malloc(sizeof(int) * (columns+1));
+ row_indices=(int*)malloc(sizeof(int) * nz_ele);
+ elements=(double*)malloc(sizeof(double) * nz_ele);
+
+ //Take column-major representation from symphony
+ status4=sym_get_matrix(global_sym_env,&nz_ele,column_start,row_indices,elements);
+ if (status1 == status4) { //Check termination status of function, if normal
+ //Show status of caller as normal termination
+ show_termination_status(FUNCTION_TERMINATED_NORMALLY);
+
+ //Allocate memory for row-major representation
+ new_list=(double*) calloc( nz_ele , sizeof(double));
+ count_per_row=(int*) calloc( rows, sizeof(int ) );
+ column_position=(int*) calloc( nz_ele, sizeof(int));
+
+ //Convert column-major representation to row-major representation
+ column_major_to_row_major(rows,columns,nz_ele,elements,row_indices,column_start,new_list,count_per_row,column_position);
+
+ /*
+ (Important)Scilab considers indices from 1 , But we have column indices starting from 0 in column_position.
+ Hence add 1 to each index
+ */
+ int iter=0;
+ for (;iter < nz_ele ; ++iter) column_position[iter]++;
+
+ }
+ else { //If termination status is abnormal
+ show_termination_status(FUNCTION_TERMINATED_ABNORMALLY);
+ sciprint("\n Is a problem loaded ? \n");
+ }
+ }
+ else //If termination status of any of functions is abnormal
+ show_termination_status(FUNCTION_TERMINATED_ABNORMALLY);
+
+ }
+
+ //Copy the result to scilab. Location is position next to input arguments.
+ SciErr err=createSparseMatrix(pvApiCtx,nbInputArgument(pvApiCtx)+1,rows,columns,nz_ele,count_per_row,column_position,new_list);
+
+ /*
+ *Free allocated memory before exit
+ */
+ free(row_indices);
+ free(column_start);
+ free(elements);
+ free(new_list);
+ free(count_per_row);
+ free(column_position);
+
+ if (err.iErr){ //Process error
+ printError(&err, 0);
+ AssignOutputVariable(pvApiCtx, 1) = 0;
+ return 1;
+ }
+
+ //assign result position to output argument
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+
+/*
+ * It converts column-major representation to row-major representation
+ * :: ARGUMENTS ::
+ * rows - No. of rows IN
+ * columns - No. of columns IN
+ * nz_ele - No. of non-zero elements IN
+ * elements - Non-zero elements in column-major representation IN
+ * row_indices - Row index( starts from 0 : symphony) of each non-zero element IN
+ * column_start - Starting index in elements of each column IN
+ * new_list - Non-zero elements in row-major representation OUT
+ * count_per_row - Count of non-zero elements in each row OUT
+ * column_position - Column index ( starts from 0 (we'll add 1 to each index later)) of each non-zero element OUT
+*/
+void column_major_to_row_major(int rows,int columns,int nz_ele,double *elements,int *row_indices,int *column_start,double *new_list,int *count_per_row,int *column_position) {
+
+ int iter=0,iter2,iter3=0,index=0;
+ for (iter=0;iter < rows;++iter) {
+ for (iter2=0;iter2 < nz_ele;++iter2) {
+ if (row_indices[iter2] == iter) {
+ count_per_row[iter]++; //Count of non-zero elements per row.
+ new_list[index]=elements[iter2];
+ for (iter3=0; iter3 < columns+1 ; ++iter3) {
+ if (iter2 < column_start[iter3])
+ break;
+ }
+ column_position[index] = iter3 - 1;
+ index++ ;
+ }
+ }
+ }
+ }
+
+
+/*
+ * This function is used to get iteration count after solving a problem
+*/
+int sci_sym_get_iteration_count(char *fname, unsigned long fname_len){
+
+ //check whether we have no input and one output argument or not
+ CheckInputArgument(pvApiCtx, 0, 0) ; //no input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ; //one output argument
+
+ int iteration_count=0; // return value to the caller
+ if(global_sym_env==NULL) //There is no environment opened.
+ sciprint("Error: Symphony environment is not initialized.\n");
+ else { //There is an environment opened
+ //Call symphony function
+ int status=sym_get_iteration_count(global_sym_env,&iteration_count);
+ show_termination_status(status);
+ if (status == FUNCTION_TERMINATED_ABNORMALLY) {
+ sciprint("\nHave you solved a problem ?\n");
+ iteration_count = 0;
+ }
+ }
+ // Write the result to scilab
+ return returnDoubleToScilab(iteration_count);
+ }
+
+}
diff --git a/sci_gateway/cpp/template.cpp b/sci_gateway/cpp/template.cpp
new file mode 100644
index 0000000..a835fc3
--- /dev/null
+++ b/sci_gateway/cpp/template.cpp
@@ -0,0 +1,43 @@
+/*
+ * Symphony Toolbox
+ *
+ *
+ */
+#include "symphony.h"
+#include "sci_iofunc.hpp"
+
+extern sym_environment* global_sym_env; //defined in globals.cpp
+
+extern "C" {
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "BOOL.h"
+#include
+
+int sci_template(char *fname){
+
+ //error management variable
+ SciErr sciErr;
+ int iRet;
+
+ //data declarations
+
+ //ensure that environment is active
+ if(global_sym_env==NULL){
+ sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
+ return 1;
+ }
+
+ //code to check arguments and get them
+ CheckInputArgument(pvApiCtx, , ) ;
+ CheckOutputArgument(pvApiCtx, , ) ;
+
+ //code to process input
+
+ //code to give output
+
+ return 0;
+}
+
+}
diff --git a/sci_gateway/loader_gateway.sce b/sci_gateway/loader_gateway.sce
new file mode 100644
index 0000000..6809d99
--- /dev/null
+++ b/sci_gateway/loader_gateway.sce
@@ -0,0 +1,24 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// Generated by builder_gateway.sce: Please, do not edit this file
+
+try
+ v = getversion("scilab");
+catch
+ v = [ 5 0 ]; // or older
+end
+if (v(1) <= 5) & (v(2) < 3) then
+ // new API in scilab 5.3
+ error(gettext("Scilab 5.3 or more is required."));
+end
+
+sci_gateway_dir = get_absolute_file_path("loader_gateway.sce");
+current_dir = pwd();
+
+chdir(sci_gateway_dir);
+if ( isdir("cpp") ) then
+ chdir("cpp");
+ exec("loader.sce");
+end
+
+chdir(current_dir);
+clear sci_gateway_dir current_dir v;
diff --git a/tests/unit_tests/symphony_base.dia.ref b/tests/unit_tests/symphony_base.dia.ref
new file mode 100644
index 0000000..95339e2
--- /dev/null
+++ b/tests/unit_tests/symphony_base.dia.ref
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then bugmes();quit;end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then bugmes();quit;end
+//endfunction
+
+
diff --git a/tests/unit_tests/symphony_base.tst b/tests/unit_tests/symphony_base.tst
new file mode 100644
index 0000000..fd11db0
--- /dev/null
+++ b/tests/unit_tests/symphony_base.tst
@@ -0,0 +1,87 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Keyur Joshi and Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: harpreet.mertia@gmail.com
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+// Objective function
+c = [350*5,330*3,310*4,280*6,500,450,400,100]
+
+// Lower Bound of variable
+lb = repmat(0,1,8);
+
+// Upper Bound of variables
+ub = [repmat(1,1,4) repmat(%inf,1,4)];
+
+// Constraint Matrix
+conMatrix = [5,3,4,6,1,1,1,1;
+ 5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
+ 5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
+
+// Lower Bound of constrains
+conlb = [ 25; 1.25; 1.25]
+
+// Upper Bound of constrains
+conub = [ 25; 1.25; 1.25]
+
+// Row Matrix for telling symphony that the is integer or not
+isInt = [repmat(%t,1,4) repmat(%f,1,4)];
+
+// Calling Symphony
+[x,f,iter] = symphony(8,3,c,isInt,lb,ub,conMatrix,conlb,conub,1);
+
+//In Symphony Library for optimal solution status = 227
+status = sym_getStatus();
+
+assert_close ( x , [1 1 0 1 7.25 0 0.25 3.5] , 1.e-7 );
+assert_close ( f , [ 8495] , 1.e-7 );
+
+assert_checkequal( status , 227 );
diff --git a/thirdparty/linux/include/coin/CbcOrClpParam.cpp b/thirdparty/linux/include/coin/CbcOrClpParam.cpp
new file mode 100644
index 0000000..b434fe0
--- /dev/null
+++ b/thirdparty/linux/include/coin/CbcOrClpParam.cpp
@@ -0,0 +1,4104 @@
+/* $Id: CbcOrClpParam.cpp 2079 2015-01-05 13:11:35Z forrest $ */
+// Copyright (C) 2002, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#include "CoinPragma.hpp"
+#include "CoinTime.hpp"
+#include "CbcOrClpParam.hpp"
+
+#include
+#include
+#include
+
+#ifdef COIN_HAS_CBC
+#ifdef COIN_HAS_CLP
+#include "OsiClpSolverInterface.hpp"
+#include "ClpSimplex.hpp"
+#endif
+#include "CbcModel.hpp"
+#endif
+#include "CoinHelperFunctions.hpp"
+#ifdef COIN_HAS_CLP
+#include "ClpSimplex.hpp"
+#include "ClpFactorization.hpp"
+#endif
+#ifdef COIN_HAS_READLINE
+#include
+#include
+#endif
+#ifdef COIN_HAS_CBC
+// from CoinSolve
+static char coin_prompt[] = "Coin:";
+#else
+static char coin_prompt[] = "Clp:";
+#endif
+#ifdef CLP_CILK
+#ifndef CBC_THREAD
+#define CBC_THREAD
+#endif
+#endif
+#if defined(COIN_HAS_WSMP) && ! defined(USE_EKKWSSMP)
+#ifndef CBC_THREAD
+#define CBC_THREAD
+#endif
+#endif
+#include "ClpConfig.h"
+#ifdef CLP_HAS_ABC
+#include "AbcCommon.hpp"
+#endif
+static bool doPrinting = true;
+std::string afterEquals = "";
+static char printArray[200];
+#if COIN_INT_MAX==0
+#undef COIN_INT_MAX
+#define COIN_INT_MAX 2147483647
+#endif
+void setCbcOrClpPrinting(bool yesNo)
+{
+ doPrinting = yesNo;
+}
+//#############################################################################
+// Constructors / Destructor / Assignment
+//#############################################################################
+
+//-------------------------------------------------------------------
+// Default Constructor
+//-------------------------------------------------------------------
+CbcOrClpParam::CbcOrClpParam ()
+ : type_(CBC_PARAM_NOTUSED_INVALID),
+ lowerDoubleValue_(0.0),
+ upperDoubleValue_(0.0),
+ lowerIntValue_(0),
+ upperIntValue_(0),
+ lengthName_(0),
+ lengthMatch_(0),
+ definedKeyWords_(),
+ name_(),
+ shortHelp_(),
+ longHelp_(),
+ action_(CBC_PARAM_NOTUSED_INVALID),
+ currentKeyWord_(-1),
+ display_(0),
+ intValue_(-1),
+ doubleValue_(-1.0),
+ stringValue_(""),
+ whereUsed_(7),
+ fakeKeyWord_(-1),
+ fakeValue_(0)
+{
+}
+// Other constructors
+CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
+ double lower, double upper, CbcOrClpParameterType type,
+ int display)
+ : type_(type),
+ lowerIntValue_(0),
+ upperIntValue_(0),
+ definedKeyWords_(),
+ name_(name),
+ shortHelp_(help),
+ longHelp_(),
+ action_(type),
+ currentKeyWord_(-1),
+ display_(display),
+ intValue_(-1),
+ doubleValue_(-1.0),
+ stringValue_(""),
+ whereUsed_(7),
+ fakeKeyWord_(-1),
+ fakeValue_(0)
+{
+ lowerDoubleValue_ = lower;
+ upperDoubleValue_ = upper;
+ gutsOfConstructor();
+}
+CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
+ int lower, int upper, CbcOrClpParameterType type,
+ int display)
+ : type_(type),
+ lowerDoubleValue_(0.0),
+ upperDoubleValue_(0.0),
+ definedKeyWords_(),
+ name_(name),
+ shortHelp_(help),
+ longHelp_(),
+ action_(type),
+ currentKeyWord_(-1),
+ display_(display),
+ intValue_(-1),
+ doubleValue_(-1.0),
+ stringValue_(""),
+ whereUsed_(7),
+ fakeKeyWord_(-1),
+ fakeValue_(0)
+{
+ gutsOfConstructor();
+ lowerIntValue_ = lower;
+ upperIntValue_ = upper;
+}
+// Other strings will be added by append
+CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
+ std::string firstValue,
+ CbcOrClpParameterType type, int whereUsed,
+ int display)
+ : type_(type),
+ lowerDoubleValue_(0.0),
+ upperDoubleValue_(0.0),
+ lowerIntValue_(0),
+ upperIntValue_(0),
+ definedKeyWords_(),
+ name_(name),
+ shortHelp_(help),
+ longHelp_(),
+ action_(type),
+ currentKeyWord_(0),
+ display_(display),
+ intValue_(-1),
+ doubleValue_(-1.0),
+ stringValue_(""),
+ whereUsed_(whereUsed),
+ fakeKeyWord_(-1),
+ fakeValue_(0)
+{
+ gutsOfConstructor();
+ definedKeyWords_.push_back(firstValue);
+}
+// Action
+CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
+ CbcOrClpParameterType type, int whereUsed,
+ int display)
+ : type_(type),
+ lowerDoubleValue_(0.0),
+ upperDoubleValue_(0.0),
+ lowerIntValue_(0),
+ upperIntValue_(0),
+ definedKeyWords_(),
+ name_(name),
+ shortHelp_(help),
+ longHelp_(),
+ action_(type),
+ currentKeyWord_(-1),
+ display_(display),
+ intValue_(-1),
+ doubleValue_(-1.0),
+ stringValue_(""),
+ fakeKeyWord_(-1),
+ fakeValue_(0)
+{
+ whereUsed_ = whereUsed;
+ gutsOfConstructor();
+}
+
+//-------------------------------------------------------------------
+// Copy constructor
+//-------------------------------------------------------------------
+CbcOrClpParam::CbcOrClpParam (const CbcOrClpParam & rhs)
+{
+ type_ = rhs.type_;
+ lowerDoubleValue_ = rhs.lowerDoubleValue_;
+ upperDoubleValue_ = rhs.upperDoubleValue_;
+ lowerIntValue_ = rhs.lowerIntValue_;
+ upperIntValue_ = rhs.upperIntValue_;
+ lengthName_ = rhs.lengthName_;
+ lengthMatch_ = rhs.lengthMatch_;
+ definedKeyWords_ = rhs.definedKeyWords_;
+ name_ = rhs.name_;
+ shortHelp_ = rhs.shortHelp_;
+ longHelp_ = rhs.longHelp_;
+ action_ = rhs.action_;
+ currentKeyWord_ = rhs.currentKeyWord_;
+ display_ = rhs.display_;
+ intValue_ = rhs.intValue_;
+ doubleValue_ = rhs.doubleValue_;
+ stringValue_ = rhs.stringValue_;
+ whereUsed_ = rhs.whereUsed_;
+ fakeKeyWord_ = rhs.fakeKeyWord_;
+ fakeValue_ = rhs.fakeValue_;
+}
+
+//-------------------------------------------------------------------
+// Destructor
+//-------------------------------------------------------------------
+CbcOrClpParam::~CbcOrClpParam ()
+{
+}
+
+//----------------------------------------------------------------
+// Assignment operator
+//-------------------------------------------------------------------
+CbcOrClpParam &
+CbcOrClpParam::operator=(const CbcOrClpParam & rhs)
+{
+ if (this != &rhs) {
+ type_ = rhs.type_;
+ lowerDoubleValue_ = rhs.lowerDoubleValue_;
+ upperDoubleValue_ = rhs.upperDoubleValue_;
+ lowerIntValue_ = rhs.lowerIntValue_;
+ upperIntValue_ = rhs.upperIntValue_;
+ lengthName_ = rhs.lengthName_;
+ lengthMatch_ = rhs.lengthMatch_;
+ definedKeyWords_ = rhs.definedKeyWords_;
+ name_ = rhs.name_;
+ shortHelp_ = rhs.shortHelp_;
+ longHelp_ = rhs.longHelp_;
+ action_ = rhs.action_;
+ currentKeyWord_ = rhs.currentKeyWord_;
+ display_ = rhs.display_;
+ intValue_ = rhs.intValue_;
+ doubleValue_ = rhs.doubleValue_;
+ stringValue_ = rhs.stringValue_;
+ whereUsed_ = rhs.whereUsed_;
+ fakeKeyWord_ = rhs.fakeKeyWord_;
+ fakeValue_ = rhs.fakeValue_;
+ }
+ return *this;
+}
+void
+CbcOrClpParam::gutsOfConstructor()
+{
+ std::string::size_type shriekPos = name_.find('!');
+ lengthName_ = static_cast(name_.length());
+ if ( shriekPos == std::string::npos ) {
+ //does not contain '!'
+ lengthMatch_ = lengthName_;
+ } else {
+ lengthMatch_ = static_cast(shriekPos);
+ name_ = name_.substr(0, shriekPos) + name_.substr(shriekPos + 1);
+ lengthName_--;
+ }
+}
+// Sets value of fake keyword to current size of keywords
+void
+CbcOrClpParam::setFakeKeyWord(int fakeValue)
+{
+ fakeKeyWord_ = static_cast(definedKeyWords_.size());
+ assert (fakeKeyWord_>0);
+ fakeValue_ = fakeValue;
+ assert (fakeValue_>=0);
+}
+/* Returns current parameter option position
+ but if fake keyword returns fakeValue_
+*/
+int
+CbcOrClpParam::currentOptionAsInteger ( ) const
+{
+ int fakeInteger;
+ return currentOptionAsInteger(fakeInteger);
+}
+/* Returns current parameter option position
+ but if fake keyword returns fakeValue_ and sets
+ fakeInteger to value
+*/
+int
+CbcOrClpParam::currentOptionAsInteger ( int & fakeInteger ) const
+{
+ fakeInteger=-COIN_INT_MAX;
+ if (fakeKeyWord_<0) {
+ return currentKeyWord_;
+ } else if (currentKeyWord_>=0&¤tKeyWord_ lengthName_) {
+ return 0;
+ } else {
+ unsigned int i;
+ for (i = 0; i < input.length(); i++) {
+ if (tolower(name_[i]) != tolower(input[i]))
+ break;
+ }
+ if (i < input.length()) {
+ return 0;
+ } else if (i >= lengthMatch_) {
+ return 1;
+ } else {
+ // matched but too short
+ return 2;
+ }
+ }
+}
+// Returns name which could match
+std::string
+CbcOrClpParam::matchName ( ) const
+{
+ if (lengthMatch_ == lengthName_)
+ return name_;
+ else
+ return name_.substr(0, lengthMatch_) + "(" + name_.substr(lengthMatch_) + ")";
+}
+
+// Returns parameter option which matches (-1 if none)
+int
+CbcOrClpParam::parameterOption ( std::string check ) const
+{
+ int numberItems = static_cast(definedKeyWords_.size());
+ if (!numberItems) {
+ return -1;
+ } else {
+ int whichItem = 0;
+ unsigned int it;
+ for (it = 0; it < definedKeyWords_.size(); it++) {
+ std::string thisOne = definedKeyWords_[it];
+ std::string::size_type shriekPos = thisOne.find('!');
+ size_t length1 = thisOne.length();
+ size_t length2 = length1;
+ if ( shriekPos != std::string::npos ) {
+ //contains '!'
+ length2 = shriekPos;
+ thisOne = thisOne.substr(0, shriekPos) +
+ thisOne.substr(shriekPos + 1);
+ length1 = thisOne.length();
+ }
+ if (check.length() <= length1 && length2 <= check.length()) {
+ unsigned int i;
+ for (i = 0; i < check.length(); i++) {
+ if (tolower(thisOne[i]) != tolower(check[i]))
+ break;
+ }
+ if (i < check.length()) {
+ whichItem++;
+ } else if (i >= length2) {
+ break;
+ }
+ } else {
+ whichItem++;
+ }
+ }
+ if (whichItem < numberItems) {
+ return whichItem;
+ } else {
+ if (fakeKeyWord_<=0)
+ return -1;
+ // allow plus or minus
+ int n;
+ if (check.substr(0,4)=="plus"||check.substr(0,4)=="PLUS") {
+ n = 4;
+ } else if (check.substr(0,5)=="minus"||check.substr(0,5)=="MINUS") {
+ n = 5;
+ } else {
+ return -1;
+ }
+ int value = 0;
+ std::string field=check.substr(n);
+ if (field != "EOL") {
+ const char * start = field.c_str();
+ char * endPointer = NULL;
+ // check valid
+ value = static_cast(strtol(start, &endPointer, 10));
+ if (*endPointer != '\0') {
+ return -1;
+ }
+ if (n==4)
+ return value + 1000;
+ else
+ return -value - 1000;
+ } else {
+ return -1;
+ }
+ }
+ }
+}
+// Prints parameter options
+void
+CbcOrClpParam::printOptions ( ) const
+{
+ std::cout << "= 0 && currentKeyWord_ < static_cast(definedKeyWords_.size()));
+ std::string current = definedKeyWords_[currentKeyWord_];
+ std::string::size_type shriekPos = current.find('!');
+ if ( shriekPos != std::string::npos ) {
+ //contains '!'
+ current = current.substr(0, shriekPos) +
+ "(" + current.substr(shriekPos + 1) + ")";
+ }
+ std::cout << ";\n\tcurrent " << current << ">" << std::endl;
+}
+// Print action and string
+void
+CbcOrClpParam::printString() const
+{
+ if (name_ == "directory")
+ std::cout << "Current working directory is " << stringValue_ << std::endl;
+ else if (name_.substr(0, 6) == "printM")
+ std::cout << "Current value of printMask is " << stringValue_ << std::endl;
+ else
+ std::cout << "Current default (if $ as parameter) for " << name_
+ << " is " << stringValue_ << std::endl;
+}
+void CoinReadPrintit(const char * input)
+{
+ int length = static_cast(strlen(input));
+ char temp[101];
+ int i;
+ int n = 0;
+ for (i = 0; i < length; i++) {
+ if (input[i] == '\n') {
+ temp[n] = '\0';
+ std::cout << temp << std::endl;
+ n = 0;
+ } else if (n >= 65 && input[i] == ' ') {
+ temp[n] = '\0';
+ std::cout << temp << std::endl;
+ n = 0;
+ } else if (n || input[i] != ' ') {
+ temp[n++] = input[i];
+ }
+ }
+ if (n) {
+ temp[n] = '\0';
+ std::cout << temp << std::endl;
+ }
+}
+// Print Long help
+void
+CbcOrClpParam::printLongHelp() const
+{
+ if (type_ >= 1 && type_ < 400) {
+ CoinReadPrintit(longHelp_.c_str());
+ if (type_ < CLP_PARAM_INT_SOLVERLOGLEVEL) {
+ printf("\n", lowerDoubleValue_, upperDoubleValue_, doubleValue_);
+ assert (upperDoubleValue_ > lowerDoubleValue_);
+ } else if (type_ < CLP_PARAM_STR_DIRECTION) {
+ printf("\n", lowerIntValue_, upperIntValue_, intValue_);
+ assert (upperIntValue_ > lowerIntValue_);
+ } else if (type_ < CLP_PARAM_ACTION_DIRECTORY) {
+ printOptions();
+ }
+ }
+}
+#ifdef COIN_HAS_CBC
+int
+CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model, double value)
+{
+ int returnCode;
+ setDoubleParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets double parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setDoubleParameterWithMessage ( OsiSolverInterface * model, double value , int & returnCode)
+{
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ sprintf(printArray, "%g was provided for %s - valid range is %g to %g",
+ value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_);
+ std::cout << value << " was provided for " << name_ <<
+ " - valid range is " << lowerDoubleValue_ << " to " <<
+ upperDoubleValue_ << std::endl;
+ returnCode = 1;
+ } else {
+ double oldValue = doubleValue_;
+ doubleValue_ = value;
+ switch (type_) {
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ model->getDblParam(OsiDualTolerance, oldValue);
+ model->setDblParam(OsiDualTolerance, value);
+ break;
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ model->getDblParam(OsiPrimalTolerance, oldValue);
+ model->setDblParam(OsiPrimalTolerance, value);
+ break;
+ default:
+ break;
+ }
+ sprintf(printArray, "%s was changed from %g to %g",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ }
+ return printArray;
+}
+#endif
+#ifdef COIN_HAS_CLP
+int
+CbcOrClpParam::setDoubleParameter (ClpSimplex * model, double value)
+{
+ int returnCode;
+ setDoubleParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets int parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setDoubleParameterWithMessage ( ClpSimplex * model, double value , int & returnCode)
+{
+ double oldValue = doubleValue_;
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ sprintf(printArray, "%g was provided for %s - valid range is %g to %g",
+ value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_);
+ returnCode = 1;
+ } else {
+ sprintf(printArray, "%s was changed from %g to %g",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ doubleValue_ = value;
+ switch (type_) {
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ model->setDualTolerance(value);
+ break;
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ model->setPrimalTolerance(value);
+ break;
+ case CLP_PARAM_DBL_ZEROTOLERANCE:
+ model->setSmallElementValue(value);
+ break;
+ case CLP_PARAM_DBL_DUALBOUND:
+ model->setDualBound(value);
+ break;
+ case CLP_PARAM_DBL_PRIMALWEIGHT:
+ model->setInfeasibilityCost(value);
+ break;
+#ifndef COIN_HAS_CBC
+ case CLP_PARAM_DBL_TIMELIMIT:
+ model->setMaximumSeconds(value);
+ break;
+#endif
+ case CLP_PARAM_DBL_OBJSCALE:
+ model->setObjectiveScale(value);
+ break;
+ case CLP_PARAM_DBL_RHSSCALE:
+ model->setRhsScale(value);
+ break;
+ case CLP_PARAM_DBL_PRESOLVETOLERANCE:
+ model->setDblParam(ClpPresolveTolerance, value);
+ break;
+ default:
+ break;
+ }
+ }
+ return printArray;
+}
+double
+CbcOrClpParam::doubleParameter (ClpSimplex * model) const
+{
+ double value;
+ switch (type_) {
+#ifndef COIN_HAS_CBC
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ value = model->dualTolerance();
+ break;
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ value = model->primalTolerance();
+ break;
+#endif
+ case CLP_PARAM_DBL_ZEROTOLERANCE:
+ value = model->getSmallElementValue();
+ break;
+ case CLP_PARAM_DBL_DUALBOUND:
+ value = model->dualBound();
+ break;
+ case CLP_PARAM_DBL_PRIMALWEIGHT:
+ value = model->infeasibilityCost();
+ break;
+#ifndef COIN_HAS_CBC
+ case CLP_PARAM_DBL_TIMELIMIT:
+ value = model->maximumSeconds();
+ break;
+#endif
+ case CLP_PARAM_DBL_OBJSCALE:
+ value = model->objectiveScale();
+ break;
+ case CLP_PARAM_DBL_RHSSCALE:
+ value = model->rhsScale();
+ break;
+ default:
+ value = doubleValue_;
+ break;
+ }
+ return value;
+}
+int
+CbcOrClpParam::setIntParameter (ClpSimplex * model, int value)
+{
+ int returnCode;
+ setIntParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets int parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setIntParameterWithMessage ( ClpSimplex * model, int value , int & returnCode)
+{
+ int oldValue = intValue_;
+ if (value < lowerIntValue_ || value > upperIntValue_) {
+ sprintf(printArray, "%d was provided for %s - valid range is %d to %d",
+ value, name_.c_str(), lowerIntValue_, upperIntValue_);
+ returnCode = 1;
+ } else {
+ intValue_ = value;
+ sprintf(printArray, "%s was changed from %d to %d",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ switch (type_) {
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ model->setLogLevel(value);
+ if (value > 2)
+ model->factorization()->messageLevel(8);
+ else
+ model->factorization()->messageLevel(0);
+ break;
+ case CLP_PARAM_INT_MAXFACTOR:
+ model->factorization()->maximumPivots(value);
+ break;
+ case CLP_PARAM_INT_PERTVALUE:
+ model->setPerturbation(value);
+ break;
+ case CLP_PARAM_INT_MAXITERATION:
+ model->setMaximumIterations(value);
+ break;
+ case CLP_PARAM_INT_SPECIALOPTIONS:
+ model->setSpecialOptions(value);
+ break;
+ case CLP_PARAM_INT_RANDOMSEED:
+ {
+ if (value==0) {
+ double time = fabs(CoinGetTimeOfDay());
+ while (time>=COIN_INT_MAX)
+ time *= 0.5;
+ value = static_cast(time);
+ sprintf(printArray, "using time of day %s was changed from %d to %d",
+ name_.c_str(), oldValue, value);
+ }
+ model->setRandomSeed(value);
+ }
+ break;
+ case CLP_PARAM_INT_MORESPECIALOPTIONS:
+ model->setMoreSpecialOptions(value);
+ break;
+#ifndef COIN_HAS_CBC
+#ifdef CBC_THREAD
+ case CBC_PARAM_INT_THREADS:
+ model->setNumberThreads(value);
+ break;
+#endif
+#endif
+ default:
+ break;
+ }
+ }
+ return printArray;
+}
+int
+CbcOrClpParam::intParameter (ClpSimplex * model) const
+{
+ int value;
+ switch (type_) {
+#ifndef COIN_HAS_CBC
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ value = model->logLevel();
+ break;
+#endif
+ case CLP_PARAM_INT_MAXFACTOR:
+ value = model->factorization()->maximumPivots();
+ break;
+ break;
+ case CLP_PARAM_INT_PERTVALUE:
+ value = model->perturbation();
+ break;
+ case CLP_PARAM_INT_MAXITERATION:
+ value = model->maximumIterations();
+ break;
+ case CLP_PARAM_INT_SPECIALOPTIONS:
+ value = model->specialOptions();
+ break;
+ case CLP_PARAM_INT_RANDOMSEED:
+ value = model->randomNumberGenerator()->getSeed();
+ break;
+ case CLP_PARAM_INT_MORESPECIALOPTIONS:
+ value = model->moreSpecialOptions();
+ break;
+#ifndef COIN_HAS_CBC
+#ifdef CBC_THREAD
+ case CBC_PARAM_INT_THREADS:
+ value = model->numberThreads();
+ break;
+#endif
+#endif
+ default:
+ value = intValue_;
+ break;
+ }
+ return value;
+}
+#endif
+int
+CbcOrClpParam::checkDoubleParameter (double value) const
+{
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ std::cout << value << " was provided for " << name_ <<
+ " - valid range is " << lowerDoubleValue_ << " to " <<
+ upperDoubleValue_ << std::endl;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+#ifdef COIN_HAS_CBC
+double
+CbcOrClpParam::doubleParameter (OsiSolverInterface *
+#ifndef NDEBUG
+ model
+#endif
+ ) const
+{
+ double value = 0.0;
+ switch (type_) {
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ assert(model->getDblParam(OsiDualTolerance, value));
+ break;
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ assert(model->getDblParam(OsiPrimalTolerance, value));
+ break;
+ default:
+ return doubleValue_;
+ break;
+ }
+ return value;
+}
+int
+CbcOrClpParam::setIntParameter (OsiSolverInterface * model, int value)
+{
+ int returnCode;
+ setIntParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets int parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setIntParameterWithMessage ( OsiSolverInterface * model, int value , int & returnCode)
+{
+ if (value < lowerIntValue_ || value > upperIntValue_) {
+ sprintf(printArray, "%d was provided for %s - valid range is %d to %d",
+ value, name_.c_str(), lowerIntValue_, upperIntValue_);
+ returnCode = 1;
+ } else {
+ int oldValue = intValue_;
+ intValue_ = oldValue;
+ switch (type_) {
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ model->messageHandler()->setLogLevel(value);
+ break;
+ default:
+ break;
+ }
+ sprintf(printArray, "%s was changed from %d to %d",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ }
+ return printArray;
+}
+int
+CbcOrClpParam::intParameter (OsiSolverInterface * model) const
+{
+ int value = 0;
+ switch (type_) {
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ value = model->messageHandler()->logLevel();
+ break;
+ default:
+ value = intValue_;
+ break;
+ }
+ return value;
+}
+int
+CbcOrClpParam::setDoubleParameter (CbcModel &model, double value)
+{
+ int returnCode=0;
+ setDoubleParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets double parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setDoubleParameterWithMessage ( CbcModel & model, double value , int & returnCode)
+{
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ sprintf(printArray, "%g was provided for %s - valid range is %g to %g",
+ value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_);
+ returnCode = 1;
+ } else {
+ double oldValue = doubleValue_;
+ doubleValue_ = value;
+ switch (type_) {
+ case CBC_PARAM_DBL_INFEASIBILITYWEIGHT:
+ oldValue = model.getDblParam(CbcModel::CbcInfeasibilityWeight);
+ model.setDblParam(CbcModel::CbcInfeasibilityWeight, value);
+ break;
+ case CBC_PARAM_DBL_INTEGERTOLERANCE:
+ oldValue = model.getDblParam(CbcModel::CbcIntegerTolerance);
+ model.setDblParam(CbcModel::CbcIntegerTolerance, value);
+ break;
+ case CBC_PARAM_DBL_INCREMENT:
+ oldValue = model.getDblParam(CbcModel::CbcCutoffIncrement);
+ model.setDblParam(CbcModel::CbcCutoffIncrement, value);
+ case CBC_PARAM_DBL_ALLOWABLEGAP:
+ oldValue = model.getDblParam(CbcModel::CbcAllowableGap);
+ model.setDblParam(CbcModel::CbcAllowableGap, value);
+ break;
+ case CBC_PARAM_DBL_GAPRATIO:
+ oldValue = model.getDblParam(CbcModel::CbcAllowableFractionGap);
+ model.setDblParam(CbcModel::CbcAllowableFractionGap, value);
+ break;
+ case CBC_PARAM_DBL_CUTOFF:
+ oldValue = model.getCutoff();
+ model.setCutoff(value);
+ break;
+ case CBC_PARAM_DBL_TIMELIMIT_BAB:
+ oldValue = model.getDblParam(CbcModel::CbcMaximumSeconds) ;
+ {
+ //OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver());
+ //ClpSimplex * lpSolver = clpSolver->getModelPtr();
+ //lpSolver->setMaximumSeconds(value);
+ model.setDblParam(CbcModel::CbcMaximumSeconds, value) ;
+ }
+ break ;
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ setDoubleParameter(model.solver(), value);
+ return 0; // to avoid message
+ default:
+ break;
+ }
+ sprintf(printArray, "%s was changed from %g to %g",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ }
+ return printArray;
+}
+double
+CbcOrClpParam::doubleParameter (CbcModel &model) const
+{
+ double value;
+ switch (type_) {
+ case CBC_PARAM_DBL_INFEASIBILITYWEIGHT:
+ value = model.getDblParam(CbcModel::CbcInfeasibilityWeight);
+ break;
+ case CBC_PARAM_DBL_INTEGERTOLERANCE:
+ value = model.getDblParam(CbcModel::CbcIntegerTolerance);
+ break;
+ case CBC_PARAM_DBL_INCREMENT:
+ value = model.getDblParam(CbcModel::CbcCutoffIncrement);
+ break;
+ case CBC_PARAM_DBL_ALLOWABLEGAP:
+ value = model.getDblParam(CbcModel::CbcAllowableGap);
+ break;
+ case CBC_PARAM_DBL_GAPRATIO:
+ value = model.getDblParam(CbcModel::CbcAllowableFractionGap);
+ break;
+ case CBC_PARAM_DBL_CUTOFF:
+ value = model.getCutoff();
+ break;
+ case CBC_PARAM_DBL_TIMELIMIT_BAB:
+ value = model.getDblParam(CbcModel::CbcMaximumSeconds) ;
+ break ;
+ case CLP_PARAM_DBL_DUALTOLERANCE:
+ case CLP_PARAM_DBL_PRIMALTOLERANCE:
+ value = doubleParameter(model.solver());
+ break;
+ default:
+ value = doubleValue_;
+ break;
+ }
+ return value;
+}
+int
+CbcOrClpParam::setIntParameter (CbcModel &model, int value)
+{
+ int returnCode;
+ setIntParameterWithMessage(model, value, returnCode);
+ if (doPrinting && strlen(printArray))
+ std::cout << printArray << std::endl;
+ return returnCode;
+}
+// Sets int parameter and returns printable string and error code
+const char *
+CbcOrClpParam::setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode)
+{
+ if (value < lowerIntValue_ || value > upperIntValue_) {
+ sprintf(printArray, "%d was provided for %s - valid range is %d to %d",
+ value, name_.c_str(), lowerIntValue_, upperIntValue_);
+ returnCode = 1;
+ } else {
+ printArray[0] = '\0';
+ if (value==intValue_)
+ return printArray;
+ int oldValue = intValue_;
+ intValue_ = value;
+ switch (type_) {
+ case CLP_PARAM_INT_LOGLEVEL:
+ oldValue = model.messageHandler()->logLevel();
+ model.messageHandler()->setLogLevel(CoinAbs(value));
+ break;
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ oldValue = model.solver()->messageHandler()->logLevel();
+ model.solver()->messageHandler()->setLogLevel(value);
+ break;
+ case CBC_PARAM_INT_MAXNODES:
+ oldValue = model.getIntParam(CbcModel::CbcMaxNumNode);
+ model.setIntParam(CbcModel::CbcMaxNumNode, value);
+ break;
+ case CBC_PARAM_INT_MAXSOLS:
+ oldValue = model.getIntParam(CbcModel::CbcMaxNumSol);
+ model.setIntParam(CbcModel::CbcMaxNumSol, value);
+ break;
+ case CBC_PARAM_INT_MAXSAVEDSOLS:
+ oldValue = model.maximumSavedSolutions();
+ model.setMaximumSavedSolutions(value);
+ break;
+ case CBC_PARAM_INT_STRONGBRANCHING:
+ oldValue = model.numberStrong();
+ model.setNumberStrong(value);
+ break;
+ case CBC_PARAM_INT_NUMBERBEFORE:
+ oldValue = model.numberBeforeTrust();
+ model.setNumberBeforeTrust(value);
+ break;
+ case CBC_PARAM_INT_NUMBERANALYZE:
+ oldValue = model.numberAnalyzeIterations();
+ model.setNumberAnalyzeIterations(value);
+ break;
+ case CBC_PARAM_INT_CUTPASSINTREE:
+ oldValue = model.getMaximumCutPasses();
+ model.setMaximumCutPasses(value);
+ break;
+ case CBC_PARAM_INT_CUTPASS:
+ oldValue = model.getMaximumCutPassesAtRoot();
+ model.setMaximumCutPassesAtRoot(value);
+ break;
+#ifdef COIN_HAS_CBC
+#ifdef CBC_THREAD
+ case CBC_PARAM_INT_THREADS:
+ oldValue = model.getNumberThreads();
+ model.setNumberThreads(value);
+ break;
+#endif
+ case CBC_PARAM_INT_RANDOMSEED:
+ oldValue = model.getRandomSeed();
+ model.setRandomSeed(value);
+ break;
+#endif
+ default:
+ break;
+ }
+ sprintf(printArray, "%s was changed from %d to %d",
+ name_.c_str(), oldValue, value);
+ returnCode = 0;
+ }
+ return printArray;
+}
+int
+CbcOrClpParam::intParameter (CbcModel &model) const
+{
+ int value;
+ switch (type_) {
+ case CLP_PARAM_INT_LOGLEVEL:
+ value = model.messageHandler()->logLevel();
+ break;
+ case CLP_PARAM_INT_SOLVERLOGLEVEL:
+ value = model.solver()->messageHandler()->logLevel();
+ break;
+ case CBC_PARAM_INT_MAXNODES:
+ value = model.getIntParam(CbcModel::CbcMaxNumNode);
+ break;
+ case CBC_PARAM_INT_MAXSOLS:
+ value = model.getIntParam(CbcModel::CbcMaxNumSol);
+ break;
+ case CBC_PARAM_INT_MAXSAVEDSOLS:
+ value = model.maximumSavedSolutions();
+ break;
+ case CBC_PARAM_INT_STRONGBRANCHING:
+ value = model.numberStrong();
+ break;
+ case CBC_PARAM_INT_NUMBERBEFORE:
+ value = model.numberBeforeTrust();
+ break;
+ case CBC_PARAM_INT_NUMBERANALYZE:
+ value = model.numberAnalyzeIterations();
+ break;
+ case CBC_PARAM_INT_CUTPASSINTREE:
+ value = model.getMaximumCutPasses();
+ break;
+ case CBC_PARAM_INT_CUTPASS:
+ value = model.getMaximumCutPassesAtRoot();
+ break;
+#ifdef COIN_HAS_CBC
+#ifdef CBC_THREAD
+ case CBC_PARAM_INT_THREADS:
+ value = model.getNumberThreads();
+#endif
+ case CBC_PARAM_INT_RANDOMSEED:
+ value = model.getRandomSeed();
+ break;
+#endif
+ default:
+ value = intValue_;
+ break;
+ }
+ return value;
+}
+#endif
+// Sets current parameter option using string
+void
+CbcOrClpParam::setCurrentOption ( const std::string value )
+{
+ int action = parameterOption(value);
+ if (action >= 0)
+ currentKeyWord_ = action;
+}
+// Sets current parameter option
+void
+CbcOrClpParam::setCurrentOption ( int value , bool printIt)
+{
+ if (printIt && value != currentKeyWord_)
+ std::cout << "Option for " << name_ << " changed from "
+ << definedKeyWords_[currentKeyWord_] << " to "
+ << definedKeyWords_[value] << std::endl;
+
+ currentKeyWord_ = value;
+}
+// Sets current parameter option and returns printable string
+const char *
+CbcOrClpParam::setCurrentOptionWithMessage ( int value )
+{
+ if (value != currentKeyWord_) {
+ char current[100];
+ char newString[100];
+ if (currentKeyWord_>=0&&(fakeKeyWord_<=0||currentKeyWord_=0&&(fakeKeyWord_<=0||value= 0) {
+ if (action == currentKeyWord_)
+ return NULL;
+ if (currentKeyWord_>=0&&(fakeKeyWord_<=0||currentKeyWord_ upperIntValue_) {
+ std::cout << value << " was provided for " << name_ <<
+ " - valid range is " << lowerIntValue_ << " to " <<
+ upperIntValue_ << std::endl;
+ } else {
+ intValue_ = value;
+ }
+}
+const char *
+CbcOrClpParam::setIntValueWithMessage ( int value )
+{
+ printArray[0] = '\0';
+ if (value < lowerIntValue_ || value > upperIntValue_) {
+ sprintf(printArray, "%d was provided for %s - valid range is %d to %d",
+ value,name_.c_str(),lowerIntValue_,upperIntValue_);
+ } else {
+ if (value==intValue_)
+ return NULL;
+ sprintf(printArray, "%s was changed from %d to %d",
+ name_.c_str(), intValue_, value);
+ intValue_ = value;
+ }
+ return printArray;
+}
+void
+CbcOrClpParam::setDoubleValue ( double value )
+{
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ std::cout << value << " was provided for " << name_ <<
+ " - valid range is " << lowerDoubleValue_ << " to " <<
+ upperDoubleValue_ << std::endl;
+ } else {
+ doubleValue_ = value;
+ }
+}
+const char *
+CbcOrClpParam::setDoubleValueWithMessage ( double value )
+{
+ printArray[0] = '\0';
+ if (value < lowerDoubleValue_ || value > upperDoubleValue_) {
+ sprintf(printArray, "%g was provided for %s - valid range is %g to %g",
+ value,name_.c_str(),lowerDoubleValue_,upperDoubleValue_);
+ } else {
+ if (value==doubleValue_)
+ return NULL;
+ sprintf(printArray, "%s was changed from %g to %g",
+ name_.c_str(), doubleValue_, value);
+ doubleValue_ = value;
+ }
+ return printArray;
+}
+void
+CbcOrClpParam::setStringValue ( std::string value )
+{
+ stringValue_ = value;
+}
+static char line[1000];
+static char * where = NULL;
+extern int CbcOrClpRead_mode;
+int CbcOrClpEnvironmentIndex = -1;
+static size_t fillEnv()
+{
+#if defined(_MSC_VER) || defined(__MSVCRT__)
+ return 0;
+#else
+ // Don't think it will work on Windows
+ char * environ = getenv("CBC_CLP_ENVIRONMENT");
+ size_t length = 0;
+ if (environ) {
+ length = strlen(environ);
+ if (CbcOrClpEnvironmentIndex < static_cast(length)) {
+ // find next non blank
+ char * whereEnv = environ + CbcOrClpEnvironmentIndex;
+ // munch white space
+ while (*whereEnv == ' ' || *whereEnv == '\t' || *whereEnv < ' ')
+ whereEnv++;
+ // copy
+ char * put = line;
+ while ( *whereEnv != '\0' ) {
+ if ( *whereEnv == ' ' || *whereEnv == '\t' || *whereEnv < ' ' ) {
+ break;
+ }
+ *put = *whereEnv;
+ put++;
+ assert (put - line < 1000);
+ whereEnv++;
+ }
+ CbcOrClpEnvironmentIndex = static_cast(whereEnv - environ);
+ *put = '\0';
+ length = strlen(line);
+ } else {
+ length = 0;
+ }
+ }
+ if (!length)
+ CbcOrClpEnvironmentIndex = -1;
+ return length;
+#endif
+}
+extern FILE * CbcOrClpReadCommand;
+// Simple read stuff
+std::string
+CoinReadNextField()
+{
+ std::string field;
+ if (!where) {
+ // need new line
+#ifdef COIN_HAS_READLINE
+ if (CbcOrClpReadCommand == stdin) {
+ // Get a line from the user.
+ where = readline (coin_prompt);
+
+ // If the line has any text in it, save it on the history.
+ if (where) {
+ if ( *where)
+ add_history (where);
+ strcpy(line, where);
+ free(where);
+ }
+ } else {
+ where = fgets(line, 1000, CbcOrClpReadCommand);
+ }
+#else
+ if (CbcOrClpReadCommand == stdin) {
+ fputs(coin_prompt,stdout);
+ fflush(stdout);
+ }
+ where = fgets(line, 1000, CbcOrClpReadCommand);
+#endif
+ if (!where)
+ return field; // EOF
+ where = line;
+ // clean image
+ char * lastNonBlank = line - 1;
+ while ( *where != '\0' ) {
+ if ( *where != '\t' && *where < ' ' ) {
+ break;
+ } else if ( *where != '\t' && *where != ' ') {
+ lastNonBlank = where;
+ }
+ where++;
+ }
+ where = line;
+ *(lastNonBlank + 1) = '\0';
+ }
+ // munch white space
+ while (*where == ' ' || *where == '\t')
+ where++;
+ char * saveWhere = where;
+ while (*where != ' ' && *where != '\t' && *where != '\0')
+ where++;
+ if (where != saveWhere) {
+ char save = *where;
+ *where = '\0';
+ //convert to string
+ field = saveWhere;
+ *where = save;
+ } else {
+ where = NULL;
+ field = "EOL";
+ }
+ return field;
+}
+
+std::string
+CoinReadGetCommand(int argc, const char *argv[])
+{
+ std::string field = "EOL";
+ // say no =
+ afterEquals = "";
+ while (field == "EOL") {
+ if (CbcOrClpRead_mode > 0) {
+ if ((CbcOrClpRead_mode < argc && argv[CbcOrClpRead_mode]) ||
+ CbcOrClpEnvironmentIndex >= 0) {
+ if (CbcOrClpEnvironmentIndex < 0) {
+ field = argv[CbcOrClpRead_mode++];
+ } else {
+ if (fillEnv()) {
+ field = line;
+ } else {
+ // not there
+ continue;
+ }
+ }
+ if (field == "-") {
+ std::cout << "Switching to line mode" << std::endl;
+ CbcOrClpRead_mode = -1;
+ field = CoinReadNextField();
+ } else if (field[0] != '-') {
+ if (CbcOrClpRead_mode != 2) {
+ // now allow std::cout<<"skipping non-command "< 0) {
+ if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) {
+ if (CbcOrClpEnvironmentIndex < 0) {
+ if (argv[CbcOrClpRead_mode][0] != '-') {
+ field = argv[CbcOrClpRead_mode++];
+ } else if (!strcmp(argv[CbcOrClpRead_mode], "--")) {
+ field = argv[CbcOrClpRead_mode++];
+ // -- means import from stdin
+ field = "-";
+ }
+ } else {
+ fillEnv();
+ field = line;
+ }
+ }
+ } else {
+ field = CoinReadNextField();
+ }
+ } else {
+ field = afterEquals;
+ afterEquals = "";
+ }
+ //std::cout< 0) {
+ if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) {
+ if (CbcOrClpEnvironmentIndex < 0) {
+ // may be negative value so do not check for -
+ field = argv[CbcOrClpRead_mode++];
+ } else {
+ fillEnv();
+ field = line;
+ }
+ }
+ } else {
+ field = CoinReadNextField();
+ }
+ } else {
+ field = afterEquals;
+ afterEquals = "";
+ }
+ long int value = 0;
+ //std::cout<(value);
+}
+double
+CoinReadGetDoubleField(int argc, const char *argv[], int * valid)
+{
+ std::string field = "EOL";
+ if (afterEquals == "") {
+ if (CbcOrClpRead_mode > 0) {
+ if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) {
+ if (CbcOrClpEnvironmentIndex < 0) {
+ // may be negative value so do not check for -
+ field = argv[CbcOrClpRead_mode++];
+ } else {
+ fillEnv();
+ field = line;
+ }
+ }
+ } else {
+ field = CoinReadNextField();
+ }
+ } else {
+ field = afterEquals;
+ afterEquals = "";
+ }
+ double value = 0.0;
+ //std::cout<= this treated as artificials in feasibility pump",
+ 0.0, COIN_DBL_MAX, CBC_PARAM_DBL_ARTIFICIALCOST, 1);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "0.0 off - otherwise variables with costs >= this are treated as artificials and fixed to lower bound in feasibility pump"
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("auto!Scale", "Whether to scale objective, rhs and bounds of problem if they look odd",
+ "off", CLP_PARAM_STR_AUTOSCALE, 7, 0);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If you think you may get odd objective values or large equality rows etc then\
+ it may be worth setting this true. It is still experimental and you may prefer\
+ to use objective!Scale and rhs!Scale."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("barr!ier", "Solve using primal dual predictor corrector algorithm",
+ CLP_PARAM_ACTION_BARRIER);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This command solves the current model using the primal dual predictor \
+corrector algorithm. You may want to link in an alternative \
+ordering and factorization. It will also solve models \
+with quadratic objectives."
+
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("basisI!n", "Import basis from bas file",
+ CLP_PARAM_ACTION_BASISIN, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read an MPS format basis file from the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set. If you have libz then it can read compressed\
+ files 'xxxxxxxx.gz' or xxxxxxxx.bz2."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("basisO!ut", "Export basis as bas file",
+ CLP_PARAM_ACTION_BASISOUT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will write an MPS format basis file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'default.bas'."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("biasLU", "Whether factorization biased towards U",
+ "UU", CLP_PARAM_STR_BIASLU, 2, 0);
+ parameters[numberParameters-1].append("UX");
+ parameters[numberParameters-1].append("LX");
+ parameters[numberParameters-1].append("LL");
+ parameters[numberParameters-1].setCurrentOption("LX");
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("branch!AndCut", "Do Branch and Cut",
+ CBC_PARAM_ACTION_BAB);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This does branch and cut. There are many parameters which can affect the performance. \
+First just try with default settings and look carefully at the log file. Did cuts help? Did they take too long? \
+Look at output to see which cuts were effective and then do some tuning. You will see that the \
+options for cuts are off, on, root and ifmove, forceon. Off is \
+obvious, on means that this cut generator will be tried in the branch and cut tree (you can fine tune using \
+'depth'). Root means just at the root node while 'ifmove' means that cuts will be used in the tree if they \
+look as if they are doing some good and moving the objective value. Forceon is same as on but forces code to use \
+cut generator at every node. For probing forceonbut just does fixing probing in tree - not strengthening etc. \
+If pre-processing reduced the size of the \
+problem or strengthened many coefficients then it is probably wise to leave it on. Switch off heuristics \
+which did not provide solutions. The other major area to look at is the search. Hopefully good solutions \
+were obtained fairly early in the search so the important point is to select the best variable to branch on. \
+See whether strong branching did a good job - or did it just take a lot of iterations. Adjust the strongBranching \
+and trustPseudoCosts parameters. If cuts did a good job, then you may wish to \
+have more rounds of cuts - see passC!uts and passT!ree."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("bscale", "Whether to scale in barrier (and ordering speed)",
+ "off", CLP_PARAM_STR_BARRIERSCALE, 7, 0);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("off1");
+ parameters[numberParameters-1].append("on1");
+ parameters[numberParameters-1].append("off2");
+ parameters[numberParameters-1].append("on2");
+ parameters[numberParameters++] =
+ CbcOrClpParam("chol!esky", "Which cholesky algorithm",
+ "native", CLP_PARAM_STR_CHOLESKY, 7);
+ parameters[numberParameters-1].append("dense");
+ //#ifdef FOREIGN_BARRIER
+#ifdef COIN_HAS_WSMP
+ parameters[numberParameters-1].append("fudge!Long");
+ parameters[numberParameters-1].append("wssmp");
+#else
+ parameters[numberParameters-1].append("fudge!Long_dummy");
+ parameters[numberParameters-1].append("wssmp_dummy");
+#endif
+#if defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(COIN_HAS_GLPK)
+ parameters[numberParameters-1].append("Uni!versityOfFlorida");
+#else
+ parameters[numberParameters-1].append("Uni!versityOfFlorida_dummy");
+#endif
+#ifdef TAUCS_BARRIER
+ parameters[numberParameters-1].append("Taucs");
+#else
+ parameters[numberParameters-1].append("Taucs_dummy");
+#endif
+#ifdef COIN_HAS_MUMPS
+ parameters[numberParameters-1].append("Mumps");
+#else
+ parameters[numberParameters-1].append("Mumps_dummy");
+#endif
+ parameters[numberParameters-1].setLonghelp
+ (
+ "For a barrier code to be effective it needs a good Cholesky ordering and factorization. \
+The native ordering and factorization is not state of the art, although acceptable. \
+You may want to link in one from another source. See Makefile.locations for some \
+possibilities."
+ );
+ //#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("clique!Cuts", "Whether to use Clique cuts",
+ "off", CBC_PARAM_STR_CLIQUECUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on clique cuts (either at root or in entire tree) \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("combine!Solutions", "Whether to use combine solution heuristic",
+ "off", CBC_PARAM_STR_COMBINE);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("onquick");
+ parameters[numberParameters-1].append("bothquick");
+ parameters[numberParameters-1].append("beforequick");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a heuristic which does branch and cut on the problem given by just \
+using variables which have appeared in one or more solutions. \
+It obviously only tries after two or more solutions. \
+See Rounding for meaning of on,both,before"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("combine2!Solutions", "Whether to use crossover solution heuristic",
+ "off", CBC_PARAM_STR_CROSSOVER2);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a heuristic which does branch and cut on the problem given by \
+fixing variables which have same value in two or more solutions. \
+It obviously only tries after two or more solutions. \
+See Rounding for meaning of on,both,before"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("constraint!fromCutoff", "Whether to use cutoff as constraint",
+ "off", CBC_PARAM_STR_CUTOFF_CONSTRAINT);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("variable");
+ parameters[numberParameters-1].append("forcevariable");
+ parameters[numberParameters-1].append("conflict");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This adds the objective as a constraint with best solution as RHS"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("cost!Strategy", "How to use costs as priorities",
+ "off", CBC_PARAM_STR_COSTSTRATEGY);
+ parameters[numberParameters-1].append("pri!orities");
+ parameters[numberParameters-1].append("column!Order?");
+ parameters[numberParameters-1].append("01f!irst?");
+ parameters[numberParameters-1].append("01l!ast?");
+ parameters[numberParameters-1].append("length!?");
+ parameters[numberParameters-1].append("singletons");
+ parameters[numberParameters-1].append("nonzero");
+ parameters[numberParameters-1].append("general!Force?");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This orders the variables in order of their absolute costs - with largest cost ones being branched on \
+first. This primitive strategy can be surprsingly effective. The column order\
+ option is obviously not on costs but easy to code here."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("cplex!Use", "Whether to use Cplex!",
+ "off", CBC_PARAM_STR_CPX);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ " If the user has Cplex, but wants to use some of Cbc's heuristics \
+then you can! If this is on, then Cbc will get to the root node and then \
+hand over to Cplex. If heuristics find a solution this can be significantly \
+quicker. You will probably want to switch off Cbc's cuts as Cplex thinks \
+they are genuine constraints. It is also probable that you want to switch \
+off preprocessing, although for difficult problems it is worth trying \
+both."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("cpp!Generate", "Generates C++ code",
+ -1, 50000, CLP_PARAM_INT_CPP, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Once you like what the stand-alone solver does then this allows \
+you to generate user_driver.cpp which approximates the code. \
+0 gives simplest driver, 1 generates saves and restores, 2 \
+generates saves and restores even for variables at default value. \
+4 bit in cbc generates size dependent code rather than computed values. \
+This is now deprecated as you can call stand-alone solver - see \
+Cbc/examples/driver4.cpp."
+ );
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("crash", "Whether to create basis for problem",
+ "off", CLP_PARAM_STR_CRASH);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("so!low_halim");
+ parameters[numberParameters-1].append("lots");
+#ifdef CLP_INHERIT_MODE
+ parameters[numberParameters-1].append("dual");
+ parameters[numberParameters-1].append("dw");
+ parameters[numberParameters-1].append("idiot");
+#else
+ parameters[numberParameters-1].append("idiot1");
+ parameters[numberParameters-1].append("idiot2");
+ parameters[numberParameters-1].append("idiot3");
+ parameters[numberParameters-1].append("idiot4");
+ parameters[numberParameters-1].append("idiot5");
+ parameters[numberParameters-1].append("idiot6");
+ parameters[numberParameters-1].append("idiot7");
+#endif
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If crash is set on and there is an all slack basis then Clp will flip or put structural\
+ variables into basis with the aim of getting dual feasible. On the whole dual seems to be\
+ better without it and there are alternative types of 'crash' for primal e.g. 'idiot' or 'sprint'. \
+I have also added a variant due to Solow and Halim which is as on but just flip.");
+ parameters[numberParameters++] =
+ CbcOrClpParam("cross!over", "Whether to get a basic solution after barrier",
+ "on", CLP_PARAM_STR_CROSSOVER);
+ parameters[numberParameters-1].append("off");
+ parameters[numberParameters-1].append("maybe");
+ parameters[numberParameters-1].append("presolve");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Interior point algorithms do not obtain a basic solution (and \
+the feasibility criterion is a bit suspect (JJF)). This option will crossover \
+to a basic solution suitable for ranging or branch and cut. With the current state \
+of quadratic it may be a good idea to switch off crossover for quadratic (and maybe \
+presolve as well) - the option maybe does this."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("csv!Statistics", "Create one line of statistics",
+ CLP_PARAM_ACTION_CSVSTATISTICS, 2, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This appends statistics to given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set. Adds header if file empty or does not exist."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("cutD!epth", "Depth in tree at which to do cuts",
+ -1, 999999, CBC_PARAM_INT_CUTDEPTH);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Cut generators may be - off, on only at root, on if they look possible \
+and on. If they are done every node then that is that, but it may be worth doing them \
+every so often. The original method was every so many nodes but it is more logical \
+to do it whenever depth in tree is a multiple of K. This option does that and defaults \
+to -1 (off -> code decides)."
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("cutL!ength", "Length of a cut",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_CUTLENGTH);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "At present this only applies to Gomory cuts. -1 (default) leaves as is. \
+Any value >0 says that all cuts <= this length can be generated both at \
+root node and in tree. 0 says to use some dynamic lengths. If value >=10,000,000 \
+then the length in tree is value%10000000 - so 10000100 means unlimited length \
+at root and 100 in tree."
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("cuto!ff", "All solutions must be better than this",
+ -1.0e60, 1.0e60, CBC_PARAM_DBL_CUTOFF);
+ parameters[numberParameters-1].setDoubleValue(1.0e50);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "All solutions must be better than this value (in a minimization sense). \
+This is also set by code whenever it obtains a solution and is set to value of \
+objective for solution minus cutoff increment."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("cuts!OnOff", "Switches all cuts on or off",
+ "off", CBC_PARAM_STR_CUTSSTRATEGY);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This can be used to switch on or off all cuts (apart from Reduce and Split). Then you can do \
+individual ones off or on \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("debug!In", "read valid solution from file",
+ CLP_PARAM_ACTION_DEBUG, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read a solution file from the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set.\n\n\
+If set to create it will create a file called debug.file after search.\n\n\
+The idea is that if you suspect a bad cut generator \
+you can do a good run with debug set to 'create' and then switch on the cuts you suspect and \
+re-run with debug set to 'debug.file' The create case has same effect as saveSolution."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("decomp!ose", "Whether to try decomposition",
+ -COIN_INT_MAX, COIN_INT_MAX, CLP_PARAM_INT_DECOMPOSE_BLOCKS, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "0 - off, 1 choose blocks >1 use as blocks \
+Dantzig Wolfe if primal, Benders if dual \
+- uses sprint pass for number of passes"
+ );
+ parameters[numberParameters-1].setIntValue(0);
+#if CLP_MULTIPLE_FACTORIZATIONS >0
+ parameters[numberParameters++] =
+ CbcOrClpParam("dense!Threshold", "Whether to use dense factorization",
+ -1, 10000, CBC_PARAM_INT_DENSE, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If processed problem <= this use dense factorization"
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+#endif
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("depth!MiniBab", "Depth at which to try mini BAB",
+ -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_DEPTHMINIBAB);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Rather a complicated parameter but can be useful. -1 means off for large problems but on as if -12 for problems where rows+columns<500, -2 \
+means use Cplex if it is linked in. Otherwise if negative then go into depth first complete search fast branch and bound when depth>= -value-2 (so -3 will use this at depth>=1). This mode is only switched on after 500 nodes. If you really want to switch it off for small problems then set this to -999. If >=0 the value doesn't matter very much. The code will do approximately 100 nodes of fast branch and bound every now and then at depth>=5. The actual logic is too twisted to describe here."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dextra3", "Extra double parameter 3",
+ -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA3, 0);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("dextra4", "Extra double parameter 4",
+ -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA4, 0);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("dextra5", "Extra double parameter 5",
+ -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA5, 0);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("Dins", "Whether to try Distance Induced Neighborhood Search",
+ "off", CBC_PARAM_STR_DINS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("often");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on Distance induced neighborhood Search. \
+See Rounding for meaning of on,both,before"
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("direction", "Minimize or Maximize",
+ "min!imize", CLP_PARAM_STR_DIRECTION);
+ parameters[numberParameters-1].append("max!imize");
+ parameters[numberParameters-1].append("zero");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is minimize - use 'direction maximize' for maximization.\n\
+You can also use the parameters 'maximize' or 'minimize'."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("directory", "Set Default directory for import etc.",
+ CLP_PARAM_ACTION_DIRECTORY);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets the directory which import, export, saveModel, restoreModel etc will use.\
+ It is initialized to './'"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dirSample", "Set directory where the COIN-OR sample problems are.",
+ CLP_PARAM_ACTION_DIRSAMPLE, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets the directory where the COIN-OR sample problems reside. It is\
+ used only when -unitTest is passed to clp. clp will pick up the test problems\
+ from this directory.\
+ It is initialized to '../../Data/Sample'"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dirNetlib", "Set directory where the netlib problems are.",
+ CLP_PARAM_ACTION_DIRNETLIB, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets the directory where the netlib problems reside. One can get\
+ the netlib problems from COIN-OR or from the main netlib site. This\
+ parameter is used only when -netlib is passed to clp. clp will pick up the\
+ netlib problems from this directory. If clp is built without zlib support\
+ then the problems must be uncompressed.\
+ It is initialized to '../../Data/Netlib'"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dirMiplib", "Set directory where the miplib 2003 problems are.",
+ CBC_PARAM_ACTION_DIRMIPLIB, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets the directory where the miplib 2003 problems reside. One can\
+ get the miplib problems from COIN-OR or from the main miplib site. This\
+ parameter is used only when -miplib is passed to cbc. cbc will pick up the\
+ miplib problems from this directory. If cbc is built without zlib support\
+ then the problems must be uncompressed.\
+ It is initialized to '../../Data/miplib3'"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("diveO!pt", "Diving options",
+ -1, 200000, CBC_PARAM_INT_DIVEOPT, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If >2 && <20 then modify diving options - \
+ \n\t3 only at root and if no solution, \
+ \n\t4 only at root and if this heuristic has not got solution, \
+ \n\t5 decay only if no solution, \
+ \n\t6 if depth <3 or decay, \
+ \n\t7 run up to 2 times if solution found 4 otherwise, \
+ \n\t>10 All only at root (DivingC normal as value-10), \
+ \n\t>20 All with value-20)."
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("diveS!olves", "Diving solve option",
+ -1, 200000, CBC_PARAM_INT_DIVEOPTSOLVES, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If >0 then do up to this many solves. Last digit is ignored \
+and used for extra options - \
+ \n\t1-3 allow fixing of satisfied integers (but not at bound) \
+ \n\t1 switch off above for that dive if goes infeasible \
+ \n\t2 switch off above permanently if goes infeasible"
+ );
+ parameters[numberParameters-1].setIntValue(100);
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingS!ome", "Whether to try Diving heuristics",
+ "off", CBC_PARAM_STR_DIVINGS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a random diving heuristic at various times. \
+C - Coefficient, F - Fractional, G - Guided, L - LineSearch, P - PseudoCost, V - VectorLength. \
+You may prefer to use individual on/off \
+See Rounding for meaning of on,both,before"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingC!oefficient", "Whether to try DiveCoefficient",
+ "off", CBC_PARAM_STR_DIVINGC);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingF!ractional", "Whether to try DiveFractional",
+ "off", CBC_PARAM_STR_DIVINGF);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingG!uided", "Whether to try DiveGuided",
+ "off", CBC_PARAM_STR_DIVINGG);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingL!ineSearch", "Whether to try DiveLineSearch",
+ "off", CBC_PARAM_STR_DIVINGL);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingP!seudoCost", "Whether to try DivePseudoCost",
+ "off", CBC_PARAM_STR_DIVINGP);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("DivingV!ectorLength", "Whether to try DiveVectorLength",
+ "off", CBC_PARAM_STR_DIVINGV);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters++] =
+ CbcOrClpParam("doH!euristic", "Do heuristics before any preprocessing",
+ CBC_PARAM_ACTION_DOHEURISTIC, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally heuristics are done in branch and bound. It may be useful to do them outside. \
+Only those heuristics with 'both' or 'before' set will run. \
+Doing this may also set cutoff, which can help with preprocessing."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("dualB!ound", "Initially algorithm acts as if no \
+gap between bounds exceeds this value",
+ 1.0e-20, 1.0e12, CLP_PARAM_DBL_DUALBOUND);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The dual algorithm in Clp is a single phase algorithm as opposed to a two phase\
+ algorithm where you first get feasible then optimal. If a problem has both upper and\
+ lower bounds then it is trivial to get dual feasible by setting non basic variables\
+ to correct bound. If the gap between the upper and lower bounds of a variable is more\
+ than the value of dualBound Clp introduces fake bounds so that it can make the problem\
+ dual feasible. This has the same effect as a composite objective function in the\
+ primal algorithm. Too high a value may mean more iterations, while too low a bound means\
+ the code may go all the way and then have to increase the bounds. OSL had a heuristic to\
+ adjust bounds, maybe we need that here."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dualize", "Solves dual reformulation",
+ 0, 4, CLP_PARAM_INT_DUALIZE, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Don't even think about it."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dualP!ivot", "Dual pivot choice algorithm",
+ "auto!matic", CLP_PARAM_STR_DUALPIVOT, 7, 1);
+ parameters[numberParameters-1].append("dant!zig");
+ parameters[numberParameters-1].append("partial");
+ parameters[numberParameters-1].append("steep!est");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Clp can use any pivot selection algorithm which the user codes as long as it\
+ implements the features in the abstract pivot base class. The Dantzig method is implemented\
+ to show a simple method but its use is deprecated. Steepest is the method of choice and there\
+ are two variants which keep all weights updated but only scan a subset each iteration.\
+ Partial switches this on while automatic decides at each iteration based on information\
+ about the factorization."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("dualS!implex", "Do dual simplex algorithm",
+ CLP_PARAM_ACTION_DUALSIMPLEX);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This command solves the continuous relaxation of the current model using the dual steepest edge algorithm.\
+The time and iterations may be affected by settings such as presolve, scaling, crash\
+ and also by dual pivot method, fake bound on variables and dual and primal tolerances."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("dualT!olerance", "For an optimal solution \
+no dual infeasibility may exceed this value",
+ 1.0e-20, 1.0e12, CLP_PARAM_DBL_DUALTOLERANCE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally the default tolerance is fine, but you may want to increase it a\
+ bit if a dual run seems to be having a hard time. One method which can be faster is \
+to use a large tolerance e.g. 1.0e-4 and dual and then clean up problem using primal and the \
+correct tolerance (remembering to switch off presolve for this final short clean up phase)."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("dw!Heuristic", "Whether to try DW heuristic",
+ "off", CBC_PARAM_STR_DW);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "See Rounding for meaning of on,both,before"
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("either!Simplex", "Do dual or primal simplex algorithm",
+ CLP_PARAM_ACTION_EITHERSIMPLEX);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This command solves the continuous relaxation of the current model using the dual or primal algorithm,\
+ based on a dubious analysis of model."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("end", "Stops clp execution",
+ CLP_PARAM_ACTION_EXIT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This stops execution ; end, exit, quit and stop are synonyms"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("environ!ment", "Read commands from environment",
+ CLP_PARAM_ACTION_ENVIRONMENT, 7, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This starts reading from environment variable CBC_CLP_ENVIRONMENT."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("error!sAllowed", "Whether to allow import errors",
+ "off", CLP_PARAM_STR_ERRORSALLOWED, 3);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is not to use any model which had errors when reading the mps file.\
+ Setting this to 'on' will allow all errors from which the code can recover\
+ simply by ignoring the error. There are some errors from which the code can not recover \
+e.g. no ENDATA. This has to be set before import i.e. -errorsAllowed on -import xxxxxx.mps."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("exit", "Stops clp execution",
+ CLP_PARAM_ACTION_EXIT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This stops the execution of Clp, end, exit, quit and stop are synonyms"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("exper!iment", "Whether to use testing features",
+ -1, 200, CBC_PARAM_INT_EXPERIMENT, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Defines how adventurous you want to be in using new ideas. \
+0 then no new ideas, 1 fairly sensible, 2 a bit dubious, 3 you are on your own!"
+ );
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("expensive!Strong", "Whether to do even more strong branching",
+ 0, COIN_INT_MAX, CBC_PARAM_INT_STRONG_STRATEGY, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Strategy for extra strong branching \n\
+\n\t0 - normal\n\
+\n\twhen to do all fractional\n\
+\n\t1 - root node\n\
+\n\t2 - depth less than modifier\n\
+\n\t4 - if objective == best possible\n\
+\n\t6 - as 2+4\n\
+\n\twhen to do all including satisfied\n\
+\n\t10 - root node etc.\n\
+\n\tIf >=100 then do when depth <= strategy/100 (otherwise 5)"
+ );
+ parameters[numberParameters-1].setIntValue(0);
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("export", "Export model as mps file",
+ CLP_PARAM_ACTION_EXPORT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will write an MPS format file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'default.mps'. \
+It can be useful to get rid of the original names and go over to using Rnnnnnnn and Cnnnnnnn. This can be done by setting 'keepnames' off before importing mps file."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("extra1", "Extra integer parameter 1",
+ -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_EXTRA1, 0);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("extra2", "Extra integer parameter 2",
+ -100, COIN_INT_MAX, CBC_PARAM_INT_EXTRA2, 0);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("extra3", "Extra integer parameter 3",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_EXTRA3, 0);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("extra4", "Extra integer parameter 4",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_EXTRA4, 0);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on yet more special options!! \
+The bottom digit is a strategy when to used shadow price stuff e.g. 3 \
+means use until a solution is found. The next two digits say what sort \
+of dual information to use. After that it goes back to powers of 2 so -\n\
+\n\t1000 - switches on experimental hotstart\n\
+\n\t2,4,6000 - switches on experimental methods of stopping cuts\n\
+\n\t8000 - increase minimum drop gradually\n\
+\n\t16000 - switches on alternate gomory criterion"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("extraV!ariables", "Allow creation of extra integer variables",
+ -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_EXTRA_VARIABLES, 0);
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on creation of extra integer variables \
+to gather all variables with same cost."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("fact!orization", "Which factorization to use",
+ "normal", CLP_PARAM_STR_FACTORIZATION);
+ parameters[numberParameters-1].append("dense");
+ parameters[numberParameters-1].append("simple");
+ parameters[numberParameters-1].append("osl");
+ parameters[numberParameters-1].setLonghelp
+ (
+#ifndef ABC_INHERIT
+ "The default is to use the normal CoinFactorization, but \
+other choices are a dense one, osl's or one designed for small problems."
+#else
+ "Normally the default is to use the normal CoinFactorization, but \
+other choices are a dense one, osl's or one designed for small problems. \
+However if at Aboca then the default is CoinAbcFactorization and other choices are \
+a dense one, one designed for small problems or if enabled a long factorization."
+#endif
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("fakeB!ound", "All bounds <= this value - DEBUG",
+ 1.0, 1.0e15, CLP_PARAM_ACTION_FAKEBOUND, 0);
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("feas!ibilityPump", "Whether to try Feasibility Pump",
+ "off", CBC_PARAM_STR_FPUMP);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on feasibility pump heuristic at root. This is due to Fischetti, Lodi and Glover \
+and uses a sequence of Lps to try and get an integer feasible solution. \
+Some fine tuning is available by passFeasibilityPump and also pumpTune. \
+See Rounding for meaning of on,both,before"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("fix!OnDj", "Try heuristic based on fixing variables with \
+reduced costs greater than this",
+ -1.0e20, 1.0e20, CBC_PARAM_DBL_DJFIX, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If this is set integer variables with reduced costs greater than this will be fixed \
+before branch and bound - use with extreme caution!"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("flow!CoverCuts", "Whether to use Flow Cover cuts",
+ "off", CBC_PARAM_STR_FLOWCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].setFakeKeyWord(3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on flow cover cuts (either at root or in entire tree) \
+See branchAndCut for information on options. \
+Can also enter testing values by plusnn (==ifmove)"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("force!Solution", "Whether to use given solution as crash for BAB",
+ -1, 20000000, CLP_PARAM_INT_USESOLUTION);
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "-1 off. If 1 then tries to branch to solution given by AMPL or priorities file. \
+If 0 then just tries to set as best solution \
+If >1 then also does that many nodes on fixed problem."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("fraction!forBAB", "Fraction in feasibility pump",
+ 1.0e-5, 1.1, CBC_PARAM_DBL_SMALLBAB, 1);
+ parameters[numberParameters-1].setDoubleValue(0.5);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "After a pass in feasibility pump, variables which have not moved \
+about are fixed and if the preprocessed model is small enough a few nodes \
+of branch and bound are done on reduced problem. Small problem has to be less than this fraction of original."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("gamma!(Delta)", "Whether to regularize barrier",
+ "off", CLP_PARAM_STR_GAMMA, 7, 1);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("gamma");
+ parameters[numberParameters-1].append("delta");
+ parameters[numberParameters-1].append("onstrong");
+ parameters[numberParameters-1].append("gammastrong");
+ parameters[numberParameters-1].append("deltastrong");
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("GMI!Cuts", "Whether to use alternative Gomory cuts",
+ "off", CBC_PARAM_STR_GMICUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("endonly");
+ parameters[numberParameters-1].append("long");
+ parameters[numberParameters-1].append("longroot");
+ parameters[numberParameters-1].append("longifmove");
+ parameters[numberParameters-1].append("forceLongOn");
+ parameters[numberParameters-1].append("longendonly");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on an alternative Gomory cut generator (either at root or in entire tree) \
+This version is by Giacomo Nannicini and may be more robust \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("gomory!Cuts", "Whether to use Gomory cuts",
+ "off", CBC_PARAM_STR_GOMORYCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].append("forceandglobal");
+ parameters[numberParameters-1].append("forceLongOn");
+ parameters[numberParameters-1].append("long");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The original cuts - beware of imitations! Having gone out of favor, they are now more \
+fashionable as LP solvers are more robust and they interact well with other cuts. They will almost always \
+give cuts (although in this executable they are limited as to number of variables in cut). \
+However the cuts may be dense so it is worth experimenting (Long allows any length). \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("greedy!Heuristic", "Whether to use a greedy heuristic",
+ "off", CBC_PARAM_STR_GREEDY);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ //parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Switches on a greedy heuristic which will try and obtain a solution. It may just fix a \
+percentage of variables and then try a small branch and cut run. \
+See Rounding for meaning of on,both,before"
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("gsolu!tion", "Puts glpk solution to file",
+ CLP_PARAM_ACTION_GMPL_SOLUTION);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Will write a glpk solution file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'stdout' (this defaults to ordinary solution if stdout). \
+If problem created from gmpl model - will do any reports."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("heur!isticsOnOff", "Switches most heuristics on or off",
+ "off", CBC_PARAM_STR_HEURISTICSTRATEGY);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This can be used to switch on or off all heuristics. Then you can do \
+individual ones off or on. CbcTreeLocal is not included as it dramatically \
+alters search."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("help", "Print out version, non-standard options and some help",
+ CLP_PARAM_ACTION_HELP, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This prints out some help to get user started. If you have printed this then \
+you should be past that stage:-)"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("hOp!tions", "Heuristic options",
+ -9999999, 9999999, CBC_PARAM_INT_HOPTIONS, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "1 says stop heuristic immediately allowable gap reached. \
+Others are for feasibility pump - \
+2 says do exact number of passes given, \
+4 only applies if initial cutoff given and says relax after 50 passes, \
+while 8 will adapt cutoff rhs after first solution if it looks as if code is stalling."
+ );
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("hot!StartMaxIts", "Maximum iterations on hot start",
+ 0, COIN_INT_MAX, CBC_PARAM_INT_MAXHOTITS);
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("idiot!Crash", "Whether to try idiot crash",
+ -1, 99999999, CLP_PARAM_INT_IDIOT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This is a type of 'crash' which works well on some homogeneous problems.\
+ It works best on problems with unit elements and rhs but will do something to any model. It should only be\
+ used before primal. It can be set to -1 when the code decides for itself whether to use it,\
+ 0 to switch off or n > 0 to do n passes."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("import", "Import model from mps file",
+ CLP_PARAM_ACTION_IMPORT, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read an MPS format file from the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set. If you have libgz then it can read compressed\
+ files 'xxxxxxxx.gz' or 'xxxxxxxx.bz2'. \
+If 'keepnames' is off, then names are dropped -> Rnnnnnnn and Cnnnnnnn."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("inc!rement", "A valid solution must be at least this \
+much better than last integer solution",
+ -1.0e20, 1.0e20, CBC_PARAM_DBL_INCREMENT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Whenever a solution is found the bound on solutions is set to solution (in a minimization\
+sense) plus this. If it is not set then the code will try and work one out e.g. if \
+all objective coefficients are multiples of 0.01 and only integer variables have entries in \
+objective then this can be set to 0.01. Be careful if you set this negative!"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("inf!easibilityWeight", "Each integer infeasibility is expected \
+to cost this much",
+ 0.0, 1.0e20, CBC_PARAM_DBL_INFEASIBILITYWEIGHT, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "A primitive way of deciding which node to explore next. Satisfying each integer infeasibility is \
+expected to cost this much."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("initialS!olve", "Solve to continuous",
+ CLP_PARAM_ACTION_SOLVECONTINUOUS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This just solves the problem to continuous - without adding any cuts"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("integerT!olerance", "For an optimal solution \
+no integer variable may be this away from an integer value",
+ 1.0e-20, 0.5, CBC_PARAM_DBL_INTEGERTOLERANCE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Beware of setting this smaller than the primal tolerance."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("keepN!ames", "Whether to keep names from import",
+ "on", CLP_PARAM_STR_KEEPNAMES);
+ parameters[numberParameters-1].append("off");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "It saves space to get rid of names so if you need to you can set this to off. \
+This needs to be set before the import of model - so -keepnames off -import xxxxx.mps."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("KKT", "Whether to use KKT factorization",
+ "off", CLP_PARAM_STR_KKT, 7, 1);
+ parameters[numberParameters-1].append("on");
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("knapsack!Cuts", "Whether to use Knapsack cuts",
+ "off", CBC_PARAM_STR_KNAPSACKCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].append("forceandglobal");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on knapsack cuts (either at root or in entire tree) \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("lagomory!Cuts", "Whether to use Lagrangean Gomory cuts",
+ "off", CBC_PARAM_STR_LAGOMORYCUTS);
+ parameters[numberParameters-1].append("endonlyroot");
+ parameters[numberParameters-1].append("endcleanroot");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("endonly");
+ parameters[numberParameters-1].append("endclean");
+ parameters[numberParameters-1].append("endboth");
+ parameters[numberParameters-1].append("onlyaswell");
+ parameters[numberParameters-1].append("cleanaswell");
+ parameters[numberParameters-1].append("bothaswell");
+ parameters[numberParameters-1].append("onlyinstead");
+ parameters[numberParameters-1].append("cleaninstead");
+ parameters[numberParameters-1].append("bothinstead");
+ parameters[numberParameters-1].append("onlyaswellroot");
+ parameters[numberParameters-1].append("cleanaswellroot");
+ parameters[numberParameters-1].append("bothaswellroot");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This is a gross simplification of 'A Relax-and-Cut Framework for Gomory's Mixed-Integer Cuts' \
+by Matteo Fischetti & Domenico Salvagnin. This simplification \
+just uses original constraints while modifying objective using other cuts. \
+So you don't use messy constraints generated by Gomory etc. \
+A variant is to allow non messy cuts e.g. clique cuts. \
+So 'only' does this while clean also allows integral valued cuts. \
+'End' is recommended which waits until other cuts have finished and then \
+does a few passes. \
+The length options for gomory cuts are used."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("latwomir!Cuts", "Whether to use Lagrangean TwoMir cuts",
+ "off", CBC_PARAM_STR_LATWOMIRCUTS);
+ parameters[numberParameters-1].append("endonlyroot");
+ parameters[numberParameters-1].append("endcleanroot");
+ parameters[numberParameters-1].append("endbothroot");
+ parameters[numberParameters-1].append("endonly");
+ parameters[numberParameters-1].append("endclean");
+ parameters[numberParameters-1].append("endboth");
+ parameters[numberParameters-1].append("onlyaswell");
+ parameters[numberParameters-1].append("cleanaswell");
+ parameters[numberParameters-1].append("bothaswell");
+ parameters[numberParameters-1].append("onlyinstead");
+ parameters[numberParameters-1].append("cleaninstead");
+ parameters[numberParameters-1].append("bothinstead");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This is a lagrangean relaxation for TwoMir cuts. See \
+lagomoryCuts for description of options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("lift!AndProjectCuts", "Whether to use Lift and Project cuts",
+ "off", CBC_PARAM_STR_LANDPCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Lift and project cuts. \
+May be slow \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("local!TreeSearch", "Whether to use local treesearch",
+ "off", CBC_PARAM_STR_LOCALTREE);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a local search algorithm when a solution is found. This is from \
+Fischetti and Lodi and is not really a heuristic although it can be used as one. \
+When used from Coin solve it has limited functionality. It is not switched on when \
+heuristics are switched on."
+ );
+#endif
+#ifndef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("log!Level", "Level of detail in Solver output",
+ -1, 999999, CLP_PARAM_INT_SOLVERLOGLEVEL);
+#else
+ parameters[numberParameters++] =
+ CbcOrClpParam("log!Level", "Level of detail in Coin branch and Cut output",
+ -63, 63, CLP_PARAM_INT_LOGLEVEL);
+ parameters[numberParameters-1].setIntValue(1);
+#endif
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If 0 then there should be no output in normal circumstances. 1 is probably the best\
+ value for most uses, while 2 and 3 give more information."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("max!imize", "Set optimization direction to maximize",
+ CLP_PARAM_ACTION_MAXIMIZE, 7);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is minimize - use 'maximize' for maximization.\n\
+You can also use the parameters 'direction maximize'."
+ );
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("maxF!actor", "Maximum number of iterations between \
+refactorizations",
+ 1, 999999, CLP_PARAM_INT_MAXFACTOR);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If this is at its initial value of 200 then in this executable clp will guess at a\
+ value to use. Otherwise the user can set a value. The code may decide to re-factorize\
+ earlier for accuracy."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("maxIt!erations", "Maximum number of iterations before \
+stopping",
+ 0, 2147483647, CLP_PARAM_INT_MAXITERATION);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This can be used for testing purposes. The corresponding library call\n\
+ \tsetMaximumIterations(value)\n can be useful. If the code stops on\
+ seconds or by an interrupt this will be treated as stopping on maximum iterations. This is ignored in branchAndCut - use maxN!odes."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("maxN!odes", "Maximum number of nodes to do",
+ -1, 2147483647, CBC_PARAM_INT_MAXNODES);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This is a repeatable way to limit search. Normally using time is easier \
+but then the results may not be repeatable."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("maxSaved!Solutions", "Maximum number of solutions to save",
+ 0, 2147483647, CBC_PARAM_INT_MAXSAVEDSOLS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Number of solutions to save."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("maxSo!lutions", "Maximum number of solutions to get",
+ 1, 2147483647, CBC_PARAM_INT_MAXSOLS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "You may want to stop after (say) two solutions or an hour. \
+This is checked every node in tree, so it is possible to get more solutions from heuristics."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("min!imize", "Set optimization direction to minimize",
+ CLP_PARAM_ACTION_MINIMIZE, 7);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is minimize - use 'maximize' for maximization.\n\
+This should only be necessary if you have previously set maximization \
+You can also use the parameters 'direction minimize'."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("mipO!ptions", "Dubious options for mip",
+ 0, COIN_INT_MAX, CBC_PARAM_INT_MIPOPTIONS, 0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("more!MipOptions", "More dubious options for mip",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_MOREMIPOPTIONS, 0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("more2!MipOptions", "More more dubious options for mip",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_MOREMOREMIPOPTIONS, 0);
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("mixed!IntegerRoundingCuts", "Whether to use Mixed Integer Rounding cuts",
+ "off", CBC_PARAM_STR_MIXEDCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on mixed integer rounding cuts (either at root or in entire tree) \
+See branchAndCut for information on options."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("mess!ages", "Controls if Clpnnnn is printed",
+ "off", CLP_PARAM_STR_MESSAGES);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ ("The default behavior is to put out messages such as:\n\
+ Clp0005 2261 Objective 109.024 Primal infeas 944413 (758)\n\
+but this program turns this off to make it look more friendly. It can be useful\
+ to turn them back on if you want to be able to 'grep' for particular messages or if\
+ you intend to override the behavior of a particular message. This only affects Clp not Cbc."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("miplib", "Do some of miplib test set",
+ CBC_PARAM_ACTION_MIPLIB, 3, 1);
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("mips!tart", "reads an initial feasible solution from file",
+ CBC_PARAM_ACTION_MIPSTART);
+ parameters[numberParameters-1].setLonghelp
+ ("\
+The MIPStart allows one to enter an initial integer feasible solution \
+to CBC. Values of the main decision variables which are active (have \
+non-zero values) in this solution are specified in a text file. The \
+text file format used is the same of the solutions saved by CBC, but \
+not all fields are required to be filled. First line may contain the \
+solution status and will be ignored, remaining lines contain column \
+indexes, names and values as in this example:\n\
+\n\
+Stopped on iterations - objective value 57597.00000000\n\
+ 0 x(1,1,2,2) 1 \n\
+ 1 x(3,1,3,2) 1 \n\
+ 5 v(5,1) 2 \n\
+ 33 x(8,1,5,2) 1 \n\
+ ...\n\
+\n\
+Column indexes are also ignored since pre-processing can change them. \
+There is no need to include values for continuous or integer auxiliary \
+variables, since they can be computed based on main decision variables. \
+Starting CBC with an integer feasible solution can dramatically improve \
+its performance: several MIP heuristics (e.g. RINS) rely on having at \
+least one feasible solution available and can start immediately if the \
+user provides one. Feasibility Pump (FP) is a heuristic which tries to \
+overcome the problem of taking too long to find feasible solution (or \
+not finding at all), but it not always succeeds. If you provide one \
+starting solution you will probably save some time by disabling FP. \
+\n\n\
+Knowledge specific to your problem can be considered to write an \
+external module to quickly produce an initial feasible solution - some \
+alternatives are the implementation of simple greedy heuristics or the \
+solution (by CBC for example) of a simpler model created just to find \
+a feasible solution. \
+\n\n\
+Question and suggestions regarding MIPStart can be directed to\n\
+haroldo.santos@gmail.com.\
+");
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("moreS!pecialOptions", "Yet more dubious options for Simplex - see ClpSimplex.hpp",
+ 0, COIN_INT_MAX, CLP_PARAM_INT_MORESPECIALOPTIONS, 0);
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("moreT!une", "Yet more dubious ideas for feasibility pump",
+ 0, 100000000, CBC_PARAM_INT_FPUMPTUNE2, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Yet more ideas for Feasibility Pump \n\
+\t/100000 == 1 use box constraints and original obj in cleanup\n\
+\t/1000 == 1 Pump will run twice if no solution found\n\
+\t/1000 == 2 Pump will only run after root cuts if no solution found\n\
+\t/1000 >10 as above but even if solution found\n\
+\t/100 == 1,3.. exact 1.0 for objective values\n\
+\t/100 == 2,3.. allow more iterations per pass\n\
+\t n fix if value of variable same for last n iterations."
+ );
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("multiple!RootPasses", "Do multiple root passes to collect cuts and solutions",
+ 0, 100000000, CBC_PARAM_INT_MULTIPLEROOTS, 0);
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Do (in parallel if threads enabled) the root phase this number of times \
+ and collect all solutions and cuts generated. The actual format is aabbcc \
+where aa is number of extra passes, if bb is non zero \
+then it is number of threads to use (otherwise uses threads setting) and \
+cc is number of times to do root phase. Yet another one from the Italian idea factory \
+(This time - Andrea Lodi , Matteo Fischetti , Michele Monaci , Domenico Salvagnin , \
+and Andrea Tramontani). \
+The solvers do not interact with each other. However if extra passes are specified \
+then cuts are collected and used in later passes - so there is interaction there."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("naive!Heuristics", "Whether to try some stupid heuristic",
+ "off", CBC_PARAM_STR_NAIVE, 7, 1);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Really silly stuff e.g. fix all integers with costs to zero!. \
+Doh option does heuristic before preprocessing" );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("netlib", "Solve entire netlib test set",
+ CLP_PARAM_ACTION_NETLIB_EITHER, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp and then solves the netlib test set using dual or primal.\
+The user can set options before e.g. clp -presolve off -netlib"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("netlibB!arrier", "Solve entire netlib test set with barrier",
+ CLP_PARAM_ACTION_NETLIB_BARRIER, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp and then solves the netlib test set using barrier.\
+The user can set options before e.g. clp -kkt on -netlib"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("netlibD!ual", "Solve entire netlib test set (dual)",
+ CLP_PARAM_ACTION_NETLIB_DUAL, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp and then solves the netlib test set using dual.\
+The user can set options before e.g. clp -presolve off -netlib"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("netlibP!rimal", "Solve entire netlib test set (primal)",
+ CLP_PARAM_ACTION_NETLIB_PRIMAL, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp and then solves the netlib test set using primal.\
+The user can set options before e.g. clp -presolve off -netlibp"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("netlibT!une", "Solve entire netlib test set with 'best' algorithm",
+ CLP_PARAM_ACTION_NETLIB_TUNE, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp and then solves the netlib test set using whatever \
+works best. I know this is cheating but it also stresses the code better by doing a \
+mixture of stuff. The best algorithm was chosen on a Linux ThinkPad using native cholesky \
+with University of Florida ordering."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("network", "Tries to make network matrix",
+ CLP_PARAM_ACTION_NETWORK, 7, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Clp will go faster if the matrix can be converted to a network. The matrix\
+ operations may be a bit faster with more efficient storage, but the main advantage\
+ comes from using a network factorization. It will probably not be as fast as a \
+specialized network code."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("nextB!estSolution", "Prints next best saved solution to file",
+ CLP_PARAM_ACTION_NEXTBESTSOLUTION);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "To write best solution, just use solution. This prints next best (if exists) \
+ and then deletes it. \
+ This will write a primitive solution file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("node!Strategy", "What strategy to use to select nodes",
+ "hybrid", CBC_PARAM_STR_NODESTRATEGY);
+ parameters[numberParameters-1].append("fewest");
+ parameters[numberParameters-1].append("depth");
+ parameters[numberParameters-1].append("upfewest");
+ parameters[numberParameters-1].append("downfewest");
+ parameters[numberParameters-1].append("updepth");
+ parameters[numberParameters-1].append("downdepth");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally before a solution the code will choose node with fewest infeasibilities. \
+You can choose depth as the criterion. You can also say if up or down branch must \
+be done first (the up down choice will carry on after solution). \
+Default has now been changed to hybrid which is breadth first on small depth nodes then fewest."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("numberA!nalyze", "Number of analysis iterations",
+ -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_NUMBERANALYZE, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This says how many iterations to spend at root node analyzing problem. \
+This is a first try and will hopefully become more sophisticated."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("objective!Scale", "Scale factor to apply to objective",
+ -1.0e20, 1.0e20, CLP_PARAM_DBL_OBJSCALE, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If the objective function has some very large values, you may wish to scale them\
+ internally by this amount. It can also be set by autoscale. It is applied after scaling. You are unlikely to need this."
+ );
+ parameters[numberParameters-1].setDoubleValue(1.0);
+#endif
+#ifdef COIN_HAS_CBC
+#ifdef COIN_HAS_NTY
+ parameters[numberParameters++] =
+ CbcOrClpParam("Orbit!alBranching", "Whether to try orbital branching",
+ "off", CBC_PARAM_STR_ORBITAL);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("strong");
+ parameters[numberParameters-1].append("force");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on Orbital branching. \
+On just adds orbital, strong tries extra fixing in strong branching");
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("outDup!licates", "takes duplicate rows etc out of integer model",
+ CLP_PARAM_ACTION_OUTDUPROWS, 7, 0);
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("output!Format", "Which output format to use",
+ 1, 6, CLP_PARAM_INT_OUTPUTFORMAT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally export will be done using normal representation for numbers and two values\
+ per line. You may want to do just one per line (for grep or suchlike) and you may wish\
+ to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal.\
+ otherwise odd values gives one value per line, even two. Values 1,2 give normal format, 3,4\
+ gives greater precision, while 5,6 give IEEE values. When used for exporting a basis 1 does not save \
+values, 2 saves values, 3 with greater accuracy and 4 in IEEE."
+ );
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("para!metrics", "Import data from file and do parametrics",
+ CLP_PARAM_ACTION_PARAMETRICS, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read a file with parametric data from the given file name \
+and then do parametrics. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set. This can not read from compressed files. \
+File is in modified csv format - a line ROWS will be followed by rows data \
+while a line COLUMNS will be followed by column data. The last line \
+should be ENDATA. The ROWS line must exist and is in the format \
+ROWS, inital theta, final theta, interval theta, n where n is 0 to get \
+CLPI0062 message at interval or at each change of theta \
+and 1 to get CLPI0063 message at each iteration. If interval theta is 0.0 \
+or >= final theta then no interval reporting. n may be missed out when it is \
+taken as 0. If there is Row data then \
+there is a headings line with allowed headings - name, number, \
+lower(rhs change), upper(rhs change), rhs(change). Either the lower and upper \
+fields should be given or the rhs field. \
+The optional COLUMNS line is followed by a headings line with allowed \
+headings - name, number, objective(change), lower(change), upper(change). \
+ Exactly one of name and number must be given for either section and \
+missing ones have value 0.0."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("passC!uts", "Number of cut passes at root node",
+ -9999999, 9999999, CBC_PARAM_INT_CUTPASS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is 100 passes if less than 500 columns, 100 passes (but \
+stop if drop small if less than 5000 columns, 20 otherwise"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("passF!easibilityPump", "How many passes in feasibility pump",
+ 0, 10000, CBC_PARAM_INT_FPUMPITS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This fine tunes Feasibility Pump by doing more or fewer passes."
+ );
+ parameters[numberParameters-1].setIntValue(20);
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("passP!resolve", "How many passes in presolve",
+ -200, 100, CLP_PARAM_INT_PRESOLVEPASS, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally Presolve does 10 passes but you may want to do less to make it\
+ more lightweight or do more if improvements are still being made. As Presolve will return\
+ if nothing is being taken out, you should not normally need to use this fine tuning."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("passT!reeCuts", "Number of cut passes in tree",
+ -9999999, 9999999, CBC_PARAM_INT_CUTPASSINTREE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is one pass"
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("pertV!alue", "Method of perturbation",
+ -5000, 102, CLP_PARAM_INT_PERTVALUE, 1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("perturb!ation", "Whether to perturb problem",
+ "on", CLP_PARAM_STR_PERTURBATION);
+ parameters[numberParameters-1].append("off");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Perturbation helps to stop cycling, but Clp uses other measures for this.\
+ However large problems and especially ones with unit elements and unit rhs or costs\
+ benefit from perturbation. Normally Clp tries to be intelligent, but you can switch this off.\
+ The Clp library has this off by default. This program has it on by default."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("PFI", "Whether to use Product Form of Inverse in simplex",
+ "off", CLP_PARAM_STR_PFI, 7, 0);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "By default clp uses Forrest-Tomlin L-U update. If you are masochistic you can switch it off."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("pivotAndC!omplement", "Whether to try Pivot and Complement heuristic",
+ "off", CBC_PARAM_STR_PIVOTANDCOMPLEMENT);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "stuff needed. \
+Doh option does heuristic before preprocessing" );
+ parameters[numberParameters++] =
+ CbcOrClpParam("pivotAndF!ix", "Whether to try Pivot and Fix heuristic",
+ "off", CBC_PARAM_STR_PIVOTANDFIX);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "stuff needed. \
+Doh option does heuristic before preprocessing" );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("plus!Minus", "Tries to make +- 1 matrix",
+ CLP_PARAM_ACTION_PLUSMINUS, 7, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Clp will go slightly faster if the matrix can be converted so that the elements are\
+ not stored and are known to be unit. The main advantage is memory use. Clp may automatically\
+ see if it can convert the problem so you should not need to use this."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("pO!ptions", "Dubious print options",
+ 0, COIN_INT_MAX, CLP_PARAM_INT_PRINTOPTIONS, 1);
+ parameters[numberParameters-1].setIntValue(0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If this is > 0 then presolve will give more information and branch and cut will give statistics"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("preO!pt", "Presolve options",
+ 0, COIN_INT_MAX, CLP_PARAM_INT_PRESOLVEOPTIONS, 0);
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("presolve", "Whether to presolve problem",
+ "on", CLP_PARAM_STR_PRESOLVE);
+ parameters[numberParameters-1].append("off");
+ parameters[numberParameters-1].append("more");
+ parameters[numberParameters-1].append("file");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Presolve analyzes the model to find such things as redundant equations, equations\
+ which fix some variables, equations which can be transformed into bounds etc etc. For the\
+ initial solve of any problem this is worth doing unless you know that it will have no effect. \
+on will normally do 5 passes while using 'more' will do 10. If the problem is very large you may need \
+to write the original to file using 'file'."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("preprocess", "Whether to use integer preprocessing",
+ "off", CBC_PARAM_STR_PREPROCESS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("save");
+ parameters[numberParameters-1].append("equal");
+ parameters[numberParameters-1].append("sos");
+ parameters[numberParameters-1].append("trysos");
+ parameters[numberParameters-1].append("equalall");
+ parameters[numberParameters-1].append("strategy");
+ parameters[numberParameters-1].append("aggregate");
+ parameters[numberParameters-1].append("forcesos");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This tries to reduce size of model in a similar way to presolve and \
+it also tries to strengthen the model - this can be very useful and is worth trying. \
+ Save option saves on file presolved.mps. equal will turn <= cliques into \
+==. sos will create sos sets if all 0-1 in sets (well one extra is allowed) \
+and no overlaps. trysos is same but allows any number extra. equalall will turn all \
+valid inequalities into equalities with integer slacks. strategy is as \
+on but uses CbcStrategy."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("preT!olerance", "Tolerance to use in presolve",
+ 1.0e-20, 1.0e12, CLP_PARAM_DBL_PRESOLVETOLERANCE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The default is 1.0e-8 - you may wish to try 1.0e-7 if presolve says the problem is \
+infeasible and you have awkward numbers and you are sure the problem is really feasible."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("primalP!ivot", "Primal pivot choice algorithm",
+ "auto!matic", CLP_PARAM_STR_PRIMALPIVOT, 7, 1);
+ parameters[numberParameters-1].append("exa!ct");
+ parameters[numberParameters-1].append("dant!zig");
+ parameters[numberParameters-1].append("part!ial");
+ parameters[numberParameters-1].append("steep!est");
+ parameters[numberParameters-1].append("change");
+ parameters[numberParameters-1].append("sprint");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Clp can use any pivot selection algorithm which the user codes as long as it\
+ implements the features in the abstract pivot base class. The Dantzig method is implemented\
+ to show a simple method but its use is deprecated. Exact devex is the method of choice and there\
+ are two variants which keep all weights updated but only scan a subset each iteration.\
+ Partial switches this on while change initially does dantzig until the factorization\
+ becomes denser. This is still a work in progress."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("primalS!implex", "Do primal simplex algorithm",
+ CLP_PARAM_ACTION_PRIMALSIMPLEX);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This command solves the continuous relaxation of the current model using the primal algorithm.\
+ The default is to use exact devex.\
+ The time and iterations may be affected by settings such as presolve, scaling, crash\
+ and also by column selection method, infeasibility weight and dual and primal tolerances."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("primalT!olerance", "For an optimal solution \
+no primal infeasibility may exceed this value",
+ 1.0e-20, 1.0e12, CLP_PARAM_DBL_PRIMALTOLERANCE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally the default tolerance is fine, but you may want to increase it a\
+ bit if a primal run seems to be having a hard time"
+ );
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("primalW!eight", "Initially algorithm acts as if it \
+costs this much to be infeasible",
+ 1.0e-20, 1.0e20, CLP_PARAM_DBL_PRIMALWEIGHT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "The primal algorithm in Clp is a single phase algorithm as opposed to a two phase\
+ algorithm where you first get feasible then optimal. So Clp is minimizing this weight times\
+ the sum of primal infeasibilities plus the true objective function (in minimization sense).\
+ Too high a value may mean more iterations, while too low a bound means\
+ the code may go all the way and then have to increase the weight in order to get feasible.\
+ OSL had a heuristic to\
+ adjust bounds, maybe we need that here."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("printi!ngOptions", "Print options",
+ "normal", CLP_PARAM_STR_INTPRINT, 3);
+ parameters[numberParameters-1].append("integer");
+ parameters[numberParameters-1].append("special");
+ parameters[numberParameters-1].append("rows");
+ parameters[numberParameters-1].append("all");
+ parameters[numberParameters-1].append("csv");
+ parameters[numberParameters-1].append("bound!ranging");
+ parameters[numberParameters-1].append("rhs!ranging");
+ parameters[numberParameters-1].append("objective!ranging");
+ parameters[numberParameters-1].append("stats");
+ parameters[numberParameters-1].append("boundsint");
+ parameters[numberParameters-1].append("boundsall");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This changes the amount and format of printing a solution:\nnormal - nonzero column variables \n\
+integer - nonzero integer column variables\n\
+special - in format suitable for OsiRowCutDebugger\n\
+rows - nonzero column variables and row activities\n\
+all - all column variables and row activities.\n\
+\nFor non-integer problems 'integer' and 'special' act like 'normal'. \
+Also see printMask for controlling output."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("printM!ask", "Control printing of solution on a mask",
+ CLP_PARAM_ACTION_PRINTMASK, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If set then only those names which match mask are printed in a solution. \
+'?' matches any character and '*' matches any set of characters. \
+ The default is '' i.e. unset so all variables are printed. \
+This is only active if model has names."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("prio!rityIn", "Import priorities etc from file",
+ CBC_PARAM_ACTION_PRIORITYIN, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read a file with priorities from the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to '', i.e. it must be set. This can not read from compressed files. \
+File is in csv format with allowed headings - name, number, priority, direction, up, down, solution. Exactly one of\
+ name and number must be given."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("probing!Cuts", "Whether to use Probing cuts",
+ "off", CBC_PARAM_STR_PROBINGCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].append("forceonglobal");
+ parameters[numberParameters-1].append("forceOnBut");
+ parameters[numberParameters-1].append("forceOnStrong");
+ parameters[numberParameters-1].append("forceOnButStrong");
+ parameters[numberParameters-1].append("strongRoot");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on probing cuts (either at root or in entire tree) \
+See branchAndCut for information on options. \
+but strong options do more probing"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("proximity!Search", "Whether to do proximity search heuristic",
+ "off", CBC_PARAM_STR_PROXIMITY);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("10");
+ parameters[numberParameters-1].append("100");
+ parameters[numberParameters-1].append("300");
+ // but allow numbers after this (returning 1)
+ parameters[numberParameters-1].setFakeKeyWord(1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a heuristic which looks for a solution close \
+to incumbent solution (Fischetti and Monaci). \
+See Rounding for meaning of on,both,before. \
+Can also set different maxNode settings by plusnnnn (and are 'on'(on==30))."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("pumpC!utoff", "Fake cutoff for use in feasibility pump",
+ -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_FAKECUTOFF);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "0.0 off - otherwise add a constraint forcing objective below this value\
+ in feasibility pump"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("pumpI!ncrement", "Fake increment for use in feasibility pump",
+ -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_FAKEINCREMENT, 1);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "0.0 off - otherwise use as absolute increment to cutoff \
+when solution found in feasibility pump"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("pumpT!une", "Dubious ideas for feasibility pump",
+ 0, 100000000, CBC_PARAM_INT_FPUMPTUNE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This fine tunes Feasibility Pump \n\
+\t>=10000000 use as objective weight switch\n\
+\t>=1000000 use as accumulate switch\n\
+\t>=1000 use index+1 as number of large loops\n\
+\t==100 use objvalue +0.05*fabs(objvalue) as cutoff OR fakeCutoff if set\n\
+\t%100 == 10,20 affects how each solve is done\n\
+\t1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds. \
+If accumulate is on then after a major pass, variables which have not moved \
+are fixed and a small branch and bound is tried."
+ );
+ parameters[numberParameters-1].setIntValue(0);
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("quit", "Stops clp execution",
+ CLP_PARAM_ACTION_EXIT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This stops the execution of Clp, end, exit, quit and stop are synonyms"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("randomC!bcSeed", "Random seed for Cbc",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_RANDOMSEED);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets a random seed for Cbc \
+- 0 says use time of day, -1 is as now."
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("randomi!zedRounding", "Whether to try randomized rounding heuristic",
+ "off", CBC_PARAM_STR_RANDROUND);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "stuff needed. \
+Doh option does heuristic before preprocessing" );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("randomS!eed", "Random seed for Clp",
+ 0, COIN_INT_MAX, CLP_PARAM_INT_RANDOMSEED);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sets a random seed for Clp \
+- 0 says use time of day."
+ );
+ parameters[numberParameters-1].setIntValue(1234567);
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("ratio!Gap", "Stop when gap between best possible and \
+best less than this fraction of larger of two",
+ 0.0, 1.0e20, CBC_PARAM_DBL_GAPRATIO);
+ parameters[numberParameters-1].setDoubleValue(0.0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If the gap between best solution and best possible solution is less than this fraction \
+of the objective value at the root node then the search will terminate. See 'allowableGap' for a \
+way of using absolute value rather than fraction."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("restoreS!olution", "reads solution from file",
+ CLP_PARAM_ACTION_RESTORESOL);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will read a binary solution file from the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'solution.file'. This reads in a file from saveSolution"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("readSt!ored", "Import stored cuts from file",
+ CLP_PARAM_ACTION_STOREDFILE, 3, 0);
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("reallyO!bjectiveScale", "Scale factor to apply to objective in place",
+ -1.0e20, 1.0e20, CLP_PARAM_DBL_OBJSCALE2, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "You can set this to -1.0 to test maximization or other to stress code"
+ );
+ parameters[numberParameters-1].setDoubleValue(1.0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("reallyS!cale", "Scales model in place",
+ CLP_PARAM_ACTION_REALLY_SCALE, 7, 0);
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("reduce!AndSplitCuts", "Whether to use Reduce-and-Split cuts",
+ "off", CBC_PARAM_STR_REDSPLITCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on reduce and split cuts (either at root or in entire tree). \
+May be slow \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("reduce2!AndSplitCuts", "Whether to use Reduce-and-Split cuts - style 2",
+ "off", CBC_PARAM_STR_REDSPLIT2CUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("longOn");
+ parameters[numberParameters-1].append("longRoot");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on reduce and split cuts (either at root or in entire tree) \
+This version is by Giacomo Nannicini based on Francois Margot's version \
+Standard setting only uses rows in tableau <=256, long uses all \
+May be slow \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("reduce2!AndSplitCuts", "Whether to use Reduce-and-Split cuts - style 2",
+ "off", CBC_PARAM_STR_REDSPLIT2CUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("longOn");
+ parameters[numberParameters-1].append("longRoot");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on reduce and split cuts (either at root or in entire tree) \
+This version is by Giacomo Nannicini based on Francois Margot's version \
+Standard setting only uses rows in tableau <=256, long uses all \
+See branchAndCut for information on options."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("residual!CapacityCuts", "Whether to use Residual Capacity cuts",
+ "off", CBC_PARAM_STR_RESIDCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Residual capacity cuts. \
+See branchAndCut for information on options."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("restore!Model", "Restore model from binary file",
+ CLP_PARAM_ACTION_RESTORE, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This reads data save by saveModel from the given file. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'default.prob'."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("reverse", "Reverses sign of objective",
+ CLP_PARAM_ACTION_REVERSE, 7, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Useful for testing if maximization works correctly"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("rhs!Scale", "Scale factor to apply to rhs and bounds",
+ -1.0e20, 1.0e20, CLP_PARAM_DBL_RHSSCALE, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If the rhs or bounds have some very large meaningful values, you may wish to scale them\
+ internally by this amount. It can also be set by autoscale. This should not be needed."
+ );
+ parameters[numberParameters-1].setDoubleValue(1.0);
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("Rens", "Whether to try Relaxation Enforced Neighborhood Search",
+ "off", CBC_PARAM_STR_RENS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("200");
+ parameters[numberParameters-1].append("1000");
+ parameters[numberParameters-1].append("10000");
+ parameters[numberParameters-1].append("dj");
+ parameters[numberParameters-1].append("djbefore");
+ parameters[numberParameters-1].append("usesolution");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on Relaxation enforced neighborhood Search. \
+on just does 50 nodes \
+200 or 1000 does that many nodes. \
+Doh option does heuristic before preprocessing" );
+ parameters[numberParameters++] =
+ CbcOrClpParam("Rins", "Whether to try Relaxed Induced Neighborhood Search",
+ "off", CBC_PARAM_STR_RINS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("often");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on Relaxed induced neighborhood Search. \
+Doh option does heuristic before preprocessing" );
+ parameters[numberParameters++] =
+ CbcOrClpParam("round!ingHeuristic", "Whether to use Rounding heuristic",
+ "off", CBC_PARAM_STR_ROUNDING);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on a simple (but effective) rounding heuristic at each node of tree. \
+On means do in solve i.e. after preprocessing, \
+Before means do if doHeuristics used, off otherwise, \
+and both means do if doHeuristics and in solve."
+ );
+
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("saveM!odel", "Save model to binary file",
+ CLP_PARAM_ACTION_SAVE, 7, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will save the problem to the given file name for future use\
+ by restoreModel. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'default.prob'."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("saveS!olution", "saves solution to file",
+ CLP_PARAM_ACTION_SAVESOL);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will write a binary solution file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'solution.file'. To read the file use fread(int) twice to pick up number of rows \
+and columns, then fread(double) to pick up objective value, then pick up row activities, row duals, column \
+activities and reduced costs - see bottom of CbcOrClpParam.cpp for code that reads or writes file. \
+If name contains '_fix_read_' then does not write but reads and will fix all variables"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("scal!ing", "Whether to scale problem",
+ "off", CLP_PARAM_STR_SCALING);
+ parameters[numberParameters-1].append("equi!librium");
+ parameters[numberParameters-1].append("geo!metric");
+ parameters[numberParameters-1].append("auto!matic");
+ parameters[numberParameters-1].append("dynamic");
+ parameters[numberParameters-1].append("rows!only");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Scaling can help in solving problems which might otherwise fail because of lack of\
+ accuracy. It can also reduce the number of iterations. It is not applied if the range\
+ of elements is small. When unscaled it is possible that there may be small primal and/or\
+ infeasibilities."
+ );
+ parameters[numberParameters-1].setCurrentOption(3); // say auto
+#ifndef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("sec!onds", "Maximum seconds",
+ -1.0, 1.0e12, CLP_PARAM_DBL_TIMELIMIT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "After this many seconds clp will act as if maximum iterations had been reached \
+(if value >=0)."
+ );
+#else
+ parameters[numberParameters++] =
+ CbcOrClpParam("sec!onds", "maximum seconds",
+ -1.0, 1.0e12, CBC_PARAM_DBL_TIMELIMIT_BAB);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "After this many seconds coin solver will act as if maximum nodes had been reached."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("sleep", "for debug",
+ CLP_PARAM_ACTION_DUMMY, 7, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If passed to solver fom ampl, then ampl will wait so that you can copy .nl file for debug."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("slow!cutpasses", "Maximum number of tries for slower cuts",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_MAX_SLOW_CUTS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Some cut generators are fairly slow - this limits the number of times they are tried."
+ );
+ parameters[numberParameters-1].setIntValue(10);
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("slp!Value", "Number of slp passes before primal",
+ -50000, 50000, CLP_PARAM_INT_SLPVALUE, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If you are solving a quadratic problem using primal then it may be helpful to do some \
+sequential Lps to get a good approximate solution."
+ );
+#if CLP_MULTIPLE_FACTORIZATIONS > 0
+ parameters[numberParameters++] =
+ CbcOrClpParam("small!Factorization", "Whether to use small factorization",
+ -1, 10000, CBC_PARAM_INT_SMALLFACT, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If processed problem <= this use small factorization"
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+#endif
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("solu!tion", "Prints solution to file",
+ CLP_PARAM_ACTION_SOLUTION);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This will write a primitive solution file to the given file name. It will use the default\
+ directory given by 'directory'. A name of '$' will use the previous value for the name. This\
+ is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask."
+ );
+#ifdef COIN_HAS_CLP
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("solv!e", "Solve problem",
+ CBC_PARAM_ACTION_BAB);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If there are no integer variables then this just solves LP. If there are integer variables \
+this does branch and cut."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("sos!Options", "Whether to use SOS from AMPL",
+ "off", CBC_PARAM_STR_SOS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setCurrentOption("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally if AMPL says there are SOS variables they should be used, but sometime sthey should\
+ be turned off - this does so."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("slog!Level", "Level of detail in (LP) Solver output",
+ -1, 63, CLP_PARAM_INT_SOLVERLOGLEVEL);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If 0 then there should be no output in normal circumstances. 1 is probably the best\
+ value for most uses, while 2 and 3 give more information. This parameter is only used inside MIP - for Clp use 'log'"
+ );
+#else
+ // allow solve as synonym for possible dual
+ parameters[numberParameters++] =
+ CbcOrClpParam("solv!e", "Solve problem using dual simplex (probably)",
+ CLP_PARAM_ACTION_EITHERSIMPLEX);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Just so can use solve for clp as well as in cbc"
+ );
+#endif
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("spars!eFactor", "Whether factorization treated as sparse",
+ "on", CLP_PARAM_STR_SPARSEFACTOR, 7, 0);
+ parameters[numberParameters-1].append("off");
+ parameters[numberParameters++] =
+ CbcOrClpParam("special!Options", "Dubious options for Simplex - see ClpSimplex.hpp",
+ 0, COIN_INT_MAX, CLP_PARAM_INT_SPECIALOPTIONS, 0);
+ parameters[numberParameters++] =
+ CbcOrClpParam("sprint!Crash", "Whether to try sprint crash",
+ -1, 5000000, CLP_PARAM_INT_SPRINT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "For long and thin problems this program may solve a series of small problems\
+ created by taking a subset of the columns. I introduced the idea as 'Sprint' after\
+ an LP code of that name of the 60's which tried the same tactic (not totally successfully).\
+ Cplex calls it 'sifting'. -1 is automatic choice, 0 is off, n is number of passes"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("stat!istics", "Print some statistics",
+ CLP_PARAM_ACTION_STATISTICS);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This command prints some statistics for the current model.\
+ If log level >1 then more is printed.\
+ These are for presolved model if presolve on (and unscaled)."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("stop", "Stops clp execution",
+ CLP_PARAM_ACTION_EXIT);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This stops the execution of Clp, end, exit, quit and stop are synonyms"
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("strat!egy", "Switches on groups of features",
+ 0, 2, CBC_PARAM_INT_STRATEGY);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This turns on newer features. \
+Use 0 for easy problems, 1 is default, 2 is aggressive. \
+1 uses Gomory cuts using tolerance of 0.01 at root, \
+does a possible restart after 100 nodes if can fix many \
+and activates a diving and RINS heuristic and makes feasibility pump \
+more aggressive. \
+This does not apply to unit tests (where 'experiment' may have similar effects)."
+ );
+ parameters[numberParameters-1].setIntValue(1);
+#ifdef CBC_KEEP_DEPRECATED
+ parameters[numberParameters++] =
+ CbcOrClpParam("strengthen", "Create strengthened problem",
+ CBC_PARAM_ACTION_STRENGTHEN, 3);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This creates a new problem by applying the root node cuts. All tight constraints \
+will be in resulting problem"
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("strong!Branching", "Number of variables to look at in strong branching",
+ 0, COIN_INT_MAX, CBC_PARAM_INT_STRONGBRANCHING);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "In order to decide which variable to branch on, the code will choose up to this number \
+of unsatisfied variables to do mini up and down branches on. Then the most effective one is chosen. \
+If a variable is branched on many times then the previous average up and down costs may be used - \
+see number before trust."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("subs!titution", "How long a column to substitute for in presolve",
+ 0, 10000, CLP_PARAM_INT_SUBSTITUTION, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Normally Presolve gets rid of 'free' variables when there are no more than 3 \
+ variables in column. If you increase this the number of rows may decrease but number of \
+ elements may increase."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("testO!si", "Test OsiObject stuff",
+ -1, COIN_INT_MAX, CBC_PARAM_INT_TESTOSI, 0);
+#endif
+#ifdef CBC_THREAD
+ parameters[numberParameters++] =
+ CbcOrClpParam("thread!s", "Number of threads to try and use",
+ -100, 100000, CBC_PARAM_INT_THREADS, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "To use multiple threads, set threads to number wanted. It may be better \
+to use one or two more than number of cpus available. If 100+n then n threads and \
+search is repeatable (maybe be somewhat slower), \
+if 200+n use threads for root cuts, 400+n threads used in sub-trees."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("tighten!Factor", "Tighten bounds using this times largest \
+activity at continuous solution",
+ 1.0e-3, 1.0e20, CBC_PARAM_DBL_TIGHTENFACTOR, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This sleazy trick can help on some problems."
+ );
+#endif
+#ifdef COIN_HAS_CLP
+ parameters[numberParameters++] =
+ CbcOrClpParam("tightLP", "Poor person's preSolve for now",
+ CLP_PARAM_ACTION_TIGHTEN, 7, 0);
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("timeM!ode", "Whether to use CPU or elapsed time",
+ "cpu", CLP_PARAM_STR_TIME_MODE);
+ parameters[numberParameters-1].append("elapsed");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "cpu uses CPU time for stopping, while elapsed uses elapsed time. \
+(On Windows, elapsed time is always used)."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("trust!PseudoCosts", "Number of branches before we trust pseudocosts",
+ -3, 2000000000, CBC_PARAM_INT_NUMBERBEFORE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Using strong branching computes pseudo-costs. After this many times for a variable we just \
+trust the pseudo costs and do not do any more strong branching."
+ );
+#endif
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("tune!PreProcess", "Dubious tuning parameters",
+ 0, 2000000000, CLP_PARAM_INT_PROCESSTUNE, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Format aabbcccc - \n If aa then this is number of major passes (i.e. with presolve) \n \
+If bb and bb>0 then this is number of minor passes (if unset or 0 then 10) \n \
+cccc is bit set \n 0 - 1 Heavy probing \n 1 - 2 Make variables integer if possible (if obj value)\n \
+2 - 4 As above but even if zero objective value\n \
+7 - 128 Try and create cliques\n 8 - 256 If all +1 try hard for dominated rows\n \
+10 - 1024 Use a larger feasibility tolerance in presolve\n \
+11 - 2048 Try probing before creating cliques"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("two!MirCuts", "Whether to use Two phase Mixed Integer Rounding cuts",
+ "off", CBC_PARAM_STR_TWOMIRCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].append("forceandglobal");
+ parameters[numberParameters-1].append("forceLongOn");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on two phase mixed integer rounding cuts (either at root or in entire tree) \
+See branchAndCut for information on options."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("unitTest", "Do unit test",
+ CLP_PARAM_ACTION_UNITTEST, 3, 1);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This exercises the unit test for clp"
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("userClp", "Hand coded Clp stuff",
+ CLP_PARAM_ACTION_USERCLP, 0, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "There are times e.g. when using AMPL interface when you may wish to do something unusual. \
+Look for USERCLP in main driver and modify sample code."
+ );
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("userCbc", "Hand coded Cbc stuff",
+ CBC_PARAM_ACTION_USERCBC, 0, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "There are times e.g. when using AMPL interface when you may wish to do something unusual. \
+Look for USERCBC in main driver and modify sample code. \
+It is possible you can get same effect by using example driver4.cpp."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("Vnd!VariableNeighborhoodSearch", "Whether to try Variable Neighborhood Search",
+ "off", CBC_PARAM_STR_VND);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("both");
+ parameters[numberParameters-1].append("before");
+ parameters[numberParameters-1].append("intree");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on variable neighborhood Search. \
+Doh option does heuristic before preprocessing" );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("vector", "Whether to use vector? Form of matrix in simplex",
+ "off", CLP_PARAM_STR_VECTOR, 7, 0);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If this is on ClpPackedMatrix uses extra column copy in odd format."
+ );
+ parameters[numberParameters++] =
+ CbcOrClpParam("verbose", "Switches on longer help on single ?",
+ 0, 31, CLP_PARAM_INT_VERBOSE, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "Set to 1 to get short help with ? list, 2 to get long help, 3 for both. (add 4 to just get ampl ones)."
+ );
+ parameters[numberParameters-1].setIntValue(0);
+#ifdef COIN_HAS_CBC
+ parameters[numberParameters++] =
+ CbcOrClpParam("vub!heuristic", "Type of vub heuristic",
+ -2, 20, CBC_PARAM_INT_VUBTRY, 0);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "If set will try and fix some integer variables"
+ );
+ parameters[numberParameters-1].setIntValue(-1);
+ parameters[numberParameters++] =
+ CbcOrClpParam("zero!HalfCuts", "Whether to use zero half cuts",
+ "off", CBC_PARAM_STR_ZEROHALFCUTS);
+ parameters[numberParameters-1].append("on");
+ parameters[numberParameters-1].append("root");
+ parameters[numberParameters-1].append("ifmove");
+ parameters[numberParameters-1].append("forceOn");
+ parameters[numberParameters-1].append("onglobal");
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This switches on zero-half cuts (either at root or in entire tree) \
+See branchAndCut for information on options. This implementation was written by \
+Alberto Caprara."
+ );
+#endif
+ parameters[numberParameters++] =
+ CbcOrClpParam("zeroT!olerance", "Kill all coefficients \
+whose absolute value is less than this value",
+ 1.0e-100, 1.0e-5, CLP_PARAM_DBL_ZEROTOLERANCE);
+ parameters[numberParameters-1].setLonghelp
+ (
+ "This applies to reading mps files (and also lp files \
+if KILL_ZERO_READLP defined)"
+ );
+ parameters[numberParameters-1].setDoubleValue(1.0e-20);
+ assert(numberParameters < CBCMAXPARAMETERS);
+}
+// Given a parameter type - returns its number in list
+int whichParam (CbcOrClpParameterType name,
+ int numberParameters, CbcOrClpParam *const parameters)
+{
+ int i;
+ for (i = 0; i < numberParameters; i++) {
+ if (parameters[i].type() == name)
+ break;
+ }
+ assert (i < numberParameters);
+ return i;
+}
+#ifdef COIN_HAS_CLP
+/* Restore a solution from file.
+ mode 0 normal, 1 swap rows and columns and primal and dual
+ if 2 set then also change signs
+*/
+void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode)
+{
+ FILE * fp = fopen(fileName.c_str(), "rb");
+ if (fp) {
+ int numberRows = lpSolver->numberRows();
+ int numberColumns = lpSolver->numberColumns();
+ int numberRowsFile;
+ int numberColumnsFile;
+ double objectiveValue;
+ size_t nRead;
+ nRead = fread(&numberRowsFile, sizeof(int), 1, fp);
+ if (nRead != 1)
+ throw("Error in fread");
+ nRead = fread(&numberColumnsFile, sizeof(int), 1, fp);
+ if (nRead != 1)
+ throw("Error in fread");
+ nRead = fread(&objectiveValue, sizeof(double), 1, fp);
+ if (nRead != 1)
+ throw("Error in fread");
+ double * dualRowSolution = lpSolver->dualRowSolution();
+ double * primalRowSolution = lpSolver->primalRowSolution();
+ double * dualColumnSolution = lpSolver->dualColumnSolution();
+ double * primalColumnSolution = lpSolver->primalColumnSolution();
+ if (mode) {
+ // swap
+ int k = numberRows;
+ numberRows = numberColumns;
+ numberColumns = k;
+ double * temp;
+ temp = dualRowSolution;
+ dualRowSolution = primalColumnSolution;
+ primalColumnSolution = temp;
+ temp = dualColumnSolution;
+ dualColumnSolution = primalRowSolution;
+ primalRowSolution = temp;
+ }
+ if (numberRows > numberRowsFile || numberColumns > numberColumnsFile) {
+ std::cout << "Mismatch on rows and/or columns - giving up" << std::endl;
+ } else {
+ lpSolver->setObjectiveValue(objectiveValue);
+ if (numberRows == numberRowsFile && numberColumns == numberColumnsFile) {
+ nRead = fread(primalRowSolution, sizeof(double), numberRows, fp);
+ if (nRead != static_cast(numberRows))
+ throw("Error in fread");
+ nRead = fread(dualRowSolution, sizeof(double), numberRows, fp);
+ if (nRead != static_cast(numberRows))
+ throw("Error in fread");
+ nRead = fread(primalColumnSolution, sizeof(double), numberColumns, fp);
+ if (nRead != static_cast(numberColumns))
+ throw("Error in fread");
+ nRead = fread(dualColumnSolution, sizeof(double), numberColumns, fp);
+ if (nRead != static_cast(numberColumns))
+ throw("Error in fread");
+ } else {
+ std::cout << "Mismatch on rows and/or columns - truncating" << std::endl;
+ double * temp = new double [CoinMax(numberRowsFile, numberColumnsFile)];
+ nRead = fread(temp, sizeof(double), numberRowsFile, fp);
+ if (nRead != static_cast(numberRowsFile))
+ throw("Error in fread");
+ CoinMemcpyN(temp, numberRows, primalRowSolution);
+ nRead = fread(temp, sizeof(double), numberRowsFile, fp);
+ if (nRead != static_cast(numberRowsFile))
+ throw("Error in fread");
+ CoinMemcpyN(temp, numberRows, dualRowSolution);
+ nRead = fread(temp, sizeof(double), numberColumnsFile, fp);
+ if (nRead != static_cast(numberColumnsFile))
+ throw("Error in fread");
+ CoinMemcpyN(temp, numberColumns, primalColumnSolution);
+ nRead = fread(temp, sizeof(double), numberColumnsFile, fp);
+ if (nRead != static_cast(numberColumnsFile))
+ throw("Error in fread");
+ CoinMemcpyN(temp, numberColumns, dualColumnSolution);
+ delete [] temp;
+ }
+ if (mode == 3) {
+ int i;
+ for (i = 0; i < numberRows; i++) {
+ primalRowSolution[i] = -primalRowSolution[i];
+ dualRowSolution[i] = -dualRowSolution[i];
+ }
+ for (i = 0; i < numberColumns; i++) {
+ primalColumnSolution[i] = -primalColumnSolution[i];
+ dualColumnSolution[i] = -dualColumnSolution[i];
+ }
+ }
+ }
+ fclose(fp);
+ } else {
+ std::cout << "Unable to open file " << fileName << std::endl;
+ }
+}
+// Dump a solution to file
+void saveSolution(const ClpSimplex * lpSolver, std::string fileName)
+{
+ if (strstr(fileName.c_str(), "_fix_read_")) {
+ FILE * fp = fopen(fileName.c_str(), "rb");
+ if (fp) {
+ ClpSimplex * solver = const_cast(lpSolver);
+ restoreSolution(solver, fileName, 0);
+ // fix all
+ int logLevel = solver->logLevel();
+ int iColumn;
+ int numberColumns = solver->numberColumns();
+ double * primalColumnSolution =
+ solver->primalColumnSolution();
+ double * columnLower = solver->columnLower();
+ double * columnUpper = solver->columnUpper();
+ for (iColumn = 0; iColumn < numberColumns; iColumn++) {
+ double value = primalColumnSolution[iColumn];
+ if (value > columnUpper[iColumn]) {
+ if (value > columnUpper[iColumn] + 1.0e-6 && logLevel > 1)
+ printf("%d value of %g - bounds %g %g\n",
+ iColumn, value, columnLower[iColumn], columnUpper[iColumn]);
+ value = columnUpper[iColumn];
+ } else if (value < columnLower[iColumn]) {
+ if (value < columnLower[iColumn] - 1.0e-6 && logLevel > 1)
+ printf("%d value of %g - bounds %g %g\n",
+ iColumn, value, columnLower[iColumn], columnUpper[iColumn]);
+ value = columnLower[iColumn];
+ }
+ columnLower[iColumn] = value;
+ columnUpper[iColumn] = value;
+ }
+ return;
+ }
+ }
+ FILE * fp = fopen(fileName.c_str(), "wb");
+ if (fp) {
+ int numberRows = lpSolver->numberRows();
+ int numberColumns = lpSolver->numberColumns();
+ double objectiveValue = lpSolver->objectiveValue();
+ size_t nWrite;
+ nWrite = fwrite(&numberRows, sizeof(int), 1, fp);
+ if (nWrite != 1)
+ throw("Error in fwrite");
+ nWrite = fwrite(&numberColumns, sizeof(int), 1, fp);
+ if (nWrite != 1)
+ throw("Error in fwrite");
+ nWrite = fwrite(&objectiveValue, sizeof(double), 1, fp);
+ if (nWrite != 1)
+ throw("Error in fwrite");
+ double * dualRowSolution = lpSolver->dualRowSolution();
+ double * primalRowSolution = lpSolver->primalRowSolution();
+ nWrite = fwrite(primalRowSolution, sizeof(double), numberRows, fp);
+ if (nWrite != static_cast(numberRows))
+ throw("Error in fwrite");
+ nWrite = fwrite(dualRowSolution, sizeof(double), numberRows, fp);
+ if (nWrite != static_cast(numberRows))
+ throw("Error in fwrite");
+ double * dualColumnSolution = lpSolver->dualColumnSolution();
+ double * primalColumnSolution = lpSolver->primalColumnSolution();
+ nWrite = fwrite(primalColumnSolution, sizeof(double), numberColumns, fp);
+ if (nWrite != static_cast(numberColumns))
+ throw("Error in fwrite");
+ nWrite = fwrite(dualColumnSolution, sizeof(double), numberColumns, fp);
+ if (nWrite != static_cast(numberColumns))
+ throw("Error in fwrite");
+ fclose(fp);
+ } else {
+ std::cout << "Unable to open file " << fileName << std::endl;
+ }
+}
+#endif
diff --git a/thirdparty/linux/include/coin/CbcOrClpParam.hpp b/thirdparty/linux/include/coin/CbcOrClpParam.hpp
new file mode 100644
index 0000000..d76d966
--- /dev/null
+++ b/thirdparty/linux/include/coin/CbcOrClpParam.hpp
@@ -0,0 +1,531 @@
+
+/* $Id: CbcOrClpParam.hpp 2070 2014-11-18 11:12:54Z forrest $ */
+// Copyright (C) 2002, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifdef USE_CBCCONFIG
+# include "CbcConfig.h"
+#else
+# include "ClpConfig.h"
+#endif
+
+#ifndef CbcOrClpParam_H
+#define CbcOrClpParam_H
+/**
+ This has parameter handling stuff which can be shared between Cbc and Clp (and Dylp etc).
+
+ This (and .cpp) should be copied so that it is the same in Cbc/Test and Clp/Test.
+ I know this is not elegant but it seems simplest.
+
+ It uses COIN_HAS_CBC for parameters wanted by CBC
+ It uses COIN_HAS_CLP for parameters wanted by CLP (or CBC using CLP)
+ It could use COIN_HAS_DYLP for parameters wanted by DYLP
+ It could use COIN_HAS_DYLP_OR_CLP for parameters wanted by DYLP or CLP etc etc
+
+ */
+class OsiSolverInterface;
+class CbcModel;
+class ClpSimplex;
+/*! \brief Parameter codes
+
+ Parameter type ranges are allocated as follows
+
+
1 -- 100 double parameters
+
101 -- 200 integer parameters
+
201 -- 250 string parameters
+
251 -- 300 cuts etc(string but broken out for clarity)
+
301 -- 400 `actions'
+
+
+ `Actions' do not necessarily invoke an immediate action; it's just that they
+ don't fit neatly into the parameters array.
+
+ This coding scheme is in flux.
+*/
+
+enum CbcOrClpParameterType
+
+{
+ CBC_PARAM_GENERALQUERY = -100,
+ CBC_PARAM_FULLGENERALQUERY,
+
+ CLP_PARAM_DBL_PRIMALTOLERANCE = 1,
+ CLP_PARAM_DBL_DUALTOLERANCE,
+ CLP_PARAM_DBL_TIMELIMIT,
+ CLP_PARAM_DBL_DUALBOUND,
+ CLP_PARAM_DBL_PRIMALWEIGHT,
+ CLP_PARAM_DBL_OBJSCALE,
+ CLP_PARAM_DBL_RHSSCALE,
+ CLP_PARAM_DBL_ZEROTOLERANCE,
+
+ CBC_PARAM_DBL_INFEASIBILITYWEIGHT = 51,
+ CBC_PARAM_DBL_CUTOFF,
+ CBC_PARAM_DBL_INTEGERTOLERANCE,
+ CBC_PARAM_DBL_INCREMENT,
+ CBC_PARAM_DBL_ALLOWABLEGAP,
+ CBC_PARAM_DBL_TIMELIMIT_BAB,
+ CBC_PARAM_DBL_GAPRATIO,
+
+ CBC_PARAM_DBL_DJFIX = 81,
+ CBC_PARAM_DBL_TIGHTENFACTOR,
+ CLP_PARAM_DBL_PRESOLVETOLERANCE,
+ CLP_PARAM_DBL_OBJSCALE2,
+ CBC_PARAM_DBL_FAKEINCREMENT,
+ CBC_PARAM_DBL_FAKECUTOFF,
+ CBC_PARAM_DBL_ARTIFICIALCOST,
+ CBC_PARAM_DBL_DEXTRA3,
+ CBC_PARAM_DBL_SMALLBAB,
+ CBC_PARAM_DBL_DEXTRA4,
+ CBC_PARAM_DBL_DEXTRA5,
+
+ CLP_PARAM_INT_SOLVERLOGLEVEL = 101,
+#ifndef COIN_HAS_CBC
+ CLP_PARAM_INT_LOGLEVEL = 101,
+#endif
+ CLP_PARAM_INT_MAXFACTOR,
+ CLP_PARAM_INT_PERTVALUE,
+ CLP_PARAM_INT_MAXITERATION,
+ CLP_PARAM_INT_PRESOLVEPASS,
+ CLP_PARAM_INT_IDIOT,
+ CLP_PARAM_INT_SPRINT,
+ CLP_PARAM_INT_OUTPUTFORMAT,
+ CLP_PARAM_INT_SLPVALUE,
+ CLP_PARAM_INT_PRESOLVEOPTIONS,
+ CLP_PARAM_INT_PRINTOPTIONS,
+ CLP_PARAM_INT_SPECIALOPTIONS,
+ CLP_PARAM_INT_SUBSTITUTION,
+ CLP_PARAM_INT_DUALIZE,
+ CLP_PARAM_INT_VERBOSE,
+ CLP_PARAM_INT_CPP,
+ CLP_PARAM_INT_PROCESSTUNE,
+ CLP_PARAM_INT_USESOLUTION,
+ CLP_PARAM_INT_RANDOMSEED,
+ CLP_PARAM_INT_MORESPECIALOPTIONS,
+ CLP_PARAM_INT_DECOMPOSE_BLOCKS,
+
+ CBC_PARAM_INT_STRONGBRANCHING = 151,
+ CBC_PARAM_INT_CUTDEPTH,
+ CBC_PARAM_INT_MAXNODES,
+ CBC_PARAM_INT_NUMBERBEFORE,
+ CBC_PARAM_INT_NUMBERANALYZE,
+ CBC_PARAM_INT_MIPOPTIONS,
+ CBC_PARAM_INT_MOREMIPOPTIONS,
+ CBC_PARAM_INT_MAXHOTITS,
+ CBC_PARAM_INT_FPUMPITS,
+ CBC_PARAM_INT_MAXSOLS,
+ CBC_PARAM_INT_FPUMPTUNE,
+ CBC_PARAM_INT_TESTOSI,
+ CBC_PARAM_INT_EXTRA1,
+ CBC_PARAM_INT_EXTRA2,
+ CBC_PARAM_INT_EXTRA3,
+ CBC_PARAM_INT_EXTRA4,
+ CBC_PARAM_INT_DEPTHMINIBAB,
+ CBC_PARAM_INT_CUTPASSINTREE,
+ CBC_PARAM_INT_THREADS,
+ CBC_PARAM_INT_CUTPASS,
+ CBC_PARAM_INT_VUBTRY,
+ CBC_PARAM_INT_DENSE,
+ CBC_PARAM_INT_EXPERIMENT,
+ CBC_PARAM_INT_DIVEOPT,
+ CBC_PARAM_INT_DIVEOPTSOLVES,
+ CBC_PARAM_INT_STRATEGY,
+ CBC_PARAM_INT_SMALLFACT,
+ CBC_PARAM_INT_HOPTIONS,
+ CBC_PARAM_INT_CUTLENGTH,
+ CBC_PARAM_INT_FPUMPTUNE2,
+#ifdef COIN_HAS_CBC
+ CLP_PARAM_INT_LOGLEVEL ,
+#endif
+ CBC_PARAM_INT_MAXSAVEDSOLS,
+ CBC_PARAM_INT_RANDOMSEED,
+ CBC_PARAM_INT_MULTIPLEROOTS,
+ CBC_PARAM_INT_STRONG_STRATEGY,
+ CBC_PARAM_INT_EXTRA_VARIABLES,
+ CBC_PARAM_INT_MAX_SLOW_CUTS,
+ CBC_PARAM_INT_MOREMOREMIPOPTIONS,
+
+ CLP_PARAM_STR_DIRECTION = 201,
+ CLP_PARAM_STR_DUALPIVOT,
+ CLP_PARAM_STR_SCALING,
+ CLP_PARAM_STR_ERRORSALLOWED,
+ CLP_PARAM_STR_KEEPNAMES,
+ CLP_PARAM_STR_SPARSEFACTOR,
+ CLP_PARAM_STR_PRIMALPIVOT,
+ CLP_PARAM_STR_PRESOLVE,
+ CLP_PARAM_STR_CRASH,
+ CLP_PARAM_STR_BIASLU,
+ CLP_PARAM_STR_PERTURBATION,
+ CLP_PARAM_STR_MESSAGES,
+ CLP_PARAM_STR_AUTOSCALE,
+ CLP_PARAM_STR_CHOLESKY,
+ CLP_PARAM_STR_KKT,
+ CLP_PARAM_STR_BARRIERSCALE,
+ CLP_PARAM_STR_GAMMA,
+ CLP_PARAM_STR_CROSSOVER,
+ CLP_PARAM_STR_PFI,
+ CLP_PARAM_STR_INTPRINT,
+ CLP_PARAM_STR_VECTOR,
+ CLP_PARAM_STR_FACTORIZATION,
+ CLP_PARAM_STR_ALLCOMMANDS,
+ CLP_PARAM_STR_TIME_MODE,
+ CLP_PARAM_STR_ABCWANTED,
+
+ CBC_PARAM_STR_NODESTRATEGY = 251,
+ CBC_PARAM_STR_BRANCHSTRATEGY,
+ CBC_PARAM_STR_CUTSSTRATEGY,
+ CBC_PARAM_STR_HEURISTICSTRATEGY,
+ CBC_PARAM_STR_GOMORYCUTS,
+ CBC_PARAM_STR_PROBINGCUTS,
+ CBC_PARAM_STR_KNAPSACKCUTS,
+ CBC_PARAM_STR_REDSPLITCUTS,
+ CBC_PARAM_STR_ROUNDING,
+ CBC_PARAM_STR_SOLVER,
+ CBC_PARAM_STR_CLIQUECUTS,
+ CBC_PARAM_STR_COSTSTRATEGY,
+ CBC_PARAM_STR_FLOWCUTS,
+ CBC_PARAM_STR_MIXEDCUTS,
+ CBC_PARAM_STR_TWOMIRCUTS,
+ CBC_PARAM_STR_PREPROCESS,
+ CBC_PARAM_STR_FPUMP,
+ CBC_PARAM_STR_GREEDY,
+ CBC_PARAM_STR_COMBINE,
+ CBC_PARAM_STR_PROXIMITY,
+ CBC_PARAM_STR_LOCALTREE,
+ CBC_PARAM_STR_SOS,
+ CBC_PARAM_STR_LANDPCUTS,
+ CBC_PARAM_STR_RINS,
+ CBC_PARAM_STR_RESIDCUTS,
+ CBC_PARAM_STR_RENS,
+ CBC_PARAM_STR_DIVINGS,
+ CBC_PARAM_STR_DIVINGC,
+ CBC_PARAM_STR_DIVINGF,
+ CBC_PARAM_STR_DIVINGG,
+ CBC_PARAM_STR_DIVINGL,
+ CBC_PARAM_STR_DIVINGP,
+ CBC_PARAM_STR_DIVINGV,
+ CBC_PARAM_STR_DINS,
+ CBC_PARAM_STR_PIVOTANDFIX,
+ CBC_PARAM_STR_RANDROUND,
+ CBC_PARAM_STR_NAIVE,
+ CBC_PARAM_STR_ZEROHALFCUTS,
+ CBC_PARAM_STR_CPX,
+ CBC_PARAM_STR_CROSSOVER2,
+ CBC_PARAM_STR_PIVOTANDCOMPLEMENT,
+ CBC_PARAM_STR_VND,
+ CBC_PARAM_STR_LAGOMORYCUTS,
+ CBC_PARAM_STR_LATWOMIRCUTS,
+ CBC_PARAM_STR_REDSPLIT2CUTS,
+ CBC_PARAM_STR_GMICUTS,
+ CBC_PARAM_STR_CUTOFF_CONSTRAINT,
+ CBC_PARAM_STR_DW,
+ CBC_PARAM_STR_ORBITAL,
+
+ CLP_PARAM_ACTION_DIRECTORY = 301,
+ CLP_PARAM_ACTION_DIRSAMPLE,
+ CLP_PARAM_ACTION_DIRNETLIB,
+ CBC_PARAM_ACTION_DIRMIPLIB,
+ CLP_PARAM_ACTION_IMPORT,
+ CLP_PARAM_ACTION_EXPORT,
+ CLP_PARAM_ACTION_RESTORE,
+ CLP_PARAM_ACTION_SAVE,
+ CLP_PARAM_ACTION_DUALSIMPLEX,
+ CLP_PARAM_ACTION_PRIMALSIMPLEX,
+ CLP_PARAM_ACTION_EITHERSIMPLEX,
+ CLP_PARAM_ACTION_MAXIMIZE,
+ CLP_PARAM_ACTION_MINIMIZE,
+ CLP_PARAM_ACTION_EXIT,
+ CLP_PARAM_ACTION_STDIN,
+ CLP_PARAM_ACTION_UNITTEST,
+ CLP_PARAM_ACTION_NETLIB_EITHER,
+ CLP_PARAM_ACTION_NETLIB_DUAL,
+ CLP_PARAM_ACTION_NETLIB_PRIMAL,
+ CLP_PARAM_ACTION_SOLUTION,
+ CLP_PARAM_ACTION_SAVESOL,
+ CLP_PARAM_ACTION_TIGHTEN,
+ CLP_PARAM_ACTION_FAKEBOUND,
+ CLP_PARAM_ACTION_HELP,
+ CLP_PARAM_ACTION_PLUSMINUS,
+ CLP_PARAM_ACTION_NETWORK,
+ CLP_PARAM_ACTION_ALLSLACK,
+ CLP_PARAM_ACTION_REVERSE,
+ CLP_PARAM_ACTION_BARRIER,
+ CLP_PARAM_ACTION_NETLIB_BARRIER,
+ CLP_PARAM_ACTION_NETLIB_TUNE,
+ CLP_PARAM_ACTION_REALLY_SCALE,
+ CLP_PARAM_ACTION_BASISIN,
+ CLP_PARAM_ACTION_BASISOUT,
+ CLP_PARAM_ACTION_SOLVECONTINUOUS,
+ CLP_PARAM_ACTION_CLEARCUTS,
+ CLP_PARAM_ACTION_VERSION,
+ CLP_PARAM_ACTION_STATISTICS,
+ CLP_PARAM_ACTION_DEBUG,
+ CLP_PARAM_ACTION_DUMMY,
+ CLP_PARAM_ACTION_PRINTMASK,
+ CLP_PARAM_ACTION_OUTDUPROWS,
+ CLP_PARAM_ACTION_USERCLP,
+ CLP_PARAM_ACTION_MODELIN,
+ CLP_PARAM_ACTION_CSVSTATISTICS,
+ CLP_PARAM_ACTION_STOREDFILE,
+ CLP_PARAM_ACTION_ENVIRONMENT,
+ CLP_PARAM_ACTION_PARAMETRICS,
+ CLP_PARAM_ACTION_GMPL_SOLUTION,
+ CLP_PARAM_ACTION_RESTORESOL,
+
+ CBC_PARAM_ACTION_BAB = 361,
+ CBC_PARAM_ACTION_MIPLIB,
+ CBC_PARAM_ACTION_STRENGTHEN,
+ CBC_PARAM_ACTION_PRIORITYIN,
+ CBC_PARAM_ACTION_MIPSTART,
+ CBC_PARAM_ACTION_USERCBC,
+ CBC_PARAM_ACTION_DOHEURISTIC,
+ CLP_PARAM_ACTION_NEXTBESTSOLUTION,
+
+ CBC_PARAM_NOTUSED_OSLSTUFF = 401,
+ CBC_PARAM_NOTUSED_CBCSTUFF,
+
+ CBC_PARAM_NOTUSED_INVALID = 1000
+} ;
+#include
+#include
+
+/// Very simple class for setting parameters
+
+class CbcOrClpParam {
+public:
+ /**@name Constructor and destructor */
+ //@{
+ /// Constructors
+ CbcOrClpParam ( );
+ CbcOrClpParam (std::string name, std::string help,
+ double lower, double upper, CbcOrClpParameterType type, int display = 2);
+ CbcOrClpParam (std::string name, std::string help,
+ int lower, int upper, CbcOrClpParameterType type, int display = 2);
+ // Other strings will be added by insert
+ CbcOrClpParam (std::string name, std::string help, std::string firstValue,
+ CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
+ // Action
+ CbcOrClpParam (std::string name, std::string help,
+ CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
+ /// Copy constructor.
+ CbcOrClpParam(const CbcOrClpParam &);
+ /// Assignment operator. This copies the data
+ CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
+ /// Destructor
+ ~CbcOrClpParam ( );
+ //@}
+
+ /**@name stuff */
+ //@{
+ /// Insert string (only valid for keywords)
+ void append(std::string keyWord);
+ /// Adds one help line
+ void addHelp(std::string keyWord);
+ /// Returns name
+ inline std::string name( ) const {
+ return name_;
+ }
+ /// Returns short help
+ inline std::string shortHelp( ) const {
+ return shortHelp_;
+ }
+ /// Sets a double parameter (nonzero code if error)
+ int setDoubleParameter(CbcModel & model, double value) ;
+ /// Sets double parameter and returns printable string and error code
+ const char * setDoubleParameterWithMessage ( CbcModel & model, double value , int & returnCode);
+ /// Gets a double parameter
+ double doubleParameter(CbcModel & model) const;
+ /// Sets a int parameter (nonzero code if error)
+ int setIntParameter(CbcModel & model, int value) ;
+ /// Sets int parameter and returns printable string and error code
+ const char * setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode);
+ /// Gets a int parameter
+ int intParameter(CbcModel & model) const;
+ /// Sets a double parameter (nonzero code if error)
+ int setDoubleParameter(ClpSimplex * model, double value) ;
+ /// Gets a double parameter
+ double doubleParameter(ClpSimplex * model) const;
+ /// Sets double parameter and returns printable string and error code
+ const char * setDoubleParameterWithMessage ( ClpSimplex * model, double value , int & returnCode);
+ /// Sets a int parameter (nonzero code if error)
+ int setIntParameter(ClpSimplex * model, int value) ;
+ /// Sets int parameter and returns printable string and error code
+ const char * setIntParameterWithMessage ( ClpSimplex * model, int value , int & returnCode);
+ /// Gets a int parameter
+ int intParameter(ClpSimplex * model) const;
+ /// Sets a double parameter (nonzero code if error)
+ int setDoubleParameter(OsiSolverInterface * model, double value) ;
+ /// Sets double parameter and returns printable string and error code
+ const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double value , int & returnCode);
+ /// Gets a double parameter
+ double doubleParameter(OsiSolverInterface * model) const;
+ /// Sets a int parameter (nonzero code if error)
+ int setIntParameter(OsiSolverInterface * model, int value) ;
+ /// Sets int parameter and returns printable string and error code
+ const char * setIntParameterWithMessage ( OsiSolverInterface * model, int value , int & returnCode);
+ /// Gets a int parameter
+ int intParameter(OsiSolverInterface * model) const;
+ /// Checks a double parameter (nonzero code if error)
+ int checkDoubleParameter(double value) const;
+ /// Returns name which could match
+ std::string matchName ( ) const;
+ /// Returns length of name for ptinting
+ int lengthMatchName ( ) const;
+ /// Returns parameter option which matches (-1 if none)
+ int parameterOption ( std::string check ) const;
+ /// Prints parameter options
+ void printOptions ( ) const;
+ /// Returns current parameter option
+ inline std::string currentOption ( ) const {
+ return definedKeyWords_[currentKeyWord_];
+ }
+ /// Sets current parameter option
+ void setCurrentOption ( int value , bool printIt = false);
+ /// Sets current parameter option and returns printable string
+ const char * setCurrentOptionWithMessage ( int value );
+ /// Sets current parameter option using string
+ void setCurrentOption (const std::string value );
+ /// Sets current parameter option using string with message
+ const char * setCurrentOptionWithMessage (const std::string value );
+ /// Returns current parameter option position
+ int currentOptionAsInteger ( ) const ;
+ /** Returns current parameter option position
+ but if fake keyword returns a fake value and sets
+ fakeInteger to true value. If not fake then fakeInteger is -COIN_INT_MAX
+ */
+ int currentOptionAsInteger ( int & fakeInteger ) const;
+ /// Sets int value
+ void setIntValue ( int value );
+ /// Sets int value with message
+ const char * setIntValueWithMessage ( int value );
+ inline int intValue () const {
+ return intValue_;
+ }
+ /// Sets double value
+ void setDoubleValue ( double value );
+ /// Sets double value with message
+ const char * setDoubleValueWithMessage ( double value );
+ inline double doubleValue () const {
+ return doubleValue_;
+ }
+ /// Sets string value
+ void setStringValue ( std::string value );
+ inline std::string stringValue () const {
+ return stringValue_;
+ }
+ /// Returns 1 if matches minimum, 2 if matches less, 0 if not matched
+ int matches (std::string input) const;
+ /// type
+ inline CbcOrClpParameterType type() const {
+ return type_;
+ }
+ /// whether to display
+ inline int displayThis() const {
+ return display_;
+ }
+ /// Set Long help
+ inline void setLonghelp(const std::string help) {
+ longHelp_ = help;
+ }
+ /// Print Long help
+ void printLongHelp() const;
+ /// Print action and string
+ void printString() const;
+ /** 7 if used everywhere,
+ 1 - used by clp
+ 2 - used by cbc
+ 4 - used by ampl
+ */
+ inline int whereUsed() const {
+ return whereUsed_;
+ }
+ /// Gets value of fake keyword
+ inline int fakeKeyWord() const
+ { return fakeKeyWord_;}
+ /// Sets value of fake keyword
+ inline void setFakeKeyWord(int value, int fakeValue)
+ { fakeKeyWord_ = value; fakeValue_ = fakeValue;}
+ /// Sets value of fake keyword to current size of keywords
+ void setFakeKeyWord(int fakeValue);
+
+private:
+ /// gutsOfConstructor
+ void gutsOfConstructor();
+ //@}
+////////////////// data //////////////////
+private:
+
+ /**@name data
+ We might as well throw all type data in - could derive?
+ */
+ //@{
+ // Type see CbcOrClpParameterType
+ CbcOrClpParameterType type_;
+ /// If double == okay
+ double lowerDoubleValue_;
+ double upperDoubleValue_;
+ /// If int == okay
+ int lowerIntValue_;
+ int upperIntValue_;
+ // Length of name
+ unsigned int lengthName_;
+ // Minimum match
+ unsigned int lengthMatch_;
+ /// set of valid strings
+ std::vector definedKeyWords_;
+ /// Name
+ std::string name_;
+ /// Short help
+ std::string shortHelp_;
+ /// Long help
+ std::string longHelp_;
+ /// Action
+ CbcOrClpParameterType action_;
+ /// Current keyWord (if a keyword parameter)
+ int currentKeyWord_;
+ /// Display on ?
+ int display_;
+ /// Integer parameter - current value
+ int intValue_;
+ /// Double parameter - current value
+ double doubleValue_;
+ /// String parameter - current value
+ std::string stringValue_;
+ /** 7 if used everywhere,
+ 1 - used by clp
+ 2 - used by cbc
+ 4 - used by ampl
+ */
+ int whereUsed_;
+ /** If >=0 then integers allowed as a fake keyword
+ So minusnnnn would got to -nnnn in currentKeyword_
+ and plusnnnn would go to fakeKeyword_+nnnn
+ */
+ int fakeKeyWord_;
+ /// Return this as main value if an integer
+ int fakeValue_;
+ //@}
+};
+/// Simple read stuff
+std::string CoinReadNextField();
+
+std::string CoinReadGetCommand(int argc, const char *argv[]);
+std::string CoinReadGetString(int argc, const char *argv[]);
+// valid 0 - okay, 1 bad, 2 not there
+int CoinReadGetIntField(int argc, const char *argv[], int * valid);
+double CoinReadGetDoubleField(int argc, const char *argv[], int * valid);
+void CoinReadPrintit(const char * input);
+void setCbcOrClpPrinting(bool yesNo);
+#define CBCMAXPARAMETERS 250
+/*
+ Subroutine to establish the cbc parameter array. See the description of
+ class CbcOrClpParam for details. Pulled from C..Main() for clarity.
+*/
+void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
+// Given a parameter type - returns its number in list
+int whichParam (CbcOrClpParameterType name,
+ int numberParameters, CbcOrClpParam *const parameters);
+// Dump/restore a solution to file
+void saveSolution(const ClpSimplex * lpSolver, std::string fileName);
+void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode);
+#endif /* CbcOrClpParam_H */
diff --git a/thirdparty/linux/include/coin/Cgl012cut.hpp b/thirdparty/linux/include/coin/Cgl012cut.hpp
new file mode 100644
index 0000000..2814b0a
--- /dev/null
+++ b/thirdparty/linux/include/coin/Cgl012cut.hpp
@@ -0,0 +1,464 @@
+// $Id: Cgl012cut.hpp 1149 2013-10-21 18:23:53Z tkr $
+// Copyright (C) 2010, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+/** @file 012cut.h Include file for C coded 0-1/2 separator */
+#ifndef CGL012CUT
+#define CGL012CUT
+#include
+#include
+#include
+
+#define CGL_NEW_SHORT
+#ifndef CGL_NEW_SHORT
+typedef /* arc */
+ struct arc_st
+{
+ int len; /* length of the arc */
+ struct node_st *head; /* head node */
+}
+ arc;
+
+typedef /* node */
+ struct node_st
+{
+ arc *first; /* first outgoing arc */
+ int dist; /* tentative shortest path length */
+ struct node_st *parent; /* parent pointer */
+ struct node_st *next; /* next node in queue */
+ struct node_st *prev; /* previous node in queue */
+ int status; /* status of node */
+ int temp; /* for temporary labels */
+ int index; /* index of the node in the graph */
+} node;
+#endif
+typedef struct
+{
+ int length; // Length of arc
+ int to; // To node
+} cgl_arc;
+
+typedef struct
+{
+ cgl_arc * firstArc; // First outgoing arc
+ int parentNode; // Parent node in shortest path
+ int index; // Which node I am
+ int distanceBack; // Distance back to source
+} cgl_node;
+
+typedef struct
+{
+ int nnodes; // Number of nodes in graph
+ int narcs; // Number of arcs in graph
+ cgl_node * nodes;
+ cgl_arc * arcs;
+} cgl_graph;
+/* #define PRINT */
+/* #define PRINT_CUTS */
+#define REDUCTION
+
+typedef struct {
+int mr; /* number of rows in the ILP matrix */
+int mc; /* number of columns in the ILP matrix */
+int mnz; /* number of nonzero's in the ILP matrix */
+int *mtbeg; /* starting position of each row in arrays mtind and mtval */
+int *mtcnt; /* number of entries of each row in arrays mtind and mtval */
+int *mtind; /* column indices of the nonzero entries of the ILP matrix */
+int *mtval; /* values of the nonzero entries of the ILP matrix */
+int *vlb; /* lower bounds on the variables */
+int *vub; /* upper bounds on the variables */
+int *mrhs; /* right hand sides of the constraints */
+char *msense; /* senses of the constraints: 'L', 'G' or 'E' */
+const double *xstar; /* current optimal solution of the LP relaxation */
+} ilp;
+
+typedef struct {
+int mr; /* number of rows in the parity ILP matrix */
+int mc; /* number of columns in the parity ILP matrix */
+int mnz; /* number of 1's in the parity ILP matrix */
+int *mtbeg; /* starting position of each row in arrays mtind and mtval */
+int *mtcnt; /* number of entries of each row in arrays mtind and mtval */
+int *mtind; /* column indices of the 1's of the parity ILP matrix */
+short int *mrhs; /* right hand side parity of the constraints */
+double *xstar; /* current optimal solution of the LP relaxation */
+double *slack; /* slack of the constraints w.r.t. xstar */
+short int *row_to_delete; /* flag for marking rows not to be considered */
+short int *col_to_delete; /* flag for marking columns not to be considered */
+int *gcd; /* greatest common divisor of each row in the input ILP matrix */
+short int *possible_weak; /* possible weakening types of each column */
+short int *type_even_weak; /* type of even weakening of each column
+ (lower or upper bound weakening) */
+short int *type_odd_weak; /* type of odd weakening of each column
+ (lower or upper bound weakening) */
+double *loss_even_weak; /* loss for the even weakening of each column */
+double *loss_odd_weak; /* loss for the odd weakening of each column */
+double *min_loss_by_weak; /* minimum loss for the weakening of each column */
+} parity_ilp;
+
+typedef struct {
+int nweak; /* number of variables weakened */
+int *var; /* list of variables weakened */
+short int *type; /* type of weakening (lower or upper bound weakening) */
+} info_weak;
+
+typedef struct {
+int endpoint1, endpoint2; /* endpoints of the edge */
+double weight; /* edge weight */
+short int parity; /* edge parity (even or odd) */
+int constr; /* constraint associated with the edge */
+info_weak *weak; /* weakening information */
+} edge;
+
+typedef struct {
+int nnodes; /* number of nodes */
+int nedges; /* number of edges */
+int *nodes; /* indexes of the ILP columns corresponding to the nodes */
+int *ind; /* indexes of the nodes corresponding to the ILP columns */
+edge **even_adj_list; /* pointers to the even edges */
+edge **odd_adj_list; /* pointers to the odd edges */
+} separation_graph;
+
+#ifndef CGL_NEW_SHORT
+typedef struct {
+int nnodes; /* number of nodes */
+int narcs; /* number of arcs */
+node *nodes; /* array of the nodes - see "types_db.h" */
+arc *arcs; /* array of the arcs - see "types_db.h" */
+} auxiliary_graph;
+#else
+typedef struct {
+int nnodes; /* number of nodes */
+int narcs; /* number of arcs */
+cgl_node *nodes; /* array of the nodes - see "types_db.h" */
+cgl_arc *arcs; /* array of the arcs - see "types_db.h" */
+} auxiliary_graph;
+#endif
+
+typedef struct {
+long dist; /* distance from/to root */
+int pred; /* index of the predecessor */
+} short_path_node;
+
+typedef struct {
+double weight; /* overall weight of the cycle */
+int length; /* number of edges in the cycle */
+edge **edge_list; /* list of edges in the cycle */
+} cycle;
+
+typedef struct {
+int cnum; /* overall number of cycles */
+cycle **list; /* pointers to the cycles in the list */
+} cycle_list;
+
+typedef struct {
+int n_of_constr; /* number of constraints combined to get the cut */
+int *constr_list; /* list of the constraints combined */
+short int *in_constr_list; /* flag saying whether a given constraint is
+ in the list of constraints of the cut (IN)
+ or not (OUT) */
+int cnzcnt; /* overall number of nonzero's in the cut */
+int *cind; /* column indices of the nonzero entries of the cut */
+int *cval; /* values of the nonzero entries of the cut */
+int crhs; /* right hand side of the cut */
+char csense; /* sense of the cut: 'L', 'G' or 'E' */
+double violation; /* violation of the cut w.r.t. the current LP solution */
+} cut;
+
+typedef struct {
+int cnum; /* overall number of cuts */
+cut **list; /* pointers to the cuts in the list */
+} cut_list;
+
+typedef struct {
+int n_of_constr; /* number of constraints combined to get the cut */
+int *constr_list; /* list of the constraints combined */
+int code; /* identifier of the cut */
+int n_it_violated; /* number of consecutive iterations (starting from the
+ last and going backward) in which the cut was
+ violated by the LP solution */
+int it_found; /* iteration in which the cut was separated */
+double score; /* score of the cut, used to choose wich cut should be
+ added to the current LP (if any) */
+} pool_cut;
+
+typedef struct {
+int cnum; /* overall number of cuts */
+pool_cut **list; /* pointers to the cuts in the list */
+int *ncod; /* number of cuts with a given code in the pool */
+} pool_cut_list;
+
+typedef struct {
+int *ccoef; /* coefficients of the cut */
+int crhs; /* right hand side of the cut */
+int pool_index; /* index of the cut in the pool */
+double score; /* cut score (to be maximized) */
+} select_cut;
+
+typedef struct {
+int n_it_zero; /* number of consecutive iterations (starting from the
+ last and going backward) in which each variable took
+ the value 0 in the LP solution */
+} log_var;
+/** 012Cut Generator Class
+
+ This class is to make Cgl01cut thread safe etc
+*/
+
+class Cgl012Cut {
+
+public:
+
+ /**@name Generate Cuts */
+ //@{
+int sep_012_cut(
+/*
+ INPUT parameters:
+*/
+int mr, /* number of rows in the ILP matrix */
+int mc, /* number of columns in the ILP matrix */
+int mnz, /* number of nonzero's in the ILP matrix */
+int *mtbeg, /* starting position of each row in arrays mtind and mtval */
+int *mtcnt, /* number of entries of each row in arrays mtind and mtval */
+int *mtind, /* column indices of the nonzero entries of the ILP matrix */
+int *mtval, /* values of the nonzero entries of the ILP matrix */
+int *vlb, /* lower bounds on the variables */
+int *vub, /* upper bounds on the variables */
+int *mrhs, /* right hand sides of the constraints */
+char *msense, /* senses of the constraints: 'L', 'G' or 'E' */
+const double *xstar, /* current optimal solution of the LP relaxation */
+bool aggressive, /* flag asking whether as many cuts as possible are
+ required on output (TRUE) or not (FALSE) */
+/*
+ OUTPUT parameters (the memory for the vectors is allocated INTERNALLY
+ by the procedure: if some memory is already allocated, it is FREED):
+*/
+int *cnum, /* number of violated 0-1/2 cuts identified by the procedure */
+int *cnzcnt, /* overall number of nonzero's in the cuts */
+int **cbeg, /* starting position of each cut in arrays cind and cval */
+int **ccnt, /* number of entries of each cut in arrays cind and cval */
+int **cind, /* column indices of the nonzero entries of the cuts */
+int **cval, /* values of the nonzero entries of the cuts */
+int **crhs, /* right hand sides of the cuts */
+char **csense /* senses of the cuts: 'L', 'G' or 'E' */
+/*
+ NOTE that all the numerical input/output vectors are INTEGER (with
+ the exception of xstar), since the procedure is intended to work
+ with pure ILP's, and that the ILP matrix has to be given on input
+ in ROW format.
+*/
+ );
+void ilp_load(
+ int mr, /* number of rows in the ILP matrix */
+ int mc, /* number of columns in the ILP matrix */
+ int mnz, /* number of nonzero's in the ILP matrix */
+ int *mtbeg, /* starting position of each row in arrays mtind and mtval */
+ int *mtcnt, /* number of entries of each row in arrays mtind and mtval */
+ int *mtind, /* column indices of the nonzero entries of the ILP matrix */
+ int *mtval, /* values of the nonzero entries of the ILP matrix */
+ int *vlb, /* lower bounds on the variables */
+ int *vub, /* upper bounds on the variables */
+ int *mrhs, /* right hand sides of the constraints */
+ char *msense /* senses of the constraints: 'L', 'G' or 'E' */
+ );
+void free_ilp();
+/* alloc_parity_ilp: allocate the memory for the parity ILP data structure */
+
+void alloc_parity_ilp(
+ int mr, /* number of rows in the ILP matrix */
+ int mc, /* number of columns in the ILP matrix */
+ int mnz /* number of nonzero's in the ILP matrix */
+ );
+void free_parity_ilp();
+ void initialize_log_var();
+/* free_log_var */
+ void free_log_var();
+private:
+/* best_weakening: find the best upper/lower bound weakening of a set
+ of variables */
+
+int best_weakening(
+ int n_to_weak, /* number of variables to weaken */
+int *vars_to_weak, /* indices of the variables to weaken */
+short int original_parity, /* original parity of the constraint to weaken */
+double original_slack, /* original slack of the constraint to weaken */
+double *best_even_slack, /* best possible slack of a weakened constraint
+ with even right-hand-side */
+double *best_odd_slack, /* best possible slack of a weakened constraint
+ with odd right-hand-side */
+info_weak **info_even_weak, /* weakening information about the best possible
+ even weakened constraint */
+info_weak **info_odd_weak, /* weakening information about the best possible
+ odd weakened constraint */
+short int only_odd, /* flag which tells whether only an odd weakening is of
+ interest (TRUE) or both weakenings are (FALSE) */
+short int only_viol /* flag which tells whether only an inequality of
+ slack smaller than MAX_SLACK is of interest (TRUE)
+ otherwise (FALSE) */
+ );
+
+/* best_cut: find the coefficients, the rhs and the violation of the
+ best possible cut that can be obtained by weakening a given set of
+ coefficients to even and a rhs to odd, dividing by 2 and rounding */
+
+short int best_cut(
+ int *ccoef, /* vector of the coefficients */
+ int *crhs, /* pointer to rhs value */
+ double *violation, /* violation of the cut */
+ short int update, /* TRUE/FALSE: if TRUE, the new ccoef and crhs are
+ given on output */
+ short int only_viol /* flag which tells whether only an inequality of
+ slack smaller than MAX_SLACK is of interest (TRUE)
+ otherwise (FALSE) */
+ );
+/* get_cut: extract a hopefully violated cut from an odd cycle of the
+ separation graph */
+
+cut *get_cut(
+ cycle *s_cyc /* shortest odd cycles identified in the separation graph */
+ );
+
+/* update_log_var: update the log information for the problem variables */
+ void update_log_var();
+
+/* basic_separation: try to identify violated 0-1/2 cuts by using the
+ original procedure described in Caprara and Fischetti's MP paper */
+
+ cut_list *basic_separation();
+
+/* score_by_moving: compute the score of the best cut obtainable from
+ the current local search solution by inserting/deleting a constraint */
+
+double score_by_moving(
+ int i, /* constraint to be moved */
+ short int itype, /* type of move - ADD or DEL */
+ double thresh /* minimum value of an interesting score */
+ );
+/* modify_current: update the current local search solution by inserting/
+ deleting a constraint */
+
+void modify_current(
+ int i, /* constraint to be moved */
+ short int itype /* type of move - ADD or DEL */
+ );
+
+/* best neighbour: find the cut to be added/deleted from the current
+ solution among those allowed by the tabu rules */
+
+ short int best_neighbour(cut_list *out_cuts /* list of the violated cuts found */);
+
+/* add_tight_constraint: initialize the current cut by adding a tight
+ constraint to it */
+
+ void add_tight_constraint();
+
+/* tabu_012: try to identify violated 0-1/2 cuts by a simple tabu search
+ procedure adapted from that used by Battiti and Protasi for finding
+ large cliques */
+
+ cut_list *tabu_012();
+/* initialize: initialize the data structures for local search */
+
+ void initialize();
+/* restart: perform a restart of the search - IMPORTANT: in the current
+ implementation vector last_moved is not cleared at restart */
+
+ void restart(short int failure /* flag forcing the restart if some trouble occurred */);
+ void print_constr(int i /* constraint to be printed */);
+ void print_parity_ilp();
+
+/* get_parity_ilp: construct an internal data structure containing all the
+ information which can be useful for 0-1/2 cut separation */
+
+ void get_parity_ilp();
+/* initialize_sep_graph: allocate and initialize the data structure
+ to contain the information associated with a separation graph */
+
+ separation_graph *initialize_sep_graph();
+ void print_cut(cut *v_cut);
+/* get_ori_cut_coef: get the coefficients of a cut, before dividing by 2 and
+ rounding, starting from the list of the constraints combined to get
+ the cut */
+
+short int get_ori_cut_coef(
+ int n_of_constr, /* number of constraints combined */
+ int *constr_list, /* list of the constraints combined */
+ int *ccoef, /* cut left hand side coefficients */
+ int *crhs, /* cut right hand side */
+ short int only_viol /* flag which tells whether only an inequality of
+ slack smaller than MAX_SLACK is of interest (TRUE)
+ otherwise (FALSE) */
+ );
+/* define_cut: construct a cut data structure from a vector of
+ coefficients and a right-hand-side */
+
+cut *define_cut(
+ int *ccoef, /* coefficients of the cut */
+ int crhs /* right hand side of the cut */
+ );
+
+/* cut_score: define the score of a (violated) cut */
+
+double cut_score(
+ int *ccoef, /* cut left hand side coefficients */
+ int crhs, /* cut right hand side */
+ double viol, /* cut violation */
+ short int only_viol /* flag which tells whether only an inequality of
+ slack smaller than MAX_SLACK is of interest (TRUE)
+ otherwise (FALSE) */
+ );
+/* get_current_cut: return a cut data type with the information about
+ the current cut of the search procedure */
+
+ cut *get_current_cut();
+/* print_cur_cut: display cur_cut on output */
+
+ void print_cur_cut();
+ void print_cut_list(cut_list *cuts);
+ //@}
+public:
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ Cgl012Cut ();
+
+ /// Copy constructor
+ Cgl012Cut (
+ const Cgl012Cut &);
+
+ /// Assignment operator
+ Cgl012Cut &
+ operator=(
+ const Cgl012Cut& rhs);
+
+ /// Destructor
+ virtual ~Cgl012Cut ();
+ //@}
+
+private:
+
+ // Private member methods
+
+ /**@name Private methods */
+ //@{
+ //@}
+
+
+ /**@name Private member data */
+ //@{
+
+ilp *inp_ilp; /* input ILP data structure */
+parity_ilp *p_ilp; /* parity ILP data structure */
+int iter;
+double gap;
+double maxgap;
+int errorNo;
+int sep_iter; /* number of the current separation iteration */
+log_var **vlog; /* information about the value attained
+ by the variables in the last iterations,
+ used to possibly set to 0 some coefficient
+ > 0 in a cut to be added */
+bool aggr; /* flag saying whether as many cuts as possible are required
+ from the separation procedure (TRUE) or not (FALSE) */
+ //@}
+};
+#endif
diff --git a/thirdparty/linux/include/coin/CglAllDifferent.hpp b/thirdparty/linux/include/coin/CglAllDifferent.hpp
new file mode 100644
index 0000000..ed369d1
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglAllDifferent.hpp
@@ -0,0 +1,115 @@
+// Copyright (C) 2005, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglAllDifferent_H
+#define CglAllDifferent_H
+
+#include
+
+#include "CglCutGenerator.hpp"
+
+/** AllDifferent Cut Generator Class
+ This has a number of sets. All the members in each set are general integer
+ variables which have to be different from all others in the set.
+
+ At present this only generates column cuts
+
+ At present it is very primitive compared to proper CSP implementations
+ */
+class CglAllDifferent : public CglCutGenerator {
+
+public:
+
+
+ /**@name Generate Cuts */
+ //@{
+ /** This fixes (or reduces bounds) on sets of all different variables
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglAllDifferent ();
+
+ /// Useful constructot
+ CglAllDifferent(int numberSets, const int * starts, const int * which);
+
+ /// Copy constructor
+ CglAllDifferent (
+ const CglAllDifferent &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglAllDifferent &
+ operator=(
+ const CglAllDifferent& rhs);
+
+ /// Destructor
+ virtual
+ ~CglAllDifferent ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+
+ /// This can be used to refresh any inforamtion
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ /**
+ Returns true if may generate Row cuts in tree (rather than root node).
+ Used so know if matrix will change in tree. Really
+ meant so column cut generators can still be active
+ without worrying code.
+ Default is true
+ */
+ virtual bool mayGenerateRowCutsInTree() const
+ { return false;}
+ //@}
+ /**@name Sets and Gets */
+ //@{
+ /// Set log level
+ inline void setLogLevel(int value)
+ { logLevel_=value;}
+ /// Get log level
+ inline int getLogLevel() const
+ { return logLevel_;}
+ /// Set Maximum number of sets to look at at once
+ inline void setMaxLook(int value)
+ { maxLook_=value;}
+ /// Get Maximum number of sets to look at at once
+ inline int getMaxLook() const
+ { return maxLook_;}
+ //@}
+
+private:
+
+ // Private member methods
+ /**@name */
+ //@{
+ //@}
+
+ // Private member data
+
+ /**@name Private member data */
+ //@{
+ /// Number of sets
+ int numberSets_;
+ /// Total number of variables in all different sets
+ int numberDifferent_;
+ /// Maximum number of sets to look at at once
+ int maxLook_;
+ /// Log level - 0 none, 1 - a bit, 2 - more details
+ int logLevel_;
+ /// Start of each set
+ int * start_;
+ /// Members (0,1,....) not as in original model
+ int * which_;
+ /// Original members
+ int * originalWhich_;
+ //@}
+};
+#endif
diff --git a/thirdparty/linux/include/coin/CglClique.hpp b/thirdparty/linux/include/coin/CglClique.hpp
new file mode 100644
index 0000000..5b47b40
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglClique.hpp
@@ -0,0 +1,308 @@
+// $Id: CglClique.hpp 1119 2013-04-06 20:24:18Z stefan $
+// Copyright (C) 2000, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef _CglClique_h_
+#define _CglClique_h_
+
+#include "CglCutGenerator.hpp"
+
+//class OsiCuts;
+//class OsiSolverInterface;
+
+class CglClique : public CglCutGenerator {
+
+ friend void CglCliqueUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+public:
+ /// Copy constructor
+ CglClique(const CglClique& rhs);
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglClique& operator=(const CglClique& rhs);
+
+public:
+
+ virtual void
+ generateCuts(const OsiSolverInterface& si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /**@name Constructors and destructors */
+ //@{
+ /** Default constructor.
+ If the setPacking argument is set to true then CglClique will assume that the
+ problem in the solverinterface passed to the generateCuts() method
+ describes a set packing problem, i.e.,
+ - all variables are binary
+ - the matrix is a 0-1 matrix
+ - all constraints are '= 1' or '<= 1'
+
+ Otherwise the user can use the considerRows() method to set the list of
+ clique rows, that is,
+ - all coeffs corresponding to binary variables at fractional level is 1
+ - all other coeffs are non-negative
+ - the constraint is '= 1' or '<= 1'.
+
+ If the user does not set the list of clique rows then CglClique will
+ start the generateCuts() methods by scanning the matrix for them.
+ Also justOriginalRows can be set to true to limit clique creation
+ */
+ CglClique(bool setPacking = false, bool justOriginalRows = false);
+ /// Destructor
+ virtual ~CglClique() {}
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+
+ void considerRows(const int numRows, const int* rowInd);
+
+public:
+ /** possible choices for selecting the next node in the star clique search
+ */
+ enum scl_next_node_method {
+ SCL_MIN_DEGREE,
+ SCL_MAX_DEGREE,
+ SCL_MAX_XJ_MAX_DEG
+ };
+
+ void setStarCliqueNextNodeMethod(scl_next_node_method method) {
+ scl_next_node_rule = method;
+ }
+
+ void setStarCliqueCandidateLengthThreshold(int maxlen) {
+ scl_candidate_length_threshold = maxlen;
+ }
+ void setRowCliqueCandidateLengthThreshold(int maxlen) {
+ rcl_candidate_length_threshold = maxlen;
+ }
+
+ void setStarCliqueReport(bool yesno = true) { scl_report_result = yesno; }
+ void setRowCliqueReport(bool yesno = true) { rcl_report_result = yesno; }
+
+ void setDoStarClique(bool yesno = true) { do_star_clique = yesno; }
+ void setDoRowClique(bool yesno = true) { do_row_clique = yesno; }
+
+ void setMinViolation(double minviol) { petol = minviol; }
+ double getMinViolation() const { return petol; }
+
+private:
+
+ struct frac_graph ;
+ friend struct frac_graph ;
+
+ /** A node of the fractional graph. There is a node for every variable at
+ fractional level. */
+ struct fnode {
+ /** pointer into all_nbr */
+ int *nbrs;
+ /** 1-x_i-x_j, needed for odd holes, in the same order as the adj list,
+ pointer into all_edgecost */
+ double *edgecosts;
+ /** degree of the node */
+ int degree;
+ /** the fractional value of the variable corresponding to this node */
+ double val;
+ };
+
+ /** A graph corresponding to a fractional solution of an LP. Two nodes are
+ adjacent iff their columns are non-orthogonal. */
+ struct frac_graph {
+ /** # of nodes = # of fractional values in the LP solution */
+ int nodenum;
+ /** # of edges in the graph */
+ int edgenum;
+ /** density= edgenum/(nodenum choose 2) */
+ double density;
+ int min_deg_node;
+ int min_degree;
+ int max_deg_node;
+ int max_degree;
+ /** The array of the nodes in the graph */
+ fnode *nodes;
+ /** The array of all the neighbors. First the indices of the nodes
+ adjacent to node 0 are listed, then those adjacent to node 1, etc. */
+ int *all_nbr;
+ /** The array of the costs of the edges going to the neighbors */
+ double *all_edgecost;
+
+ frac_graph() :
+ nodenum(0), edgenum(0), density(0),
+ min_deg_node(0), min_degree(0), max_deg_node(0), max_degree(0),
+ nodes(0), all_nbr(0), all_edgecost(0) {}
+ };
+
+protected:
+ /** An indicator showing whether the whole matrix in the solverinterface is
+ a set packing problem or not */
+ bool setPacking_;
+ /// True if just look at original rows
+ bool justOriginalRows_;
+ /** pieces of the set packing part of the solverinterface */
+ int sp_numrows;
+ int* sp_orig_row_ind;
+ int sp_numcols;
+ int* sp_orig_col_ind;
+ double* sp_colsol;
+ int* sp_col_start;
+ int* sp_col_ind;
+ int* sp_row_start;
+ int* sp_row_ind;
+
+ /** the intersection graph corresponding to the set packing problem */
+ frac_graph fgraph;
+ /** the node-node incidence matrix of the intersection graph. */
+ bool* node_node;
+
+ /** The primal tolerance in the solverinterface. */
+ double petol;
+
+ /** data for the star clique algorithm */
+
+ /** Parameters */
+ /**@{*/
+ /** whether to do the row clique algorithm or not. */
+ bool do_row_clique;
+ /** whether to do the star clique algorithm or not. */
+ bool do_star_clique;
+
+ /** How the next node to be added to the star clique should be selected */
+ scl_next_node_method scl_next_node_rule;
+ /** In the star clique method the maximal length of the candidate list
+ (those nodes that are in a star, i.e., connected to the center of the
+ star) to allow complete enumeration of maximal cliques. Otherwise a
+ greedy algorithm is used. */
+ int scl_candidate_length_threshold;
+ /** whether to give a detailed statistics on the star clique method */
+ bool scl_report_result;
+
+ /** In the row clique method the maximal length of the candidate list
+ (those nodes that can extend the row clique, i.e., connected to all
+ nodes in the row clique) to allow complete enumeration of maximal
+ cliques. Otherwise a greedy algorithm is used. */
+ int rcl_candidate_length_threshold;
+ /** whether to give a detailed statistics on the row clique method */
+ bool rcl_report_result;
+ /**@}*/
+
+ /** variables/arrays that are used across many methods */
+ /**@{*/
+ /** List of indices that must be in the to be created clique. This is just
+ a pointer, it is never new'd and therefore does not need to be
+ delete[]'d either. */
+ const int* cl_perm_indices;
+ /** The length of cl_perm_indices */
+ int cl_perm_length;
+
+ /** List of indices that should be considered for extending the ones listed
+ in cl_perm_indices. */
+ int* cl_indices;
+ /** The length of cl_indices */
+ int cl_length;
+
+ /** An array of nodes discarded from the candidate list. These are
+ rechecked when a maximal clique is found just to make sure that the
+ clique is really maximal. */
+ int* cl_del_indices;
+ /** The length of cl_del_indices */
+ int cl_del_length;
+
+ /**@}*/
+
+private:
+ /** Scan through the variables and select those that are binary and are at
+ a fractional level. */
+ void selectFractionalBinaries(const OsiSolverInterface& si);
+ /** Scan through the variables and select those that are at a fractional
+ level. We already know that everything is binary. */
+ void selectFractionals(const OsiSolverInterface& si);
+ /** */
+ void selectRowCliques(const OsiSolverInterface& si,int numOriginalRows);
+ /** */
+ void createSetPackingSubMatrix(const OsiSolverInterface& si);
+ /** */
+ void createFractionalGraph();
+ /** */
+ int createNodeNode();
+ /** */
+ void deleteSetPackingSubMatrix();
+ /** */
+ void deleteFractionalGraph();
+ /** */
+ void find_scl(OsiCuts& cs);
+ /** */
+ void find_rcl(OsiCuts& cs);
+ /** */
+ int scl_choose_next_node(const int current_nodenum,
+ const int *current_indices,
+ const int *current_degrees,
+ const double *current_values);
+ /** */
+ void scl_delete_node(const int del_ind, int& current_nodenum,
+ int *current_indices, int *current_degrees,
+ double *current_values);
+ /** */
+ int enumerate_maximal_cliques(int& pos, bool* scl_label, OsiCuts& cs);
+ /** */
+ int greedy_maximal_clique(OsiCuts& cs);
+ /** */
+ void recordClique(const int len, int* indices, OsiCuts& cs);
+};
+//#############################################################################
+/** A function that tests the methods in the CglClique class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglCliqueUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+/// This works on a fake solver i.e. invented rows
+class CglProbing;
+class CglFakeClique : public CglClique {
+
+public:
+ /// Copy constructor
+ CglFakeClique(const CglFakeClique& rhs);
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglFakeClique& operator=(const CglFakeClique& rhs);
+
+ virtual void
+ generateCuts(const OsiSolverInterface& si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /**@name Constructors and destructors */
+ //@{
+ /** Default constructor.
+ If the setPacking argument is set to true then CglFakeClique will assume that the
+ problem in the solverinterface passed to the generateCuts() method
+ describes a set packing problem, i.e.,
+ - all variables are binary
+ - the matrix is a 0-1 matrix
+ - all constraints are '= 1' or '<= 1'
+
+ Otherwise the user can use the considerRows() method to set the list of
+ clique rows, that is,
+ - all coeffs corresponding to binary variables at fractional level is 1
+ - all other coeffs are non-negative
+ - the constraint is '= 1' or '<= 1'.
+
+ If the user does not set the list of clique rows then CglFakeClique will
+ start the generateCuts() methods by scanning the matrix for them.
+ */
+ CglFakeClique(OsiSolverInterface * solver=NULL,bool setPacking = false);
+ /// Destructor
+ virtual ~CglFakeClique();
+ /// Assign solver (generator takes over ownership)
+ void assignSolver(OsiSolverInterface * fakeSolver);
+protected:
+ /// fake solver to use
+ OsiSolverInterface * fakeSolver_;
+ /// Probing object
+ CglProbing * probing_;
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglConfig.h b/thirdparty/linux/include/coin/CglConfig.h
new file mode 100644
index 0000000..bca5553
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglConfig.h
@@ -0,0 +1,19 @@
+/* src/config_cgl.h. Generated by configure. */
+/* src/config_cgl.h.in. */
+
+#ifndef __CONFIG_CGL_H__
+#define __CONFIG_CGL_H__
+
+/* Version number of project */
+#define CGL_VERSION "0.59.4"
+
+/* Major Version number of project */
+#define CGL_VERSION_MAJOR 0
+
+/* Minor Version number of project */
+#define CGL_VERSION_MINOR 59
+
+/* Release Version number of project */
+#define CGL_VERSION_RELEASE 4
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglCutGenerator.hpp b/thirdparty/linux/include/coin/CglCutGenerator.hpp
new file mode 100644
index 0000000..7629140
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglCutGenerator.hpp
@@ -0,0 +1,121 @@
+// Copyright (C) 2000, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglCutGenerator_H
+#define CglCutGenerator_H
+
+#include "OsiCuts.hpp"
+#include "OsiSolverInterface.hpp"
+#include "CglTreeInfo.hpp"
+
+//-------------------------------------------------------------------
+//
+// Abstract base class for generating cuts.
+//
+//-------------------------------------------------------------------
+///
+/** Cut Generator Base Class
+
+This is an abstract base class for generating cuts. A specific cut
+generator will inherit from this class.
+*/
+class CglCutGenerator {
+
+public:
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate cuts for the model data contained in si.
+ The generated cuts are inserted into and returned in the
+ collection of cuts cs.
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo())=0;
+ //@}
+
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglCutGenerator ();
+
+ /// Copy constructor
+ CglCutGenerator ( const CglCutGenerator &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const = 0;
+
+ /// Assignment operator
+ CglCutGenerator & operator=(const CglCutGenerator& rhs);
+
+ /// Destructor
+ virtual ~CglCutGenerator ();
+
+ /** Create C++ lines to set the generator in the current state.
+ The output must be parsed by the calling code, as each line
+ starts with a key indicating the following:
+ 0: must be kept (for #includes etc)
+ 3: Set to changed (not default) values
+ 4: Set to default values (redundant)
+
+ Keys 1, 2, 5, 6, 7, 8 are defined, but not applicable to
+ cut generators.
+ */
+ virtual std::string generateCpp( FILE * ) {return "";}
+
+ /// This can be used to refresh any information
+ virtual void refreshSolver(OsiSolverInterface * ) {}
+ //@}
+
+ /**@name Gets and Sets */
+ //@{
+ /**
+ Get Aggressiveness - 0 = neutral, 100 is normal root node.
+ Really just a hint to cut generator
+ */
+ inline int getAggressiveness() const
+ { return aggressive_;}
+
+ /**
+ Set Aggressiveness - 0 = neutral, 100 is normal root node.
+ Really just a hint to cut generator
+ */
+ inline void setAggressiveness(int value)
+ { aggressive_=value;}
+ /// Set whether can do global cuts
+ inline void setGlobalCuts(bool trueOrFalse)
+ { canDoGlobalCuts_ = trueOrFalse;}
+ /// Say whether can do global cuts
+ inline bool canDoGlobalCuts() const
+ {return canDoGlobalCuts_;}
+ /**
+ Returns true if may generate Row cuts in tree (rather than root node).
+ Used so know if matrix will change in tree. Really
+ meant so column cut generators can still be active
+ without worrying code.
+ Default is true
+ */
+ virtual bool mayGenerateRowCutsInTree() const;
+ /// Return true if needs optimal basis to do cuts
+ virtual bool needsOptimalBasis() const;
+ /// Return maximum length of cut in tree
+ virtual int maximumLengthOfCutInTree() const
+ { return COIN_INT_MAX;}
+ //@}
+
+ // test this class
+ //static void unitTest();
+
+// private:
+
+ /**
+ Aggressiveness - 0 = neutral, 100 is normal root node.
+ Really just a hint to cut generator
+ */
+ int aggressive_;
+ /// True if can do global cuts i.e. no general integers
+ bool canDoGlobalCuts_;
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglDuplicateRow.hpp b/thirdparty/linux/include/coin/CglDuplicateRow.hpp
new file mode 100644
index 0000000..b40f969
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglDuplicateRow.hpp
@@ -0,0 +1,189 @@
+// $Id: CglDuplicateRow.hpp 1119 2013-04-06 20:24:18Z stefan $
+// Copyright (C) 2004, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglDuplicateRow_H
+#define CglDuplicateRow_H
+
+#include
+
+#include "CglCutGenerator.hpp"
+class CglStored;
+
+/** DuplicateRow Cut Generator Class */
+class CglDuplicateRow : public CglCutGenerator {
+
+public:
+
+
+ /**@name Generate Cuts */
+ //@{
+ /** Fix variables and find duplicate/dominated rows for the model of the
+ solver interface, si.
+
+ This is a very simple minded idea but I (JJF) am using it in a project so thought
+ I might as well add it. It should really be called before first solve and I may
+ modify CBC to allow for that.
+
+ This is designed for problems with few rows and many integer variables where the rhs
+ are <= or == and all coefficients and rhs are small integers.
+
+ If effective rhs is K then we can fix all variables with coefficients > K to their lower bounds
+ (effective rhs just means original with variables with nonzero lower bounds subtracted out).
+
+ If one row is a subset of another and the effective rhs are same we can fix some variables
+ and then the two rows are identical.
+
+ The generator marks identical rows so can be taken out in solve
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+private:
+ /// Does work for modes 1,2
+ void generateCuts12( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ /// Does work for mode 4
+ void generateCuts4( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ /// Does work for mode 8
+ void generateCuts8( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+public:
+ /** Fix variables and find duplicate/dominated rows for the model of the
+ solver interface, si.
+
+ This is a very simple minded idea but I (JJF) am using it in a project so thought
+ I might as well add it. It should really be called before first solve and I may
+ modify CBC to allow for that.
+
+ This is designed for problems with few rows and many integer variables where the rhs
+ are <= or == and all coefficients and rhs are small integers.
+
+ If effective rhs is K then we can fix all variables with coefficients > K to their lower bounds
+ (effective rhs just means original with variables with nonzero lower bounds subtracted out).
+
+ If one row is a subset of another and the effective rhs are same we can fix some variables
+ and then the two rows are identical.
+
+ This version does deletions and fixings and may return stored cuts for
+ dominated columns
+ */
+ CglStored * outDuplicates( OsiSolverInterface * solver);
+
+ //@}
+
+ /**@name Get information on size of problem */
+ //@{
+ /// Get duplicate row list, -1 means still in, -2 means out (all fixed), k>= means same as row k
+ inline const int * duplicate() const
+ { return duplicate_;}
+ /// Size of dynamic program
+ inline int sizeDynamic() const
+ { return sizeDynamic_;}
+ /// Number of rows in original problem
+ inline int numberOriginalRows() const
+ { return matrix_.getNumRows();}
+ //@}
+
+ /**@name Get information on size of problem */
+ //@{
+ /// logLevel
+ inline int logLevel() const
+ { return logLevel_;}
+ inline void setLogLevel(int value)
+ { logLevel_ = value;}
+ //@}
+
+
+ /**@name We only check for duplicates amongst rows with effective rhs <= this */
+ //@{
+ /// Get
+ inline int maximumRhs() const
+ { return maximumRhs_;}
+ /// Set
+ inline void setMaximumRhs(int value)
+ { maximumRhs_=value;}
+ //@}
+
+ /**@name We only check for dominated amongst groups of columns whose size <= this */
+ //@{
+ /// Get
+ inline int maximumDominated() const
+ { return maximumDominated_;}
+ /// Set
+ inline void setMaximumDominated(int value)
+ { maximumDominated_=value;}
+ //@}
+ /**@name gets and sets */
+ //@{
+ /// Get mode
+ inline int mode() const
+ { return mode_;}
+ /// Set mode
+ inline void setMode(int value)
+ { mode_=value;}
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglDuplicateRow ();
+
+ /// Useful constructor
+ CglDuplicateRow (OsiSolverInterface * solver);
+
+ /// Copy constructor
+ CglDuplicateRow (
+ const CglDuplicateRow & rhs);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglDuplicateRow &
+ operator=(
+ const CglDuplicateRow& rhs);
+
+ /// Destructor
+ virtual
+ ~CglDuplicateRow ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+
+ /// This can be used to refresh any information
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ //@}
+
+protected:
+
+
+ // Protected member data
+
+ /**@name Protected member data */
+ //@{
+ /// Matrix
+ CoinPackedMatrix matrix_;
+ /// Matrix by row
+ CoinPackedMatrix matrixByRow_;
+ /// Possible rhs (if 0 then not possible)
+ int * rhs_;
+ /// Marks duplicate rows
+ int * duplicate_;
+ /// To allow for <= rows
+ int * lower_;
+ /// Stored cuts if we found dominance cuts
+ CglStored * storedCuts_;
+ /// Check dominated columns if less than this number of candidates
+ int maximumDominated_;
+ /// Check duplicates if effective rhs <= this
+ int maximumRhs_;
+ /// Size of dynamic program
+ int sizeDynamic_;
+ /// 1 do rows, 2 do columns, 3 do both
+ int mode_;
+ /// Controls print out
+ int logLevel_;
+ //@}
+};
+#endif
diff --git a/thirdparty/linux/include/coin/CglFlowCover.hpp b/thirdparty/linux/include/coin/CglFlowCover.hpp
new file mode 100644
index 0000000..eea070f
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglFlowCover.hpp
@@ -0,0 +1,371 @@
+// $Id: CglFlowCover.hpp 1119 2013-04-06 20:24:18Z stefan $
+//-----------------------------------------------------------------------------
+// name: Cgl Lifted Simple Generalized Flow Cover Cut Generator
+// author: Yan Xu email: yan.xu@sas.com
+// Jeff Linderoth email: jtl3@lehigh.edu
+// Martin Savelsberg email: martin.savelsbergh@isye.gatech.edu
+// date: 05/01/2003
+// comments: please scan this file for '???' and read the comments
+//-----------------------------------------------------------------------------
+// Copyright (C) 2003, Yan Xu, Jeff Linderoth, Martin Savelsberg and others.
+// All Rights Reserved.
+// This code is published under the Eclipse Public License.
+
+#ifndef CglFlowCover_H
+#define CglFlowCover_H
+
+#include
+
+#include "CoinError.hpp"
+
+#include "CglCutGenerator.hpp"
+
+//=============================================================================
+
+//=============================================================================
+
+/** This enumerative constant describes the various col types.*/
+enum CglFlowColType {
+ /** The column(variable) is a negative binary variable.*/
+ CGLFLOW_COL_BINNEG = -2,
+ /** The column is a negative continous variable.*/
+ CGLFLOW_COL_CONTNEG,
+ /** The column is a positive continous variable.*/
+ CGLFLOW_COL_CONTPOS = 1,
+ /** The column is a positive binary variable.*/
+ CGLFLOW_COL_BINPOS
+};
+
+enum CglFlowColStatus{
+};
+
+/** This enumerative constant describes the various stati of vars in
+ a cut or not.*/
+enum CglFlowColCut{
+ /** The column is NOT in cover.*/
+ CGLFLOW_COL_OUTCUT = 0,
+ /** The column is in cover now. */
+ CGLFLOW_COL_INCUT,
+ /** The column is decided to be in cover. */
+ CGLFLOW_COL_INCUTDONE,
+ /** The column is in L-. */
+ CGLFLOW_COL_INLMIN,
+ /** The column is decided to be in L-. */
+ CGLFLOW_COL_INLMINDONE,
+ /** The column is in L--.*/
+ CGLFLOW_COL_INLMINMIN,
+ /** This enumerative constant describes the various stati of vars in
+ determining the cover.*/
+ /** The column is a prime candidate. */
+ CGLFLOW_COL_PRIME,
+ /** The column is a secondary candidate. */
+ CGLFLOW_COL_SECONDARY
+};
+
+/** This enumerative constant describes the various row types.*/
+enum CglFlowRowType {
+ /** The row type of this row is NOT defined yet.*/
+ CGLFLOW_ROW_UNDEFINED,
+ /** After the row is flipped to 'L', the row has exactly two variables:
+ one is negative binary and the other is continous, and the RHS
+ is zero.*/
+ CGLFLOW_ROW_VARUB,
+ /** After the row is flipped to 'L', the row has exactlytwo variables:
+ one is positive binary and the other is continous, and the RHS
+ is zero.*/
+ CGLFLOW_ROW_VARLB,
+ /** The row sense is 'E', the row has exactly two variables:
+ one is binary and the other is a continous, and the RHS is zero.*/
+ CGLFLOW_ROW_VAREQ,
+ /** Rows can not be classfied into other types and the row sense
+ is NOT 'E'.*/
+ CGLFLOW_ROW_MIXUB,
+ /** Rows can not be classfied into other types and the row sense is 'E'.*/
+ CGLFLOW_ROW_MIXEQ,
+ /** All variables are NOT binary and the row sense is NOT 'E'. */
+ CGLFLOW_ROW_NOBINUB,
+ /** All variables are NOT binary and the row sense is 'E'. */
+ CGLFLOW_ROW_NOBINEQ,
+ /** The row has one binary and 2 or more other types of variables and
+ the row sense is NOT 'E'. */
+ CGLFLOW_ROW_SUMVARUB,
+ /** The row has one binary and 2 or more other types of variables and
+ the row sense is 'E'. */
+ CGLFLOW_ROW_SUMVAREQ,
+ /** All variables are binary. */
+ CGLFLOW_ROW_UNINTERSTED
+};
+
+//=============================================================================
+
+/** Variable upper bound class. */
+class CglFlowVUB
+{
+protected:
+ int varInd_; /** The index of the associated 0-1 variable.*/
+ double upper_; /** The Value of the associated upper bound.*/
+
+public:
+ CglFlowVUB() : varInd_(-1), upper_(-1) {}
+
+ CglFlowVUB(const CglFlowVUB& source) {
+ varInd_= source.varInd_;
+ upper_ = source.upper_;
+ }
+
+ CglFlowVUB& operator=(const CglFlowVUB& rhs) {
+ if (this == &rhs)
+ return *this;
+ varInd_= rhs.varInd_;
+ upper_ = rhs.upper_;
+ return *this;
+ }
+
+ /**@name Query and set functions for associated 0-1 variable index
+ and value.
+ */
+ //@{
+ inline int getVar() const { return varInd_; }
+ inline double getVal() const { return upper_; }
+ inline void setVar(const int v) { varInd_ = v; }
+ inline void setVal(const double v) { upper_ = v; }
+ //@}
+};
+
+//=============================================================================
+
+/** Variable lower bound class, which is the same as vub. */
+typedef CglFlowVUB CglFlowVLB;
+
+/** Overloaded operator<< for printing VUB and VLB.*/
+std::ostream& operator<<( std::ostream& os, const CglFlowVUB &v );
+
+//=============================================================================
+
+/**
+ * Lifed Simple Generalized Flow Cover Cut Generator Class.
+ */
+class CglFlowCover : public CglCutGenerator {
+ friend void CglFlowCoverUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+
+ /**
+ * Do the following tasks:
+ *
+ *
classify row types
+ *
indentify vubs and vlbs
+ *
+ * This function is called by
+ * generateCuts(const OsiSolverInterface & si, OsiCuts & cs).
+ */
+ void flowPreprocess(const OsiSolverInterface& si);
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate Lifed Simple Generalized flow cover cuts for the model data
+ contained in si. The generated cuts are inserted into and returned
+ in the collection of cuts cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ /**@name Functions to query and set maximum number of cuts can be
+ generated. */
+ //@{
+ inline int getMaxNumCuts() const { return maxNumCuts_; }
+ inline void setMaxNumCuts(int mc) { maxNumCuts_ = mc; }
+ //@}
+
+ /**@name Functions to query and set the number of cuts have been
+ generated. */
+ //@{
+ static int getNumFlowCuts() { return numFlowCuts_; }
+ static void setNumFlowCuts(int fc) { numFlowCuts_ = fc; }
+ static void incNumFlowCuts(int fc = 1) { numFlowCuts_ += fc; }
+ //@}
+
+ //-------------------------------------------------------------------------
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglFlowCover ();
+
+ /// Copy constructor
+ CglFlowCover (
+ const CglFlowCover &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglFlowCover &
+ operator=(
+ const CglFlowCover& rhs);
+
+ /// Destructor
+ virtual
+ ~CglFlowCover ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+private:
+ //-------------------------------------------------------------------------
+ // Private member functions
+
+ /** Based a given row, a LP solution and other model data, this function
+ tries to generate a violated lifted simple generalized flow cover.
+ */
+ bool generateOneFlowCut( const OsiSolverInterface & si,
+ const int rowLen,
+ int* ind,
+ double* coef,
+ char sense,
+ double rhs,
+ OsiRowCut& flowCut,
+ double& violation );
+
+
+ /** Transform a row from ">=" to "<=", and vice versa. */
+ void flipRow(int rowLen, double* coef, double& rhs) const;
+
+ /** Transform a row from ">=" to "<=", and vice versa. Have 'sense'. */
+ void flipRow(int rowLen, double* coef, char& sen, double& rhs) const;
+
+ /** Determine the type of a given row. */
+ CglFlowRowType determineOneRowType(const OsiSolverInterface& si,
+ int rowLen, int* ind,
+ double* coef, char sen,
+ double rhs) const;
+ /** Lift functions */
+ void liftMinus(double &movement, /* Output */
+ int t,
+ int r,
+ double z,
+ double dPrimePrime,
+ double lambda,
+ double ml,
+ double *M,
+ double *rho) const;
+
+ bool liftPlus(double &alpha,
+ double &beta,
+ int r,
+ double m_j,
+ double lambda,
+ double y_j,
+ double x_j,
+ double dPrimePrime,
+ double *M) const;
+
+
+ //-------------------------------------------------------------------------
+ //**@name Query and set the row type of a givne row. */
+ //@{
+ inline const CglFlowRowType* getRowTypes() const
+ { return rowTypes_; }
+ inline CglFlowRowType getRowType(const int i) const
+ { return rowTypes_[i]; }
+ /** Set rowtypes, take over the ownership. */
+ inline void setRowTypes(CglFlowRowType* rt)
+ { rowTypes_ = rt; rt = 0; }
+ inline void setRowTypes(const CglFlowRowType rt, const int i) {
+ if (rowTypes_ != 0)
+ rowTypes_[i] = rt;
+ else {
+ std::cout << "ERROR: Should allocate memory for rowType_ before "
+ << "using it " << std::endl;
+ throw CoinError("Forgot to allocate memory for rowType_",
+ "setRowType", "CglFlowCover");
+ }
+ }
+ //@}
+
+ //-------------------------------------------------------------------------
+ //**@name Query and set vubs. */
+ //@{
+ inline const CglFlowVUB* getVubs() const { return vubs_; }
+ inline const CglFlowVUB& getVubs(int i) const { return vubs_[i]; }
+ /** Set CglFlowVUBs,take over the ownership. */
+ inline void setVubs(CglFlowVUB* vubs) { vubs_ = vubs; vubs = 0; }
+ inline void setVubs(const CglFlowVUB& vub, int i) {
+ if (vubs_ != 0)
+ vubs_[i] = vub;
+ else {
+ std::cout << "ERROR: Should allocate memory for vubs_ before "
+ << "using it " << std::endl;
+ throw CoinError("Forgot to allocate memory for vubs_", "setVubs",
+ "CglFlowCover");
+ }
+ }
+ inline void printVubs(std::ostream& os) const {
+ for (int i = 0; i < numCols_; ++i) {
+ os << "ix: " << i << ", " << vubs_[i];
+ }
+ }
+ //@}
+
+ //-------------------------------------------------------------------------
+ //**@name Query and set vlbs. */
+ //@{
+ inline const CglFlowVLB* getVlbs() const { return vlbs_; }
+ inline const CglFlowVLB& getVlbs(int i) const { return vlbs_[i]; }
+ /** Set CglFlowVLBs,take over the ownership. */
+ inline void setVlbs(CglFlowVLB* vlbs) { vlbs_ = vlbs; vlbs = 0; }
+ inline void setVlbs(const CglFlowVLB& vlb, int i) {
+ if (vlbs_ != 0)
+ vlbs_[i] = vlb;
+ else {
+ std::cout << "ERROR: Should allocate memory for vlbs_ before "
+ << "using it " << std::endl;
+ throw CoinError("Forgot to allocate memory for vlbs_", "setVlbs",
+ "CglFlowCover");
+ }
+ }
+ //@}
+
+private:
+ //------------------------------------------------------------------------
+ // Private member data
+
+ /** The maximum number of flow cuts to be generated. Default is 1000. */
+ int maxNumCuts_;
+ /** Tolerance used for numerical purpose. */
+ double EPSILON_;
+ /** The variable upper bound of a flow is not indentified yet.*/
+ int UNDEFINED_;
+ /** Very large number. */
+ double INFTY_;
+ /** If violation of a cut is greater that this number, the cut is useful.*/
+ double TOLERANCE_;
+ /** First time preprocessing */
+ bool firstProcess_;
+ /** The number rows of the problem.*/
+ int numRows_;
+ /** The number columns of the problem.*/
+ int numCols_;
+ /** The number flow cuts found.*/
+ static int numFlowCuts_;
+ /** Indicate whether initial flow preprecessing has been done. */
+ bool doneInitPre_;
+ /** The array of CglFlowVUBs. */
+ CglFlowVUB* vubs_;
+ /** The array of CglFlowVLBs. */
+ CglFlowVLB* vlbs_;
+ /** CglFlowRowType of the rows in model. */
+ CglFlowRowType* rowTypes_;
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglFlowCover class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglFlowCoverUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglGMI.hpp b/thirdparty/linux/include/coin/CglGMI.hpp
new file mode 100644
index 0000000..240f6ad
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglGMI.hpp
@@ -0,0 +1,364 @@
+// Last edit: 02/05/2013
+//
+// Name: CglGMI.hpp
+// Author: Giacomo Nannicini
+// Singapore University of Technology and Design, Singapore
+// email: nannicini@sutd.edu.sg
+// Date: 11/17/09
+//-----------------------------------------------------------------------------
+// Copyright (C) 2009, Giacomo Nannicini. All Rights Reserved.
+
+#ifndef CglGMI_H
+#define CglGMI_H
+
+#include "CglCutGenerator.hpp"
+#include "CglGMIParam.hpp"
+#include "CoinWarmStartBasis.hpp"
+#include "CoinFactorization.hpp"
+
+/* Enable tracking of rejection of cutting planes. If this is disabled,
+ the cut generator is slightly faster. If defined, it enables proper use
+ of setTrackRejection and related functions. */
+//#define TRACK_REJECT
+
+/* Debug output */
+//#define GMI_TRACE
+
+/* Debug output: print optimal tableau */
+//#define GMI_TRACETAB
+
+/* Print reason for cut rejection, whenever a cut is discarded */
+//#define GMI_TRACE_CLEAN
+
+/** Gomory cut generator with several cleaning procedures, used to test
+ * the numerical safety of the resulting cuts
+ */
+
+class CglGMI : public CglCutGenerator {
+
+ friend void CglGMIUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+public:
+
+ /** Public enum: all possible reasons for cut rejection */
+ enum RejectionType{
+ failureFractionality,
+ failureDynamism,
+ failureViolation,
+ failureSupport,
+ failureScale
+ };
+
+ /**@name generateCuts */
+ //@{
+ /** Generate Gomory Mixed-Integer cuts for the model of the solver
+ interface si.
+
+ Insert the generated cuts into OsiCuts cs.
+
+ Warning: This generator currently works only with the Lp solvers Clp or
+ Cplex9.0 or higher. It requires access to the optimal tableau and
+ optimal basis inverse and makes assumptions on the way slack variables
+ are added by the solver. The Osi implementations for Clp and Cplex
+ verify these assumptions.
+
+ When calling the generator, the solver interface si must contain
+ an optimized problem and information related to the optimal
+ basis must be available through the OsiSolverInterface methods
+ (si->optimalBasisIsAvailable() must return 'true'). It is also
+ essential that the integrality of structural variable i can be
+ obtained using si->isInteger(i).
+
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /// Return true if needs optimal basis to do cuts (will return true)
+ virtual bool needsOptimalBasis() const { return true; }
+ //@}
+
+ /**@name Common Methods */
+ //@{
+ // Function for checking equality with user tolerance
+ inline bool areEqual(double x, double y,
+ double epsAbs = 1e-12,
+ double epsRel = 1e-12) {
+ return (fabs((x) - (y)) <=
+ std::max(epsAbs, epsRel * std::max(fabs(x), fabs(y))));
+ }
+
+ // Function for checking is a number is zero
+ inline bool isZero(double x, double epsZero = 1e-20) {
+ return (fabs(x) <= epsZero);
+ }
+
+
+ // Function for checking if a number is integer
+ inline bool isIntegerValue(double x,
+ double intEpsAbs = 1e-9,
+ double intEpsRel = 1e-15) {
+ return (fabs((x) - floor((x)+0.5)) <=
+ std::max(intEpsAbs, intEpsRel * fabs(x)));
+ }
+
+
+ //@}
+
+
+ /**@name Public Methods */
+ //@{
+
+ // Set the parameters to the values of the given CglGMIParam object.
+ void setParam(const CglGMIParam &source);
+ // Return the CglGMIParam object of the generator.
+ inline CglGMIParam getParam() const {return param;}
+ inline CglGMIParam & getParam() {return param;}
+
+ // Compute entries of is_integer.
+ void computeIsInteger();
+
+ /// Print the current simplex tableau
+ void printOptTab(OsiSolverInterface *solver) const;
+
+ /// Set/get tracking of the rejection of cutting planes.
+ /// Note that all rejection related functions will not do anything
+ /// unless the generator is compiled with the define GMI_TRACK_REJECTION
+ void setTrackRejection(bool value);
+ bool getTrackRejection();
+
+ /// Get number of cuts rejected for given reason; see above
+ int getNumberRejectedCuts(RejectionType reason);
+
+ /// Reset counters for cut rejection tracking; see above
+ void resetRejectionCounters();
+
+ /// Get total number of generated cuts since last resetRejectionCounters()
+ int getNumberGeneratedCuts();
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglGMI();
+
+ /// Constructor with specified parameters
+ CglGMI(const CglGMIParam ¶m);
+
+ /// Copy constructor
+ CglGMI(const CglGMI &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglGMI & operator=(const CglGMI& rhs);
+
+ /// Destructor
+ virtual ~CglGMI();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+
+ //@}
+
+private:
+
+ // Private member methods
+
+/**@name Private member methods */
+
+ //@{
+
+ // Method generating the cuts after all CglGMI members are properly set.
+ void generateCuts(OsiCuts & cs);
+
+ /// Compute the fractional part of value, allowing for small error.
+ inline double aboveInteger(double value) const;
+
+ /// Compute the fractionalities involved in the cut, and the cut rhs.
+ /// Returns true if cut is accepted, false if discarded
+ inline bool computeCutFractionality(double varRhs, double& cutRhs);
+
+ /// Compute the cut coefficient on a given variable
+ inline double computeCutCoefficient(double rowElem, int index);
+
+ /// Use multiples of the initial inequalities to cancel out the coefficient
+ /// on a slack variables.
+ inline void eliminateSlack(double cutElem, int cutIndex, double* cut,
+ double& cutRhs, const double *elements,
+ const int *rowStart, const int *indices,
+ const int *rowLength, const double *rhs);
+
+ /// Change the sign of the coefficients of the non basic
+ /// variables at their upper bound.
+ inline void flip(double& rowElem, int rowIndex);
+
+ /// Change the sign of the coefficients of the non basic
+ /// variables at their upper bound and do the translations restoring
+ /// the original bounds. Modify the right hand side
+ /// accordingly. Two functions: one for original variables, one for slacks.
+ inline void unflipOrig(double& rowElem, int rowIndex, double& rowRhs);
+ inline void unflipSlack(double& rowElem, int rowIndex, double& rowRhs,
+ const double* slack_val);
+
+ /// Pack a row of ncol elements
+ inline void packRow(double* row, double* rowElem, int* rowIndex,
+ int& rowNz);
+
+ /// Clean the cutting plane; the cleaning procedure does several things
+ /// like removing small coefficients, scaling, and checks several
+ /// acceptance criteria. If this returns false, the cut should be discarded.
+ /// There are several cleaning procedures available, that can be selected
+ /// via the parameter param.setCLEANING_PROCEDURE(int value)
+ bool cleanCut(double* cutElem, int* cutIndex, int& cutNz,
+ double& cutRhs, const double* xbar);
+
+ /// Cut cleaning procedures: return true if successfull, false if
+ /// cut should be discarded by the caller of if problems encountered
+
+ /// Check the violation
+ bool checkViolation(const double* cutElem, const int* cutIndex,
+ int cutNz, double cutrhs, const double* xbar);
+
+ /// Check the dynamism
+ bool checkDynamism(const double* cutElem, const int* cutIndex,
+ int cutNz);
+
+ /// Check the support
+ bool checkSupport(int cutNz);
+
+ /// Remove small coefficients and adjust the rhs accordingly
+ bool removeSmallCoefficients(double* cutElem, int* cutIndex,
+ int& cutNz, double& cutRhs);
+
+ /// Adjust the rhs by relaxing by a small amount (relative or absolute)
+ void relaxRhs(double& rhs);
+
+ /// Scale the cutting plane in different ways;
+ /// scaling_type possible values:
+ /// 0 : scale to obtain integral cut
+ /// 1 : scale based on norm, to obtain cut norm equal to ncol
+ /// 2 : scale to obtain largest coefficient equal to 1
+ bool scaleCut(double* cutElem, int* cutIndex, int cutNz,
+ double& cutRhs, int scalingType);
+
+ /// Scale the cutting plane in order to generate integral coefficients
+ bool scaleCutIntegral(double* cutElem, int* cutIndex, int cutNz,
+ double& cutRhs);
+
+ /// Compute the nearest rational number; used by scale_row_integral
+ bool nearestRational(double val, double maxdelta, long maxdnom,
+ long& numerator, long& denominator);
+
+ /// Compute the greatest common divisor
+ long computeGcd(long a, long b);
+
+ /// print a vector of integers
+ void printvecINT(const char *vecstr, const int *x, int n) const;
+ /// print a vector of doubles: dense form
+ void printvecDBL(const char *vecstr, const double *x, int n) const;
+ /// print a vector of doubles: sparse form
+ void printvecDBL(const char *vecstr, const double *elem, const int * index,
+ int nz) const;
+
+ /// Recompute the simplex tableau for want of a better accuracy.
+ /// Requires an empty CoinFactorization object to do the computations,
+ /// and two empty (already allocated) arrays which will contain
+ /// the basis indices on exit. Returns 0 if successfull.
+ int factorize(CoinFactorization & factorization,
+ int* colBasisIndex, int* rowBasisIndex);
+
+
+ //@}
+
+
+ // Private member data
+
+/**@name Private member data */
+
+ //@{
+
+ /// Object with CglGMIParam members.
+ CglGMIParam param;
+
+ /// Number of rows ( = number of slack variables) in the current LP.
+ int nrow;
+
+ /// Number of structural variables in the current LP.
+ int ncol;
+
+ /// Lower bounds for structural variables
+ const double *colLower;
+
+ /// Upper bounds for structural variables
+ const double *colUpper;
+
+ /// Lower bounds for constraints
+ const double *rowLower;
+
+ /// Upper bounds for constraints
+ const double *rowUpper;
+
+ /// Righ hand side for constraints (upper bound for ranged constraints).
+ const double *rowRhs;
+
+ /// Characteristic vectors of structural integer variables or continuous
+ /// variables currently fixed to integer values.
+ bool *isInteger;
+
+ /// Current basis status: columns
+ int *cstat;
+
+ /// Current basis status: rows
+ int *rstat;
+
+ /// Pointer on solver. Reset by each call to generateCuts().
+ OsiSolverInterface *solver;
+
+ /// Pointer on point to separate. Reset by each call to generateCuts().
+ const double *xlp;
+
+ /// Pointer on row activity. Reset by each call to generateCuts().
+ const double *rowActivity;
+
+ /// Pointer on matrix of coefficient ordered by rows.
+ /// Reset by each call to generateCuts().
+ const CoinPackedMatrix *byRow;
+
+ /// Pointer on matrix of coefficient ordered by columns.
+ /// Reset by each call to generateCuts().
+ const CoinPackedMatrix *byCol;
+
+ /// Fractionality of the cut and related quantities.
+ double f0;
+ double f0compl;
+ double ratiof0compl;
+
+#if defined(TRACK_REJECT) || defined (TRACK_REJECT_SIMPLE)
+ /// Should we track the reason of each cut rejection?
+ bool trackRejection;
+ /// Number of failures by type
+ int fracFail;
+ int dynFail;
+ int violFail;
+ int suppFail;
+ int smallCoeffFail;
+ int scaleFail;
+ /// Total number of generated cuts
+ int numGeneratedCuts;
+#endif
+
+ //@}
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglGMI class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglGMIUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglGMIParam.hpp b/thirdparty/linux/include/coin/CglGMIParam.hpp
new file mode 100644
index 0000000..a1aae41
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglGMIParam.hpp
@@ -0,0 +1,313 @@
+// Name: CglGMIParam.hpp
+// Author: Giacomo Nannicini
+// Singapore University of Technology and Design
+// email: nannicini@sutd.edu.sg
+// based on CglRedSplitParam.hpp by Francois Margot
+// Date: 11/17/09
+//-----------------------------------------------------------------------------
+// Copyright (C) 2009, Giacomo Nannicini and others. All Rights Reserved.
+
+#ifndef CglGMIParam_H
+#define CglGMIParam_H
+
+#include "CglParam.hpp"
+
+
+ /**@name CglGMI Parameters */
+ //@{
+
+ /** Class collecting parameters for the GMI cut generator.
+
+ Parameters of the generator are listed below. Modifying the default
+ values for parameters other than the last four might result in
+ invalid cuts.
+
+ - MAXDYN: Maximum ratio between largest and smallest non zero
+ coefficients in a cut. See method setMAXDYN().
+ - EPS_ELIM: Precision for deciding if a coefficient is zero when
+ eliminating slack variables. See method setEPS_ELIM().
+ - MINVIOL: Minimum violation for the current basic solution in
+ a generated cut. See method setMINVIOL().
+ - USE_INTSLACKS: Use integer slacks to generate cuts.
+ (not implemented yet, will be in the future).
+ See method setUSE_INTSLACKS().
+ - AWAY: Look only at basic integer variables whose current value is at
+ least this value away from being integer. See method setAway().
+ - CHECK_DUPLICATES: Should we check for duplicates when adding a cut
+ to the collection? Can be slow.
+ Default 0 - do not check, add cuts anyway.
+ - CLEAN_PROC: Cleaning procedure that should be used. Look below at the
+ enumeration CleaningProcedure for possible values.
+ - INTEGRAL_SCALE_CONT: If we try to scale cut coefficients so that
+ they become integral, do we also scale on
+ continuous variables?
+ Default 0 - do not scale continuous vars.
+ Used only if CLEAN_PROC does integral scaling.
+ - ENFORCE_SCALING: Discard badly scaled cuts, or keep them (unscaled).
+ Default 1 - yes.
+
+ */
+ //@}
+
+class CglGMIParam : public CglParam {
+
+public:
+
+ /**@name Enumerations */
+ enum CleaningProcedure{
+ /* CglLandP procedure I */
+ CP_CGLLANDP1,
+ /* CglLandP procedure II */
+ CP_CGLLANDP2,
+ /* CglRedSplit procedure I */
+ CP_CGLREDSPLIT,
+ /* Only integral cuts, i.e. cuts with integral coefficients */
+ CP_INTEGRAL_CUTS,
+ /* CglLandP procedure I with integral scaling */
+ CP_CGLLANDP1_INT,
+ /* CglLandP procedure I with scaling of the max element to 1 if possible */
+ CP_CGLLANDP1_SCALEMAX,
+ /* CglLandP procedure I with scaling of the rhs to 1 if possible */
+ CP_CGLLANDP1_SCALERHS
+ };
+
+ /**@name Set/get methods */
+
+ //@{
+ /** Aliases for parameter get/set method in the base class CglParam */
+
+ /** Value for Infinity. Default: DBL_MAX */
+ inline void setInfinity(double value) {setINFINIT(value);}
+ inline double getInfinity() const {return INFINIT;}
+
+ /** Epsilon for comparing numbers. Default: 1.0e-6 */
+ inline void setEps(double value) {setEPS(value);}
+ inline double getEps() const {return EPS;}
+
+ /** Epsilon for zeroing out coefficients. Default: 1.0e-5 */
+ inline void setEpsCoeff(double value) {setEPS_COEFF(value);}
+ inline double getEpsCoeff() const {return EPS_COEFF;}
+
+ /** Maximum support of the cutting planes. Default: INT_MAX */
+ inline void setMaxSupport(int value) {setMAX_SUPPORT(value);}
+ inline int getMaxSupport() const {return MAX_SUPPORT;}
+ /** Alias for consistency with our naming scheme */
+ inline void setMaxSupportAbs(int value) {setMAX_SUPPORT(value);}
+ inline int getMaxSupportAbs() const {return MAX_SUPPORT;}
+ inline int getMAX_SUPPORT_ABS() const {return MAX_SUPPORT;}
+
+ /** Set AWAY, the minimum distance from being integer used for selecting
+ rows for cut generation; all rows whose pivot variable should be
+ integer but is more than away from integrality will be selected;
+ Default: 0.005 */
+ virtual void setAway(double value);
+ /** Get value of away */
+ inline double getAway() const {return AWAY;}
+ /// Aliases
+ inline void setAWAY(double value) {setAway(value);}
+ inline double getAWAY() const {return AWAY;}
+
+ /** Set the value of EPS_ELIM, epsilon for values of coefficients when
+ eliminating slack variables;
+ Default: 0 */
+ virtual void setEPS_ELIM(double value);
+ /** Get the value of EPS_ELIM */
+ inline double getEPS_ELIM() const {return EPS_ELIM;}
+ /// Aliases
+ inline void setEpsElim(double value) {setEPS_ELIM(value);}
+ inline double getEpsElim() const {return EPS_ELIM;}
+
+ /** Set EPS_RELAX_ABS */
+ virtual void setEPS_RELAX_ABS(double value);
+ /** Get value of EPS_RELAX_ABS */
+ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;}
+ /// Aliases
+ inline void setEpsRelaxAbs(double value) {setEPS_RELAX_ABS(value);}
+ inline double getEpsRelaxAbs() const {return EPS_RELAX_ABS;}
+
+ /** Set EPS_RELAX_REL */
+ virtual void setEPS_RELAX_REL(double value);
+ /** Get value of EPS_RELAX_REL */
+ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;}
+ /// Aliases
+ inline void setEpsRelaxRel(double value) {setEPS_RELAX_REL(value);}
+ inline double getEpsRelaxRel() const {return EPS_RELAX_REL;}
+
+ // Set the maximum ratio between largest and smallest non zero
+ // coefficients in a cut. Default: 1e6.
+ virtual void setMAXDYN(double value);
+ /** Get the value of MAXDYN */
+ inline double getMAXDYN() const {return MAXDYN;}
+ /// Aliases
+ inline void setMaxDyn(double value) {setMAXDYN(value);}
+ inline double getMaxDyn() const {return MAXDYN;}
+
+ /** Set the value of MINVIOL, the minimum violation for the current
+ basic solution in a generated cut. Default: 1e-7 */
+ virtual void setMINVIOL(double value);
+ /** Get the value of MINVIOL */
+ inline double getMINVIOL() const {return MINVIOL;}
+ /// Aliases
+ inline void setMinViol(double value) {setMINVIOL(value);}
+ inline double getMinViol() const {return MINVIOL;}
+
+ /** Set the value of MAX_SUPPORT_REL, the factor contributing to the
+ maximum support relative to the number of columns. Maximum
+ allowed support is: MAX_SUPPORT_ABS +
+ MAX_SUPPORT_REL*ncols. Default: 0.1 */
+ virtual void setMAX_SUPPORT_REL(double value);
+ /** Get the value of MINVIOL */
+ inline double getMAX_SUPPORT_REL() const {return MAX_SUPPORT_REL;}
+ /// Aliases
+ inline void setMaxSupportRel(double value) {setMAX_SUPPORT_REL(value);}
+ inline double getMaxSupportRel() const {return MAX_SUPPORT_REL;}
+
+ /** Set the value of USE_INTSLACKS. Default: 0 */
+ virtual void setUSE_INTSLACKS(bool value);
+ /** Get the value of USE_INTSLACKS */
+ inline bool getUSE_INTSLACKS() const {return USE_INTSLACKS;}
+ /// Aliases
+ inline void setUseIntSlacks(bool value) {setUSE_INTSLACKS(value);}
+ inline int getUseIntSlacks() const {return USE_INTSLACKS;}
+
+ /** Set the value of CHECK_DUPLICATES. Default: 0 */
+ virtual void setCHECK_DUPLICATES(bool value);
+ /** Get the value of CHECK_DUPLICATES */
+ inline bool getCHECK_DUPLICATES() const {return CHECK_DUPLICATES;}
+ /// Aliases
+ inline void setCheckDuplicates(bool value) {setCHECK_DUPLICATES(value);}
+ inline bool getCheckDuplicates() const {return CHECK_DUPLICATES;}
+
+ /** Set the value of CLEAN_PROC. Default: CP_CGLLANDP1 */
+ virtual void setCLEAN_PROC(CleaningProcedure value);
+ /** Get the value of CLEAN_PROC. */
+ inline CleaningProcedure getCLEAN_PROC() const {return CLEAN_PROC;}
+ /// Aliases
+ inline void setCleanProc(CleaningProcedure value) {setCLEAN_PROC(value);}
+ inline CleaningProcedure getCleaningProcedure() const {return CLEAN_PROC;}
+
+ /** Set the value of INTEGRAL_SCALE_CONT. Default: 0 */
+ virtual void setINTEGRAL_SCALE_CONT(bool value);
+ /** Get the value of INTEGRAL_SCALE_CONT. */
+ inline bool getINTEGRAL_SCALE_CONT() const {return INTEGRAL_SCALE_CONT;}
+ /// Aliases
+ inline void setIntegralScaleCont(bool value) {setINTEGRAL_SCALE_CONT(value);}
+ inline bool getIntegralScaleCont() const {return INTEGRAL_SCALE_CONT;}
+
+ /** Set the value of ENFORCE_SCALING. Default: 1 */
+ virtual void setENFORCE_SCALING(bool value);
+ /** Get the value of ENFORCE_SCALING. */
+ inline bool getENFORCE_SCALING() const {return ENFORCE_SCALING;}
+ /// Aliases
+ inline void setEnforceScaling(bool value) {setENFORCE_SCALING(value);}
+ inline bool getEnforcescaling() const {return ENFORCE_SCALING;}
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglGMIParam(double eps = 1e-12,
+ double away = 0.005,
+ double eps_coeff = 1e-11,
+ double eps_elim = 0,
+ double eps_relax_abs = 1e-11,
+ double eps_relax_rel = 1e-13,
+ double max_dyn = 1e6,
+ double min_viol = 1e-4,
+ int max_supp_abs = 1000,
+ double max_supp_rel = 0.1,
+ CleaningProcedure clean_proc = CP_CGLLANDP1,
+ bool use_int_slacks = false,
+ bool check_duplicates = false,
+ bool integral_scale_cont = false,
+ bool enforce_scaling = true);
+
+ /// Constructor from CglParam
+ CglGMIParam(CglParam &source,
+ double away = 0.005,
+ double eps_elim = 1e-12,
+ double eps_relax_abs = 1e-11,
+ double eps_relax_rel = 1e-13,
+ double max_dyn = 1e6,
+ double min_viol = 1e-4,
+ double max_supp_rel = 0.1,
+ CleaningProcedure clean_proc = CP_CGLLANDP1,
+ bool use_int_slacks = false,
+ bool check_duplicates = false,
+ bool integral_scale_cont = false,
+ bool enforce_scaling = true);
+
+ /// Copy constructor
+ CglGMIParam(const CglGMIParam &source);
+
+ /// Clone
+ virtual CglGMIParam* clone() const;
+
+ /// Assignment operator
+ virtual CglGMIParam& operator=(const CglGMIParam &rhs);
+
+ /// Destructor
+ virtual ~CglGMIParam();
+ //@}
+
+protected:
+
+ /**@name Parameters */
+ //@{
+
+ /** Use row only if pivot variable should be integer but is more
+ than AWAY from being integer. */
+ double AWAY;
+
+ /** Epsilon for value of coefficients when eliminating slack variables.
+ Default: 0. */
+ double EPS_ELIM;
+
+ /** Value added to the right hand side of each generated cut to relax it.
+ Default: 1e-11 */
+ double EPS_RELAX_ABS;
+
+ /** For a generated cut with right hand side rhs_val,
+ EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint.
+ Default: 1.e-13 */
+ double EPS_RELAX_REL;
+
+ /** Maximum ratio between largest and smallest non zero
+ coefficients in a cut. Default: 1e6. */
+ double MAXDYN;
+
+ /** Minimum violation for the current basic solution in a generated cut.
+ Default: 1e-4. */
+ double MINVIOL;
+
+ /** Maximum support relative to number of columns. Must be between 0
+ and 1. Default: 0. */
+ double MAX_SUPPORT_REL;
+
+ /** Which cleaning procedure should be used? */
+ CleaningProcedure CLEAN_PROC;
+
+ /** Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0. */
+ bool USE_INTSLACKS;
+
+ /** Check for duplicates when adding the cut to the collection? */
+ bool CHECK_DUPLICATES;
+
+ /** Should we try to rescale cut coefficients on continuous variables
+ so that they become integral, or do we only rescale coefficients
+ on integral variables? Used only by cleaning procedure that try
+ the integral scaling. */
+ bool INTEGRAL_SCALE_CONT;
+
+ /** Should we discard badly scaled cuts (according to the scaling
+ procedure in use)? If false, CglGMI::scaleCut always returns
+ true, even though it still scales cuts whenever possible, but
+ not cut is rejected for scaling. Default true. Used only by
+ cleaning procedure that try to scale. */
+ bool ENFORCE_SCALING;
+
+ //@}
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglGomory.hpp b/thirdparty/linux/include/coin/CglGomory.hpp
new file mode 100644
index 0000000..2d7f5c5
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglGomory.hpp
@@ -0,0 +1,204 @@
+// Copyright (C) 2002, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglGomory_H
+#define CglGomory_H
+
+#include
+
+#include "CglCutGenerator.hpp"
+
+class CoinWarmStartBasis;
+/** Gomory Cut Generator Class */
+class CglGomory : public CglCutGenerator {
+ friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate Mixed Integer Gomory cuts for the model of the
+ solver interface, si.
+
+ Insert the generated cuts into OsiCut, cs.
+
+ There is a limit option, which will only generate cuts with
+ less than this number of entries.
+
+ We can also only look at 0-1 variables a certain distance
+ from integer.
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ /** Generates cuts given matrix and solution etc,
+ returns number of cuts generated */
+ int generateCuts( const OsiRowCutDebugger * debugger,
+ OsiCuts & cs,
+ const CoinPackedMatrix & columnCopy,
+ const CoinPackedMatrix & rowCopy,
+ const double * colsol,
+ const double * colLower, const double * colUpper,
+ const double * rowLower, const double * rowUpper,
+ const char * intVar ,
+ const CoinWarmStartBasis* warm,
+ const CglTreeInfo info = CglTreeInfo());
+ /** Generates cuts given matrix and solution etc,
+ returns number of cuts generated (no row copy passed in) */
+ int generateCuts( const OsiRowCutDebugger * debugger,
+ OsiCuts & cs,
+ const CoinPackedMatrix & columnCopy,
+ const double * colsol,
+ const double * colLower, const double * colUpper,
+ const double * rowLower, const double * rowUpper,
+ const char * intVar ,
+ const CoinWarmStartBasis* warm,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /// Return true if needs optimal basis to do cuts (will return true)
+ virtual bool needsOptimalBasis() const { return true; }
+ //@}
+
+ /**@name Change way Gomory works */
+ //@{
+ /// Pass in a copy of original solver (clone it)
+ void passInOriginalSolver(OsiSolverInterface * solver);
+ /// Returns original solver
+ inline OsiSolverInterface * originalSolver() const
+ { return originalSolver_;}
+ /// Set type - 0 normal, 1 add original matrix one, 2 replace
+ inline void setGomoryType(int type)
+ { gomoryType_=type;}
+ /// Return type
+ inline int gomoryType() const
+ { return gomoryType_;}
+ //@}
+
+ /**@name Change limit on how many variables in cut (default 50) */
+ //@{
+ /// Set
+ void setLimit(int limit);
+ /// Get
+ int getLimit() const;
+ /// Set at root (if
+
+#include "CglCutGenerator.hpp"
+#include "CglTreeInfo.hpp"
+
+/** Knapsack Cover Cut Generator Class */
+class CglKnapsackCover : public CglCutGenerator {
+ friend void CglKnapsackCoverUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+ /** A method to set which rows should be tested for knapsack covers */
+ void setTestedRowIndices(int num, const int* ind);
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate knapsack cover cuts for the model of the solver interface, si.
+ Insert the generated cuts into OsiCut, cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglKnapsackCover ();
+
+ /// Copy constructor
+ CglKnapsackCover (
+ const CglKnapsackCover &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglKnapsackCover &
+ operator=(
+ const CglKnapsackCover& rhs);
+
+ /// Destructor
+ virtual
+ ~CglKnapsackCover ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ /// This can be used to refresh any information
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ //@}
+
+
+ /**@name Sets and gets */
+ //@{
+ /// Set limit on number in knapsack
+ inline void setMaxInKnapsack(int value)
+ { if (value>0) maxInKnapsack_ = value;}
+ /// get limit on number in knapsack
+ inline int getMaxInKnapsack() const
+ {return maxInKnapsack_;}
+ /// Switch off expensive cuts
+ inline void switchOffExpensive()
+ { expensiveCuts_=false;}
+ /// Switch on expensive cuts
+ inline void switchOnExpensive()
+ { expensiveCuts_=true;}
+private:
+
+ // Private member methods
+
+
+ /**@name Private methods */
+ //@{
+
+ /** deriveAKnapsack
+ returns 1 if it is able to derive
+ a (canonical) knapsack inequality
+ in binary variables of the form ax<=b
+ from the rowIndex-th row in the model,
+ returns 0 otherwise.
+ */
+ int deriveAKnapsack(
+ const OsiSolverInterface & si,
+ OsiCuts & cs,
+ CoinPackedVector & krow,
+ bool treatAsLRow,
+ double & b,
+ int * complement,
+ double * xstar,
+ int rowIndex,
+ int numberElements,
+ const int * index,
+ const double * element);
+
+ int deriveAKnapsack(
+ const OsiSolverInterface & si,
+ OsiCuts & cs,
+ CoinPackedVector & krow,
+ double & b,
+ int * complement,
+ double * xstar,
+ int rowIndex,
+ const CoinPackedVectorBase & matrixRow);
+
+ /** Find a violated minimal cover from
+ a canonical form knapsack inequality by
+ solving the -most- violated cover problem
+ and postprocess to ensure minimality
+ */
+ int findExactMostViolatedMinCover(
+ int nCols,
+ int row,
+ CoinPackedVector & krow,
+ double b,
+ double * xstar,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder);
+
+ /** Find the most violate minimum cover by solving the lp-relaxation of the
+ most-violate-min-cover problem
+ */
+ int findLPMostViolatedMinCover(
+ int nCols,
+ int row,
+ CoinPackedVector & krow,
+ double & b,
+ double * xstar,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder);
+
+/// find a minimum cover by a simple greedy approach
+ int findGreedyCover(
+ int row,
+ CoinPackedVector & krow,
+ double & b,
+ double * xstar,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder
+ );
+
+ /// lift the cover inequality
+ int liftCoverCut(
+ double & b,
+ int nRowElem,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder,
+ CoinPackedVector & cut );
+
+ /// sequence-independent lift and uncomplement and add the resulting cut to the cut set
+ int liftAndUncomplementAndAdd(
+ double rowub,
+ CoinPackedVector & krow,
+ double & b,
+ int * complement,
+ int row,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder,
+ OsiCuts & cs );
+
+ /// sequence-dependent lift, uncomplement and add the resulting cut to the cut set
+void seqLiftAndUncomplementAndAdd(
+ int nCols,
+ double * xstar,
+ int * complement,
+ int row,
+ int nRowElem,
+ double & b,
+ CoinPackedVector & cover, // need not be violated
+ CoinPackedVector & remainder,
+ OsiCuts & cs );
+
+ /// sequence-dependent lift binary variables either up or down, uncomplement and add to the cut set
+void liftUpDownAndUncomplementAndAdd(
+ int nCols,
+ double * xstar,
+ int * complement,
+ int row,
+ int nRowElem,
+ double & b,
+
+ // the following 3 packed vectors partition the krow:
+ CoinPackedVector & fracCover, // vars have frac soln values in lp relaxation
+ // and form cover with the vars atOne
+ CoinPackedVector & atOne, // vars have soln value of 1 in lp relaxation
+ // and together with fracCover form minimal (?) cover.
+ CoinPackedVector & remainder,
+ OsiCuts & cs );
+
+ /// find a cover using a variation of the logic found in OSL (w/o SOS)
+ int findPseudoJohnAndEllisCover (
+ int row,
+ CoinPackedVector & krow,
+ double & b,
+ double * xstar,
+ CoinPackedVector & cover,
+ CoinPackedVector & remainder);
+
+ /// find a cover using the basic logic found in OSL (w/o SOS)
+ int findJohnAndEllisCover (
+ int row,
+ CoinPackedVector & krow,
+ double & b,
+ double * xstar,
+ CoinPackedVector & fracCover,
+ CoinPackedVector & atOnes,
+ CoinPackedVector & remainder);
+
+
+ /** A C-style implementation of the Horowitz-Sahni exact solution
+ procedure for solving knapsack problem.
+
+ (ToDo: implement the more efficient dynamic programming approach)
+
+ (Reference: Martello and Toth, Knapsack Problems, Wiley, 1990, p30.)
+ */
+ int exactSolveKnapsack(
+ int n,
+ double c,
+ double const *pp,
+ double const *ww,
+ double & z,
+ int * x);
+ /// For testing gub stuff
+ int gubifyCut(CoinPackedVector & cut);
+public:
+ /** Creates cliques for use by probing.
+ Only cliques >= minimumSize and < maximumSize created
+ Can also try and extend cliques as a result of probing (root node).
+ Returns number of cliques found.
+ */
+ int createCliques( OsiSolverInterface & si,
+ int minimumSize=2, int maximumSize=100, bool extendCliques=false);
+private:
+ /// Delete all clique information
+ void deleteCliques();
+ //@}
+
+ // Private member data
+
+ /**@name Private member data */
+ //@{
+ /// epsilon
+ double epsilon_;
+ /// Tolerance to use for violation - bigger than epsilon_
+ double epsilon2_;
+ /// 1-epsilon
+ double onetol_;
+ /// Maximum in knapsack
+ int maxInKnapsack_;
+ /** which rows to look at. If specified, only these rows will be considered
+ for generating knapsack covers. Otherwise all rows will be tried */
+ int numRowsToCheck_;
+ int* rowsToCheck_;
+ /// exactKnapsack can be expensive - this switches off some
+ bool expensiveCuts_;
+ /// Cliques
+ /// **** TEMP so can reference from listing
+ const OsiSolverInterface * solver_;
+ int whichRow_;
+ int * complement_;
+ double * elements_;
+ /// Number of cliques
+ int numberCliques_;
+ /// Clique type
+ typedef struct {
+ unsigned int equality:1; // nonzero if clique is ==
+ } CliqueType;
+ CliqueType * cliqueType_;
+ /// Start of each clique
+ int * cliqueStart_;
+ /// Entries for clique
+ CliqueEntry * cliqueEntry_;
+ /** Start of oneFixes cliques for a column in matrix or -1 if not
+ in any clique */
+ int * oneFixStart_;
+ /** Start of zeroFixes cliques for a column in matrix or -1 if not
+ in any clique */
+ int * zeroFixStart_;
+ /// End of fixes for a column
+ int * endFixStart_;
+ /// Clique numbers for one or zero fixes
+ int * whichClique_;
+ /// Number of columns
+ int numberColumns_;
+ /** For each column with nonzero in row copy this gives a clique "number".
+ So first clique mentioned in row is always 0. If no entries for row
+ then no cliques. If sequence > numberColumns then not in clique.
+ */
+ //CliqueEntry * cliqueRow_;
+ /// cliqueRow_ starts for each row
+ //int * cliqueRowStart_;
+ //@}
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglKnapsackCover class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglKnapsackCoverUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglLandP.hpp b/thirdparty/linux/include/coin/CglLandP.hpp
new file mode 100644
index 0000000..64447e7
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglLandP.hpp
@@ -0,0 +1,306 @@
+// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
+// Author: Pierre Bonami
+// Tepper School of Business
+// Carnegie Mellon University, Pittsburgh, PA 15213
+// Date: 07/21/05
+//
+// $Id: CglLandP.hpp 1122 2013-04-06 20:39:53Z stefan $
+//
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+//---------------------------------------------------------------------------
+#ifndef CglLandP_H
+#define CglLandP_H
+
+#include "CglLandPValidator.hpp"
+#include "CglCutGenerator.hpp"
+#include "CglParam.hpp"
+
+#include
+class CoinWarmStartBasis;
+/** Performs one round of Lift & Project using CglLandPSimplex
+ to build cuts
+*/
+
+namespace LAP
+{
+enum LapMessagesTypes
+{
+ BEGIN_ROUND,
+ END_ROUND,
+ DURING_SEP,
+ CUT_REJECTED,
+ CUT_FAILED,
+ CUT_GAP,
+ LAP_CUT_FAILED_DO_MIG,
+ LAP_MESSAGES_DUMMY_END
+};
+/** Output messages for Cgl */
+class LapMessages : public CoinMessages
+{
+public:
+ /** Constructor */
+ LapMessages( );
+ /** destructor.*/
+ virtual ~LapMessages() {}
+};
+class CglLandPSimplex;
+}
+
+class CglLandP : public CglCutGenerator
+{
+ friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
+
+ friend class LAP::CglLandPSimplex;
+ friend class CftCglp;
+
+public:
+
+ enum SelectionRules
+ {
+ mostNegativeRc /** select most negative reduced cost */,
+ bestPivot /** select best possible pivot.*/,
+ initialReducedCosts/** Select only those rows which had initialy a 0 reduced cost.*/
+ };
+
+ enum ExtraCutsMode
+ {
+ none/** Generate no extra cuts.*/,
+ AtOptimalBasis /** Generate cuts from the optimal basis.*/,
+ WhenEnteringBasis /** Generate cuts as soon as a structural enters the basis.*/,
+ AllViolatedMigs/** Generate all violated Mixed integer Gomory cuts in the course of the optimization.*/
+ };
+
+ /** Space where cuts are optimized.*/
+ enum SeparationSpaces
+ {
+ Fractional=0 /** True fractional space.*/,
+ Fractional_rc/** Use fractional space only for computing reduced costs.*/,
+ Full /** Work in full space.*/
+ };
+
+ /** Normalization */
+ enum Normalization
+ {
+ Unweighted = 0,
+ WeightRHS,
+ WeightLHS,
+ WeightBoth
+ };
+
+ enum LHSnorm
+ {
+ L1 = 0,
+ L2,
+ SupportSize,
+ Infinity,
+ Average,
+ Uniform
+ };
+ /** RHS weight in normalization.*/
+ enum RhsWeightType
+ {
+ Fixed = 0 /** 2*initial number of constraints. */,
+ Dynamic /** 2 * current number of constraints. */
+ };
+ /** Class storing parameters.
+ \remark I take all parameters from Ionut's code */
+ class Parameters : public CglParam
+ {
+ public:
+ /** Default constructor (with default values)*/
+ Parameters();
+ /** Copy constructor */
+ Parameters(const Parameters &other);
+ /** Assignment opertator */
+ Parameters & operator=(const Parameters &other);
+ /// @name integer parameters
+ ///@{
+
+ /** Max number of pivots before we generate the cut
+ \default 20 */
+ int pivotLimit;
+ /** Max number of pivots at regular nodes. Put a value if you want it lower than the global pivot limit.
+ \default 100.*/
+ int pivotLimitInTree;
+ /** Maximum number of cuts generated at a given round*/
+ int maxCutPerRound;
+ /** Maximum number of failed pivots before aborting */
+ int failedPivotLimit;
+ /** maximum number of consecutive degenerate pivots
+ \default 0 */
+ int degeneratePivotLimit;
+ /** Maximum number of extra rows to generate per round.*/
+ int extraCutsLimit;
+ ///@}
+ /// @name double parameters
+ ///@{
+ /** Tolerance for small pivots values (should be the same as the solver */
+ double pivotTol;
+ /** A variable have to be at least away from integrity to be generated */
+ double away;
+ /** Total time limit for cut generation.*/
+ double timeLimit;
+ /** Time limit for generating a single cut.*/
+ double singleCutTimeLimit;
+ /** Weight to put in RHS of normalization if static.*/
+ double rhsWeight;
+ ///@}
+
+ /// @name Flags
+ ///@{
+ /** Do we use tableau row or the disjunction (I don't really get that there should be a way to always use the tableau)*/
+ bool useTableauRow;
+ /** Do we apply Egon Balas's Heuristic for modularized cuts */
+ bool modularize;
+ /** Do we strengthen the final cut (always do if modularize is 1) */
+ bool strengthen;
+ /** Wether to limit or not the number of mistaken RC (when perturbation is applied).*/
+ bool countMistakenRc;
+ /** Work in the reduced space (only non-structurals enter the basis) */
+ SeparationSpaces sepSpace;
+ /** Apply perturbation procedure. */
+ bool perturb;
+ /** How to weight normalization.*/
+ Normalization normalization;
+ /** How to weight RHS of normalization.*/
+ RhsWeightType rhsWeightType;
+ /** How to weight LHS of normalization.*/
+ LHSnorm lhs_norm;
+ /** Generate extra constraints from optimal lift-and-project basis.*/
+ ExtraCutsMode generateExtraCuts;
+ /** Which rule to apply for choosing entering and leaving variables.*/
+ SelectionRules pivotSelection;
+ ///@}
+ };
+
+
+ /** Constructor for the class*/
+ CglLandP(const CglLandP::Parameters ¶ms = CglLandP::Parameters(),
+ const LAP::Validator &validator = LAP::Validator());
+ /** Destructor */
+ ~CglLandP();
+ /** Copy constructor */
+ CglLandP(const CglLandP &source);
+ /** Assignment operator */
+ CglLandP& operator=(const CglLandP &rhs);
+ /** Clone function */
+ CglCutGenerator * clone() const;
+
+ /**@name Generate Cuts */
+ //@{
+
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ //@}
+
+ virtual bool needsOptimalBasis() const
+ {
+ return true;
+ }
+
+ LAP::Validator & validator()
+ {
+ return validator_;
+ }
+ /** set level of log for cut generation procedure :
+
+
for none
+
for log at begin and end of procedure + at some time interval
+
for log at every cut generated
+
+ */
+ void setLogLevel(int level)
+ {
+ handler_->setLogLevel(level);
+ }
+
+ class NoBasisError : public CoinError
+ {
+ public:
+ NoBasisError(): CoinError("No basis available","LandP","") {}
+ };
+
+ class SimplexInterfaceError : public CoinError
+ {
+ public:
+ SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {}
+ };
+ Parameters & parameter()
+ {
+ return params_;
+ }
+private:
+
+
+ void scanExtraCuts(OsiCuts& cs, const double * colsol) const;
+
+ Parameters params_;
+
+ /** Some informations that will be changed by the pivots and that we want to keep*/
+ struct CachedData
+ {
+ CachedData(int nBasics = 0 , int nNonBasics = 0);
+ CachedData(const CachedData & source);
+
+ CachedData& operator=(const CachedData &source);
+ /** Get the data from a problem */
+ void getData(const OsiSolverInterface &si);
+
+ void clean();
+
+ ~CachedData();
+ /** Indices of basic variables in starting basis (ordered if variable basics_[i] s basic in row i)*/
+ int * basics_;
+ /** Indices of non-basic variables */
+ int *nonBasics_;
+ /** number of basics variables */
+ int nBasics_;
+ /** number of non-basics */
+ int nNonBasics_;
+ /** Optimal basis */
+ CoinWarmStartBasis * basis_;
+ /** Stores the value of the solution to cut */
+ double * colsol_;
+ /** Stores the values of the slacks */
+ double * slacks_;
+ /** Stores wheter slacks are integer constrained */
+ bool * integers_;
+ /** Solver before pivots */
+ OsiSolverInterface * solver_;
+ };
+ /** Retrieve sorted integer variables which are fractional in the solution.
+ Return the number of variables.*/
+ int getSortedFractionals(CoinPackedVector &xFrac,
+ const CachedData & data,
+ const CglLandP::Parameters& params) const;
+ /** Retrieve sorted integer variables which are fractional in the solution.
+ Return the number of variables.*/
+ void getSortedFractionalIndices(std::vector& indices,
+ const CachedData &data,
+ const CglLandP::Parameters & params) const;
+ /** Cached informations about problem.*/
+ CachedData cached_;
+ /** message handler */
+ CoinMessageHandler * handler_;
+ /** messages */
+ CoinMessages messages_;
+ /** cut validator */
+ LAP::Validator validator_;
+ /** number of rows in the original problems. */
+ int numrows_;
+ /** number of columns in the original problems. */
+ int numcols_;
+ /** Original lower bounds for the problem (for lifting cuts).*/
+ double * originalColLower_;
+ /** Original upper bounds for the problem (for lifting cuts).*/
+ double * originalColUpper_;
+ /** Flag to say if cuts can be lifted.*/
+ bool canLift_;
+ /** Store some extra cut which could be cheaply generated but do not cut current incumbent.*/
+ OsiCuts extraCuts_;
+};
+void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
+
+#endif
+
diff --git a/thirdparty/linux/include/coin/CglLandPValidator.hpp b/thirdparty/linux/include/coin/CglLandPValidator.hpp
new file mode 100644
index 0000000..8b05597
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglLandPValidator.hpp
@@ -0,0 +1,131 @@
+// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
+// Author: Pierre Bonami
+// Tepper School of Business
+// Carnegie Mellon University, Pittsburgh, PA 15213
+// Date: 11/22/05
+//
+// $Id: CglLandPValidator.hpp 1122 2013-04-06 20:39:53Z stefan $
+//
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+//---------------------------------------------------------------------------
+
+#ifndef CglLandPValidator_H
+#define CglLandPValidator_H
+#include "OsiSolverInterface.hpp"
+#include "CglParam.hpp"
+#include
+
+/** constants describing rejection codes*/
+//[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"}
+
+
+namespace LAP
+{
+
+/** Class to validate or reject a cut */
+class Validator
+{
+public:
+ /** Reasons for rejecting a cut */
+ enum RejectionsReasons
+ {
+ NoneAccepted=0 /**Cut was accepted*/,
+ SmallViolation /** Violation of the cut is too small */,
+ SmallCoefficient /** There is a small coefficient we can not get rid off.*/,
+ BigDynamic /** Dynamic of coefficinet is too important. */,
+ DenseCut/**cut is too dense */,
+ EmptyCut/**After cleaning cut has become empty*/,
+ DummyEnd/** dummy*/
+ };
+
+ /** Constructor with default values */
+ Validator(double maxFillIn = 1.,
+ double maxRatio = 1e8,
+ double minViolation = 0,
+ bool scale = false,
+ double rhsScale = 1);
+
+ /** Clean an OsiCut */
+ int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
+ const double * colLower, const double * colUpper);
+ /** Clean an OsiCut by another method */
+ int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
+ const double * colLower, const double * colUpper);
+ /** Call the cut cleaner */
+ int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
+ const double * colLower, const double * colUpper)
+ {
+ return cleanCut(aCut, solCut, si, par, colLower, colUpper);
+ }
+ /** @name set functions */
+ /** @{ */
+ void setMaxFillIn(double value)
+ {
+ maxFillIn_ = value;
+ }
+ void setMaxRatio(double value)
+ {
+ maxRatio_ = value;
+ }
+ void setMinViolation(double value)
+ {
+ minViolation_ = value;
+ }
+
+ void setRhsScale(double v)
+ {
+ rhsScale_ = v;
+ }
+ /** @} */
+ /** @name get functions */
+ /** @{ */
+ double getMaxFillIn()
+ {
+ return maxFillIn_;
+ }
+ double getMaxRatio()
+ {
+ return maxRatio_;
+ }
+ double getMinViolation()
+ {
+ return minViolation_;
+ }
+ /** @} */
+
+ const std::string& failureString(RejectionsReasons code) const
+ {
+ return rejections_[static_cast (code)];
+ }
+ const std::string& failureString(int code) const
+ {
+ return rejections_[ code];
+ }
+ int numRejected(RejectionsReasons code)const
+ {
+ return numRejected_[static_cast (code)];
+ }
+ int numRejected(int code)const
+ {
+ return numRejected_[ code];
+ }
+private:
+ static void fillRejectionReasons();
+ /** max percentage of given formulation fillIn should be accepted for cut fillin.*/
+ double maxFillIn_;
+ /** max ratio between smallest and biggest coefficient */
+ double maxRatio_;
+ /** minimum violation for accepting a cut */
+ double minViolation_;
+ /** Do we do scaling? */
+ bool scale_;
+ /** Scale of right-hand-side.*/
+ double rhsScale_;
+ /** Strings explaining reason for rejections */
+ static std::vector rejections_;
+ /** Number of cut rejected for each of the reasons.*/
+ std::vector numRejected_;
+};
+
+}/* Ends namespace LAP.*/
+#endif
diff --git a/thirdparty/linux/include/coin/CglLiftAndProject.hpp b/thirdparty/linux/include/coin/CglLiftAndProject.hpp
new file mode 100644
index 0000000..364ba5a
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglLiftAndProject.hpp
@@ -0,0 +1,104 @@
+// Copyright (C) 2000, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglLiftAndProject_H
+#define CglLiftAndProject_H
+
+#include
+
+#include "CglCutGenerator.hpp"
+
+/** Lift And Project Cut Generator Class */
+class CglLiftAndProject : public CglCutGenerator {
+ friend void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+ /**@name Generate Cuts */
+ //@{
+ /** Generate lift-and-project cuts for the
+ model of the solver interface, si.
+ Insert the generated cuts into OsiCut, cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /** Get the normalization : Either beta=+1 or beta=-1.
+ */
+
+ double getBeta() const {
+ return beta_;
+ }
+
+ /** Set the normalization : Either beta=+1 or beta=-1.
+ Default value is 1.
+ */
+ void setBeta(int oneOrMinusOne){
+ if (oneOrMinusOne==1 || oneOrMinusOne==-1){
+ beta_= static_cast(oneOrMinusOne);
+ }
+ else {
+ throw CoinError("Unallowable value. Beta must be 1 or -1",
+ "cutGeneration","CglLiftAndProject");
+ }
+ }
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglLiftAndProject ();
+
+ /// Copy constructor
+ CglLiftAndProject (
+ const CglLiftAndProject &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglLiftAndProject &
+ operator=(
+ const CglLiftAndProject& rhs);
+
+ /// Destructor
+ virtual
+ ~CglLiftAndProject ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+private:
+
+ // Private member methods
+
+ /**@name Private methods */
+ //@{
+
+ //@}
+
+ // Private member data
+
+ /**@name Private member data */
+ //@{
+ /// The normalization is beta_=1 or beta_=-1
+ double beta_;
+ /// epsilon
+ double epsilon_;
+ /// 1-epsilon
+ double onetol_;
+ //@}
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglLiftAndProject class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglMessage.hpp b/thirdparty/linux/include/coin/CglMessage.hpp
new file mode 100644
index 0000000..5f080e8
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglMessage.hpp
@@ -0,0 +1,50 @@
+// $Id: CglMessage.hpp 1105 2013-03-19 12:43:52Z forrest $
+// Copyright (C) 2005, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglMessage_H
+#define CglMessage_H
+
+
+#include "CoinPragma.hpp"
+
+// This deals with Cgl messages (as against Osi messages etc)
+
+#include "CoinMessageHandler.hpp"
+enum CGL_Message
+{
+ CGL_INFEASIBLE,
+ CGL_CLIQUES,
+ CGL_FIXED,
+ CGL_PROCESS_STATS,
+ CGL_SLACKS,
+ CGL_PROCESS_STATS2,
+ CGL_PROCESS_SOS1,
+ CGL_PROCESS_SOS2,
+ CGL_UNBOUNDED,
+ CGL_ELEMENTS_CHANGED1,
+ CGL_ELEMENTS_CHANGED2,
+ CGL_MADE_INTEGER,
+ CGL_ADDED_INTEGERS,
+ CGL_POST_INFEASIBLE,
+ CGL_POST_CHANGED,
+ CGL_GENERAL,
+ CGL_DUMMY_END
+};
+
+/** This deals with Cgl messages (as against Osi messages etc)
+ */
+class CglMessage : public CoinMessages {
+
+public:
+
+ /**@name Constructors etc */
+ //@{
+ /** Constructor */
+ CglMessage(Language language=us_en);
+ //@}
+
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglMixedIntegerRounding.hpp b/thirdparty/linux/include/coin/CglMixedIntegerRounding.hpp
new file mode 100644
index 0000000..10580cb
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglMixedIntegerRounding.hpp
@@ -0,0 +1,429 @@
+// LAST EDIT:
+//-----------------------------------------------------------------------------
+// name: Mixed Integer Rounding Cut Generator
+// authors: Joao Goncalves (jog7@lehigh.edu)
+// Laszlo Ladanyi (ladanyi@us.ibm.com)
+// date: August 11, 2004
+//-----------------------------------------------------------------------------
+// Copyright (C) 2004, International Business Machines Corporation and others.
+// All Rights Reserved.
+// This code is published under the Eclipse Public License.
+
+#ifndef CglMixedIntegerRounding_H
+#define CglMixedIntegerRounding_H
+
+#include
+#include
+//#include
+
+#include "CoinError.hpp"
+
+#include "CglCutGenerator.hpp"
+
+//=============================================================================
+
+#ifndef CGL_DEBUG
+#define CGL_DEBUG 0
+#endif
+
+//=============================================================================
+
+// Class to store variable upper bounds (VUB)
+class CglMixIntRoundVUB
+{
+ // Variable upper bounds have the form x_j <= a y_j, where x_j is
+ // a continuous variable and y_j is an integer variable
+
+protected:
+ int var_; // The index of y_j
+ double val_; // The value of a
+
+public:
+ // Default constructor
+ CglMixIntRoundVUB() : var_(-1), val_(-1) {}
+
+ // Copy constructor
+ CglMixIntRoundVUB(const CglMixIntRoundVUB& source) {
+ var_ = source.var_;
+ val_ = source.val_;
+ }
+
+ // Assignment operator
+ CglMixIntRoundVUB& operator=(const CglMixIntRoundVUB& rhs) {
+ if (this != &rhs) {
+ var_ = rhs.var_;
+ val_ = rhs.val_;
+ }
+ return *this;
+ }
+
+ // Destructor
+ ~CglMixIntRoundVUB() {}
+
+ // Query and set functions
+ int getVar() const { return var_; }
+ double getVal() const { return val_; }
+ void setVar(const int v) { var_ = v; }
+ void setVal(const double v) { val_ = v; }
+};
+
+//=============================================================================
+
+// Class to store variable lower bounds (VLB).
+// It is the same as the class to store variable upper bounds
+typedef CglMixIntRoundVUB CglMixIntRoundVLB;
+
+//=============================================================================
+
+/** Mixed Integer Rounding Cut Generator Class */
+
+// Reference:
+// Hugues Marchand and Laurence A. Wolsey
+// Aggregation and Mixed Integer Rounding to Solve MIPs
+// Operations Research, 49(3), May-June 2001.
+// Also published as CORE Dicusion Paper 9839, June 1998.
+
+class CglMixedIntegerRounding : public CglCutGenerator {
+
+ friend void CglMixedIntegerRoundingUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Enumeration constants that describe the various types of rows
+ enum RowType {
+ // The row type of this row is NOT defined yet.
+ ROW_UNDEFINED,
+ /** After the row is flipped to 'L', the row has exactly two variables:
+ one is negative binary and the other is a continous,
+ and the RHS is zero.*/
+ ROW_VARUB,
+ /** After the row is flipped to 'L', the row has exactly two variables:
+ one is positive binary and the other is a continous,
+ and the RHS is zero.*/
+ ROW_VARLB,
+ /** The row sense is 'E', the row has exactly two variables:
+ one is binary and the other is a continous, and the RHS is zero.*/
+ ROW_VAREQ,
+ // The row contains continuous and integer variables;
+ // the total number of variables is at least 2
+ ROW_MIX,
+ // The row contains only continuous variables
+ ROW_CONT,
+ // The row contains only integer variables
+ ROW_INT,
+ // The row contains other types of rows
+ ROW_OTHER
+ };
+
+
+public:
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate Mixed Integer Rounding cuts for the model data
+ contained in si. The generated cuts are inserted
+ in the collection of cuts cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ //---------------------------------------------------------------------------
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglMixedIntegerRounding ();
+
+ /// Alternate Constructor
+ CglMixedIntegerRounding (const int maxaggr,
+ const bool multiply,
+ const int criterion,
+ const int preproc = -1);
+
+ /// Copy constructor
+ CglMixedIntegerRounding (
+ const CglMixedIntegerRounding &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglMixedIntegerRounding &
+ operator=(
+ const CglMixedIntegerRounding& rhs);
+
+ /// Destructor
+ virtual
+ ~CglMixedIntegerRounding ();
+ /// This can be used to refresh any inforamtion
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+ //---------------------------------------------------------------------------
+ /**@name Set and get methods */
+ //@{
+ /// Set MAXAGGR_
+ inline void setMAXAGGR_ (int maxaggr) {
+ if (maxaggr > 0) {
+ MAXAGGR_ = maxaggr;
+ }
+ else {
+ throw CoinError("Unallowable value. maxaggr must be > 0",
+ "gutsOfConstruct","CglMixedIntegerRounding");
+ }
+ }
+
+ /// Get MAXAGGR_
+ inline int getMAXAGGR_ () const { return MAXAGGR_; }
+
+ /// Set MULTIPLY_
+ inline void setMULTIPLY_ (bool multiply) { MULTIPLY_ = multiply; }
+
+ /// Get MULTIPLY_
+ inline bool getMULTIPLY_ () const { return MULTIPLY_; }
+
+ /// Set CRITERION_
+ inline void setCRITERION_ (int criterion) {
+ if ((criterion >= 1) && (criterion <= 3)) {
+ CRITERION_ = criterion;
+ }
+ else {
+ throw CoinError("Unallowable value. criterion must be 1, 2 or 3",
+ "gutsOfConstruct","CglMixedIntegerRounding");
+ }
+ }
+
+ /// Get CRITERION_
+ inline int getCRITERION_ () const { return CRITERION_; }
+
+
+ /// Set doPreproc
+ void setDoPreproc(int value);
+ /// Get doPreproc
+ bool getDoPreproc() const;
+
+ //@}
+
+private:
+ //--------------------------------------------------------------------------
+ // Private member methods
+
+ // Construct
+ void gutsOfConstruct (const int maxaggr,
+ const bool multiply,
+ const int criterion,
+ const int preproc);
+
+ // Delete
+ void gutsOfDelete();
+
+ // Copy
+ void gutsOfCopy (const CglMixedIntegerRounding& rhs);
+
+ // Do preprocessing.
+ // It determines the type of each row. It also identifies the variable
+ // upper bounds and variable lower bounds.
+ // It may change sense and RHS for ranged rows
+ void mixIntRoundPreprocess(const OsiSolverInterface& si);
+
+ // Determine the type of a given row.
+ RowType determineRowType(const OsiSolverInterface& si,
+ const int rowLen, const int* ind,
+ const double* coef, const char sense,
+ const double rhs) const;
+
+ // Generate MIR cuts
+ void generateMirCuts( const OsiSolverInterface& si,
+ const double* xlp,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinPackedMatrix& matrixByRow,
+ const double* LHS,
+ const double* coefByRow,
+ const int* colInds,
+ const int* rowStarts,
+ const int* rowLengths,
+ //const CoinPackedMatrix& matrixByCol,
+ const double* coefByCol,
+ const int* rowInds,
+ const int* colStarts,
+ const int* colLengths,
+ OsiCuts& cs ) const;
+
+ // Copy row selected to CoinPackedVector
+ void copyRowSelected( const int iAggregate,
+ const int rowSelected,
+ std::set& setRowsAggregated,
+ int* listRowsAggregated,
+ double* xlpExtra,
+ const char sen,
+ const double rhs,
+ const double lhs,
+ const CoinPackedMatrix& matrixByRow,
+ CoinPackedVector& rowToAggregate,
+ double& rhsToAggregate) const;
+
+ // Select a row to aggregate
+ bool selectRowToAggregate( const OsiSolverInterface& si,
+ const CoinPackedVector& rowAggregated,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const std::set& setRowsAggregated,
+ const double* xlp, const double* coefByCol,
+ const int* rowInds, const int* colStarts,
+ const int* colLengths,
+ int& rowSelected,
+ int& colSelected ) const;
+
+ // Aggregation heuristic.
+ // Combines one or more rows of the original matrix
+ void aggregateRow( const int colSelected,
+ CoinPackedVector& rowToAggregate, double rhs,
+ CoinPackedVector& rowAggregated,
+ double& rhsAggregated ) const;
+
+ // Choose the bound substitution based on the criteria defined by the user
+ inline bool isLowerSubst(const double inf,
+ const double aj,
+ const double xlp,
+ const double LB,
+ const double UB) const;
+
+ // Bound substitution heuristic
+ bool boundSubstitution( const OsiSolverInterface& si,
+ const CoinPackedVector& rowAggregated,
+ const double* xlp,
+ const double* xlpExtra,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ CoinPackedVector& mixedKnapsack,
+ double& rhsMixedKnapsack, double& sStar,
+ CoinPackedVector& contVariablesInS ) const;
+
+ // c-MIR separation heuristic
+ bool cMirSeparation ( const OsiSolverInterface& si,
+ const CoinPackedMatrix& matrixByRow,
+ const CoinPackedVector& rowAggregated,
+ const int* listRowsAggregated,
+ const char* sense, const double* RHS,
+ //const double* coefByRow,
+ //const int* colInds, const int* rowStarts,
+ //const int* rowLengths,
+ const double* xlp, const double sStar,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinPackedVector& mixedKnapsack,
+ const double& rhsMixedKnapsack,
+ const CoinPackedVector& contVariablesInS,
+ OsiRowCut& flowCut ) const;
+
+ // function to create one c-MIR inequality
+ void cMirInequality( const int numInt,
+ const double delta,
+ const double numeratorBeta,
+ const int *knapsackIndices,
+ const double* knapsackElements,
+ const double* xlp,
+ const double sStar,
+ const double* colUpperBound,
+ const std::set& setC,
+ CoinPackedVector& cMIR,
+ double& rhscMIR,
+ double& sCoef,
+ double& violation) const;
+
+ // function to compute G
+ inline double functionG( const double d, const double f ) const;
+
+ // function to print statistics (used only in debug mode)
+ void printStats(
+ std::ofstream & fout,
+ const bool hasCut,
+ const OsiSolverInterface& si,
+ const CoinPackedVector& rowAggregated,
+ const double& rhsAggregated, const double* xlp,
+ const double* xlpExtra,
+ const int* listRowsAggregated,
+ const int* listColsSelected,
+ const int level,
+ const double* colUpperBound,
+ const double* colLowerBound ) const;
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Private member data
+
+ // Maximum number of rows to aggregate
+ int MAXAGGR_;
+ // Flag that indicates if an aggregated row is also multiplied by -1
+ bool MULTIPLY_;
+ // The criterion to use in the bound substitution
+ int CRITERION_;
+ // Tolerance used for numerical purposes
+ double EPSILON_;
+ /// There is no variable upper bound or variable lower bound defined
+ int UNDEFINED_;
+ // If violation of a cut is greater that this number, the cut is accepted
+ double TOLERANCE_;
+ /** Controls the preprocessing of the matrix to identify rows suitable for
+ cut generation.
+
-1: preprocess according to solver settings;
+
0: Do preprocessing only if it has not yet been done;
+
1: Do preprocessing.
+
+ Default value: -1 **/
+ int doPreproc_;
+ // The number of rows of the problem.
+ int numRows_;
+ // The number columns of the problem.
+ int numCols_;
+ // Indicates whether preprocessing has been done.
+ bool doneInitPre_;
+ // The array of CglMixIntRoundVUBs.
+ CglMixIntRoundVUB* vubs_;
+ // The array of CglMixIntRoundVLBs.
+ CglMixIntRoundVLB* vlbs_;
+ // Array with the row types of the rows in the model.
+ RowType* rowTypes_;
+ // The indices of the rows of the initial matrix
+ int* indRows_;
+ // The number of rows of type ROW_MIX
+ int numRowMix_;
+ // The indices of the rows of type ROW_MIX
+ int* indRowMix_;
+ // The number of rows of type ROW_CONT
+ int numRowCont_;
+ // The indices of the rows of type ROW_CONT
+ int* indRowCont_;
+ // The number of rows of type ROW_INT
+ int numRowInt_;
+ // The indices of the rows of type ROW_INT
+ int* indRowInt_;
+ // The number of rows of type ROW_CONT that have at least one variable
+ // with variable upper or lower bound
+ int numRowContVB_;
+ // The indices of the rows of type ROW_CONT that have at least one variable
+ // with variable upper or lower bound
+ int* indRowContVB_;
+ // Sense of rows (modified if ranges)
+ char * sense_;
+ // RHS of rows (modified if ranges)
+ double * RHS_;
+
+};
+
+//#############################################################################
+// A function that tests the methods in the CglMixedIntegerRounding class. The
+// only reason for it not to be a member method is that this way it doesn't
+// have to be compiled into the library. And that's a gain, because the
+// library should be compiled with optimization on, but this method should be
+// compiled with debugging.
+void CglMixedIntegerRoundingUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglMixedIntegerRounding2.hpp b/thirdparty/linux/include/coin/CglMixedIntegerRounding2.hpp
new file mode 100644
index 0000000..abf2530
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglMixedIntegerRounding2.hpp
@@ -0,0 +1,427 @@
+// LAST EDIT:
+//-----------------------------------------------------------------------------
+// name: Mixed Integer Rounding Cut Generator
+// authors: Joao Goncalves (jog7@lehigh.edu)
+// Laszlo Ladanyi (ladanyi@us.ibm.com)
+// date: August 11, 2004
+//-----------------------------------------------------------------------------
+// Copyright (C) 2004, International Business Machines Corporation and others.
+// All Rights Reserved.
+// This code is published under the Eclipse Public License.
+
+#ifndef CglMixedIntegerRounding2_H
+#define CglMixedIntegerRounding2_H
+
+#include
+#include
+//#include
+
+#include "CoinError.hpp"
+
+#include "CglCutGenerator.hpp"
+#include "CoinIndexedVector.hpp"
+
+//=============================================================================
+
+#ifndef CGL_DEBUG
+#define CGL_DEBUG 0
+#endif
+
+//=============================================================================
+
+// Class to store variable upper bounds (VUB)
+class CglMixIntRoundVUB2
+{
+ // Variable upper bounds have the form x_j <= a y_j, where x_j is
+ // a continuous variable and y_j is an integer variable
+
+protected:
+ int var_; // The index of y_j
+ double val_; // The value of a
+
+public:
+ // Default constructor
+ CglMixIntRoundVUB2() : var_(-1), val_(-1) {}
+
+ // Copy constructor
+ CglMixIntRoundVUB2(const CglMixIntRoundVUB2& source) {
+ var_ = source.var_;
+ val_ = source.val_;
+ }
+
+ // Assignment operator
+ CglMixIntRoundVUB2& operator=(const CglMixIntRoundVUB2& rhs) {
+ if (this != &rhs) {
+ var_ = rhs.var_;
+ val_ = rhs.val_;
+ }
+ return *this;
+ }
+
+ // Destructor
+ ~CglMixIntRoundVUB2() {}
+
+ // Query and set functions
+ int getVar() const { return var_; }
+ double getVal() const { return val_; }
+ void setVar(const int v) { var_ = v; }
+ void setVal(const double v) { val_ = v; }
+};
+
+//=============================================================================
+
+// Class to store variable lower bounds (VLB).
+// It is the same as the class to store variable upper bounds
+typedef CglMixIntRoundVUB2 CglMixIntRoundVLB2;
+
+//=============================================================================
+
+/** Mixed Integer Rounding Cut Generator Class */
+
+// Reference:
+// Hugues Marchand and Laurence A. Wolsey
+// Aggregation and Mixed Integer Rounding to Solve MIPs
+// Operations Research, 49(3), May-June 2001.
+// Also published as CORE Dicusion Paper 9839, June 1998.
+
+class CglMixedIntegerRounding2 : public CglCutGenerator {
+
+ friend void CglMixedIntegerRounding2UnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Enumeration constants that describe the various types of rows
+ enum RowType {
+ // The row type of this row is NOT defined yet.
+ ROW_UNDEFINED,
+ /** After the row is flipped to 'L', the row has exactly two variables:
+ one is negative binary and the other is a continous,
+ and the RHS is zero.*/
+ ROW_VARUB,
+ /** After the row is flipped to 'L', the row has exactly two variables:
+ one is positive binary and the other is a continous,
+ and the RHS is zero.*/
+ ROW_VARLB,
+ /** The row sense is 'E', the row has exactly two variables:
+ one is binary and the other is a continous, and the RHS is zero.*/
+ ROW_VAREQ,
+ // The row contains continuous and integer variables;
+ // the total number of variables is at least 2
+ ROW_MIX,
+ // The row contains only continuous variables
+ ROW_CONT,
+ // The row contains only integer variables
+ ROW_INT,
+ // The row contains other types of rows
+ ROW_OTHER
+ };
+
+
+public:
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate Mixed Integer Rounding cuts for the model data
+ contained in si. The generated cuts are inserted
+ in the collection of cuts cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ //---------------------------------------------------------------------------
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglMixedIntegerRounding2 ();
+
+ /// Alternate Constructor
+ CglMixedIntegerRounding2 (const int maxaggr,
+ const bool multiply,
+ const int criterion,
+ const int preproc = -1);
+
+ /// Copy constructor
+ CglMixedIntegerRounding2 (
+ const CglMixedIntegerRounding2 &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglMixedIntegerRounding2 &
+ operator=(
+ const CglMixedIntegerRounding2& rhs);
+
+ /// Destructor
+ virtual
+ ~CglMixedIntegerRounding2 ();
+ /// This can be used to refresh any inforamtion
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+ //---------------------------------------------------------------------------
+ /**@name Set and get methods */
+ //@{
+ /// Set MAXAGGR_
+ inline void setMAXAGGR_ (int maxaggr) {
+ if (maxaggr > 0) {
+ MAXAGGR_ = maxaggr;
+ }
+ else {
+ throw CoinError("Unallowable value. maxaggr must be > 0",
+ "gutsOfConstruct","CglMixedIntegerRounding2");
+ }
+ }
+
+ /// Get MAXAGGR_
+ inline int getMAXAGGR_ () const { return MAXAGGR_; }
+
+ /// Set MULTIPLY_
+ inline void setMULTIPLY_ (bool multiply) { MULTIPLY_ = multiply; }
+
+ /// Get MULTIPLY_
+ inline bool getMULTIPLY_ () const { return MULTIPLY_; }
+
+ /// Set CRITERION_
+ inline void setCRITERION_ (int criterion) {
+ if ((criterion >= 1) && (criterion <= 3)) {
+ CRITERION_ = criterion;
+ }
+ else {
+ throw CoinError("Unallowable value. criterion must be 1, 2 or 3",
+ "gutsOfConstruct","CglMixedIntegerRounding2");
+ }
+ }
+
+ /// Get CRITERION_
+ inline int getCRITERION_ () const { return CRITERION_; }
+
+ /// Set doPreproc
+ void setDoPreproc(int value);
+ /// Get doPreproc
+ bool getDoPreproc() const;
+ //@}
+
+private:
+ //--------------------------------------------------------------------------
+ // Private member methods
+
+ // Construct
+ void gutsOfConstruct ( const int maxaggr,
+ const bool multiply,
+ const int criterion,
+ const int preproc);
+
+ // Delete
+ void gutsOfDelete();
+
+ // Copy
+ void gutsOfCopy (const CglMixedIntegerRounding2& rhs);
+
+ // Do preprocessing.
+ // It determines the type of each row. It also identifies the variable
+ // upper bounds and variable lower bounds.
+ // It may change sense and RHS for ranged rows
+ void mixIntRoundPreprocess(const OsiSolverInterface& si);
+
+ // Determine the type of a given row.
+ RowType determineRowType(//const OsiSolverInterface& si,
+ const int rowLen, const int* ind,
+ const double* coef, const char sense,
+ const double rhs) const;
+
+ // Generate MIR cuts
+ void generateMirCuts( const OsiSolverInterface& si,
+ const double* xlp,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinPackedMatrix& matrixByRow,
+ const double* LHS,
+ //const double* coefByRow,
+ //const int* colInds,
+ //const int* rowStarts,
+ //const CoinPackedMatrix& matrixByCol,
+ const double* coefByCol,
+ const int* rowInds,
+ const int* colStarts,
+ OsiCuts& cs ) const;
+
+ // Copy row selected to CoinIndexedVector
+ void copyRowSelected( const int iAggregate,
+ const int rowSelected,
+ CoinIndexedVector& setRowsAggregated,
+ int* listRowsAggregated,
+ double* xlpExtra,
+ const char sen,
+ const double rhs,
+ const double lhs,
+ const CoinPackedMatrix& matrixByRow,
+ CoinIndexedVector& rowToAggregate,
+ double& rhsToAggregate) const;
+
+ // Select a row to aggregate
+ bool selectRowToAggregate( //const OsiSolverInterface& si,
+ const CoinIndexedVector& rowAggregated,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinIndexedVector& setRowsAggregated,
+ const double* xlp, const double* coefByCol,
+ const int* rowInds, const int* colStarts,
+ int& rowSelected,
+ int& colSelected ) const;
+
+ // Aggregation heuristic.
+ // Combines one or more rows of the original matrix
+ void aggregateRow( const int colSelected,
+ CoinIndexedVector& rowToAggregate, double rhs,
+ CoinIndexedVector& rowAggregated,
+ double& rhsAggregated ) const;
+
+ // Choose the bound substitution based on the criteria defined by the user
+ inline bool isLowerSubst(const double inf,
+ const double aj,
+ const double xlp,
+ const double LB,
+ const double UB) const;
+
+ // Bound substitution heuristic
+ bool boundSubstitution( const OsiSolverInterface& si,
+ const CoinIndexedVector& rowAggregated,
+ const double* xlp,
+ const double* xlpExtra,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ CoinIndexedVector& mixedKnapsack,
+ double& rhsMixedKnapsack, double& sStar,
+ CoinIndexedVector& contVariablesInS ) const;
+
+ // c-MIR separation heuristic
+ bool cMirSeparation ( const OsiSolverInterface& si,
+ const CoinPackedMatrix& matrixByRow,
+ const CoinIndexedVector& rowAggregated,
+ const int* listRowsAggregated,
+ const char* sense, const double* RHS,
+ //const double* coefByRow,
+ //const int* colInds, const int* rowStarts,
+ const double* xlp, const double sStar,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinIndexedVector& mixedKnapsack,
+ const double& rhsMixedKnapsack,
+ const CoinIndexedVector& contVariablesInS,
+ CoinIndexedVector * workVector,
+ OsiRowCut& flowCut ) const;
+
+ // function to create one c-MIR inequality
+ void cMirInequality( const int numInt,
+ const double delta,
+ const double numeratorBeta,
+ const int *knapsackIndices,
+ const double* knapsackElements,
+ const double* xlp,
+ const double sStar,
+ const double* colUpperBound,
+ const CoinIndexedVector& setC,
+ CoinIndexedVector& cMIR,
+ double& rhscMIR,
+ double& sCoef,
+ double& violation) const;
+
+ // function to compute G
+ inline double functionG( const double d, const double f ) const;
+
+ // function to print statistics (used only in debug mode)
+ void printStats(
+ std::ofstream & fout,
+ const bool hasCut,
+ const OsiSolverInterface& si,
+ const CoinIndexedVector& rowAggregated,
+ const double& rhsAggregated, const double* xlp,
+ const double* xlpExtra,
+ const int* listRowsAggregated,
+ const int* listColsSelected,
+ const int level,
+ const double* colUpperBound,
+ const double* colLowerBound ) const;
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Private member data
+
+ // Maximum number of rows to aggregate
+ int MAXAGGR_;
+ // Flag that indicates if an aggregated row is also multiplied by -1
+ bool MULTIPLY_;
+ // The criterion to use in the bound substitution
+ int CRITERION_;
+ // Tolerance used for numerical purposes
+ double EPSILON_;
+ /// There is no variable upper bound or variable lower bound defined
+ int UNDEFINED_;
+ // If violation of a cut is greater that this number, the cut is accepted
+ double TOLERANCE_;
+ /** Controls the preprocessing of the matrix to identify rows suitable for
+ cut generation.
+
-1: preprocess according to solver settings;
+
0: Do preprocessing only if it has not yet been done;
+
1: Do preprocessing.
+
+ Default value: -1 **/
+ int doPreproc_;
+ // The number of rows of the problem.
+ int numRows_;
+ // The number columns of the problem.
+ int numCols_;
+ // Indicates whether preprocessing has been done.
+ bool doneInitPre_;
+ // The array of CglMixIntRoundVUB2s.
+ CglMixIntRoundVUB2* vubs_;
+ // The array of CglMixIntRoundVLB2s.
+ CglMixIntRoundVLB2* vlbs_;
+ // Array with the row types of the rows in the model.
+ RowType* rowTypes_;
+ // The indices of the rows of the initial matrix
+ int* indRows_;
+ // The number of rows of type ROW_MIX
+ int numRowMix_;
+ // The indices of the rows of type ROW_MIX
+ int* indRowMix_;
+ // The number of rows of type ROW_CONT
+ int numRowCont_;
+ // The indices of the rows of type ROW_CONT
+ int* indRowCont_;
+ // The number of rows of type ROW_INT
+ int numRowInt_;
+ // The indices of the rows of type ROW_INT
+ int* indRowInt_;
+ // The number of rows of type ROW_CONT that have at least one variable
+ // with variable upper or lower bound
+ int numRowContVB_;
+ // The indices of the rows of type ROW_CONT that have at least one variable
+ // with variable upper or lower bound
+ int* indRowContVB_;
+ // If integer - for speed
+ char * integerType_;
+ // Sense of rows (modified if ranges)
+ char * sense_;
+ // RHS of rows (modified if ranges)
+ double * RHS_;
+
+};
+
+//#############################################################################
+// A function that tests the methods in the CglMixedIntegerRounding2 class. The
+// only reason for it not to be a member method is that this way it doesn't
+// have to be compiled into the library. And that's a gain, because the
+// library should be compiled with optimization on, but this method should be
+// compiled with debugging.
+void CglMixedIntegerRounding2UnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglOddHole.hpp b/thirdparty/linux/include/coin/CglOddHole.hpp
new file mode 100644
index 0000000..3b80caa
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglOddHole.hpp
@@ -0,0 +1,160 @@
+// $Id: CglOddHole.hpp 1119 2013-04-06 20:24:18Z stefan $
+// Copyright (C) 2000, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglOddHole_H
+#define CglOddHole_H
+
+#include
+
+#include "CglCutGenerator.hpp"
+
+/** Odd Hole Cut Generator Class */
+class CglOddHole : public CglCutGenerator {
+ friend void CglOddHoleUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate odd hole cuts for the model of the solver interface, si.
+ This looks at all rows of type sum x(i) <= 1 (or == 1) (x 0-1)
+ and sees if there is an odd cycle cut. See Grotschel, Lovasz
+ and Schrijver (1988) for method.
+ This is then lifted by using the corresponding Chvatal cut i.e.
+ Take all rows in cycle and add them together. RHS will be odd so
+ weaken all odd coefficients so 1.0 goes to 0.0 etc - then
+ constraint is sum even(j)*x(j) <= odd which can be replaced by
+ sum (even(j)/2)*x(j) <= (odd-1.0)/2.
+ A similar cut can be generated for sum x(i) >= 1.
+
+ Insert the generated cuts into OsiCut, cs.
+
+ This is only done for rows with unsatisfied 0-1 variables. If there
+ are many of these it will be slow. Improvements would do a
+ randomized subset and also speed up shortest path algorithm used.
+
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ /**@name Create Row List */
+ //@{
+ /// Create a list of rows which might yield cuts
+ /// this is to speed up process
+ /// The possible parameter is a list to cut down search
+ void createRowList( const OsiSolverInterface & si,
+ const int * possible=NULL);
+ /// This version passes in a list - 1 marks possible
+ void createRowList(int numberRows, const int * whichRow);
+ //@}
+
+ /**@name Create Clique List */
+ //@{
+ /// Create a list of extra row cliques which may not be in matrix
+ /// At present these are classical cliques
+ void createCliqueList(int numberCliques, const int * cliqueStart,
+ const int * cliqueMember);
+ //@}
+
+ /**@name Number Possibilities */
+ //@{
+ /// Returns how many rows might give odd hole cuts
+ int numberPossible();
+ //@}
+ /**@name Gets and Sets */
+ //@{
+ /// Minimum violation
+ double getMinimumViolation() const;
+ void setMinimumViolation(double value);
+ /// Minimum violation per entry
+ double getMinimumViolationPer() const;
+ void setMinimumViolationPer(double value);
+ /// Maximum number of entries in a cut
+ int getMaximumEntries() const;
+ void setMaximumEntries(int value);
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglOddHole ();
+
+ /// Copy constructor
+ CglOddHole (
+ const CglOddHole &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglOddHole &
+ operator=(
+ const CglOddHole& rhs);
+
+ /// Destructor
+ virtual
+ ~CglOddHole ();
+
+ /// This can be used to refresh any inforamtion
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ //@}
+
+private:
+
+ // Private member methods
+
+
+ /**@name Private methods */
+ //@{
+ /// Generate cuts from matrix copy and solution
+ /// If packed true then <=1 rows, otherwise >=1 rows.
+ void generateCuts(const OsiRowCutDebugger * debugger,
+ const CoinPackedMatrix & rowCopy,
+ const double * solution, const double * dj,
+ OsiCuts & cs, const int * suitableRow,
+ const int * fixedColumn,const CglTreeInfo info,
+ bool packed);
+ //@}
+
+ // Private member data
+
+ /**@name Private member data */
+ //@{
+ /// list of suitableRows
+ int * suitableRows_;
+ /// start of each clique
+ int * startClique_;
+ /// clique members
+ int * member_;
+ /// epsilon
+ double epsilon_;
+ /// 1-epsilon
+ double onetol_;
+ /// Minimum violation
+ double minimumViolation_;
+ /// Minimum violation per entry
+ double minimumViolationPer_;
+ /// Maximum number of entries in a cut
+ int maximumEntries_;
+ /// number of rows when suitability tested
+ int numberRows_;
+ /// number of cliques
+ int numberCliques_;
+ //@}
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglOddHole class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglOddHoleUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglParam.hpp b/thirdparty/linux/include/coin/CglParam.hpp
new file mode 100644
index 0000000..4463ef5
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglParam.hpp
@@ -0,0 +1,93 @@
+// Name: CglParam.hpp
+// Author: Francois Margot
+// Tepper School of Business
+// Carnegie Mellon University, Pittsburgh, PA 15213
+// email: fmargot@andrew.cmu.edu
+// Date: 11/24/06
+//
+// $Id: CglParam.hpp 1122 2013-04-06 20:39:53Z stefan $
+//
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+//-----------------------------------------------------------------------------
+// Copyright (C) 2006, Francois Margot and others. All Rights Reserved.
+
+#ifndef CglParam_H
+#define CglParam_H
+#include "CglConfig.h"
+#include "CoinFinite.hpp"
+/** Class collecting parameters for all cut generators. Each generator
+ may have a derived class to add parameters. Each generator might
+ also set different default values for the parameters in CglParam. */
+
+class CglParam {
+
+public:
+
+ /**@name Public Set/get methods */
+ //@{
+
+ /** Set INFINIT */
+ virtual void setINFINIT(const double inf);
+ /** Get value of INFINIT */
+ inline double getINFINIT() const {return INFINIT;}
+
+ /** Set EPS */
+ virtual void setEPS(const double eps);
+ /** Get value of EPS */
+ inline double getEPS() const {return EPS;}
+
+ /** Set EPS_COEFF */
+ virtual void setEPS_COEFF(const double eps_c);
+ /** Get value of EPS_COEFF */
+ inline double getEPS_COEFF() const {return EPS_COEFF;}
+
+ /** Set MAX_SUPPORT */
+ virtual void setMAX_SUPPORT(const int max_s);
+ /** Get value of MAX_SUPPORT */
+ inline int getMAX_SUPPORT() const {return MAX_SUPPORT;}
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglParam(const double inf = COIN_DBL_MAX, const double eps = 1e-6,
+ const double eps_c = 1e-5, const int max_s = COIN_INT_MAX);
+
+ /// Copy constructor
+ CglParam(const CglParam&);
+
+ /// Clone
+ virtual CglParam* clone() const;
+
+ /// Assignment operator
+ CglParam& operator=(const CglParam &rhs);
+
+ /// Destructor
+ virtual ~CglParam();
+ //@}
+
+protected:
+
+ // Protected member data
+
+ /**@name Protected member data */
+
+ //@{
+ // Value for infinity. Default: COIN_DBL_MAX.
+ double INFINIT;
+
+ // EPSILON for double comparisons. Default: 1e-6.
+ double EPS;
+
+ // Returned cuts do not have coefficients with absolute value smaller
+ // than EPS_COEFF. Default: 1e-5.
+ double EPS_COEFF;
+
+ /** Maximum number of non zero coefficients in a generated cut;
+ Default: COIN_INT_MAX */
+ int MAX_SUPPORT;
+ //@}
+
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglPreProcess.hpp b/thirdparty/linux/include/coin/CglPreProcess.hpp
new file mode 100644
index 0000000..65c04ca
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglPreProcess.hpp
@@ -0,0 +1,492 @@
+// Copyright (C) 2005, International Business Machines
+// Corporation and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglPreProcess_H
+#define CglPreProcess_H
+
+#include
+#include
+
+#include "CoinMessageHandler.hpp"
+#include "OsiSolverInterface.hpp"
+#include "CglStored.hpp"
+#include "OsiPresolve.hpp"
+#include "CglCutGenerator.hpp"
+
+//#############################################################################
+
+/** Class for preProcessing and postProcessing.
+
+ While cuts can be added at any time in the tree, some cuts are actually just
+ stronger versions of existing constraints. In this case they can replace those
+ constraints rather than being added as new constraints. This is awkward in the
+ tree but reasonable at the root node.
+
+ This is a general process class which uses other cut generators to strengthen
+ constraints, establish that constraints are redundant, fix variables and
+ find relationships such as x + y == 1.
+
+ Presolve will also be done.
+
+ If row names existed they may be replaced by R0000000 etc
+
+*/
+
+class CglPreProcess {
+
+public:
+
+ ///@name Main methods
+ //@{
+ /** preProcess problem - returning new problem.
+ If makeEquality true then <= cliques converted to ==.
+ Presolve will be done numberPasses times.
+
+ Returns NULL if infeasible
+
+ This version uses default strategy. For more control copy and edit
+ code from this function i.e. call preProcessNonDefault
+ */
+ OsiSolverInterface * preProcess(OsiSolverInterface & model,
+ bool makeEquality=false, int numberPasses=5);
+ /** preProcess problem - returning new problem.
+ If makeEquality true then <= cliques converted to ==.
+ Presolve will be done numberPasses times.
+
+ Returns NULL if infeasible
+
+ This version assumes user has added cut generators to CglPreProcess object
+ before calling it. As an example use coding in preProcess
+ If makeEquality is 1 add slacks to get cliques,
+ if 2 add slacks to get sos (but only if looks plausible) and keep sos info
+ */
+ OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model,
+ int makeEquality=0, int numberPasses=5,
+ int tuning=0);
+ /// Creates solution in original model
+ void postProcess(OsiSolverInterface &model
+ ,bool deleteStuff=true);
+ /** Tightens primal bounds to make dual and branch and cutfaster. Unless
+ fixed or integral, bounds are slightly looser than they could be.
+ Returns non-zero if problem infeasible
+ Fudge for branch and bound - put bounds on columns of factor *
+ largest value (at continuous) - should improve stability
+ in branch and bound on infeasible branches (0.0 is off)
+ */
+ int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
+ /** Fix some of problem - returning new problem.
+ Uses reduced costs.
+ Optional signed character array
+ 1 always keep, -1 always discard, 0 use djs
+
+ */
+ OsiSolverInterface * someFixed(OsiSolverInterface & model,
+ double fractionToKeep=0.25,
+ bool fixContinuousAsWell=false,
+ char * keep=NULL) const;
+ /** Replace cliques by more maximal cliques
+ Returns NULL if rows not reduced by greater than cliquesNeeded*rows
+
+ */
+ OsiSolverInterface * cliqueIt(OsiSolverInterface & model,
+ double cliquesNeeded=0.0) const;
+ /// If we have a cutoff - fix variables
+ int reducedCostFix(OsiSolverInterface & model);
+ //@}
+
+ //---------------------------------------------------------------------------
+
+ /**@name Parameter set/get methods
+
+ The set methods return true if the parameter was set to the given value,
+ false if the value of the parameter is out of range.
+
+ The get methods return the value of the parameter.
+
+ */
+ //@{
+ /** Set cutoff bound on the objective function.
+
+ When using strict comparison, the bound is adjusted by a tolerance to
+ avoid accidentally cutting off the optimal solution.
+ */
+ void setCutoff(double value) ;
+
+ /// Get the cutoff bound on the objective function - always as minimize
+ double getCutoff() const;
+ /// The original solver associated with this model.
+ inline OsiSolverInterface * originalModel() const
+ { return originalModel_;}
+ /// Solver after making clique equalities (may == original)
+ inline OsiSolverInterface * startModel() const
+ { return startModel_;}
+ /// Copies of solver at various stages after presolve
+ inline OsiSolverInterface * modelAtPass(int iPass) const
+ { if (iPass>=0&&iPass=0&&iPass=0&&iPass
+
+#include "CglCutGenerator.hpp"
+ /** Only useful type of disaggregation is most normal
+ For now just done for 0-1 variables
+ Can be used for building cliques
+ */
+ typedef struct {
+ //unsigned int zeroOne:1; // nonzero if affected variable is 0-1
+ //unsigned int whenAtUB:1; // nonzero if fixing happens when this variable at 1
+ //unsigned int affectedToUB:1; // nonzero if affected variable fixed to UB
+ //unsigned int affected:29; // If 0-1 then 0-1 sequence, otherwise true
+ unsigned int affected;
+ } disaggregationAction;
+
+/** Probing Cut Generator Class */
+class CglProbing : public CglCutGenerator {
+ friend void CglProbingUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+public:
+
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate probing/disaggregation cuts for the model of the
+ solver interface, si.
+
+ This is a simplification of probing ideas put into OSL about
+ ten years ago. The only known documentation is a copy of a
+ talk handout - we think Robin Lougee-Heimer has a copy!
+
+ For selected integer variables (e.g. unsatisfied ones) the effect of
+ setting them up or down is investigated. Setting a variable up
+ may in turn set other variables (continuous as well as integer).
+ There are various possible results:
+
+ 1) It is shown that problem is infeasible (this may also be
+ because objective function or reduced costs show worse than
+ best solution). If the other way is feasible we can generate
+ a column cut (and continue probing), if not feasible we can
+ say problem infeasible.
+
+ 2) If both ways are feasible, it can happen that x to 0 implies y to 1
+ ** and x to 1 implies y to 1 (again a column cut). More common
+ is that x to 0 implies y to 1 and x to 1 implies y to 0 so we could
+ substitute for y which might lead later to more powerful cuts.
+ ** This is not done in this code as there is no mechanism for
+ returning information.
+
+ 3) When x to 1 a constraint went slack by c. We can tighten the
+ constraint ax + .... <= b (where a may be zero) to
+ (a+c)x + .... <= b. If this cut is violated then it is
+ generated.
+
+ 4) Similarly we can generate implied disaggregation cuts
+
+ Note - differences to cuts in OSL.
+
+ a) OSL had structures intended to make this faster.
+ b) The "chaining" in 2) was done
+ c) Row cuts modified original constraint rather than adding cut
+ b) This code can cope with general integer variables.
+
+ Insert the generated cuts into OsiCut, cs.
+
+ If a "snapshot" of a matrix exists then this will be used.
+ Presumably this will give global cuts and will be faster.
+ No check is done to see if cuts will be global.
+
+ Otherwise use current matrix.
+
+ Both row cuts and column cuts may be returned
+
+ The mode options are:
+ 0) Only unsatisfied integer variables will be looked at.
+ If no information exists for that variable then
+ probing will be done so as a by-product you "may" get a fixing
+ or infeasibility. This will be fast and is only available
+ if a snapshot exists (otherwise as 1).
+ The bounds in the snapshot are the ones used.
+ 1) Look at unsatisfied integer variables, using current bounds.
+ Probing will be done on all looked at.
+ 2) Look at all integer variables, using current bounds.
+ Probing will be done on all
+
+ ** If generateCutsAndModify is used then new relaxed
+ row bounds and tightened column bounds are generated
+ Returns number of infeasibilities
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ int generateCutsAndModify( const OsiSolverInterface & si, OsiCuts & cs,
+ CglTreeInfo * info);
+ //@}
+
+ /**@name snapshot etc */
+ //@{
+ /** Create a copy of matrix which is to be used
+ this is to speed up process and to give global cuts
+ Can give an array with 1 set to select, 0 to ignore
+ column bounds are tightened
+ If array given then values of 1 will be set to 0 if redundant.
+ Objective may be added as constraint
+ Returns 1 if infeasible otherwise 0
+ */
+ int snapshot ( const OsiSolverInterface & si,
+ char * possible=NULL,
+ bool withObjective=true);
+ /// Deletes snapshot
+ void deleteSnapshot ( );
+ /** Creates cliques for use by probing.
+ Only cliques >= minimumSize and < maximumSize created
+ Can also try and extend cliques as a result of probing (root node).
+ Returns number of cliques found.
+ */
+ int createCliques( OsiSolverInterface & si,
+ int minimumSize=2, int maximumSize=100);
+ /// Delete all clique information
+ void deleteCliques();
+ /** Create a fake model by adding cliques
+ if type&4 then delete rest of model first,
+ if 1 then add proper cliques, 2 add fake cliques */
+ OsiSolverInterface * cliqueModel(const OsiSolverInterface * model,
+ int type);
+ //@}
+
+ /**@name Get tighter column bounds */
+ //@{
+ /// Lower
+ const double * tightLower() const;
+ /// Upper
+ const double * tightUpper() const;
+ /// Array which says tighten continuous
+ const char * tightenBounds() const
+ { return tightenBounds_;}
+ //@}
+
+ /**@name Get possible freed up row bounds - only valid after mode==3 */
+ //@{
+ /// Lower
+ const double * relaxedRowLower() const;
+ /// Upper
+ const double * relaxedRowUpper() const;
+ //@}
+
+ /**@name Change mode */
+ //@{
+ /// Set
+ void setMode(int mode);
+ /// Get
+ int getMode() const;
+ //@}
+
+ /**@name Change maxima */
+ //@{
+ /// Set maximum number of passes per node
+ void setMaxPass(int value);
+ /// Get maximum number of passes per node
+ int getMaxPass() const;
+ /// Set log level - 0 none, 1 - a bit, 2 - more details
+ void setLogLevel(int value);
+ /// Get log level
+ int getLogLevel() const;
+ /// Set maximum number of unsatisfied variables to look at
+ void setMaxProbe(int value);
+ /// Get maximum number of unsatisfied variables to look at
+ int getMaxProbe() const;
+ /// Set maximum number of variables to look at in one probe
+ void setMaxLook(int value);
+ /// Get maximum number of variables to look at in one probe
+ int getMaxLook() const;
+ /// Set maximum number of elements in row for it to be considered
+ void setMaxElements(int value);
+ /// Get maximum number of elements in row for it to be considered
+ int getMaxElements() const;
+ /// Set maximum number of passes per node (root node)
+ void setMaxPassRoot(int value);
+ /// Get maximum number of passes per node (root node)
+ int getMaxPassRoot() const;
+ /// Set maximum number of unsatisfied variables to look at (root node)
+ void setMaxProbeRoot(int value);
+ /// Get maximum number of unsatisfied variables to look at (root node)
+ int getMaxProbeRoot() const;
+ /// Set maximum number of variables to look at in one probe (root node)
+ void setMaxLookRoot(int value);
+ /// Get maximum number of variables to look at in one probe (root node)
+ int getMaxLookRoot() const;
+ /// Set maximum number of elements in row for it to be considered (root node)
+ void setMaxElementsRoot(int value);
+ /// Get maximum number of elements in row for it to be considered (root node)
+ int getMaxElementsRoot() const;
+ /**
+ Returns true if may generate Row cuts in tree (rather than root node).
+ Used so know if matrix will change in tree. Really
+ meant so column cut generators can still be active
+ without worrying code.
+ Default is true
+ */
+ virtual bool mayGenerateRowCutsInTree() const;
+ //@}
+
+ /**@name Get information back from probing */
+ //@{
+ /// Number looked at this time
+ inline int numberThisTime() const
+ { return numberThisTime_;}
+ /// Which ones looked at this time
+ inline const int * lookedAt() const
+ { return lookedAt_;}
+ //@}
+
+ /**@name Stop or restart row cuts (otherwise just fixing from probing) */
+ //@{
+ /// Set
+ /// 0 no cuts, 1 just disaggregation type, 2 coefficient ( 3 both)
+ void setRowCuts(int type);
+ /// Get
+ int rowCuts() const;
+ //@}
+ /// Clique type
+ typedef struct {
+ unsigned int equality:1; // nonzero if clique is ==
+ } CliqueType;
+
+ /**@name Information on cliques */
+ //@{
+ /// Number of cliques
+ inline int numberCliques() const
+ { return numberCliques_;}
+ /// Clique type
+ inline CliqueType * cliqueType() const
+ { return cliqueType_;}
+ /// Start of each clique
+ inline int * cliqueStart() const
+ { return cliqueStart_;}
+ /// Entries for clique
+ inline CliqueEntry * cliqueEntry() const
+ { return cliqueEntry_;}
+ //@}
+
+ /**@name Whether use objective as constraint */
+ //@{
+ /** Set
+ 0 don't
+ 1 do
+ -1 don't even think about it
+ */
+ void setUsingObjective(int yesNo);
+ /// Get
+ int getUsingObjective() const;
+ //@}
+
+ /**@name Mark which continuous variables are to be tightened */
+ //@{
+ /// Mark variables to be tightened
+ void tightenThese(const OsiSolverInterface & solver, int number, const int * which);
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglProbing ();
+
+ /// Copy constructor
+ CglProbing (
+ const CglProbing &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglProbing &
+ operator=(
+ const CglProbing& rhs);
+
+ /// Destructor
+ virtual
+ ~CglProbing ();
+
+ /// This can be used to refresh any inforamtion
+ virtual void refreshSolver(OsiSolverInterface * solver);
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+private:
+
+ // Private member methods
+ /**@name probe */
+ //@{
+ /// Does probing and adding cuts (without cliques and mode_!=0)
+ int probe( const OsiSolverInterface & si,
+ const OsiRowCutDebugger * debugger,
+ OsiCuts & cs,
+ double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
+ CoinPackedMatrix *columnCopy,const CoinBigIndex * rowStartPos,
+ const int * realRow, const double * rowLower, const double * rowUpper,
+ const char * intVar, double * minR, double * maxR, int * markR,
+ CglTreeInfo * info);
+ /// Does probing and adding cuts (with cliques)
+ int probeCliques( const OsiSolverInterface & si,
+ const OsiRowCutDebugger * debugger,
+ OsiCuts & cs,
+ double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
+ CoinPackedMatrix *columnCopy, const int * realRow,
+ double * rowLower, double * rowUpper,
+ char * intVar, double * minR, double * maxR, int * markR,
+ CglTreeInfo * info);
+ /// Does probing and adding cuts for clique slacks
+ int probeSlacks( const OsiSolverInterface & si,
+ const OsiRowCutDebugger * debugger,
+ OsiCuts & cs,
+ double * colLower, double * colUpper, CoinPackedMatrix *rowCopy,
+ CoinPackedMatrix *columnCopy,
+ double * rowLower, double * rowUpper,
+ char * intVar, double * minR, double * maxR,int * markR,
+ CglTreeInfo * info);
+ /** Does most of work of generateCuts
+ Returns number of infeasibilities */
+ int gutsOfGenerateCuts( const OsiSolverInterface & si,
+ OsiCuts & cs,
+ double * rowLower, double * rowUpper,
+ double * colLower, double * colUpper,
+ CglTreeInfo * info);
+ /// Sets up clique information for each row
+ void setupRowCliqueInformation(const OsiSolverInterface & si);
+ /** This tightens column bounds (and can declare infeasibility)
+ It may also declare rows to be redundant */
+ int tighten(double *colLower, double * colUpper,
+ const int *column, const double *rowElements,
+ const CoinBigIndex *rowStart,const CoinBigIndex * rowStartPos,
+ const int * rowLength,
+ double *rowLower, double *rowUpper,
+ int nRows,int nCols,char * intVar,int maxpass,
+ double tolerance);
+ /// This just sets minima and maxima on rows
+ void tighten2(double *colLower, double * colUpper,
+ const int *column, const double *rowElements,
+ const CoinBigIndex *rowStart,
+ const int * rowLength,
+ double *rowLower, double *rowUpper,
+ double * minR, double * maxR, int * markR,
+ int nRows);
+ //@}
+
+ // Private member data
+
+ struct disaggregation_struct_tag ;
+ friend struct CglProbing::disaggregation_struct_tag ;
+
+ /**@name Private member data */
+ //@{
+ /// Row copy (only if snapshot)
+ CoinPackedMatrix * rowCopy_;
+ /// Column copy (only if snapshot)
+ CoinPackedMatrix * columnCopy_;
+ /// Lower bounds on rows
+ double * rowLower_;
+ /// Upper bounds on rows
+ double * rowUpper_;
+ /// Lower bounds on columns
+ double * colLower_;
+ /// Upper bounds on columns
+ double * colUpper_;
+ /// Number of rows in snapshot (or when cliqueRow stuff computed)
+ int numberRows_;
+ /// Number of columns in problem ( must == current)
+ int numberColumns_;
+ /// Tolerance to see if infeasible
+ double primalTolerance_;
+ /** Mode - 0 lazy using snapshot, 1 just unsatisfied, 2 all.
+ 16 bit set if want to extend cliques at root node
+ */
+ int mode_;
+ /** Row cuts flag
+ 0 no cuts, 1 just disaggregation type, 2 coefficient ( 3 both), 4 just column cuts
+ -n as +n but just fixes variables unless at root
+ */
+ int rowCuts_;
+ /// Maximum number of passes to do in probing
+ int maxPass_;
+ /// Log level - 0 none, 1 - a bit, 2 - more details
+ int logLevel_;
+ /// Maximum number of unsatisfied variables to probe
+ int maxProbe_;
+ /// Maximum number of variables to look at in one probe
+ int maxStack_;
+ /// Maximum number of elements in row for scan
+ int maxElements_;
+ /// Maximum number of passes to do in probing at root
+ int maxPassRoot_;
+ /// Maximum number of unsatisfied variables to probe at root
+ int maxProbeRoot_;
+ /// Maximum number of variables to look at in one probe at root
+ int maxStackRoot_;
+ /// Maximum number of elements in row for scan at root
+ int maxElementsRoot_;
+ /// Whether to include objective as constraint
+ int usingObjective_;
+ /// Number of integer variables
+ int numberIntegers_;
+ /// Number of 0-1 integer variables
+ int number01Integers_;
+ /// Number looked at this time
+ int numberThisTime_;
+ /// Total number of times called
+ int totalTimesCalled_;
+ /// Which ones looked at this time
+ int * lookedAt_;
+ /// Disaggregation cuts and for building cliques
+ typedef struct disaggregation_struct_tag {
+ int sequence; // integer variable
+ // index will be NULL if no probing done yet
+ int length; // length of newValue
+ disaggregationAction * index; // columns whose bounds will be changed
+ } disaggregation;
+ disaggregation * cutVector_;
+ /// Cliques
+ /// Number of cliques
+ int numberCliques_;
+ /// Clique type
+ CliqueType * cliqueType_;
+ /// Start of each clique
+ int * cliqueStart_;
+ /// Entries for clique
+ CliqueEntry * cliqueEntry_;
+ /** Start of oneFixes cliques for a column in matrix or -1 if not
+ in any clique */
+ int * oneFixStart_;
+ /** Start of zeroFixes cliques for a column in matrix or -1 if not
+ in any clique */
+ int * zeroFixStart_;
+ /// End of fixes for a column
+ int * endFixStart_;
+ /// Clique numbers for one or zero fixes
+ int * whichClique_;
+ /** For each column with nonzero in row copy this gives a clique "number".
+ So first clique mentioned in row is always 0. If no entries for row
+ then no cliques. If sequence > numberColumns then not in clique.
+ */
+ CliqueEntry * cliqueRow_;
+ /// cliqueRow_ starts for each row
+ int * cliqueRowStart_;
+ /// If not null and [i] !=0 then also tighten even if continuous
+ char * tightenBounds_;
+ //@}
+};
+inline int affectedInDisaggregation(const disaggregationAction & dis)
+{ return dis.affected&0x1fffffff;}
+inline void setAffectedInDisaggregation(disaggregationAction & dis,
+ int affected)
+{ dis.affected = affected|(dis.affected&0xe0000000);}
+#ifdef NDEBUG
+inline bool zeroOneInDisaggregation(const disaggregationAction & )
+{ return true;}
+#else
+inline bool zeroOneInDisaggregation(const disaggregationAction & dis)
+//{ return (dis.affected&0x80000000)!=0;}
+{ assert ((dis.affected&0x80000000)!=0); return true;}
+#endif
+inline void setZeroOneInDisaggregation(disaggregationAction & dis,bool zeroOne)
+{ dis.affected = (zeroOne ? 0x80000000 : 0)|(dis.affected&0x7fffffff);}
+inline bool whenAtUBInDisaggregation(const disaggregationAction & dis)
+{ return (dis.affected&0x40000000)!=0;}
+inline void setWhenAtUBInDisaggregation(disaggregationAction & dis,bool whenAtUB)
+{ dis.affected = (whenAtUB ? 0x40000000 : 0)|(dis.affected&0xbfffffff);}
+inline bool affectedToUBInDisaggregation(const disaggregationAction & dis)
+{ return (dis.affected&0x20000000)!=0;}
+inline void setAffectedToUBInDisaggregation(disaggregationAction & dis,bool affectedToUB)
+{ dis.affected = (affectedToUB ? 0x20000000 : 0)|(dis.affected&0xdfffffff);}
+
+//#############################################################################
+/** A function that tests the methods in the CglProbing class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglProbingUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+/// This just uses implication info
+class CglImplication : public CglCutGenerator {
+
+public:
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate cuts from implication table
+ Insert generated cuts into the cut set cs.
+ */
+ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglImplication ();
+
+ /// Constructor with info
+ CglImplication (CglTreeProbingInfo * info);
+
+ /// Copy constructor
+ CglImplication (
+ const CglImplication &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglImplication &
+ operator=(
+ const CglImplication& rhs);
+
+ /// Destructor
+ virtual
+ ~CglImplication ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+ /**@name Set implication */
+ //@{
+ /// Set implication
+ inline void setProbingInfo(CglTreeProbingInfo * info)
+ { probingInfo_=info;}
+ //@}
+
+private:
+ /**@name Private member data */
+ //@{
+ /// Pointer to tree probing info
+ CglTreeProbingInfo * probingInfo_;
+ //@}
+};
+#endif
diff --git a/thirdparty/linux/include/coin/CglRedSplit.hpp b/thirdparty/linux/include/coin/CglRedSplit.hpp
new file mode 100644
index 0000000..1265b1d
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglRedSplit.hpp
@@ -0,0 +1,448 @@
+// Last edit: 4/20/07
+//
+// Name: CglRedSplit.hpp
+// Author: Francois Margot
+// Tepper School of Business
+// Carnegie Mellon University, Pittsburgh, PA 15213
+// email: fmargot@andrew.cmu.edu
+// Date: 2/6/05
+//
+// $Id: CglRedSplit.hpp 1119 2013-04-06 20:24:18Z stefan $
+//-----------------------------------------------------------------------------
+// Copyright (C) 2005, Francois Margot and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglRedSplit_H
+#define CglRedSplit_H
+
+#include "CglCutGenerator.hpp"
+#include "CglRedSplitParam.hpp"
+
+/** Gomory Reduce-and-Split Cut Generator Class; See method generateCuts().
+ Based on the paper by K. Anderson, G. Cornuejols, Yanjun Li,
+ "Reduce-and-Split Cuts: Improving the Performance of Mixed Integer
+ Gomory Cuts", Management Science 51 (2005). */
+
+class CglRedSplit : public CglCutGenerator {
+
+ friend void CglRedSplitUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+public:
+ /**@name generateCuts */
+ //@{
+ /** Generate Reduce-and-Split Mixed Integer Gomory cuts
+ for the model of the solver interface si.
+
+ Insert the generated cuts into OsiCuts cs.
+
+ Warning: This generator currently works only with the Lp solvers Clp or
+ Cplex9.0 or higher. It requires access to the optimal tableau and
+ optimal basis inverse and makes assumptions on the way slack variables
+ are added by the solver. The Osi implementations for Clp and Cplex
+ verify these assumptions.
+
+ When calling the generator, the solver interface si
+ must contain an optimized
+ problem and information related to the optimal basis must be available
+ through the OsiSolverInterface methods (si->optimalBasisIsAvailable()
+ must return 'true'). It is also essential that the integrality of
+ structural variable i can be obtained using si->isInteger(i).
+
+ Reduce-and-Split cuts are variants of Gomory cuts: Starting from
+ the current optimal tableau, linear combinations of the rows of
+ the current optimal simplex tableau are used for generating Gomory
+ cuts. The choice of the linear combinations is driven by the objective
+ of reducing the coefficients of the non basic continuous variables
+ in the resulting row.
+ Note that this generator might not be able to generate cuts for some
+ solutions violating integrality constraints.
+
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /// Return true if needs optimal basis to do cuts (will return true)
+ virtual bool needsOptimalBasis() const;
+ //@}
+
+
+ /**@name Public Methods */
+ //@{
+
+ // Set the parameters to the values of the given CglRedSplitParam object.
+ void setParam(const CglRedSplitParam &source);
+ // Return the CglRedSplitParam object of the generator.
+ inline CglRedSplitParam getParam() const {return param;}
+
+ // Compute entries of low_is_lub and up_is_lub.
+ void compute_is_lub();
+
+ // Compute entries of is_integer.
+ void compute_is_integer();
+
+ /// Set given_optsol to the given optimal solution given_sol.
+ /// If given_optsol is set using this method,
+ /// the code will stop as soon as
+ /// a generated cut is violated by the given solution; exclusively
+ /// for debugging purposes.
+ void set_given_optsol(const double *given_sol, const int card_sol);
+
+ /// Print some of the data members
+ void print() const;
+
+ /// Print the current simplex tableau
+ void printOptTab(OsiSolverInterface *solver) const;
+
+ //@}
+
+ /**@name Public Methods (soon to be obsolete)*/
+ //@{
+ //************************************************************
+ // TO BE REMOVED
+ /** Set limit, the maximum number of non zero coefficients in generated cut;
+ Default: 50 */
+ void setLimit(int limit);
+ /** Get value of limit */
+ int getLimit() const;
+
+ /** Set away, the minimum distance from being integer used for selecting
+ rows for cut generation; all rows whose pivot variable should be
+ integer but is more than away from integrality will be selected;
+ Default: 0.05 */
+ void setAway(double value);
+ /// Get value of away
+ double getAway() const;
+ /** Set the value of LUB, value considered large for the absolute value of
+ a lower or upper bound on a variable;
+ Default: 1000 */
+ void setLUB(double value);
+ /** Get the value of LUB */
+ double getLUB() const;
+
+ /** Set the value of EPS, epsilon for double computations;
+ Default: 1e-7 */
+ void setEPS(double value);
+ /** Get the value of EPS */
+ double getEPS() const;
+
+ /** Set the value of EPS_COEFF, epsilon for values of coefficients;
+ Default: 1e-8 */
+ void setEPS_COEFF(double value);
+ /** Get the value of EPS_COEFF */
+ double getEPS_COEFF() const;
+
+ /** Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for
+ variables with absolute value of lower or upper bound larger than LUB;
+ Default: 1e-13 */
+ void setEPS_COEFF_LUB(double value);
+ /** Get the value of EPS_COEFF_LUB */
+ double getEPS_COEFF_LUB() const;
+
+ /** Set the value of EPS_RELAX, value used for relaxing the right hand side
+ of each generated cut;
+ Default: 1e-8 */
+ void setEPS_RELAX(double value);
+ /** Get the value of EPS_RELAX */
+ double getEPS_RELAX() const;
+
+ /** Set the value of normIsZero, the threshold for considering a norm to be
+ 0; Default: 1e-5 */
+ void setNormIsZero(double value);
+ /** Get the value of normIsZero */
+ double getNormIsZero() const;
+
+ /** Set the value of minReduc, threshold for relative norm improvement for
+ performing a reduction; Default: 0.05 */
+ void setMinReduc(double value);
+ /// Get the value of minReduc
+ double getMinReduc() const;
+
+ /** Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where
+ mTab is the number of rows used in the combinations and nTab is the
+ number of continuous non basic variables. The work of the generator is
+ proportional to (mTab * mTab * CoinMax(mTab, nTab)). Reducing the value of
+ maxTab makes the generator faster, but weaker. Default: 1e7. */
+ void setMaxTab(double value);
+ /// Get the value of maxTab
+ double getMaxTab() const;
+ // END TO BE REMOVED
+ //************************************************************
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglRedSplit();
+
+ /// Constructor with specified parameters
+ CglRedSplit(const CglRedSplitParam &RS_param);
+
+ /// Copy constructor
+ CglRedSplit (const CglRedSplit &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglRedSplit &
+ operator=(
+ const CglRedSplit& rhs);
+
+ /// Destructor
+ virtual
+ ~CglRedSplit ();
+ /// Create C++ lines to get to current state
+ virtual std::string generateCpp( FILE * fp);
+ //@}
+
+private:
+
+ // Private member methods
+
+/**@name Private member methods */
+
+ //@{
+
+ // Method generating the cuts after all CglRedSplit members are properly set.
+ void generateCuts(OsiCuts & cs);
+
+ /// Compute the fractional part of value, allowing for small error.
+ inline double rs_above_integer(double value);
+
+ /// Perform row r1 of pi := row r1 of pi - step * row r2 of pi.
+ void update_pi_mat(int r1, int r2, int step);
+
+ /// Perform row r1 of tab := row r1 of tab - step * row r2 of tab.
+ void update_redTab(int r1, int r2, int step);
+
+ /// Find optimal integer step for changing row r1 by adding to it a
+ /// multiple of another row r2.
+ void find_step(int r1, int r2, int *step,
+ double *reduc, double *norm);
+
+ /// Test if an ordered pair of rows yields a reduction. Perform the
+ /// reduction if it is acceptable.
+ int test_pair(int r1, int r2, double *norm);
+
+ /// Reduce rows of contNonBasicTab.
+ void reduce_contNonBasicTab();
+
+ /// Generate a row of the current LP tableau.
+ void generate_row(int index_row, double *row);
+
+ /// Generate a mixed integer Chvatal-Gomory cut, when all non basic
+ /// variables are non negative and at their lower bound.
+ int generate_cgcut(double *row, double *rhs);
+
+ /// Generate a mixed integer Chvatal-Gomory cut, when all non basic
+ /// variables are non negative and at their lower bound (different formula)
+ int generate_cgcut_2(int basic_ind, double *row, double *rhs);
+
+ /// Use multiples of the initial inequalities to cancel out the coefficients
+ /// of the slack variables.
+ void eliminate_slacks(double *row,
+ const double *elements,
+ const int *start,
+ const int *indices,
+ const int *rowLength,
+ const double *rhs, double *rowrhs);
+
+ /// Change the sign of the coefficients of the continuous non basic
+ /// variables at their upper bound.
+ void flip(double *row);
+
+ /// Change the sign of the coefficients of the continuous non basic
+ /// variables at their upper bound and do the translations restoring
+ /// the original bounds. Modify the right hand side
+ /// accordingly.
+ void unflip(double *row, double *rowrhs, double *slack_val);
+
+ /// Return the scale factor for the row.
+ /// Compute max_coeff: maximum absolute value of the coefficients.
+ /// Compute min_coeff: minimum absolute value of the coefficients
+ /// larger than EPS_COEFF.
+ /// Return -1 if max_coeff < EPS_COEFF or if max_coeff/min_coeff > MAXDYN
+ /// or MAXDYN_LUB (depending if the row has a non zero coeff. for a variable
+ /// with large lower/upper bound) */.
+ double row_scale_factor(double *row);
+
+ /// Generate the packed cut from the row representation.
+ int generate_packed_row(const double *xlp, double *row,
+ int *rowind, double *rowelem,
+ int *card_row, double & rhs);
+
+ /// Check that the generated cuts do not cut a given optimal solution.
+ void check_optsol(const int calling_place,
+ const double *xlp, const double *slack_val,
+ const int do_flip);
+
+ /// Check that the generated cuts do not cut a given optimal solution.
+ void check_optsol(const int calling_place,
+ const double *xlp, const double *slack_val,
+ const double *ck_row, const double ck_rhs,
+ const int cut_number, const int do_flip);
+
+ // Check that two vectors are different.
+ bool rs_are_different_vectors(const int *vect1,
+ const int *vect2,
+ const int dim);
+
+ // Check that two vectors are different.
+ bool rs_are_different_vectors(const double *vect1,
+ const double *vect2,
+ const int dim);
+
+ // Check that two matrices are different.
+ bool rs_are_different_matrices(const CoinPackedMatrix *mat1,
+ const CoinPackedMatrix *mat2,
+ const int nmaj,
+ const int nmin);
+ //@}
+
+
+ // Private member data
+
+/**@name Private member data */
+
+ //@{
+
+ /// Object with CglRedSplitParam members.
+ CglRedSplitParam param;
+
+ /// Number of rows ( = number of slack variables) in the current LP.
+ int nrow;
+
+ /// Number of structural variables in the current LP.
+ int ncol;
+
+ /// Lower bounds for structural variables
+ const double *colLower;
+
+ /// Upper bounds for structural variables
+ const double *colUpper;
+
+ /// Lower bounds for constraints
+ const double *rowLower;
+
+ /// Upper bounds for constraints
+ const double *rowUpper;
+
+ /// Righ hand side for constraints (upper bound for ranged constraints).
+ const double *rowRhs;
+
+ /// Number of integer basic structural variables that are fractional in the
+ /// current lp solution (at least param.away_ from being integer).
+ int card_intBasicVar_frac;
+
+ /// Number of integer non basic structural variables in the
+ /// current lp solution.
+ int card_intNonBasicVar;
+
+ /// Number of continuous non basic variables (structural or slack) in the
+ /// current lp solution.
+ int card_contNonBasicVar;
+
+ /// Number of non basic variables (structural or slack) at their
+ /// upper bound in the current lp solution.
+ int card_nonBasicAtUpper;
+
+ /// Number of non basic variables (structural or slack) at their
+ /// lower bound in the current lp solution.
+ int card_nonBasicAtLower;
+
+ /// Characteristic vector for integer basic structural variables
+ /// with non integer value in the current lp solution.
+ int *cv_intBasicVar_frac;
+
+ /// List of integer structural basic variables
+ /// (in order of pivot in selected rows for cut generation).
+ int *intBasicVar_frac;
+
+ /// List of integer structural non basic variables.
+ int *intNonBasicVar;
+
+ /// List of continuous non basic variables (structural or slack).
+ // slacks are considered continuous (no harm if this is not the case).
+ int *contNonBasicVar;
+
+ /// List of non basic variables (structural or slack) at their
+ /// upper bound.
+ int *nonBasicAtUpper;
+
+ /// List of non basic variables (structural or slack) at their lower
+ /// bound.
+ int *nonBasicAtLower;
+
+ /// Number of rows in the reduced tableau (= card_intBasicVar_frac).
+ int mTab;
+
+ /// Number of columns in the reduced tableau (= card_contNonBasicVar)
+ int nTab;
+
+ /// Tableau of multipliers used to alter the rows used in generation.
+ /// Dimensions: mTab by mTab. Initially, pi_mat is the identity matrix.
+ int **pi_mat;
+
+ /// Current tableau for continuous non basic variables (structural or slack).
+ /// Only rows used for generation.
+ /// Dimensions: mTab by nTab.
+ double **contNonBasicTab;
+
+ /// Current tableau for integer non basic structural variables.
+ /// Only rows used for generation.
+ // Dimensions: mTab by card_intNonBasicVar.
+ double **intNonBasicTab;
+
+ /// Right hand side of the tableau.
+ /// Only rows used for generation.
+ double *rhsTab ;
+
+ /// Given optimal solution that should not be cut; only for debug.
+ const double *given_optsol;
+
+ /// Number of entries in given_optsol.
+ int card_given_optsol;
+
+ /// Characteristic vectors of structural integer variables or continuous
+ /// variables currently fixed to integer values.
+ int *is_integer;
+
+ /// Characteristic vector of the structural variables whose lower bound
+ /// in absolute value is larger than LUB.
+ int *low_is_lub;
+
+ /// Characteristic vector of the structural variables whose upper bound
+ /// in absolute value is larger than LUB.
+ int *up_is_lub;
+
+ /// Pointer on solver. Reset by each call to generateCuts().
+ OsiSolverInterface *solver;
+
+ /// Pointer on point to separate. Reset by each call to generateCuts().
+ const double *xlp;
+
+ /// Pointer on row activity. Reset by each call to generateCuts().
+ const double *rowActivity;
+
+ /// Pointer on column type. Reset by each call to generateCuts().
+ const char *colType;
+
+ /// Pointer on matrix of coefficient ordered by rows.
+ /// Reset by each call to generateCuts().
+ const CoinPackedMatrix *byRow;
+
+ //@}
+};
+
+//#############################################################################
+/** A function that tests the methods in the CglRedSplit class. The
+ only reason for it not to be a member method is that this way it doesn't
+ have to be compiled into the library. And that's a gain, because the
+ library should be compiled with optimization on, but this method should be
+ compiled with debugging. */
+void CglRedSplitUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglRedSplit2.hpp b/thirdparty/linux/include/coin/CglRedSplit2.hpp
new file mode 100644
index 0000000..c66e1ca
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglRedSplit2.hpp
@@ -0,0 +1,494 @@
+// Last edit: 04/03/10
+//
+// Name: CglRedSplit2.hpp
+// Author: Giacomo Nannicini
+// Singapore University of Technology and Design
+// Singapore
+// email: nannicini@sutd.edu.sg
+// based on CglRedSplit by Francois Margot
+// Date: 03/09/09
+//-----------------------------------------------------------------------------
+// Copyright (C) 2010, Giacomo Nannicini and others. All Rights Reserved.
+
+#ifndef CglRedSplit2_H
+#define CglRedSplit2_H
+
+#include "CglCutGenerator.hpp"
+#include "CglRedSplit2Param.hpp"
+#include "CoinWarmStartBasis.hpp"
+#include "CoinHelperFunctions.hpp"
+#include "CoinTime.hpp"
+
+/** Reduce-and-Split Cut Generator Class; See method generateCuts().
+ Based on the papers "Practical strategies for generating rank-1
+ split cuts in mixed-integer linear programming" by G. Cornuejols
+ and G. Nannicini, published on Mathematical Programming
+ Computation, and "Combining Lift-and-Project and Reduce-and-Split"
+ by E. Balas, G. Cornuejols, T. Kis and G. Nannicini, published on
+ INFORMS Journal on Computing. Part of this code is based on
+ CglRedSplit by F. Margot. */
+
+class CglRedSplit2 : public CglCutGenerator {
+
+ friend void CglRedSplit2UnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir);
+public:
+ /**@name generateCuts */
+ //@{
+ /** Generate Reduce-and-Split Mixed Integer Gomory cuts
+ for the model of the solver interface si.
+
+ Insert the generated cuts into OsiCuts cs.
+
+ This generator currently works only with the Lp solvers Clp or
+ Cplex9.0 or higher. It requires access to the optimal tableau
+ and optimal basis inverse and makes assumptions on the way slack
+ variables are added by the solver. The Osi implementations for
+ Clp and Cplex verify these assumptions.
+
+ When calling the generator, the solver interface si must contain
+ an optimized problem and information related to the optimal
+ basis must be available through the OsiSolverInterface methods
+ (si->optimalBasisIsAvailable() must return 'true'). It is also
+ essential that the integrality of structural variable i can be
+ obtained using si->isInteger(i).
+
+ Reduce-and-Split cuts are a class of split cuts. We compute
+ linear combinations of the rows of the simplex tableau, trying
+ to reduce some of the coefficients on the nonbasic continuous
+ columns. We have a large number of heuristics to choose which
+ coefficients should be reduced, and by using which rows. The
+ paper explains everything in detail.
+
+ Note that this generator can potentially generate a huge number
+ of cuts, depending on how it is parametered. Default parameters
+ should be good for most situations; if you want to go heavy on
+ split cuts, use more row selection strategies or a different
+ number of rows in the linear combinations. Again, look at the
+ paper for details. If you want to generate a small number of
+ cuts, default parameters are not the best choice.
+
+ A combination of Reduce-and-Split with Lift & Project is
+ described in the paper "Combining Lift-and-Project and
+ Reduce-and-Split". The Reduce-and-Split code for the
+ implementation used in that paper is included here.
+
+ This generator does not generate the same cuts as CglRedSplit,
+ therefore both generators can be used in conjunction.
+
+ */
+
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+
+ /// Return true if needs optimal basis to do cuts (will return true)
+ virtual bool needsOptimalBasis() const;
+
+ // Generate the row multipliers computed by Reduce-and-Split from the
+ // given OsiSolverInterface. The multipliers are written in lambda;
+ // lambda should be of size nrow*maxNumMultipliers. We generate at most
+ // maxNumMultipliers m-vectors of row multipliers, and return the number
+ // of m-vectors that were generated.
+ // If the caller wants to know which variables are basic in each row
+ // (same order as lambda), basicVariables should be non-NULL (size nrow).
+ // This method can also generate the cuts corresponding to the multipliers
+ // returned; it suffices to pass non-NULL OsiCuts.
+ // This method is not needed by the typical user; however, it is useful
+ // in the context of generating Lift & Project cuts.
+ int generateMultipliers(const OsiSolverInterface& si, int* lambda,
+ int maxNumMultipliers, int* basicVariables = NULL,
+ OsiCuts* cs = NULL);
+
+ // Try to improve a Lift & Project cut, by employing the
+ // Reduce-and-Split procedure. We start from a row of a L&P tableau,
+ // and generate a cut trying to reduce the coefficients on the
+ // nonbasic variables. Note that this L&P tableau will in general
+ // have nonbasic variables which are nonzero in the point that we
+ // want to cut off, so we should be careful. Arguments:
+ // OsiSolverInterface which contains the simplex tableau, initial
+ // row from which the cut is derived, row rhs, row number of the
+ // source row (if it is in the simplex tableau; otherwise, a
+ // negative number; needed to avoid using duplicate rows), point
+ // that we want to cut off (note: this is NOT a basic solution for
+ // the OsiSolverInterace!), list of variables which are basic in
+ // xbar but are nonbasic in the OsiSolverInterface. The computed cut
+ // is written in OsiRowCut* cs. Finally, if a starting disjunction
+ // is provided in the vector lambda (of size ncols, i.e. a
+ // disjunction on the structural variables), the disjunction is
+ // modified according to the cut which is produced.
+ int tiltLandPcut(const OsiSolverInterface* si, double* row,
+ double rowRhs, int rownumber, const double* xbar,
+ const int* newnonbasics, OsiRowCut* cs, int* lambda = NULL);
+
+ //@}
+
+
+ /**@name Public Methods */
+ //@{
+
+ // Set the parameters to the values of the given CglRedSplit2Param object.
+ void setParam(const CglRedSplit2Param &source);
+ // Return the CglRedSplit2Param object of the generator.
+ inline CglRedSplit2Param& getParam() {return param;}
+
+ /// Print some of the data members; used for debugging
+ void print() const;
+
+ /// Print the current simplex tableau
+ void printOptTab(OsiSolverInterface *solver) const;
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglRedSplit2();
+
+ /// Constructor with specified parameters
+ CglRedSplit2(const CglRedSplit2Param &RS_param);
+
+ /// Copy constructor
+ CglRedSplit2(const CglRedSplit2 &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglRedSplit2 & operator=(const CglRedSplit2& rhs);
+
+ /// Destructor
+ virtual ~CglRedSplit2 ();
+
+ //@}
+
+private:
+
+ // Private member methods
+
+/**@name Private member methods */
+
+ //@{
+
+ // Method generating the cuts after all CglRedSplit2 members are
+ // properly set. This does the actual work. Returns the number of
+ // generated cuts (or multipliers).
+ // Will generate cuts if cs != NULL, and will generate multipliers
+ // if lambda != NULL.
+ int generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda = NULL);
+
+ /// Compute the fractional part of value, allowing for small error.
+ inline double rs_above_integer(const double value) const;
+
+ /// Fill workNonBasicTab, depending on the column selection strategy.
+ /// Accepts a list of variables indices that should be ignored; by
+ /// default, this list is empty (it is only used by Lift & Project).
+ /// The list ignore_list contains -1 as the last element.
+ /// Note that the implementation of the ignore_list is not very efficient
+ /// if the list is long, so it should be used only if its short.
+ void fill_workNonBasicTab(CglRedSplit2Param::ColumnSelectionStrategy
+ strategy, const int* ignore_list = NULL);
+
+ /// Fill workNonBasicTab, alternate version for Lift & Project: also
+ /// reduces columns which are now nonbasic but are basic in xbar.
+ /// This function should be called only when CglRedSplit2 is used in
+ /// conjunction with CglLandP to generate L&P+RS cuts.
+ void fill_workNonBasicTab(const int* newnonbasics, const double* xbar,
+ CglRedSplit2Param::ColumnScalingStrategy scaling);
+
+ /// Reduce rows of workNonBasicTab, i.e. compute integral linear
+ /// combinations of the rows in order to reduce row coefficients on
+ /// workNonBasicTab
+ void reduce_workNonBasicTab(int numRows,
+ CglRedSplit2Param::RowSelectionStrategy
+ rowSelectionStrategy,
+ int maxIterations);
+
+ /// Generate a linear combination of the rows of the current LP
+ /// tableau, using the row multipliers stored in the matrix pi_mat
+ /// on the row of index index_row
+ void generate_row(int index_row, double *row);
+
+ /// Generate a mixed integer Gomory cut, when all non basic
+ /// variables are non negative and at their lower bound.
+ int generate_cgcut(double *row, double *rhs);
+
+ /// Use multiples of the initial inequalities to cancel out the coefficients
+ /// of the slack variables.
+ void eliminate_slacks(double *row,
+ const double *elements,
+ const int *start,
+ const int *indices,
+ const int *rowLength,
+ const double *rhs, double *rowrhs);
+
+ /// Change the sign of the coefficients of the continuous non basic
+ /// variables at their upper bound.
+ void flip(double *row);
+
+ /// Change the sign of the coefficients of the continuous non basic
+ /// variables at their upper bound and do the translations restoring
+ /// the original bounds. Modify the right hand side
+ /// accordingly.
+ void unflip(double *row, double *rowrhs);
+
+ /// Returns 1 if the row has acceptable max/min coeff ratio.
+ /// Compute max_coeff: maximum absolute value of the coefficients.
+ /// Compute min_coeff: minimum absolute value of the coefficients
+ /// larger than EPS_COEFF.
+ /// Return 0 if max_coeff/min_coeff > MAXDYN.
+ int check_dynamism(double *row);
+
+ /// Generate the packed cut from the row representation.
+ int generate_packed_row(const double *xlp, double *row,
+ int *rowind, double *rowelem,
+ int *card_row, double & rhs);
+
+ // Compute entries of is_integer.
+ void compute_is_integer();
+
+ // Check that two vectors are different.
+ bool rs_are_different_vectors(const int *vect1,
+ const int *vect2,
+ const int dim);
+
+ // allocate matrix of integers
+ void rs_allocmatINT(int ***v, int m, int n);
+ // deallocate matrix of integers
+ void rs_deallocmatINT(int ***v, int m);
+ // allocate matrix of doubles
+ void rs_allocmatDBL(double ***v, int m, int n);
+ // deallocate matrix of doubles
+ void rs_deallocmatDBL(double ***v, int m);
+ // print a vector of integers
+ void rs_printvecINT(const char *vecstr, const int *x, int n) const;
+ // print a vector of doubles
+ void rs_printvecDBL(const char *vecstr, const double *x, int n) const;
+ // print a matrix of integers
+ void rs_printmatINT(const char *vecstr, const int * const *x, int m, int n) const;
+ // print a matrix of doubles
+ void rs_printmatDBL(const char *vecstr, const double * const *x, int m, int n) const;
+ // dot product
+ double rs_dotProd(const double *u, const double *v, int dim) const;
+ double rs_dotProd(const int *u, const double *v, int dim) const;
+ // From Numerical Recipes in C: LU decomposition
+ int ludcmp(double **a, int n, int *indx, double *d, double* vv) const;
+ // from Numerical Recipes in C: backward substitution
+ void lubksb(double **a, int n, int *indx, double *b) const;
+
+ // Check if the linear combination given by listOfRows with given multipliers
+ // improves the norm of row #rowindex; note: multipliers are rounded!
+ // Returns the difference with respect to the old norm (if negative there is
+ // an improvement, if positive norm increases)
+ double compute_norm_change(double oldnorm, const int* listOfRows,
+ int numElemList, const double* multipliers) const;
+
+ // Compute the list of rows that should be used to reduce row #rowIndex
+ int get_list_rows_reduction(int rowIndex, int numRowsReduction,
+ int* list, const double* norm,
+ CglRedSplit2Param::RowSelectionStrategy
+ rowSelectionStrategy) const;
+
+ // Sorts the rows by increasing number of nonzeroes with respect to a given
+ // row (rowIndex), on the nonbasic variables (whichTab == 0 means only
+ // integer, whichTab == 1 means only workTab, whichTab == 2 means both).
+ // The array for sorting must be allocated (and deleted) by caller.
+ // Corresponds to BRS1 in the paper.
+ int sort_rows_by_nonzeroes(struct sortElement* array, int rowIndex,
+ int maxRows, int whichTab) const;
+
+ // Greedy variant of the previous function; slower but typically
+ // more effective. Corresponds to BRS2 in the paper.
+ int sort_rows_by_nonzeroes_greedy(struct sortElement* array, int rowIndex,
+ int maxRows, int whichTab) const;
+
+ // Sorts the rows by decreasing absolute value of the cosine of the
+ // angle with respect to a given row (rowIndex), on the nonbasic
+ // variables (whichTab == 0 means only integer, whichTab == 1 means
+ // only workTab, whichTab == 2 means both). The array for sorting
+ // must be allocated (and deleted) by caller. Very effective
+ // strategy in practice. Corresponds to BRS3 in the paper.
+ int sort_rows_by_cosine(struct sortElement* array, int rowIndex,
+ int maxRows, int whichTab) const;
+
+ // Did we hit the time limit?
+ inline bool checkTime() const{
+ if ((CoinCpuTime() - startTime) < param.getTimeLimit()){
+ return true;
+ }
+ return false;
+ }
+
+ //@}
+
+
+ // Private member data
+
+ /**@name Private member data */
+
+ //@{
+
+ /// Object with CglRedSplit2Param members.
+ CglRedSplit2Param param;
+
+ /// Number of rows ( = number of slack variables) in the current LP.
+ int nrow;
+
+ /// Number of structural variables in the current LP.
+ int ncol;
+
+ /// Number of rows which have been reduced
+ int numRedRows;
+
+ /// Lower bounds for structural variables
+ const double *colLower;
+
+ /// Upper bounds for structural variables
+ const double *colUpper;
+
+ /// Lower bounds for constraints
+ const double *rowLower;
+
+ /// Upper bounds for constraints
+ const double *rowUpper;
+
+ /// Righ hand side for constraints (upper bound for ranged constraints).
+ const double *rowRhs;
+
+ /// Reduced costs for columns
+ const double *reducedCost;
+
+ /// Row price
+ const double *rowPrice;
+
+ /// Objective coefficients
+ const double* objective;
+
+ /// Number of integer basic structural variables
+ int card_intBasicVar;
+
+ /// Number of integer basic structural variables that are fractional in the
+ /// current lp solution (at least param.away_ from being integer).
+ int card_intBasicVar_frac;
+
+ /// Number of integer non basic structural variables in the
+ /// current lp solution.
+ int card_intNonBasicVar;
+
+ /// Number of continuous non basic variables (structural or slack) in the
+ /// current lp solution.
+ int card_contNonBasicVar;
+
+ /// Number of continuous non basic variables (structural or slack) in the
+ /// current working set for coefficient reduction
+ int card_workNonBasicVar;
+
+ /// Number of non basic variables (structural or slack) at their
+ /// upper bound in the current lp solution.
+ int card_nonBasicAtUpper;
+
+ /// Number of non basic variables (structural or slack) at their
+ /// lower bound in the current lp solution.
+ int card_nonBasicAtLower;
+
+ /// Characteristic vector for integer basic structural variables
+ int *cv_intBasicVar;
+
+ /// Characteristic vector for integer basic structural variables
+ /// with non integer value in the current lp solution.
+ int *cv_intBasicVar_frac;
+
+ /// Characteristic vector for rows of the tableau selected for reduction
+ /// with non integer value in the current lp solution
+ int *cv_fracRowsTab;
+
+ /// List of integer structural basic variables
+ /// (in order of pivot in selected rows for cut generation).
+ int *intBasicVar;
+
+ /// List of integer structural basic variables with fractional value
+ /// (in order of pivot in selected rows for cut generation).
+ int *intBasicVar_frac;
+
+ /// List of integer structural non basic variables.
+ int *intNonBasicVar;
+
+ /// List of continuous non basic variables (structural or slack).
+ // slacks are considered continuous (no harm if this is not the case).
+ int *contNonBasicVar;
+
+ /// List of non basic variables (structural or slack) at their
+ /// upper bound.
+ int *nonBasicAtUpper;
+
+ /// List of non basic variables (structural or slack) at their lower
+ /// bound.
+ int *nonBasicAtLower;
+
+ /// Number of rows in the reduced tableau (= card_intBasicVar).
+ int mTab;
+
+ /// Number of columns in the reduced tableau (= card_contNonBasicVar)
+ int nTab;
+
+ /// Tableau of multipliers used to alter the rows used in generation.
+ /// Dimensions: mTab by mTab. Initially, pi_mat is the identity matrix.
+ int **pi_mat;
+
+ /// Simplex tableau for continuous non basic variables (structural or slack).
+ /// Only rows used for generation.
+ /// Dimensions: mTab by card_contNonBasicVar.
+ double **contNonBasicTab;
+
+ /// Current tableau for continuous non basic variables (structural or slack).
+ /// Only columns used for coefficient reduction.
+ /// Dimensions: mTab by card_workNonBasicVar.
+ double **workNonBasicTab;
+
+ /// Simplex tableau for integer non basic structural variables.
+ /// Only rows used for generation.
+ // Dimensions: mTab by card_intNonBasicVar.
+ double **intNonBasicTab;
+
+ /// Right hand side of the tableau.
+ /// Only rows used for generation.
+ double *rhsTab;
+
+ /// Norm of rows in workNonBasicTab; needed for faster computations
+ double *norm;
+
+ /// Characteristic vectors of structural integer variables or continuous
+ /// variables currently fixed to integer values.
+ int *is_integer;
+
+ /// Pointer on solver. Reset by each call to generateCuts().
+ OsiSolverInterface *solver;
+
+ /// Pointer on point to separate. Reset by each call to generateCuts().
+ const double *xlp;
+
+ /// Pointer on row activity. Reset by each call to generateCuts().
+ const double *rowActivity;
+
+ /// Pointer on matrix of coefficient ordered by rows.
+ /// Reset by each call to generateCuts().
+ const CoinPackedMatrix *byRow;
+
+ /// Time at which cut computations began.
+ /// Reset by each call to generateCuts().
+ double startTime;
+
+ //@}
+};
+
+//#############################################################################
+/** A function that tests some of the methods in the CglRedSplit2
+ class. The only reason for it not to be a member method is that
+ this way it doesn't have to be compiled into the library. And
+ that's a gain, because the library should be compiled with
+ optimization on, but this method should be compiled with
+ debugging. */
+void CglRedSplit2UnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglRedSplit2Param.hpp b/thirdparty/linux/include/coin/CglRedSplit2Param.hpp
new file mode 100644
index 0000000..369c676
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglRedSplit2Param.hpp
@@ -0,0 +1,495 @@
+// Name: CglRedSplit2Param.hpp
+// Author: Giacomo Nannicini
+// Singapore University of Technology and Design
+// Singapore
+// email: nannicini@sutd.edu.sg
+// Date: 03/09/09
+//-----------------------------------------------------------------------------
+// Copyright (C) 2010, Giacomo Nannicini and others. All Rights Reserved.
+
+#ifndef CglRedSplit2Param_H
+#define CglRedSplit2Param_H
+
+#include "CglParam.hpp"
+#include
+
+ /**@name CglRedSplit2 Parameters */
+ //@{
+
+ /** Class collecting parameters the Reduced-and-split cut generator.
+
+ An important thing to note is that the cut generator allows for
+ the selection of a number of strategies that can be combined
+ together. By default, a selection that typically yields a good
+ compromise between speed and cut strenght is made. The selection
+ can be changed by resetting the default choices (see the
+ functions whose name starts with "reset") or by setting the
+ parameter use_default_strategies to false in the
+ constructors. After this, the chosen strategies can be added to
+ the list by using the functions whose name starts with
+ "add". All strategies will be combined together: if we choose 3
+ row selection strategies, 2 column selection strategies, and 2
+ possible numbers of rows, we end up with a total of 3*2*2
+ combinations.
+
+ For a detailed explanation of the parameters and their meaning,
+ see the paper by Cornuejols and Nannicini: "Practical strategies
+ for generating rank-1 split cuts in mixed-integer linear
+ programming", on Mathematical Programming Computation.
+
+ Parameters of the generator are listed below.
+
+ - MAXDYN: Maximum ratio between largest and smallest non zero
+ coefficients in a cut. See method setMAXDYN().
+ - EPS_ELIM: Precision for deciding if a coefficient is zero when
+ eliminating slack variables. See method setEPS_ELIM().
+ - MINVIOL: Minimum violation for the current basic solution in
+ a generated cut. See method setMINVIOL().
+ - EPS_RELAX_ABS: Absolute relaxation of cut rhs.
+ - EPS_RELAX_REL: Relative relaxation of cut rhs.
+ - MAX_SUPP_ABS: Maximum cut support (absolute).
+ - MAX_SUPP_REL: Maximum cut support (relative): the formula to
+ compute maximum cut support is
+ MAX_SUPP_ABS + ncol*MAX_SUPP_REL.
+ - USE_INTSLACKS: Use integer slacks to generate cuts. (not implemented).
+ See method setUSE_INTSLACKS().
+ - normIsZero: Norm of a vector is considered zero if smaller than
+ this value. See method setNormIsZero().
+ - minNormReduction: a cut is generated if the new norm of the row on the
+ continuous nonbasics is reduced by at least
+ this factor (relative reduction).
+ - away: Look only at basic integer variables whose current value
+ is at least this value from being integer. See method setAway().
+ - maxSumMultipliers: maximum sum (in absolute value) of row multipliers
+ - normalization: normalization factor for the norm of lambda in the
+ coefficient reduction algorithm (convex min problem)
+ - numRowsReduction: Maximum number of rows in the linear system for
+ norm reduction.
+ - columnSelectionStrategy: parameter to select which columns should be
+ used for coefficient reduction.
+ - rowSelectionStrategy: parameter to select which rows should be
+ used for coefficient reduction.
+ - timeLimit: Time limit (in seconds) for cut generation.
+ - maxNumCuts: Maximum number of cuts that can be returned at each pass;
+ we could generate more cuts than this number (see below)
+ - maxNumComputedCuts: Maximum number of cuts that can be computed
+ by the generator at each pass
+ - maxNonzeroesTab : Rows of the simplex tableau with more than
+ this number of nonzeroes will not be
+ considered for reduction. Only works if
+ RS_FAST_* are defined in CglRedSplit2.
+ - skipGomory: Skip traditional Gomory cuts, i.e. GMI cuts arising from
+ a single row of the tableau (instead of a combination).
+ Default is 1 (true), because we assume that they are
+ generated by a traditional Gomory generator anyway.
+ */
+ //@}
+
+class CglRedSplit2Param : public CglParam {
+
+public:
+ /** Enumerations for parameters */
+
+ /** Row selection strategies; same names as in the paper */
+ enum RowSelectionStrategy{
+ /* Pick rows that introduce the fewest nonzeroes on integer nonbasics */
+ RS1,
+ /* Pick rows that introduce the fewest nonzeroes on the set of working
+ continuous nonbasics */
+ RS2,
+ /* Pick rows that introduce the fewest nonzeroes on both integer and
+ working continuous nonbasics */
+ RS3,
+ /* Same as RS0 but with greedy algorithm */
+ RS4,
+ /* Same as RS1 but with greedy algorithm */
+ RS5,
+ /* Same as RS2 but with greedy algorithm */
+ RS6,
+ /* Pick rows with smallest angle in the space of integer and working
+ continuous nonbasics */
+ RS7,
+ /* Pick rows with smallest angle in the space of working
+ continuous nonbasics */
+ RS8,
+ /* Use all strategies */
+ RS_ALL,
+ /* Use best ones - that is, RS8 and RS7 */
+ RS_BEST
+ };
+
+ /** Column selection strategies; again, look them up in the paper. */
+ enum ColumnSelectionStrategy{
+ /* C-3P */
+ CS1, CS2, CS3,
+ /* C-5P */
+ CS4, CS5, CS6, CS7, CS8,
+ /* I-2P-2/3 */
+ CS9, CS10,
+ /* I-2P-4/5 */
+ CS11, CS12,
+ /* I-2P-1/2 */
+ CS13, CS14,
+ /* I-3P */
+ CS15, CS16, CS17,
+ /* I-4P */
+ CS18, CS19, CS20, CS21,
+ /* Use all strategies up to this point */
+ CS_ALL,
+ /* Use best strategies (same effect as CS_ALL, because it turns out that
+ using all strategies is the best thing to do) */
+ CS_BEST,
+ /* Optimize over all continuous nonbasic columns; this does not give
+ good results, but we use it for testing Lift & Project + RedSplit */
+ CS_ALLCONT,
+ /* Lift & Project specific strategy: only select variables which
+ are nonbasic in the tableau but are basic in the point to cut
+ off. This strategy cannot be used outside L&P. It is not very
+ effective even with L&P, but is left here for testing.*/
+ CS_LAP_NONBASICS
+ };
+
+ /** Scaling strategies for new nonbasic columns for Lift & Project;
+ * "factor" is the value of columnScalingBoundLAP_ */
+ enum ColumnScalingStrategy{
+ /* No scaling */
+ SC_NONE,
+ /* Multiply by |xbar[i]| where xbar[i] is the value of the
+ corresponding component of the point that we want to cut off */
+ SC_LINEAR,
+ /* Multiply by min(factor,|xbar[i]|) */
+ SC_LINEAR_BOUNDED,
+ /* Multiply by min(factor,log(|xbar[i]|)) */
+ SC_LOG_BOUNDED,
+ /* Multiply all new nonbasics by factor */
+ SC_UNIFORM,
+ /* Multiply only nonzero coefficients by factor */
+ SC_UNIFORM_NZ
+ };
+
+ /**@name Set/get methods */
+ //@{
+ /** Set away, the minimum distance from being integer used for selecting
+ rows for cut generation; all rows whose pivot variable should be
+ integer but is more than away from integrality will be selected;
+ Default: 0.005 */
+ virtual void setAway(double value);
+ /// Get value of away
+ inline double getAway() const {return away_;}
+
+ /** Set the value of EPS_ELIM, epsilon for values of coefficients when
+ eliminating slack variables;
+ Default: 0.0 */
+ void setEPS_ELIM(double value);
+ /** Get the value of EPS_ELIM */
+ double getEPS_ELIM() const {return EPS_ELIM;}
+
+ /** Set EPS_RELAX_ABS */
+ virtual void setEPS_RELAX_ABS(double eps_ra);
+ /** Get value of EPS_RELAX_ABS */
+ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;}
+
+ /** Set EPS_RELAX_REL */
+ virtual void setEPS_RELAX_REL(double eps_rr);
+ /** Get value of EPS_RELAX_REL */
+ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;}
+
+ // Set the maximum ratio between largest and smallest non zero
+ // coefficients in a cut. Default: 1e6.
+ virtual void setMAXDYN(double value);
+ /** Get the value of MAXDYN */
+ inline double getMAXDYN() const {return MAXDYN;}
+
+ /** Set the value of MINVIOL, the minimum violation for the current
+ basic solution in a generated cut. Default: 1e-3 */
+ virtual void setMINVIOL(double value);
+ /** Get the value of MINVIOL */
+ inline double getMINVIOL() const {return MINVIOL;}
+
+ /** Maximum absolute support of the cutting planes. Default: INT_MAX.
+ Aliases for consistency with our naming scheme. */
+ inline void setMAX_SUPP_ABS(int value) {setMAX_SUPPORT(value);}
+ inline int getMAX_SUPP_ABS() const {return MAX_SUPPORT;}
+
+ /** Maximum relative support of the cutting planes. Default: 0.0.
+ The maximum support is MAX_SUPP_ABS + MAX_SUPPREL*ncols. */
+ inline void setMAX_SUPP_REL(double value);
+ inline double getMAX_SUPP_REL() const {return MAX_SUPP_REL;}
+
+ /** Set the value of USE_INTSLACKS. Default: 0 */
+ virtual void setUSE_INTSLACKS(int value);
+ /** Get the value of USE_INTSLACKS */
+ inline int getUSE_INTSLACKS() const {return USE_INTSLACKS;}
+
+ /** Set the value of normIsZero, the threshold for considering a norm to be
+ 0; Default: 1e-5 */
+ virtual void setNormIsZero(double value);
+ /** Get the value of normIsZero */
+ inline double getNormIsZero() const {return normIsZero_;}
+
+ /** Set the value of minNormReduction; Default: 0.1 */
+ virtual void setMinNormReduction(double value);
+ /** Get the value of normIsZero */
+ inline double getMinNormReduction() const {return minNormReduction_;}
+
+ /** Set the value of maxSumMultipliers; Default: 10 */
+ virtual void setMaxSumMultipliers(int value);
+ /** Get the value of maxSumMultipliers */
+ inline int getMaxSumMultipliers() const {return maxSumMultipliers_;}
+
+ /** Set the value of normalization; Default: 0.0001 */
+ virtual void setNormalization(double value);
+ /** Get the value of normalization */
+ inline double getNormalization() const {return normalization_;}
+
+ /** Set the value of numRowsReduction, max number of rows that are used
+ * for each row reduction step. In particular, the linear system will
+ * involve a numRowsReduction*numRowsReduction matrix */
+ virtual void addNumRowsReduction(int value);
+ /// get the value
+ inline std::vector getNumRowsReduction() const {return numRowsReduction_;}
+ /// reset
+ inline void resetNumRowsReduction() {numRowsReduction_.clear();}
+
+ /** Add the value of columnSelectionStrategy */
+ virtual void addColumnSelectionStrategy(ColumnSelectionStrategy value);
+ /// get the value
+ inline std::vector getColumnSelectionStrategy() const {return columnSelectionStrategy_;}
+ /// reset
+ inline void resetColumnSelectionStrategy(){columnSelectionStrategy_.clear();}
+
+ /** Set the value for rowSelectionStrategy, which changes the way we choose
+ * the rows for the reduction step */
+ virtual void addRowSelectionStrategy(RowSelectionStrategy value);
+ /// get the value
+ inline std::vector getRowSelectionStrategy() const {return rowSelectionStrategy_;};
+ /// reset
+ inline void resetRowSelectionStrategy() {rowSelectionStrategy_.clear();}
+
+ /** Set the value of numRowsReductionLAP, max number of rows that are used
+ * for each row reduction step during Lift & Project.
+ * In particular, the linear system will involve a
+ * numRowsReduction*numRowsReduction matrix */
+ virtual void addNumRowsReductionLAP(int value);
+ /// get the value
+ inline std::vector getNumRowsReductionLAP() const {return numRowsReductionLAP_;}
+ /// reset
+ inline void resetNumRowsReductionLAP() {numRowsReductionLAP_.clear();}
+
+ /** Add the value of columnSelectionStrategyLAP */
+ virtual void addColumnSelectionStrategyLAP(ColumnSelectionStrategy value);
+ /// get the value
+ inline std::vector getColumnSelectionStrategyLAP() const {return columnSelectionStrategyLAP_;}
+ /// reset
+ inline void resetColumnSelectionStrategyLAP(){columnSelectionStrategyLAP_.clear();}
+
+ /** Set the value for rowSelectionStrategyLAP, which changes the way we
+ * choose the rows for the reduction step */
+ virtual void addRowSelectionStrategyLAP(RowSelectionStrategy value);
+ /// get the value
+ inline std::vector getRowSelectionStrategyLAP() const {return rowSelectionStrategyLAP_;};
+ /// reset
+ inline void resetRowSelectionStrategyLAP() {rowSelectionStrategyLAP_.clear();}
+
+ /** Set the value for columnScalingStrategyLAP, which sets the way nonbasic
+ * columns that are basic in the fractional point to cut off are scaled */
+ virtual void setColumnScalingStrategyLAP(ColumnScalingStrategy value);
+ /// get the value
+ inline ColumnScalingStrategy getColumnScalingStrategyLAP() const {return columnScalingStrategyLAP_; };
+
+ /** Set the value for the bound in the column scaling factor */
+ virtual void setColumnScalingBoundLAP(double value);
+ /// get the value
+ inline double getColumnScalingBoundLAP() const {return columnScalingBoundLAP_;};
+
+ /** Set the value of the time limit for cut generation (in seconds) */
+ virtual void setTimeLimit(double value);
+ /// get the value
+ inline double getTimeLimit() const {return timeLimit_;}
+
+ /** Set the value for the maximum number of cuts that can be returned */
+ virtual void setMaxNumCuts(int value);
+ /// get the value
+ inline int getMaxNumCuts() const {return maxNumCuts_;}
+
+ /** Set the value for the maximum number of cuts that can be computed */
+ virtual void setMaxNumComputedCuts(int value);
+ /// get the value
+ inline int getMaxNumComputedCuts() const {return maxNumComputedCuts_;}
+
+ /** Set the value for the maximum number of nonzeroes in a row of
+ * the simplex tableau for the row to be considered */
+ virtual void setMaxNonzeroesTab(int value);
+ /// get the value
+ inline int getMaxNonzeroesTab() const {return maxNonzeroesTab_;}
+
+ /** Set the value of skipGomory: should we skip simple Gomory cuts,
+ * i.e. GMI cuts derived from a single row of the simple tableau?
+ * This is 1 (true) by default: we only generate cuts from linear
+ * combinations of at least two rows. */
+ virtual void setSkipGomory(int value);
+ /// get the value
+ inline int getSkipGomory() const {return skipGomory_;}
+
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor. If use_default_strategies is true, we add
+ /// to the list of strategies the default ones. If is false, the
+ /// list of strategies is left empty (must be populated before usage!).
+ CglRedSplit2Param(bool use_default_strategies = true,
+ double eps = 1e-12,
+ double eps_coeff = 1e-11,
+ double eps_elim = 0.0,
+ double eps_relax_abs = 1e-11,
+ double eps_relax_rel = 1e-13,
+ double max_dyn = 1e6,
+ double min_viol = 1e-3,
+ int max_supp_abs = 1000,
+ double max_supp_rel = 0.1,
+ int use_int_slacks = 0,
+ double norm_zero = 1e-5,
+ double minNormReduction = 0.1,
+ int maxSumMultipliers = 10,
+ double normalization = 0.0001,
+ double away = 0.005,
+ double timeLimit = 60,
+ int maxNumCuts = 10000,
+ int maxNumComputedCuts = 10000,
+ int maxNonzeroesTab = 1000,
+ double columnScalingBoundLAP = 5.0,
+ int skipGomory = 1);
+
+ /// Constructor from CglParam. If use_default_strategies is true, we
+ /// add to the list of strategies the default ones. If is false, the
+ /// list of strategies is left empty (must be populated before
+ /// usage!).
+ CglRedSplit2Param(const CglParam &source,
+ bool use_default_strategies = true,
+ double eps_elim = 0.0,
+ double eps_relax_abs = 1e-11,
+ double eps_relax_rel = 1e-13,
+ double max_dyn = 1e6,
+ double min_viol = 1e-3,
+ double max_supp_rel = 0.1,
+ int use_int_slacks = 0,
+ double norm_zero = 1e-5,
+ double minNormReduction = 0.1,
+ int maxSumMultipliers = 10,
+ double normalization = 0.0001,
+ double away = 0.005,
+ double timeLimit = 60,
+ int maxNumCuts = 10000,
+ int maxNumComputedCuts = 10000,
+ int maxNonzeroesTab = 1000,
+ double columnScalingBoundLAP = 5.0,
+ int skipGomory = 1);
+
+ /// Copy constructor
+ CglRedSplit2Param(const CglRedSplit2Param &source);
+
+ /// Clone
+ virtual CglRedSplit2Param* clone() const;
+
+ /// Assignment operator
+ virtual CglRedSplit2Param& operator=(const CglRedSplit2Param &rhs);
+
+ /// Destructor
+ virtual ~CglRedSplit2Param();
+ //@}
+
+protected:
+
+ /**@name Parameters */
+ //@{
+
+ /** Epsilon for value of coefficients when eliminating slack variables.
+ Default: 0.0. */
+ double EPS_ELIM;
+
+ /** Value added to the right hand side of each generated cut to relax it.
+ Default: 1e-11 */
+ double EPS_RELAX_ABS;
+
+ /** For a generated cut with right hand side rhs_val,
+ EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint.
+ Default: 1e-13 */
+ double EPS_RELAX_REL;
+
+ // Maximum ratio between largest and smallest non zero
+ // coefficients in a cut. Default: 1e6.
+ double MAXDYN;
+
+ /// Minimum violation for the current basic solution in a generated cut.
+ /// Default: 1e-3.
+ double MINVIOL;
+
+ /// Maximum support - relative part of the formula
+ double MAX_SUPP_REL;
+
+ /// Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0.
+ int USE_INTSLACKS;
+
+ /// Norm of a vector is considered zero if smaller than normIsZero;
+ /// Default: 1e-5.
+ double normIsZero_;
+
+ /// Minimum reduction to accept a new row.
+ double minNormReduction_;
+
+ /// Maximum sum of the vector of row multipliers to generate a cut
+ int maxSumMultipliers_;
+
+ /// Normalization factor for the norm of lambda in the quadratic
+ /// minimization problem that is solved during the coefficient reduction step
+ double normalization_;
+
+ /// Use row only if pivot variable should be integer but is more
+ /// than away_ from being integer. Default: 0.005
+ double away_;
+
+ /// Maximum number of rows to use for the reduction of a given row.
+ std::vector numRowsReduction_;
+
+ /// Column selection method
+ std::vector columnSelectionStrategy_;
+
+ /// Row selection method
+ std::vector rowSelectionStrategy_;
+
+ /// Maximum number of rows to use for the reduction during Lift & Project
+ std::vector numRowsReductionLAP_;
+
+ /// Column selection method for Lift & Project
+ std::vector columnSelectionStrategyLAP_;
+
+ /// Row selection method for Lift & Project
+ std::vector rowSelectionStrategyLAP_;
+
+ /// Column scaling strategy for the nonbasics columns that were basic in
+ /// the point that we want to cut off (Lift & Project only)
+ ColumnScalingStrategy columnScalingStrategyLAP_;
+
+ /// Minimum value for column scaling (Lift & Project only)
+ double columnScalingBoundLAP_;
+
+ /// Time limit
+ double timeLimit_;
+
+ /// Maximum number of returned cuts
+ int maxNumCuts_;
+
+ /// Maximum number of computed cuts
+ int maxNumComputedCuts_;
+
+ /// Maximum number of nonzeroes in tableau row for reduction
+ int maxNonzeroesTab_;
+
+ /// Skip simple Gomory cuts
+ int skipGomory_;
+
+ //@}
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglRedSplitParam.hpp b/thirdparty/linux/include/coin/CglRedSplitParam.hpp
new file mode 100644
index 0000000..2601fb2
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglRedSplitParam.hpp
@@ -0,0 +1,272 @@
+// Name: CglRedSplitParam.hpp
+// Author: Francois Margot
+// Tepper School of Business
+// Carnegie Mellon University, Pittsburgh, PA 15213
+// email: fmargot@andrew.cmu.edu
+// Date: 11/24/06
+//
+// $Id: CglRedSplitParam.hpp 1122 2013-04-06 20:39:53Z stefan $
+//-----------------------------------------------------------------------------
+// Copyright (C) 2006, Francois Margot and others. All Rights Reserved.
+// This code is licensed under the terms of the Eclipse Public License (EPL).
+
+#ifndef CglRedSplitParam_H
+#define CglRedSplitParam_H
+
+#include "CglParam.hpp"
+
+
+ /**@name CglRedSplit Parameters */
+ //@{
+
+ /** Class collecting parameters the Reduced-and-split cut generator.
+
+ Parameters of the generator are listed below. Modifying the default
+ values for parameters other than the last four might result in
+ invalid cuts.
+
+ - LUB: Value considered large for the absolute value of a lower or upper
+ bound on a variable. See method setLUB().
+ - MAXDYN: Maximum ratio between largest and smallest non zero
+ coefficients in a cut. See method setMAXDYN().
+ - MAXDYN_LUB: Maximum ratio between largest and smallest non zero
+ coefficients in a cut involving structural variables with
+ lower or upper bound in absolute value larger than LUB.
+ Should logically be larger or equal to MAXDYN.
+ See method setMAXDYN_LUB().
+ - EPS_ELIM: Precision for deciding if a coefficient is zero when
+ eliminating slack variables. See method setEPS_ELIM().
+ - EPS_COEFF_LUB: Precision for deciding if a coefficient of a
+ generated cut is zero when the corresponding
+ variable has a lower or upper bound larger than
+ LUB in absolute value. See method setEPS_COEFF_LUB().
+ - MINVIOL: Minimum violation for the current basic solution in
+ a generated cut. See method setMINVIOL().
+ - USE_INTSLACKS: Use integer slacks to generate cuts. (not implemented).
+ See method setUSE_INTSLACKS().
+ - USE_CG2: Use alternative formula to generate a mixed integer Gomory
+ cut (see methods CglRedSPlit::generate_cgcut()
+ and CglRedSPlit::generate_cgcut_2()). See method setUSE_CG2().
+ - normIsZero: Norm of a vector is considered zero if smaller than
+ this value. See method setNormIsZero().
+ - minReduc: Reduction is performed only if the norm of the vector is
+ reduced by this fraction. See method setMinReduc().
+ - away: Look only at basic integer variables whose current value
+ is at least this value from being integer. See method setAway().
+ - maxTab: Controls the number of rows selected for the generation. See
+ method setMaxTab().
+ */
+ //@}
+
+class CglRedSplitParam : public CglParam {
+
+public:
+
+ /**@name Set/get methods */
+ //@{
+ /** Set away, the minimum distance from being integer used for selecting
+ rows for cut generation; all rows whose pivot variable should be
+ integer but is more than away from integrality will be selected;
+ Default: 0.05 */
+ virtual void setAway(const double value);
+ /// Get value of away
+ inline double getAway() const {return away_;}
+
+ /** Set the value of LUB, value considered large for the absolute value of
+ a lower or upper bound on a variable;
+ Default: 1000 */
+ virtual void setLUB(const double value);
+ /** Get the value of LUB */
+ inline double getLUB() const {return LUB;}
+
+ /** Set the value of EPS_ELIM, epsilon for values of coefficients when
+ eliminating slack variables;
+ Default: 1e-12 */
+ void setEPS_ELIM(const double value);
+ /** Get the value of EPS_ELIM */
+ double getEPS_ELIM() const {return EPS_ELIM;}
+
+ /** Set EPS_RELAX_ABS */
+ virtual void setEPS_RELAX_ABS(const double eps_ra);
+ /** Get value of EPS_RELAX_ABS */
+ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;}
+
+ /** Set EPS_RELAX_REL */
+ virtual void setEPS_RELAX_REL(const double eps_rr);
+ /** Get value of EPS_RELAX_REL */
+ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;}
+
+ // Set the maximum ratio between largest and smallest non zero
+ // coefficients in a cut. Default: 1e8.
+ virtual void setMAXDYN(double value);
+ /** Get the value of MAXDYN */
+ inline double getMAXDYN() const {return MAXDYN_LUB;}
+
+ // Set the maximum ratio between largest and smallest non zero
+ // coefficient in a cut involving structural variables with
+ // lower or upper bound in absolute value larger than LUB.
+ // Should logically be larger or equal to MAXDYN. Default: 1e13.
+ virtual void setMAXDYN_LUB(double value);
+ /** Get the value of MAXDYN_LUB */
+ inline double getMAXDYN_LUB() const {return MAXDYN_LUB;}
+
+ /** Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for
+ variables with absolute value of lower or upper bound larger than LUB;
+ Default: 1e-13 */
+ virtual void setEPS_COEFF_LUB(const double value);
+ /** Get the value of EPS_COEFF_LUB */
+ inline double getEPS_COEFF_LUB() const {return EPS_COEFF_LUB;}
+
+ /** Set the value of MINVIOL, the minimum violation for the current
+ basic solution in a generated cut. Default: 1e-7 */
+ virtual void setMINVIOL(double value);
+ /** Get the value of MINVIOL */
+ inline double getMINVIOL() const {return MINVIOL;}
+
+ /** Set the value of USE_INTSLACKS. Default: 0 */
+ virtual void setUSE_INTSLACKS(int value);
+ /** Get the value of USE_INTSLACKS */
+ inline int getUSE_INTSLACKS() const {return USE_INTSLACKS;}
+
+ /** Set the value of USE_CG2. Default: 0 */
+ virtual void setUSE_CG2(int value);
+ /** Get the value of USE_CG2 */
+ inline int getUSE_CG2() const {return USE_CG2;}
+
+ /** Set the value of normIsZero, the threshold for considering a norm to be
+ 0; Default: 1e-5 */
+ virtual void setNormIsZero(const double value);
+ /** Get the value of normIsZero */
+ inline double getNormIsZero() const {return normIsZero;}
+
+ /** Set the value of minReduc, threshold for relative norm improvement for
+ performing a reduction; Default: 0.05 */
+ virtual void setMinReduc(const double value);
+ /// Get the value of minReduc
+ inline double getMinReduc() const {return minReduc;}
+
+ /** Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where
+ mTab is the number of rows used in the combinations and nTab is the
+ number of continuous non basic variables. The work of the generator is
+ proportional to (mTab * mTab * CoinMax(mTab, nTab)). Reducing the value of
+ maxTab makes the generator faster, but weaker. Default: 1e7. */
+ virtual void setMaxTab(const double value);
+ /// Get the value of maxTab
+ inline double getMaxTab() const {return maxTab_;}
+ //@}
+
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglRedSplitParam(const double lub = 1000.0,
+ const double eps_elim = 1e-12,
+ const double eps_relax_abs = 1e-8,
+ const double eps_relax_rel = 0.0,
+ const double max_dyn = 1e8,
+ const double max_dyn_lub = 1e13,
+ const double eps_coeff_lub = 1e-13,
+ const double min_viol = 1e-7,
+ const int use_int_slacks = 0,
+ const int use_cg2 = 0,
+ const double norm_zero = 1e-5,
+ const double min_reduc = 0.05,
+ const double away = 0.05,
+ const double max_tab = 1e7);
+
+ /// Constructor from CglParam
+ CglRedSplitParam(const CglParam &source,
+ const double lub = 1000.0,
+ const double eps_elim = 1e-12,
+ const double eps_relax_abs = 1e-8,
+ const double eps_relax_rel = 0.0,
+ const double max_dyn = 1e8,
+ const double max_dyn_lub = 1e13,
+ const double eps_coeff_lub = 1e-13,
+ const double min_viol = 1e-7,
+ const int use_int_slacks = 0,
+ const int use_cg2 = 0,
+ const double norm_zero = 1e-5,
+ const double min_reduc = 0.05,
+ const double away = 0.05,
+ const double max_tab = 1e7);
+
+ /// Copy constructor
+ CglRedSplitParam(const CglRedSplitParam &source);
+
+ /// Clone
+ virtual CglRedSplitParam* clone() const;
+
+ /// Assignment operator
+ virtual CglRedSplitParam& operator=(const CglRedSplitParam &rhs);
+
+ /// Destructor
+ virtual ~CglRedSplitParam();
+ //@}
+
+protected:
+
+ /**@name Parameters */
+ //@{
+
+ /** Value considered large for the absolute value of lower or upper
+ bound on a variable. Default: 1000. */
+ double LUB;
+
+ /** Epsilon for value of coefficients when eliminating slack variables.
+ Default: 1e-12. */
+ double EPS_ELIM;
+
+ /** Value added to the right hand side of each generated cut to relax it.
+ Default: 1e-8 */
+ double EPS_RELAX_ABS;
+
+ /** For a generated cut with right hand side rhs_val,
+ EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint.
+ Default: 0 */
+ double EPS_RELAX_REL;
+
+ // Maximum ratio between largest and smallest non zero
+ // coefficients in a cut. Default: 1e8.
+ double MAXDYN;
+
+ // Maximum ratio between largest and smallest non zero
+ // coefficients in a cut involving structural variables with
+ // lower or upper bound in absolute value larger than LUB.
+ // Should logically be larger or equal to MAXDYN. Default: 1e13.
+ double MAXDYN_LUB;
+
+ /// Epsilon for value of coefficients for variables with absolute value of
+ /// lower or upper bound larger than LUB. Default: 1e-13.
+ double EPS_COEFF_LUB;
+
+ /// Minimum violation for the current basic solution in a generated cut.
+ /// Default: 1e-7.
+ double MINVIOL;
+
+ /// Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0.
+ int USE_INTSLACKS;
+
+ /// Use second way to generate a mixed integer Gomory cut
+ /// (see methods generate_cgcut()) and generate_cgcut_2()). Default: 0.
+ int USE_CG2;
+
+ /// Norm of a vector is considered zero if smaller than normIsZero;
+ /// Default: 1e-5.
+ double normIsZero;
+
+ /// Minimum reduction in percent that must be achieved by a potential
+ /// reduction step in order to be performed; Between 0 and 1, default: 0.05.
+ double minReduc;
+
+ /// Use row only if pivot variable should be integer but is more
+ /// than away_ from being integer.
+ double away_;
+
+ /// Maximum value for (mTab * mTab * CoinMax(mTab, nTab)). See method
+ /// setMaxTab().
+ double maxTab_;
+
+ //@}
+};
+
+#endif
diff --git a/thirdparty/linux/include/coin/CglResidualCapacity.hpp b/thirdparty/linux/include/coin/CglResidualCapacity.hpp
new file mode 100644
index 0000000..1e26e46
--- /dev/null
+++ b/thirdparty/linux/include/coin/CglResidualCapacity.hpp
@@ -0,0 +1,240 @@
+// LAST EDIT:
+//-----------------------------------------------------------------------------
+// Implementation of Residual Capacity Inequalities
+// Francisco Barahona (barahon@us.ibm.com)
+//
+// date: May 18, 2006
+//-----------------------------------------------------------------------------
+// Copyright (C) 2004, International Business Machines Corporation and others.
+// All Rights Reserved.
+// This code is published under the Eclipse Public License.
+
+#ifndef CglResidualCapacity_H
+#define CglResidualCapacity_H
+
+#include
+#include
+//#include
+
+#include "CoinError.hpp"
+
+#include "CglCutGenerator.hpp"
+
+//=============================================================================
+
+#ifndef CGL_DEBUG
+#define CGL_DEBUG 0
+#endif
+
+//=============================================================================
+
+
+
+
+//=============================================================================
+
+/** Residual Capacity Inequalities Cut Generator Class
+
+ References:
+ T Magnanti, P Mirchandani, R Vachani,
+ "The convex hull of two core capacitated network design problems,"
+ Math Programming 60 (1993), 233-250.
+
+ A Atamturk, D Rajan,
+ "On splittable and unsplittable flow capacitated network design
+ arc-set polyhedra," Math Programming 92 (2002), 315-333. **/
+
+class CglResidualCapacity : public CglCutGenerator {
+
+ friend void CglResidualCapacityUnitTest(const OsiSolverInterface * siP,
+ const std::string mpdDir );
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Enumeration constants that describe the various types of rows
+ enum RowType {
+ /** row of the type a_1 c_1 + + a_k c_k - d z_1 - - d z_p <= b,
+ where c_i are continuous variables and z_j are integer variables
+ */
+ ROW_L,
+ /** row of the type -a_1 c_1 - - a_k c_k + d z_1 + + d z_p >= b,
+ where c_i are continuous variables and z_j are integer variables
+ */
+ ROW_G,
+ /** equation that can be treated as ROW_L and ROW_G
+ */
+ ROW_BOTH,
+ /** Other types of rows
+ */
+ ROW_OTHER
+ };
+
+
+public:
+ /**@name Get and Set Parameters */
+ //@{
+ /// Set Epsilon
+ void setEpsilon(double value);
+ /// Get Epsilon
+ double getEpsilon() const;
+ /// Set Tolerance
+ void setTolerance(double value);
+ /// Get Tolerance
+ double getTolerance() const;
+ /// Set doPreproc
+ void setDoPreproc(int value);
+ /// Get doPreproc
+ bool getDoPreproc() const;
+ //@}
+
+ /**@name Generate Cuts */
+ //@{
+ /** Generate Residual Capacity cuts for the model data
+ contained in si. The generated cuts are inserted
+ in the collection of cuts cs.
+ */
+ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
+ const CglTreeInfo info = CglTreeInfo());
+ //@}
+
+ //---------------------------------------------------------------------------
+ /**@name Constructors and destructors */
+ //@{
+ /// Default constructor
+ CglResidualCapacity ();
+
+ /// Alternate Constructor
+ CglResidualCapacity ( const double tolerance );
+
+ /// Copy constructor
+ CglResidualCapacity (
+ const CglResidualCapacity &);
+
+ /// Clone
+ virtual CglCutGenerator * clone() const;
+
+ /// Assignment operator
+ CglResidualCapacity &
+ operator=(
+ const CglResidualCapacity& rhs);
+
+ /// Destructor
+ virtual
+ ~CglResidualCapacity ();
+ /// This is to refresh preprocessing
+ virtual void refreshPrep();
+ //@}
+
+
+
+private:
+ //--------------------------------------------------------------------------
+ // Private member methods
+
+ // Construct
+ void gutsOfConstruct ( const double tolerance);
+
+ // Delete
+ void gutsOfDelete();
+
+ // Copy
+ void gutsOfCopy (const CglResidualCapacity& rhs);
+
+ // Do preprocessing.
+ // It determines the type of each row.
+ // It may change sense and RHS for ranged rows
+ void resCapPreprocess(const OsiSolverInterface& si);
+
+ // Determine the type of a given row.
+ RowType determineRowType(const OsiSolverInterface& si,
+ const int rowLen, const int* ind,
+ const double* coef, const char sense,
+ const double rhs,
+ const double* colLowerBound,
+ const double* colUpperBound) const;
+ // helps the function above
+ bool treatAsLessThan(const OsiSolverInterface& si,
+ const int rowLen, const int* ind,
+ const double* coef,
+ const double rhs,
+ const double* colLowerBound,
+ const double* colUpperBound) const;
+
+ // Generate Residual Capacity cuts
+ void generateResCapCuts( const OsiSolverInterface& si,
+ const double* xlp,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ const CoinPackedMatrix& matrixByRow,
+ const double* LHS,
+ const double* coefByRow,
+ const int* colInds,
+ const int* rowStarts,
+ const int* rowLengths,
+ OsiCuts& cs ) const;
+
+
+ // Residual Capacity separation
+ bool resCapSeparation(const OsiSolverInterface& si,
+ const int rowLen, const int* ind,
+ const double* coef,
+ const double rhs,
+ const double *xlp,
+ const double* colUpperBound,
+ const double* colLowerBound,
+ OsiRowCut& resCapCut) const;
+
+
+
+private:
+ //---------------------------------------------------------------------------
+ // Private member data
+ /** Tolerance used for numerical purposes, default value: 1.e-6 **/
+ double EPSILON_;
+ /** If violation of a cut is greater that this number,
+ the cut is accepted, default value: 1.e-4 **/
+ double TOLERANCE_;
+ /** Controls the preprocessing of the matrix to identify rows suitable for
+ cut generation.