(B2) 序章 FICO Xpressの基礎



Similar documents
第 5 章 Xpress の基礎 本書の全ての問題は Xpress-Mosel( 短縮して Mosel) 言語で記述されています 問題を解く場合 ユーザは Mosel コマンド文か Xpress-IVE を選択できます 本書の最適化問題を解く場合 線形問題や混合整数計画問題を Mosel 言語で記述

f(x) x S (optimal solution) f(x ) (optimal value) f(x) (1) 3 GLPK glpsol -m -d -m glpsol -h -m -d -o -y --simplex ( ) --interior --min --max --check -

Solution Report

My関数の作成演習問題集

コンピュータ概論

min. z = 602.5x x 2 + 2

2 1/2 1/4 x 1 x 2 x 1, x 2 9 3x 1 + 2x 2 9 (1.1) 1/3 RDA 1 15 x /4 RDA 1 6 x /6 1 x 1 3 x 2 15 x (1.2) (1.3) (1.4) 1 2 (1.5) x 1

untitled

listings-ext

AtCoder Regular Contest 073 Editorial Kohei Morita(yosupo) A: Shiritori if python3 a, b, c = input().split() if a[len(a)-1] == b[0] and b[len(

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

Excel Excel Excel = Excel III 7 ( ) 1

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal

ストラドプロシージャの呼び出し方

syspro-0405.ppt

94 expression True False expression FalseMSDN IsNumber WorksheetFunctionIsNumberexpression expression True Office support.office.com/ja-jp/ S

L N P Y F C T V W Z I X Pentomino Form Name Caption Position FormMain podesktopcenter

Excel Excel Excel = Excel ( ) 1

PowerPoint プレゼンテーション

橡Taro9-生徒の活動.PDF

XJTAG

コンピュータ概論

fp.gby


45 VBA Fortran, Pascal, C Windows OS Excel VBA Visual Basic Excel VBA VBA Visual Basic For Application Microsoft Office Office Excel VBA VBA Excel Acc

橡WINAPLI.PDF


untitled

,,,,., C Java,,.,,.,., ,,.,, i

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 初版 1 刷発行時のものです.

TOPLON PRIO操作手順

B 5 (2) VBA R / B 5 ( ) / 34

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

2005 D Pascal CASL ( ) Pascal C 3. A A Pascal TA TA TA

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

第10回 コーディングと統合(WWW用).PDF

74 No ACCESS

Java updated

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

r07.dvi

ohp07.dvi


Microsoft Word - Meta70_Preferences.doc

改訂版 :基本的な文字化の原則(Basic Transcription System for Japanese: BTSJ)



D0120.PDF


BASICとVisual Basic

IDL_lecture_12Jan.ppt

# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript

CM-3G 周辺モジュール拡張技術文書 INA226センサ(電流、電圧、電力)

X Window System X X &

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i

VDM-SL VDM VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web bool

2011 D Pascal CASL II ( ) Pascal C 3. A A Pascal TA TA enshu-

たのしいプログラミング Pythonではじめよう!

PowerPoint プレゼンテーション


(Java/FX ) Java CD Java version Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas C

解きながら学ぶJava入門編

120802_MPI.ppt

Java演習(4) -- 変数と型 --

Excel97関数編

スライド 1

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

Specview Specview Specview STSCI(Space Telescope SCience Institute) VO Specview Web page htt

新・明解C言語で学ぶアルゴリズムとデータ構造

Python Speed Learning

<4D F736F F D208DEC90AC837D836A B81698F4390B394C5816A2E646F63>

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM

Transcription:

Xpress の 基 礎 Xpress-Mosel Mosel Mosel Xpress-IVE Mosel http://www.msi-jp.com/xpress/learning/square/ Mosel 1. 2 3 2 4 40 160 1kg 3kg 200kg 20 5 chess.mos Mosel mos model Chess uses "mmxprs"! We shall use Xpress-Optimizer declarations xs, xl: mpvar! Decision variables: produced quantities end-declarations Profit:= 5*xs + 20*xl! Objective function Boxwood:= 1*xs + 3*xl <= 200! kg of boxwood Lathe:= 3*xs + 2*xl <= 160! Lathehours maximize(profit)! Solve the problem writeln("lp Solution:")! Solution printing writeln(" Objective: ", getobjval)

writeln("make ", getsol(xs), " small sets") writeln("make ", getsol(xl), " large sets") end-model Xpress-Mosel Mosel Optimizer Mosel Mosel Excel Mosel chess.mos mosel exec chess quit Mosel Mosel ** Xpress-Mosel ** (c) Copyright Dash Associates 1998-2006 > exec chess LP Solution: Objective: 1333.33 Make 0 small sets Make 66.6667 large sets Returned value: 0 > quit Exiting. mosel -c "exec chess" -c

Mosel h Mosel mosel h Mosel function modules module function exam Xpress-Optimizer module mmxprs mosel -c "exam mmxprs" Mosel Mosel Reference Manual http://www.msi-jp.com/xpress/learning/square/ Mosel IVE Xpress-IVE IVE Xpress Interactive Visual Environment) Microsoft Windows Mosel raphical User Interface (GUI) IVE chess.mos IVE File > Open Windows IVE Editor Build > Run. 5.1 Windows Windows Build pane

Edit Windows Output/Input pane Write IVE IVE IVE Windows Entities pane 1 Reduced Cost Dual Slack 2.Mosel Figure 5.1: Xpress-IVE display after running model chess.mos 2 Mosel 8 (WTMAX ITEMS(i)

take(i) (i take(i) 1 take(i) 0 take(i) binary i VALUE(i) WEIGHT(i) maximize Σ VALUEi takei ( maximize the total value ) i ITEMS Σ WEIGHTi takei WTMAX ( weight restriction ) i ITEMS i ITEMS : takei 2 {0, 1} Mosel model "Burglar 1" uses "mmxprs" declarations ITEMS = 1..8! Index range for items WTMAX = 102! Maximum weight allowed VALUE: array(items) of real! Value of items WEIGHT: array(items) of real! Weight of items take: array(items) of mpvar! 1 if we take item i; 0 otherwise end-declarations! Item: 1 2 3 4 5 6 7 8 VALUE := [15, 100, 90, 60, 40, 15, 10, 1] WEIGHT:= [ 2, 20, 20, 30, 40, 30, 60, 10]! Objective: maximize total value MaxVal:= sum(i in ITEMS) VALUE(i)*take(i)! Weight restriction sum(i in ITEMS) WEIGHT(i)*take(i) <= WTMAX! All variables are 0/1 forall(i in ITEMS) take(i) is_binary maximize(maxval)! Solve the MIP-problem! Print out the solution writeln("solution:\n Objective: ", getobjval) forall(i in ITEMS) writeln(" take(", i, "): ", getsol(take(i))) end-model Solution: Objective: 280

take(1): 1 take(2): 1 take(3): 1 take(4): 1 take(5): 0 take(6): 1 take(7): 0 take(8): 0 Mosel Model: Mosel Keyword model Keyword end-model Declarations: object declarations block assignment i::1 i 1 MaxVal Problem definition: VALUE WEIGHT assignment MaxVal binary( 0 or 1 ) Solving: maximize Xpress-Optimizer MaxVal Mosel default solver uses mmxprs Optimizer Output printing: 2

Line breaks: 1 ( x1 <= 4; x2 >= 7). (+, >= etc.), Comments: Ranges and sets: ITEMS = 1..8 1 8 data array(value, WEIGHT) take ITEMS = 1..8 Index ITEMS = {"camera", "necklace", "vase", "picture", "tv", "video", "chest", "brick"}! Index set for items Arrays: VALUE: array(items) of real 1 array ITEMS Index array VAL3: array(items, 1..20, ITEMS) of real 3 array take array mpvar Mosel Object( array),default real, integer: 0 boolean: false string: (i.e. the empty string) array 5.2.2 Initialization from). Summations:

MaxVal:= sum(i in Items) VALUE(i)*x(i) MazVal sum Σ VALUEi Xi i ITEMS Simple looping: forall(i in ITEMS) take(i) is_binary ITEMS take loop ITEMS 1..8 take(1),take(2), take(8) binary forall loop Application Integer Programming variable types: mpvar binary xbinvar binary xbinvar is_binary MIP xbinvar xintvar is_integer Text ITEM ITEM Mosel burglar2.mos model "Burglar 2" uses "mmxprs" declarations ITEMS: set of string! Set of items WTMAX = 102! Maximum weight allowed

VALUE: array(items) of real! Value of items WEIGHT: array(items) of real! Weight of items end-declarations initializations from burglar.dat VALUE WEIGHT end-initializations declarations take: array(items) of mpvar! 1 if we take item i; 0 otherwise end-declarations! Objective: maximize total value MaxVal:= sum(i in ITEMS) VALUE(i)*take(i)! Weight restriction sum(i in ITEMS) WEIGHT(i)*take(i) <= WTMAX! All variables are 0/1 forall(i in ITEMS) take(i) is_binary maximize(maxval)! Solve the MIP-problem! Print out the solution writeln("solution:\n Objective: ", getobjval) forall(i in ITEMS) writeln(" take(", i, "): ", getsol(take(i))) end-model burglar.dat VALUE: [("camera") 15 ("necklace") 100 ("vase") 90 ("picture") 60 ("tv") 40 ("video") 15 ("chest") 10 ("brick") 1] WEIGHT:[("camera") 2 ("necklace") 20 ("vase") 20 ("picture") 30 ("tv") 40 ("video") 30 ("chest") 60 ("brick") 10] Mosel initialization block initialization block ITEMS VALUE WEIGHT Index initialization ITEMS Application dynamic array KNAPSACK

initializations from burglar2.dat [VALUE, WEIGHT] as KNAPSACK end-initializations burglar2.dat KNAPSACK: [ ("camera") [ 15 2] ("necklace") [100 20] ("vase") [ 90 20] ("picture") [ 60 30] ("tv") [ 40 40] ("video") [ 15 30] ("chest") [ 10 60] ("brick") [ 1 10] ] Mosel Excel Access Mosel AND and kyeword And kyeword and, array, as boolean, break case declarations, div, do, dynamic elif, else, end false, forall, forward, from, function if, in, include, initialisations, initializations, integer, inter, is_binary, is_continuous, is_free, is_integer, is_partint, is_semcont, is_semint, is_sos1, is_sos2 linctr max, min, mod, model, mpvar next, not of, options, or parameters, procedure, public, prod range, real, repeat set, string, sum then, to, true union, until, uses while