summaryrefslogtreecommitdiff
path: root/sci_gateway/cpp/globals.cpp
diff options
context:
space:
mode:
authorHarpreet2015-08-27 02:32:30 +0530
committerHarpreet2015-08-27 02:32:30 +0530
commitf9afc284ce324fa3c13606ad90895beec507c249 (patch)
treea1680fec3342c4eb00b73cd056ff9fad519c5877 /sci_gateway/cpp/globals.cpp
downloadFOSSEE-Optimization-toolbox-f9afc284ce324fa3c13606ad90895beec507c249.tar.gz
FOSSEE-Optimization-toolbox-f9afc284ce324fa3c13606ad90895beec507c249.tar.bz2
FOSSEE-Optimization-toolbox-f9afc284ce324fa3c13606ad90895beec507c249.zip
Master File
Diffstat (limited to 'sci_gateway/cpp/globals.cpp')
-rw-r--r--sci_gateway/cpp/globals.cpp101
1 files changed, 101 insertions, 0 deletions
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 <symphony.h>
+#include <sciprint.h>
+
+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;
+}
+
+}