logo资料库

gurobi学习手册,很好用的自定义机器学习数学建模编程语言.pdf

第1页 / 共100页
第2页 / 共100页
第3页 / 共100页
第4页 / 共100页
第5页 / 共100页
第6页 / 共100页
第7页 / 共100页
第8页 / 共100页
资料共100页,剩余部分请下载后查看
Introduction
Obtaining a Gurobi License
Creating a new academic license
Software Installation Guide
Retrieving and Setting Up a Gurobi License
Retrieving a Free Academic license
Academic validation
Retrieving a Named-User or Single-Machine or Single-Use license
Setting up and using a Floating license
Retrieving a Floating license
Starting a token server
Upgrading a token server
Creating a token server client license
Setting up and using a Compute Server license
Retrieving a Compute Server license
Creating a Compute Server client license
Starting Gurobi Remote Services
Upgrading Gurobi Remote Services
Using an Instant Cloud license
Testing your license
Setting environment variables
Solving a Simple Model - The Gurobi Command Line
Interactive Shell
Attributes
C Interface
C++ Interface
Java Interface
.NET Interface (C#)
Python Interface
Simple Python Example
Python Dictionary Example
Building and running the examples
MATLAB Interface
R Interface
Recommended Reading
Installing the Anaconda Python distribution
Using the Spyder IDE
Using Jupyter
File Overview
Version 7.5, Copyright c 2017, Gurobi Optimization, Inc. GUROBI OPTIMIZERQUICK START GUIDE
Contents 1 Introduction 2 Obtaining a Gurobi License 2.1 Creating a new academic license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Software Installation Guide 4 Retrieving and Setting Up a Gurobi License 4.1 Retrieving a Free Academic license . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Academic validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Retrieving a Named-User or Single-Machine or Single-Use license . . . . . . . . . . . 4.3 Setting up and using a Floating license . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Retrieving a Floating license . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Starting a token server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Upgrading a token server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.4 Creating a token server client license . . . . . . . . . . . . . . . . . . . . . . . 4.4 Setting up and using a Compute Server license . . . . . . . . . . . . . . . . . . . . . 4.4.1 Retrieving a Compute Server license . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 Creating a Compute Server client license . . . . . . . . . . . . . . . . . . . . . 4.5 Starting Gurobi Remote Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Upgrading Gurobi Remote Services . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Using an Instant Cloud license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Testing your license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8 Setting environment variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Solving a Simple Model - The Gurobi Command Line 6 Interactive Shell 7 Attributes 2 4 6 6 7 8 9 10 11 12 12 13 15 15 16 16 17 18 20 20 21 22 23 29 42
8 C Interface 9 C++ Interface 10 Java Interface 11 .NET Interface (C#) 12 Python Interface 12.1 Simple Python Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 Python Dictionary Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3 Building and running the examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 MATLAB Interface 14 R Interface 15 Recommended Reading 16 Installing the Anaconda Python distribution 16.1 Using the Spyder IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2 Using Jupyter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 File Overview 43 51 56 62 68 69 73 85 86 90 94 95 96 97 99 3
Introduction Welcome to the GurobiTM Optimizer Quick Start Guide for Mac OS users! This document provides a basic introduction to the Gurobi Optimizer, including: • Information on Obtaining a Gurobi License. • A Software Installation Guide, which includes information on Retrieving and Setting Up your License. • An example of how to create a simple optimization model and solve it with the Gurobi Command Line, and • A discussion of the Gurobi Interactive Shell. We suggest that all users read these rst ve sections. Once you have done this, you will probably want to choose a programming environment from which to use Gurobi. If you don't have a strong preference, we recommend that you use our Python R interface, which provides a number of benets. First, Python is a very nice programming language that can be used for anything from experimentation to prototyping to deployment. Beyond this, though, our Python interface includes a set of higher-level modeling constructs that make it much easier to build optimization models. We also include instructions for installing the Anaconda Python distribution, which includes both a graphical development environment (Spyder) and a notebook- style interface (Jupyter). If you already have a preferred programming language, you can select from among our available interfaces: • C interface, • C++ interface, • Java R interface, • Microsoft R .NET interface, • Python interface, • MATLAB R interface, or • R interface. At the end of the Quick Start Guide, you'll nd a File Overview that lists the les included in the Gurobi distribution. 4
Additional resources Once you are done with the Quick Start Guide, the next step is to explore these additional resources: • If you are familiar with mathematical modeling and are ready to use Gurobi from one of our programming language APIs, consult the Gurobi Reference Manual. • If you would like to see examples of ways to use Gurobi, consult the Gurobi Example Tour. • If you would like to learn more about mathematical programming or modeling, we've collected a set of references in our recommended reading section. Getting help Have a question that isn't answered in this guide? Post it to the Gurobi Google Group. Clients with current maintenance contracts can send questions to support@gurobi.com. Ready to get started? Your rst step is to Obtain a License. 5
Obtaining a Gurobi License You will need a license in order to install and use the Gurobi Optimizer. There are several ways to obtain one, depending on your situation: • If you would like a free evaluation license, please email us at sales@gurobi.com to request one. • If you are an academic user, you can obtain a free academic license on our website. • If you have purchased a license from us, that license should be visible through the Current tab of your Licenses page on our website (you will need to login to your account to see this page). • If you are planning to use Gurobi as a client of a machine that is already set up as a Gurobi token server or compute server, you will need to create a token server client license or create a compute server client license. Once you have a license, your next step is to install the software. 2.1 Creating a new academic license If you are an academic user at a degree-granting institution and wish to use an academic Gurobi license, you can create one yourself. To do so, visit the Free Academic License page on our website. You will need to read and agree to the End User License Agreement and the Conditions for academic use. Once you have done so, click on Request License. Your new license will be visible immediately on the Current page. You can create as many academic licenses as you like. Your next step is to install the software. 6
Software Installation Guide Before using the Gurobi Optimizer, you'll need to install the software on your computer. If you haven't already done so, please go to our download page. Find your platform (we'll assume Mac OS X in this document) and choose the corresponding le to download. Make a note of the name and location of the downloaded le. Your next step is to double-click on the appropriate Gurobi installer (e.g., gurobi7.5.2_mac64.pkg for Gurobi 7.5.2) and follow the prompts. By default, the installer will place the Gurobi 7.5.2 les in /Library/gurobi752/mac64 (note that this is the system /Library directory, not your personal ~/Library directory). Your (which we'll refer to throughout this document) will be /Library/gurobi752/mac64. You are now ready to proceed to the section on Retrieving Your Gurobi License. If you would like an overview of the les included in the Gurobi distribution, you can also view the File Overview section. 7
Retrieving and Setting Up a Gurobi License Once your license is visible on the Current Page of the website, click on the License ID to view the License Detail page: Your next step is to install this Gurobi license on your machine. You do this by obtaining a license key le. We strongly recommend that you place your client gurobi.lic le in a default location for your platform (either your home directory or /Library/gurobi). Setting up a non-default location is error-prone and a frequent source of trouble. Please consult the License Type eld on the License Detail page to identify your license type, and click on the appropriate link below to proceed: • Free Academic • Named User • Single-Machine 8
分享到:
收藏