Browse Source

Remove gurobi

Olivier Marty 8 years ago
parent
commit
bc8d993270
2 changed files with 3 additions and 71 deletions
  1. 3 15
      Olivier/Makefile
  2. 0 56
      Olivier/gurobi.cpp

+ 3 - 15
Olivier/Makefile

@@ -1,9 +1,5 @@
-GUROBI_DIR=/opt/gurobi650/linux64
-CPP=g++ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 -m64 -g -std=c++11
-#INC=-I$(GUROBI_DIR)/include
-#LIBS=-L $(GUROBI_DIR)/lib -lgurobi_c++ -lgurobi65 -lpthread -lm
+CPP=g++ -O2 -std=c++11
 SOURCES=instance.cpp main.cpp
-SOURCES_GUROBI=gurobi.cpp
 
 all: source.zip bd.out moaw.out red.out
 
@@ -28,21 +24,13 @@ source.zip: $(SOURCES)
 main: $(SOURCES:.cpp=.o)
 	$(CPP) -o $@ $^ $(INC) $(LIBS)
 
-gurobi: $(SOURCES_GUROBI:.cpp=.o)
-	$(CPP) -o $@ $^ $(INC) $(LIBS)
-
 %.o: %.cpp
 	$(CPP) -o $@ -c $< $(INC)
 
 .PHONY: all clean mrproper init
 
-init:
-	@echo '# please run the following command'
-	@echo '# source /dev/stdin <<< "$$(make init)"'
-	@echo 'export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(GUROBI_DIR)/lib'
-
 clean:
-	rm -f $(SOURCES:.cpp=.o) $(SOURCES_GUROBI:.cpp=.o)
+	rm -f $(SOURCES:.cpp=.o)
 
 mrproper: clean
-	rm -f main gurobi *.out
+	rm -f main *.out

+ 0 - 56
Olivier/gurobi.cpp

@@ -1,56 +0,0 @@
-#include "gurobi_c++.h"
-using namespace std;
-
-int
-main(int   argc,
-     char *argv[])
-{
-  try {
-    GRBEnv env = GRBEnv();
-
-    GRBModel model = GRBModel(env);
-
-    // Create variables
-
-    GRBVar x = model.addVar(0.0, 1.0, 0.0, GRB_BINARY, "x");
-    GRBVar y = model.addVar(0.0, 1.0, 0.0, GRB_BINARY, "y");
-    GRBVar z = model.addVar(0.0, 1.0, 0.0, GRB_BINARY, "z");
-
-    // Integrate new variables
-
-    model.update();
-
-    // Set objective: maximize x + y + 2 z
-
-    model.setObjective(x + y + 2 * z, GRB_MAXIMIZE);
-
-    // Add constraint: x + 2 y + 3 z <= 4
-
-    model.addConstr(x + 2 * y + 3 * z <= 4, "c0");
-
-    // Add constraint: x + y >= 1
-
-    model.addConstr(x + y >= 1, "c1");
-
-    // Optimize model
-
-    model.optimize();
-
-    cout << x.get(GRB_StringAttr_VarName) << " "
-         << x.get(GRB_DoubleAttr_X) << endl;
-    cout << y.get(GRB_StringAttr_VarName) << " "
-         << y.get(GRB_DoubleAttr_X) << endl;
-    cout << z.get(GRB_StringAttr_VarName) << " "
-         << z.get(GRB_DoubleAttr_X) << endl;
-
-    cout << "Obj: " << model.get(GRB_DoubleAttr_ObjVal) << endl;
-
-  } catch(GRBException e) {
-    cout << "Error code = " << e.getErrorCode() << endl;
-    cout << e.getMessage() << endl;
-  } catch(...) {
-    cout << "Exception during optimization" << endl;
-  }
-
-  return 0;
-}