Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
gurobi [2023/07/14 15:24] – admingurobi [2023/07/17 06:33] (Version actuelle) – supprimée admin
Ligne 1: Ligne 1:
-<note warning>Apres avoir écrit cette doc, le comporetemnt est aléatoire avec la glibc. 
  
-Du coup j'a fait la même install qui est plutot stable. 
- 
-@Robin, copier cette doc sur mesoservices. Danke. :-P</note> 
- 
-====== Gurobi Optimizer ====== 
- 
-===== Installed version ===== 
-  * 10.0.2 
-  *Available License : **Academic license - for non-commercial use only**  
-  * This installation is ready to use. No need to install Python nor license file  
- 
- 
-===== How to use gurobi ===== 
- 
-==== Interactive mode for testing short computation ==== 
- 
-  * Connect to shared node ''mesoshared.univ-fcomte.fr''  using SSH 
-  * Always use WORK directory as working area <code bash>$ cd WORK</code>   
-  * Load guroby using ''module'' command <code bash>$ module load guroby/10.0.2</code>  
- 
-<WRAP center round important 60%> 
-  * You don't need to setup a conda environment  
-  * You don't need to setup any license 
-  * You will use one provided by meso-admins 
-  * Please contact us if you noticed any problem 
-</WRAP> 
- 
-From now on you can use guroby directly. 
- 
-Say you need to run this python program : 
-<file python  mip.py> 
-# Solve the following MIP: 
-#  maximize 
-#        x +   y + 2 z 
-#  subject to 
-#        x + 2 y + 3 z <= 4 
-#        x +   y       >= 1 
-#        x, y, z binary 
- 
-import gurobipy as gp 
- 
-# Create a new model 
-m = gp.Model() 
- 
-# Create variables 
-x = m.addVar(vtype="B", name="x") 
-y = m.addVar(vtype="B", name="y") 
-z = m.addVar(vtype="B", name="z") 
- 
-# Set objective function 
-m.setObjective(x + y + 2 * z, gp.GRB.MAXIMIZE) 
- 
-# Add constraints 
-m.addConstr(x + 2 * y + 3 * z <= 4) 
-m.addConstr(x + y >= 1) 
- 
-# Solve it! 
-m.optimize() 
- 
-print(f"Optimal objective value: {m.objVal}") 
-print(f"Solution values: x={x.X}, y={y.X}, z={z.X}") 
- 
-</file> 
- 
-Just run : 
-<code bash> 
-$ guroby.sh mip.py  
-</code> 
-<code bash> 
-Set parameter WLSAccessID 
-Set parameter WLSSecret 
-Set parameter LicenseID to value 2395939 
-Academic license - for non-commercial use only - registered to meso-admins@univ-fcomte.fr 
-Gurobi Optimizer version 10.0.2 build v10.0.2rc0 (linux64) 
- 
-CPU model: Intel(R) Xeon(R) Platinum 8160 CPU @ 2.10GHz, instruction set [SSE2|AVX|AVX2|AVX512] 
-Thread count: 96 physical cores, 96 logical processors, using up to 32 threads 
- 
-Academic license - for non-commercial use only - registered to meso-admins@univ-fcomte.fr 
-Optimize a model with 2 rows, 3 columns and 5 nonzeros 
-Model fingerprint: 0x98886187 
-Variable types: 0 continuous, 3 integer (3 binary) 
-Coefficient statistics: 
-  Matrix range     [1e+00, 3e+00] 
-  Objective range  [1e+00, 2e+00] 
-  Bounds range     [1e+00, 1e+00] 
-  RHS range        [1e+00, 4e+00] 
-Found heuristic solution: objective 2.0000000 
-Presolve removed 2 rows and 3 columns 
-Presolve time: 0.00s 
-Presolve: All rows and columns removed 
- 
-Explored 0 nodes (0 simplex iterations) in 0.01 seconds (0.00 work units) 
-Thread count was 1 (of 96 available processors) 
- 
-Solution count 2: 3 2 
- 
-Optimal solution found (tolerance 1.00e-04) 
-Best objective 3.000000000000e+00, best bound 3.000000000000e+00, gap 0.0000% 
-Optimal objective value: 3.0 
-Solution values: x=1.0, y=0.0, z=1.0 
-</code> 
-==== Batch mode for long  computation==== 
-For long computation. We need to use [[SGE]] to submit job to computing nodes. 
- 
-Here is an example of SGE script to adapt: 
- 
-<file bash gurobi.sge> 
-#!/bin/bash -l 
-  
-#$ -q all.q 
-#$ -V 
-#$ -N Gurobi_example 
- 
-#$ -o $JOB_NAME.$JOB_ID.out 
-#$ -e $JOB_NAME.$JOB_ID.err 
-  
-#$ -l h_vmem=6G  # request 6G memory 
- 
-## load module 
-  
-module load gurobi/10.0.2 
-  
-## run application 
-  
-gurobi.sh mip.py 
- 
-</file> 
- 
-Submit job to SGE: 
-<code bash> 
-$ qsub job.sge 
-</code> 
  • gurobi.1689348256.txt.gz
  • Dernière modification : 2023/07/14 15:24
  • de admin