Mosel

Size: px
Start display at page:

Download "Mosel"

Transcription

1

2 Mosel Mosel public Mosel Mosel Mosel Mosel Mosel i

3 ii A 231 A A A A B Mosel 248 B B

4 1 1.1 Xpress-Mosel Xpress-MP Mosel Xpress-Modeler Xpress-EMOSL Xpress-Mosel ODBC Mosel Xpress-MP Mosel Mosel Mosel Xpress-MP Xpress-IVE Mosel Mosel Mosel Mosel 1

5 2 1 Mosel Xpress-MP C Java Visual Basic Mosel Xpress-MP Essentials Xpress-MP 1.2 Mosel Mosel Mosel 1 Mosel Mosel Mosel Mosel Mosel 1.3 Mosel / Mosel / BInary Model(BIM) 2 / / BIM Mosel Mosel : VIrtual MAchine (VIMA) / ( ) ( )

6 : VIMA : mosel 2 : Mosel mmxprs Mosel Xpress-Optimizer maximize Mosel BIM Mosel / BIM Mosel Mosel Mosel Mosel 1.4 Mosel 2 3 Mosel ( ) Java ( Prolog Lisp) Mosel Pascal ( sum )

7 4 1 Mosel mpmodel Mosel Mosel 3 Mosel Mosel 4 Mosel Mosel Mosel 1.6 fixed width italic C 5 [...] {...} italic return CTRL CTRL UNIX PC ASCII 16 7C 8 124

8 2 Mosel Mosel Mosel Mosel 2.1! 5

9 6 2 MOSEL (! (! 2!)!) word Word and, array, as, boolean, break, case, declarations, div, do, mpvar, 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, next, not, of, options, or, parameters, procedure, public, prod, range, real, repeat, set, string, sum, then, to, true, union, until, uses, while Mosel AND and And.. A+B! 1 -C+D! 2 A+B-! 3... C+D! 3

10 A+B ; -C+D!2 explterm(2.3 ) A+B;! 1 -C+D;! 2 A+B! C+D;! 3 word word todo todo [something] something {something...} something 2.2 Mosel model model name [Directives] [Parameters] [body] end-model model end-model model name Mosel directives parameters / body

11 8 2 MOSEL BIM 2.3 uses options 2 uses uses libname1 [,libname2...][;] options options optname1 [,optname2...] explterm noimplicit ( ) uses "mmsystem" options noimplicit,explterm 2.4 (XPRMrunmod(RUN) ) parameters ident1 = Expression1 [ident2 = Expression2...] end-parameters identi Expressioni XPRMrummod(RUN)

12 parameters size=12 F="myfile" end-parameters 2.5 Mosel include include filename filename.mos include filename a.mos model "Example for file inclusion" written ( From the main file ) include "b" end-model b.mos written ( From an included file ) b.mos a.mos model "Example for file inclusion" written ( From the main file ) written ( From an included file ) end-model uses options parameters 2.6 / 1 declarations end-declarations declarations Declare stat

13 10 2 MOSEL [Declare stat...] end-declarationss ident1 [, ident2..] : typename typename identi integer,real,string,boolean MP mpvar,linctr MP declarations i,j:integer str:string x,y,z:mpvar end-declarations integer real 1.7e e string boolean true false 0 false MP 2 mpvar linctr

14 ident1 [,ident2...]:set of typename typename identi ident1 [, ident2...]:range set of integer identi declarations sl: set of string rl: range end-declarations, ident1 [, ident2...] : [dynamic] array (list of sets) of typename list of sets / typename identi rs:set of real rs set of real declarations e: set of string t1: array (e, rs:set of real, range, integer) of real

15 12 2 MOSEL t2: array ({"i1","i2"}, 1..3) of integer end-declarations finalize dunamic Mosel mpvar mpvar create identifier = Expression identifier Expression declarations STR= my const string I1=12 R=1..10 S={2.3,5.6,7.01} end-declarations 2.7 array ident (Exp1 [, Exp2...])

16 array ident Expi i Exp1[,Exp2...] function ident function ident( Exp1 [, Exp2...] ) function ident expi i if Bool expr Exp1 Exp2 if(bool expr, Exp1, Exp2) Exp1 Exp2 Exp1 Exp2 Mosel integer -> real integer -> real,linctr real ->linctr mpvar ->linctr integer -> real,string,linctr real ->string,linctr mpvar ->linctr boolean -> string integer, real, string, boolean string boolean string string true MP!A=3.5,B=2 integer(a+b)!=5 string(a-b)!= 1.5 real(integer(a+b))!=5.5 ( ) ()

17 14 2 MOSEL Aggregate ident (Iterator1 [, Iterator2 ]) Expression Aggregate indent Expression ( ) Expression iterator Set expr ident1 [,ident2...]in Set expr[ Bool expr] ident = Expression [ Bool expr] 2 identi Set expr 3 identi 2 3 iterator Bool expr iterator (+ / + ) mod div mpvar sum integer real mpvar prod minimun maximum x*5.5+(2+z)^4+cos(12.4) sum(i in 1..10) (min(j in s) t(i)*(a(j) mod 2))

18 string string C a, b, f, n, r, t, v n C ddd1 ddd2 ddd3 C ddd1 ddd2 ddd3 C ddd1 ddd2 ddd3 C ddd1ddd2ddd3 string a1b2c3d5 e6 a1b2c3d5e6 a1b2c3d5 3d5 a1b2c {[ Exp1 [, Exp2 ]]} [{] Integer exp1.. Integer exp2 [}] 2 union inter {1,2,3}+{4,5,6}-{5..8}*{6,10}! = {1,2,3,4,5} { a, b, c }*{ b, c, d }! = { b, c } union(i in 1..4 i<>2) {i*3}! = {3,9,12} string ISO

19 16 2 MOSEL expr in Set expr Set Expr not in and ( ) or ( ) not and or 3<=x and y>=45 or t<>r and not r in {1..10} and(i in 1..10) 3<=x(i) mpvar Linear expr Linear expr1 Ctr cmp Linear expr2 Linear Expr SOS type mpvar ref mpvar type1 mpvar ref mpvar type2 Arith expr 2 3 is sos1 is sos2 2 1 is continuous is integer is binary is free 2 is partint is semicont is semint 3*y+sum(i in 1..10) x(i)*i >= z-t t is_integer sum(i in 1..10) x(i) is_sos1 y is_partint 5

20 *x>=5*y-10 3*x-5*y+10 ctl 3*x>=5*y-10 z-x+ctl z-2*x-5*y+10 x is type threshold x-threshold x is integer x-max INT [Exp1 [, Exp2...]] declarations T:array(1..2,1..3) of integer end-declarations T:=[1,2,3,4,5,6] writeln(t)! [1,2,3,4,5,6] writeln(getsize([2,3,4]))! Mosel 4

21 18 2 MOSEL ident ref := Expression ident ref + = Expression ident ref = Expression ident ref Expression ident ref ident ref c:= 3*x+y >= 5 c+= y! c 3*x+2*y-5 >= 0 c:= 3*x+y >= 5 c:= c + y! c 3*x+2*y-5 (c ) T:=[2,4,6,8] T(12):=[7,8,9,19]!A,S,SE A:=1!A S:={1,2,3}!S SE:={}! SE Mosel A(1):=1! A (1,..1) A(t):=2.5! t 1 10 f(t)>0! A noimplicit

22 <=x; x<=20 x is_integer procedure ident procedure ident (Exp1 [, Exp2 ]) procedure ident expi i?? writeln("hello!")! hello! initializations from Filename ident1 [ as Label1] [ident2 [ as Label2]...] end-initializations Filename identi string Labeli Label: value Label value integer,real,string,boolean []

23 20 2 MOSEL false true initialization to ident1 [as Label1] [ident2 [as Label2]...] end-initialization Filename 2 1 a.dat! Example of the use of initialization blocks t:[ (1 un) 10 (2 deux) 20 (3 trois) 30 ] t2:[ 10 (4) ] nb used : 0 model "Example initblk" declarations nb_used:integer s: set of string t: array(1..3,s) of real t2: array(1..5) of integer end-declarations initializations from a.dat t! t=[(1, un,10),(2, deux,20),(3, trois,30)] t2! t2=[10,0,0,30,40] 1 fname fname-

24 nb_used as "nb used"! nb_used=0 end-initializations nb_used+=1 t(2,"quatre"):=1000 initializations to t nb_used as "nb used" s end-initializations end-model a.dat! Example of the use of initialization blocks t:[(1 un ) 10 (2 deux ) 20 (2 quatre ) 1000 (3 trois ) 30] t2:[ 10 (4) ] nb used : 1 s : [ un deux trois quatre ] If if if Bool exp 1 then Statement list 1 [ elif Bool exp 2 then Statement list 2 ] [else Statement list E ] end if Bool exp 1 true Statement list 1 end-if elif if false else Statement list E end-if if c=1 then writeln( c=1 ) elif c=2 then writeln( c=2 ) else writeln( c<>1 and c<>2 )

25 22 2 MOSEL end-if Case Case case Expression 0 of Expression 1 : Statement 1 or Expression 1 : do Statement list 1 end-do [ Expression 2 : Statement 2 or Expression 2 : do Statement list 2 end-do ] [else Statement list E ] end case Expression 0 Expression i Statement i Statement list i end case else Statement list E end-if Expression i 2 Expression 0 case c of 1 : writeln( c=1 ) 2..5 : writeln( c in 2..5 ) 6,8,10: writeln( c in {6,8,10} ) else writeln( c in {7,9} or c >10 or c <1 ) end-case forall forall forall(iterator list) Statement forall(iterator list) do Statement list end-do Statement Statement list ( )

26 forall (i in 1..10,j in i<>j) do write( (,i,,,j, ) ) if isodd(i*j) then s+={i*j} end-if end-do While While while(bool expr) Statement while(bool expr) do Statement list end-do Statement Statement list, Bool expr true false while i:=1 while(i<=10) do write(,i) if isodd(i) then s+={i} end-if i+=1 end-do Repeat repeat repeat Statement1 [Statement2...] until Bool expr repeat until Bool expr true while i:=1 repeat write(,i) if isodd(i) then s+={i} end-if i+=1 until i>10

27 24 2 MOSEL break next break next break next break [n] next [n] n n-1! repeat!1: L1 forall (i in S) do!2: L2 while (C3) do!3: L3 break 3!4:L3 11 next!5:l3 (3 ) next 2!6:L3 i (2 ) end-do!7:l3 next 2!8:L2 L1 (11 ) break!9:l2 10 end-do!10:l2 until C1!11:L1 2.9 Mosel 2 ( writeln("hi!") ) ( round(12.3) ) ( ) ( ) procedure name proc [(list of args)] Proc body end-procedure

28 name proc list of args 2.6 ( A-12 t1:array(1..4) of real ) procedure myproc writeln("in myproc") end-procedure procedure withparams(a:array(r:range) of real, i,j:integer) writeln("i received: i=",i," j=",j) forall(n in r) writeln("a(",n,")=",a(n)) end-procedure declarations mytab:array(1..10) of real end-declarations myproc! myproc withparams(mytab,23,67)! withparams function name func [(list of args)]: Basic type Func body end-function Mosel integer,real,boolean,string returned function multiply_by_3(i:integer):integer returned:=i*3 end-function writeln("3*12=",multiply_by_3(12))!

29 26 2 MOSEL procedure alter(s:set of integer,i:integer) i+=1 s+={i} end-procedure gs:={1} gi:=5 alter(gs,gi) writeln(gs," ",gi)! displays: {1,6} 5 ( end-procedure end-function ) (mpvar) ( linctr) declarations! i,j:integer end-declarations procedure myproc declarations i:string! end-declarations i:="a string"! i j:=4 writeln("inside of myproc, i=",i," j=",j) end-procedure i:=45! i j:=10

30 myproc writeln("outside of myproc, i=",i," j=",j)! displays:! myproc, i=a string j=4! myproc, i=45 j=4 Mosel! 1 function random(limit:integer):integer returned:=round(.5+random*limit)! random end-function 1 2 ( ) 2 1 forwarf procedure Proc name[(list of prams)] forwarf procedure Func name[(list of prams)] :Basic type Proc name Func name Mosel forward function f2(x:integer):integer function f1(x:integer):integer returned:=x+if(x>0,f2(x-1),0)! f1 needs to know f2 end-function

31 28 2 MOSEL function f2(x:integer):integer returned:=x+if(x>0,f1(x-1),0)! f2 needs to know f1 end-function 2.10 public Mosel ( DISPLAY ) BIM -s public ( ) parameters public T="default"! T end-parameters declarations public a,b,c:integer! a,b,c d:real! d end-declarations forward public procedure myproc(i:integer)! myproc 2.11 / 2 (write, writeln,fflush) (read, readln, fskipline) Mosel fopen fclose ( ) fselect getfid model "test IO" def_out:=getfid(f_output)! ID

32 fopen("mylog.txt",f_output)! my_out:=getfid(f_output)! ID repeat fselect(def_out)! write("text? ")! text:= readln(text)! string fselect(my_out)! mylog.txt writeln(text)! string until text= fclose(f_output)! ( mylog.txt ) writeln("finished!")! end-model 2.12 Mosel ( ) Mosel ( ) mmive, mmodbc, mmsystem, mmxprs Mosel uses module name 6 7 mmsystem mmsystem OS mmsystem getsysstat mmsystem

33 30 2 MOSEL fdelete fmove getcwd getenv getfstat getsysstat gettime makedir removedir system mmxprs OS mmxprs Mosel Xpress-Optimizer Xpress-Optimizer 4 Mosel ( XPRS_LPSTATUS) getparam setparam XPRS_VERBOSE: / XPRS_LOADNAMES MPS / XPRS_PROBLEM : Mosel setparam("xprs_presolve",0); setparam("xprs_cutstrategy",0); setparam("xprs_extrarows",5000); setcallback Mosel Mosel ( ) / ) mmxprs : mmxprs

34 addcut addcuts clearmipdir clearmodcut delbasis delcuts dropcuts getcnlist getcplist getlb getprobstat getub loadbasis loadcuts loadprob maximize minimize savebasis setcallback setlb setmipdir setmodcut setub storecut storecuts MIP mmodbc Mosel ODBC ODBC ODBC / mydata pricelist

35 32 2 MOSEL articlenum colour price 1001 blue red black blue 3.99 Model model ODBC Example uses "mmodbc" declarations prices: array(range) of real end-declarations setparam("sqlverbose",true) SQLconnect("DSN=mydata") writeln("connection number: ",getparam("sqlconnection")) SQLexecute("select articlenum,price from pricelist",prices) SQLdisconnect end-model SQLVERBOSE ODBC SQLexecute price articlenum pricelist mmodbc : mmdobc SQLconnect SQLdisconnect SQLexecute SQLreadinteger SQLreadreal SQLreadstring ODBC ODBC SQL integer real string mmive mmive Xpress-MPIntegrated Visual Environment IVE 2 IVEaddtograph IVEinitgraph

36

37 3 Mosel 3.1 Mosel Mosel (.mos ) (.bim ) Mosel -h -v -s -c commands Mosel Commands ( OS ) Commands Mosel mosel -c "CLOAD -sg mymodel;run Mosel ( [] ) INFO [symbol]: ( ) SYSTEM [command]: OS QUIT: Mosel COMPILE[-sgep] filename[comment]: filename (BIM).mos.bim -e 34

38 3.1. MOSEL 35 -s BIM -g comment BIM LIST -p LOAD filename: filename BIM.bim model CLOAD[-sge] filename[comment]: filename COMPILE filename LOAD filename LIST: CLOAD LOAD name: model number: size: system: / user comment: (COMPILE,CLOAD ). DELETE,RUN.RESET SELECT number name: DELETE number name: (BIM ) ( ) RUN [parameters]: / param name = value dsoname

39 36 3 MOSEL ctrpar name dsoname.ctrpar name=value RESET: EXPORTPROB[-[ms] [filename[objective] :] filename LP MPS (-m ) -p -m MPS -s objective DISPLAY symbol: ( 0) ( 0) SYMBOLS [-cspo]: -c -s / -p / -o LSLIBS: (DSO) ( EXAMINE [-cspt] libname: libname / / -c -s / -t -p / FLUSHLIBS: CL CLOAD C COMPILE 1 / CLOAD mymodel RUN Xpress-MP

40 3.2. MOSEL Mosel Mosel C Mosel (BIM) BIM Mosel Mosel Mosel (Mosel ) 2 Mosel Xpress-MP Mosel xprm rt BIM xprm rt.h XRPMMmodel: XPRMdsolib: XPRMmpvar: XPRMlinctr: XPRMset: XPRMarray: XPRMproc: / XPRMinteger: (C int ) XPRMreal: (C double ) XPRMboolean: (C int: 0 = false, 1 = true) XPRMstring: (C const char * )

41 38 3 MOSEL Mosel (xprm mc) Mosel BIM xprm mc XPRMcompmod xprm rt xprm mc.h 3.3 Mosel Mosel XPRMinit Mosel Mosel XPRMfree (XPRMloadmod) (XPRMrunmod) (XPRMunloadmod) (XPRMgetmodinfo) Mosel (MPRMmodel ) XPRMloadmod BIM( ) XPRMmodel 2 (pp) Mosel BIM XPRMfindident XPRMgetnextparam XPRMgetnextproc ). s public (XPRMgetsettype) (XPRMgetsetsize) (XPRMgetelsetval, XPRMgetelsetndx, XPRMfirstsetndx,XPRMlastsetndx) Mosel (XPRMgetarrsize) (XPRMgetarrdim) (XPRMfirstarrentry, XPRMnextarrentry,XPRMlastarrentry) (XPRMgetarrval) 2 BIM Mosel

42 3.3. MOSEL 39 XPRMgetarrtype Mosel XPRM TYP INT, XPRM TYP REAL, XPRM TYP STRING, XPRM TYP BOOL, XPRM TYP MPVAR, XPRM TYP LINCTR, XPRM TYP SET, XPRM TYP ARR 2 XPRM GRP DYN: out of range error XPRM GRP GEN: ( ) XPRM GRP DYN XPRM GRP DYN XPRM GRP GEN ( ) Mosel XPRM GRP DYN Mosel 2 XPRMfirstarrtruentry,XPRMnextarrtruentry XPRMgetelsetndx main problem Mosel main problem XPRMgetobjval (XPRMgetvsol) (XPRMgetcsol) (XPRMgetrcost) (XPRMgetdual) (XPRMgetslack) XPRMexportprob mmxprs loadprob mmxprs maximize Mosel DSOs 2.12 Mosel 1 Mosel (XPRMgetnextdso) (XXRPXgetdsoinfo) (XPRMgetnextdsoparam)

43 40 3 MOSEL XPRMpreloaddso XPRMflushdso Mosel (xprm mc) XPRMcompmod Mosel xprm mc, xprm rt. XPRMcompmod XPRMinit Mosel 3.4 XPRMinit XPRMfree XPRMgetversion Mosel Mosel Mosel XPRMloadmod XPRMrunmod XPRMisrunmod XPRMstoprunmod XPRMunloadmod XPRMgetmodinfo XPRMgetnextmod XPRMfindmod Mosel Mosel XPRMfindident XPRMgetnextident XPRMgetnextparam XPRMgetnextproc XPRMgetprocinfo / / XPRMgetsetsize XPRMgetsettype XPRMfirstsetndx XPRMlastsetndx XPRMgetelsetval XPRMgetelsetndx

44 XPRMgetarrdim XPRMgetarrtype XPRMgetarrsize XPRMgetarrsets XPRMfirstarrentry XPRMlastarrentry XPRMnextarrentry XPRMnextarrentry trs XPRMfirstarrtruenty XPRMnextarrtruentry XPRMchkarrind XPRMcmpindices XPRMgetarrval 2 XPRMgetprobstat XPRMexportprob XPRMgetobjval XPRMgetobjval XPRMgetcsol XPRMgetrcost XPRMgetdual XPRMgetslack XPRMgetact XPRMgetvarnum XPRMgetctrnum XPRMautounloaddso XPRMfinddso XPRMflushdso XPRMgetdsoparam XPRMgetnextdso XPRMgetnextdsoconst XPRMgetnextdsoparam XPRMgetnextdsoproc XPRMgetdsoinfo XPRMpreloaddso DSO / DSO DSO / DSO DSO DSO DSO / DSO DSO

45 42 3 MOSEL XPRMcompmod Mosel BIM

46 4 Mosel 4.1 Mosel 2 Mosel Mosel Mosel Mosel MAX_INT integer MAX_REAL real M_E e M_PI π 4.2 / Mosel 43

47 44 4 MOSEL uses module name 1 2

48 abs integer real function abs(i: integer): integer function abs(r: real): real i r declarations number: real end-declarations writeln("enter a non-negative number.") readln(number) if(number <> abs(number)) then writeln("the number is negative.") end-if exp,ln,log,sqrt

49 46 4 MOSEL addcut procedure addcut(cuttype: integer, type: integer,linexp: linctr) cuttype type linexp CT_GEQ CT_LEQ CT_EQ mmxprs Boolean VERBOSE / addcuts, dropcuts, delcuts, loadcuts, storecut, storecuts, XPRSaddcuts ( )

50 addcuts procedure addcuts(cuttype: array(range) of integer, type: array(range) of integer, linexp: array(range) of linctr) cuttype type linexp CT_GEQ CT_LEQ CT_EQ mmxprs Boolean VERBOSE / 3 addcut, dropcuts, delcuts, loadcuts, storecut, storecuts, XPRSaddcuts( )

51 48 4 MOSEL arctan function arctan(r: real): real r 2 a b 2 declarations a,b: real end-declaration read(a,b) write("the triangle has angles ",arctan(a/b)*180/m_pi) writeln(", ",arctan(b/a)*180/m_pi," and 90 degrees") cos,sin

52 bittest function bittest(i: integer, mask: integer): integer i mask i 4 j 5 k 8 i := bittest(12,5) j := bittest(13,5) k := bittest(13,10)

53 50 4 MOSEL ceil function ceil(r: real): integer r d -1 d := ceil(-1.9) floor,round

54 clearmipdir MIP procedure clearmipdir mmxprs Boolean VERBOSE / setmipdir, XPRSgetdirs( ),XPRSloaddirs( )

55 52 4 MOSEL clearmodcut procedure clearmodcut mmxprs Boolean VERBOSE / declarations Items: set of integer ctr: array(items) of linctr end-declarations... forall(i in Items isodd(i)) setmodcut(ctr(i)) maximize(profit) writeln("profit: ",getobjval) clearmodcut setmodcut

56 cos function cos(r: real): real r 2 declarations b,c,a: real end-declarations read(b,c,a) write("the other side has length ") writeln(sqrt(b*b + c*c -2*b*c*cos(A*M_PI/180))) arctan,sin

57 54 4 MOSEL create procedure create(x: mpvar) x x(1) + x(3) + x(5) + x(7) declarations x: dynamic array(1..8) of mpvar end-declarations forall(i in 1..8 isodd(i)) create(x(i)) c := sum(i in 1..8) x(i) finalize(2 Mosel )

58 delbasis savebasis procedure delbasis(num: integer) procedure delbasis(name: string) num name mmxprs Boolean VERBOSE / 2 2 savebasis(2)... delbasis(2) loadbasis, savebasis, XPRSgetbasis ( ),XPRSloadbasis( )

59 56 4 MOSEL delcuts procedure delcuts(keepbasis: boolean, cuttype: integer, interpret: integer, delta: real, cuts: set of integer) procedure delcuts(keepbasis: boolean, cuttype: integer, interpret: integer, delta: real) keepbasis cuttype interpret false true cuttype 3 cuttype delta cuts mmxprs Boolean delta -MAX REAL cuttype VERBOSE / addcut, addcuts, dropcuts, loadcuts, storecut, storecuts, XPRSdelcuts ( )

60 dropcuts procedure dropcuts(cuttype: integer, interpret: integer, cuts: set of integer) procedure dropcuts(cuttype: integer, interpret: integer) cuttype interpret cuttype 3 cuttype cuts mmxprs Boolean cuttype VERBOSE / addcut, addcuts, delcuts, loadcuts, storecut, storecuts, XPRSdelcpcuts( )

61 58 4 MOSEL exlsts function exists(x): boolean x ( t(1)) declarations x: dynamic array(1..8) of mpvar end-declarations forall(i in 1..8 isodd(i)=false) create(x(i)) c:= sum(i in 1..8) x(i) forall(i in 1..8) if(exists(x(i)) = true) then writeln("x(",i,") exists") end-if create

62 exit procedure exit(code: integer) code 1 readln(number) if(number > 0) then writeln(log(number)) else exit(1) end-if exit 0 QUIT

63 60 4 MOSEL exp function exp(r: real): real r 2 exp declarations limit = 100 xp = 0 end-declarations read(number) forall(i in 0..limit) do xp := xp + pospow(number,limit-i)/factorial(limit-i) end-do writeln("calculated: ",xp,"; exp(",number,"): ", exp(number)) function factorial(a: integer): real if(a < 0) then returned := -1 else if(a = 1 or a = 0) then returned := 1 else returned := a*factorial(a-1) end-if end-if end-function function pospow(x:real, e:integer): real if(e<=0) then

64 returned := 1 else returned := x*pospow(x,e-1) end-if end-function abs,ln.log,sqrt

65 62 4 MOSEL exportprob procedure exportprob(options: integer, filename: string, obj: linctr) options EP MIN EP MAX EP MPS EP STRIP filename obj LP LP MPS LP prob1.lp Profit: declarations MinCost,Profit: linctr end-declarations exportprob(0,"",mincost) exportprob(ep_max+ep_strip,"prob1", Profit) LP.lp MPS.mps XPRMexportprob (EXPORTPROB), XPRBexportprob

66 fclose procedure fclose(stream: integer) stream F INPUT F OUTPUT Boolean IOCTRL IO / declarations profit: linctr variables: set of mpvar end-declarations... fopen("solution.dat",f_output) writeln("profit: ",getobjval) getvars(profit,variables) forall(x in variables) writeln(getsol(x)) fclose(f_output) fopen fopen, fselect, getfid, iseof, SQLconnect, SQLdisconnect.

67 64 4 MOSEL delete procedure fdelete(filename: string) filename mmsystem fdelete("logfile.log") fopen("logfile.log",f_output)... fclose(f_output) fmove, getfstat

68 fflush OS procedure fflush XPRMflushdso (FLUSHLIBS)

69 66 4 MOSEL finalize procedure finalize(s: set) s 3 declarations Set1: set of string x: array(set1) of mpvar end-declarations Set1 := {"first", "second", "fifth"} finalize(set1) declarations y: array(set1) of mpvar end-declarations create

70 floor function floor(r: real): integer r i 5 j -7 k 12 i := floor(5.6) j := floor(-6.7) k := floor(12.3) ceil,round

71 68 4 MOSEL fmove procedure fmove(namesrc: string, namedest: string) namesrc namedest / mmsystem forall(i in ) do file := "logfile" + i status := getfstat(file) if(bittest(status,sys_typ) = SYS_REG) then next else break end-if end-do fmove("logfile.log",file) fopen("logfile.log",f_output)... namesrc namedest 2 fdelete, getfstat

72 fopen procedure fopen(f: string, mode: integer) f mode F INPUT F OUTPUT F APPEND Boolean IOCTRL IO / fopen("data.dat",f_append) if(getparam(iostatus) <> 0) then exit(1) end-if writeln(getobjval) fclose(f_output) 1. write writeln read readln fskipline 2. IO IOCTRL false false IO LOSTATUS 0 getparam fclose, fselect, getfid, iseof, SQLconnect, SQLdisconnect

73 70 4 MOSEL fselect procedure fselect(stream: integer) stream ID mylog.txt ID def_out := getfid(f_output) fopen("mylog.txt",f_output)... my_out:=getfid(f_output) fselect(def_out) getfid fclose, fopen, getfid, iseof

74 fskipline procedure fskipline(filter: string) filter Boolean IOCTRL IO / fskipline("!#") fskipline("\n") n read,readln

75 72 4 MOSEL getact 0 function getact(c: linctr): real c function check(ctr: linctr, name: string): boolean if((gettype(ctr)=ct_geq or gettype(ctr)=ct_leq) and (getact(ctr)+getslack(ctr)+getcoeff(ctr)<>0)) then writeln("error in constraint ",name," ") returned := false end-if returned := true end-function maximize(profit) if(check(first,"first") and check(second,"second")) then writeln("profit: ",getobjval) end-if getdual, getslack, getsol, XPRMgetact

76 getcnlist procedure getcnlist(cuttype: integer, interpret: integer, cuts: set of integer) cuttype interpret cuttype 3 cuttype cuts mmxprs Boolean VERBOSE / cuts getcplist, XPRSgetcutlist( )

77 74 4 MOSEL getcoeff =-RHS function getcoeff(c: linctr): real function getcoeff(c: linctr, x: mpvar): real c x 3 getcoeff r 1.0 s 12.0 declarations x, y, z: mpvar end-declarations c := 4*x + y - z <= 12 r := getcoeff(c,z) s := getcoeff(c) getvars, setcoeff, XPRSgetrows ( )

78 getcplist procedure getcplist(cuttype: integer, interpret: integer, delta: real, cuts: set of integer, viol: array(range) of real) cuttype interpret cuttype 3 cuttype delta cuts viol mmxprs Boolean delta VERBOSE / cuts getcnlist, XPRSgetcpcutlist( ),XPRSgetcpcuts( )

79 76 4 MOSEL getcwd function getcwd: string mmsystem procedure printdir writeln("executing from ",getcwd) end-procedure Mosel getenv, getfstat, makedir, removedir

80 getdual 0 function getdual(c: linctr): real c first := 3*a + 2*b <= 400 second := a + 3*b <= 200 profit := a + 2*b maximize(profit) writeln("dual value of constraint first is ", getdual(first)); getobjval, getrcost, getslack, getsol, XPRMgetdual, XPRSgetsol ( )

81 78 4 MOSEL getenv OS function getenv(name: string): string name mmsystem PATH str := getenv("path") getcwd, getsysstat, system

82 getfid function getfid(stream: integer): integer stream F INPUT F OUTPUT def out file file def_out := getfid(f_output) fopen("file",f_output) writeln("objective function value: ",getobjval) my_out := getfid(f_output) fselect(def_out) fselect fclose, fopen, fselect, iseof

83 80 4 MOSEL getfirst 0 function getfirst(r: range): integer r r declarations r = 2..8 end-declarations... writeln("first element of r: ", getfirst(r),"\nlast element of r: ",getlast(r)) getlast

84 getfstat function getfstat(filename: string): integer filename mmsystem ftest fstat := getfstat("ftest") if bittest(fstat,sys_typ)=sys_dir then writeln("ftest is a directory") end-if if bittest(fstat,sys_write)=sys_write then writeln("ftest is writeable") end-if SYS TYP( ) SYS DIR SYS REG SYS OTH SYS MOD( ) SYS READ SYS WRITE SYS EXEC bittest

85 82 4 MOSEL getlast 0 function getlast(r: range): integer r r declarations r = 2..8 end-declarations... writeln("first element of r: ", getfirst(r),"\nlast element of r: ",getlast(r)) getfirst

86 getlb function getlb(x: mpvar): real x mmxprs Boolean VERBOSE / x declarations Items = x: array(items) of mpvar end-declarations... forall(i in Items) writeln(i,": ",getlb(x(i)),", ",getub(x(i))) setlb Mosel loadprob getub, setlb, setub, XPRSchgbounds ( ),XPRSgetlb ( )

87 84 4 MOSEL getobjval 0 function getobjval: real profit maximize(profit) writeln("maximum profit obtainable is ",getobjval) LP getdual, getprobstat, getrcost, getslack, getsol, LPOBJVAL ( ),MIPOBJVAL( )

88 getparam function getparam(name: string): integer string real boolean name SQL success := getparam("sqlsuccess") Mosel mmxprs.xprs VERBOSE setparam( 7 8 )

89 86 4 MOSEL getprobstat function getprobstat: integer mmxprs Boolean VERBOSE / getobjval maximize(profit) if(getprobstat = XPRS_OPT) then writeln("maximum profit is ",getobjval) else writeln("problem could not be solved to optimality") end-if getprobstat XPRS OPT XPRS UNF XPRS INF XPRS UNB getparam PRESOLVESTATE, LPSTATUS, MIPSTATUS ( ) XPRMgetprobstat, LPSTATUS ( ),MIPSTATUS ( )

90 getrcost 0 function getrcost(v: mpvar): real v declarations profit: linctr variables: set of mpvar end-declarations... if(getprobstat = XPRS_OPT) then getvars(profit,variables) forall(x in variables) writeln(getsol(x),"; ",getrcost(x)) end-if getdual, getobjval, getprobstat, getslack, getsol, XPRMgetrcost, XPRMgetsol( )

91 88 4 MOSEL getsize function getsize(a: array): integer function getsize(s: set): integer a s 8 2 getsize 2 declarations a: dynamic array(1..8) of real end-declarations a(1) := 4 a(5) := 7.2 l := getsize(a) XPRMgetarrsize, XPRMgetsetsize

92 getslack 0 function getslack(c: linctr): real c declarations ctr: set of linctr end-declarations... if(getprobstat = XPRS_OPT) then forall(c in ctr) if(getslack(c) <> 0) then writeln(getslack(c)) end-if end-if getdual, getobjval, getprobstat, getrcost, getsol, XPRMgetslack, XPRSgetsol ( )

93 90 4 MOSEL getsol 0 function getsol(v: mpvar): real function getsol(c: linctr): real v c declarations profit: linctr variables: set of mpvar end-declarations... if(getprobstat = XPRS_OPT) then getvars(profit,variables) forall(x in variables) writeln(getsol(x)) end-if getdual, getrcost, getobjval, getprobstat, XPRMgetcsol, XPRMgetvsol, XPRSgetsol ( )

94 getsysstat function getsysstat: integer mmsystem randomfile fdelete("randomfile") if(getsysstat <> 0) then writeln("randomfile could not be deleted.") end-if 0 getfstat, IOSTATUS, NBREAD, SQLSUCCESS

95 92 4 MOSEL gettime function gettime: real mmsystem starttime := gettime... write("time: ",gettime-starttime)

96 gettype function gettype(c: linctr): integer c declarations c: set of linctr end-declarations... if(getprobstat = XPRS_OPT) then forall(c in ctr) if(gettype(c) = CT_GEQ or gettype(c) = CT_LET) then writeln(getslack(c)) end-if end-if gettype CT EQ CT GEQ CT LEQ CT UNB CT SOS1 CT SOS2 = 1 2 CT CONT CT INT CT BIN CT PINT CT SEC CT SINT getdual, getslack, settype

97 94 4 MOSEL getub function getub(x: mpvar): real x mmxprs Boolean VERBOSE / x declarations Items = x: array(items) of mpvar end-declarations... forall(i in Items) writeln(i,": ",getlb(x(i)),", ",getub(x(i))) setub Mosel loadprob getlb, setlb, setub, XPRSchgbounds ( ),XPRSgetub ( )

98 getvars procedure getvars(c: linctr, s: set of mpvar) c s vset declarations c: linctr vset: set of mpvar end-declarations getvars(c,vset) forall(x in vset) writeln(getsol(x)) XPRMgetvarnum, COLS ( ), XPRSgetcols ( )

99 96 4 MOSEL initglobal procedure initglobal mmxprs XPRS NIG maxmize minimize maximize,minimize

100 iseof function iseof: boolean declarations d: integer end-declarations... fopen("datafile.dat",f_input) while(iseof = false) do readln(d) writeln(d) end-do fclose(f_input) fclose, fopen, fselect, getfid

101 98 4 MOSEL ishidden function ishidden(c: linctr): boolean c declarations ctr: set of linctr end-declarations... maximize(profit) writeln(getobjval) forall(c in ctr) if(ishidden(c)) then sethidden(c,false) end-if maximize(profit) writeln(getobjval) sethidden Mosel sethidden

102 isodd function isodd(i: integer): boolean i x(1) + x(3) + x(5) + x(7) declarations x: dynamic array(1..8) of mpvar end-declarations forall(i in 1..8 isodd(i)) create(x(i)) c := sum(i in 1..8) x(i)

103 100 4 MOSEL IVEaddtograph IVE procedure IVEaddtograph(xval: real, yval: real) xval yval x y mmive IVEinitgraph("Random graph","xcoord","value") forall (j in ) do IVEaddtograph(j,random) end-do 1. IVEinitgraph x IVEinitgraph

104 IVEinitgraph IVE procedure IVEinitgraph(name: string, x: string, y: string) name x y x y mmive Xpress-MP exp( 0.01x) cos(0.1x) model decay uses "mmive"; IVEinitgraph("Decaying oscillator","x","y") forall(i in ) IVEaddtograph(i,exp(-0.01*i)*cos(i*0.1)) end-model IVEaddtograph

105 102 4 MOSEL ln function ln(r: real): real r 1 i 0 j 1 k i := ln(1) j := ln(m_e) k := ln(0) 2 log exp, log, sqrt

106 loadbasis savebasis (delbasis ) procedure loadbasis(num: integer) procedure loadbasis(name: string) num name mmxprs Boolean VERBOSE / 2 declarations MinCost: linctr end-declarations savebasis(2)... loadprob(mincost) loadbasis(2) loadbasis maximize minimize loadprob delbasis, savebasis, XPRSloadbasis ( )

107 104 4 MOSEL loadcuts procedure loadcuts(cuttype: integer, interpret: integer, cuts: set of integer) procedure loadcuts(cuttype: integer, interpret: integer) cuttype interpret cuttype 3 cuttype cuts mmxprs Boolean cuttype VERBOSE / addcut, addcuts, delcuts, dropcuts, storecut, storecuts, XPRSloadcuts ( )

108 loadprob procedure loadprob(obj: linctr) procedure loadprob(force: boolean, obj: linctr) procedure loadprob(obj: linctr, extravar: set of mpvar) procedure loadprob(force: boolean, obj: linctr, extravar: set of mpvar) obj force extravar mmxprs Boolean LOADNAMES MPS / VERBOSE / 2 2 declarations MinCost: linctr end-declarations... savebasis(2)... loadprob(mincost) loasbasis(2) minimize maximize loadprob force extravar ( ) maximize, minimize, XPRSloadlp ( )

109 106 4 MOSEL log 10 function log(r: real): real r function logn(base,number: real): real if(number > 0 and base > 0) then returned := log(number)/log(base) else exit(1) end-if end-function exp,ln.sqrt

110 mkdir procedure makedir(dirname: string) dirname mmsystem makedir("logfiles") if(getsysstat = 0) then fopen("logfiles/log1.txt",f_output)... fclose(f_output) end-if getsysstat, removedir, system

111 108 4 MOSEL makesos (SOS) procedure makesos1(cs: linctr, s: set of mpvar, c: linctr) procedure makesos1(s: set of mpvar, c: linctr) procedure makesos2(cs: linctr, s: set of mpvar, c: linctr) procedure makesos2(s: set of mpvar, c: linctr) cs s c SOS s c cs

112 maximize procedure maximize(alg: integer, obj: linctr) procedure maximize(obj: linctr) alg XPRS BAR XPRS DUAL XPRS LIN XPRS TOP XPRS PRI XPRS GLB XPRS NIG obj LP LP iniglobal mmxprs Boolean LOADNAMES MPS / VERBOSE / Profit declarations Profit: linctr end-declarations maximize(xprs_dual+xprs_top,profit) 1. ( ) 2. XPRS LIN 3. XPRS TOP LP is LP initglobal, loadprob, minimize, XPRSmaxim (MAXIM) ( )

113 110 4 MOSEL maxlist function maxlist(i1: integer, i2: integer [, i3: integer ]): integer function maxlist(r1: real, r2: real [, r3: real ]): real i1,i2,.. r1,r2,.. maxlist r 7.0 r := maxlist(-1, 4.5, 2, 7, -0.3) minlist

114 minimize procedure minimize(alg: integer, obj: linctr) procedure minimize(obj: linctr) alg XPRS BAR XPRS DUAL XPRS LIN XPRS TOP XPRS PRI XPRS GLB XPRS NIG obj LP LP iniglobal mmxprs Boolean LOADNAMES MPS / VERBOSE / MinCost declarations MinCost: linctr end-declarations minimize(xprs_bar+xprs_lin, MinCost) 1. ( ) 2. XPRS LIN 3. XPRS TOP LP is LP

115 112 4 MOSEL initglobal, loadprob, maximize, XPRSminim (MINIM)( )

116 minlist function minlist(i1: integer, i2: integer [,i3: integer ]): integer function minlist(r1: real, r2: real [,r3: real ]): real i1,i2,.. r1,r2,.. maxlist r -1.0 r := minlist(-1, 4.5, 2, 7, -0.3) maxlist

117 114 4 MOSEL random [0, 1) function random: real i 1 10 setrandseed(round(gettime)) i := integer(round((10*random)+0.5)) setrandseed

118 read,readlin procedure read(e1: expr [,e2: expr ]) procedure readln procedure readln(e1: expr [,e2: expr ]) e1,e2,... Boolean IOCTRL IO / word toto(12 and 45)=word declarations i, j: integer s: string ts: array(range,range) of string end-declarations read(i,j,s) readln("toto(",i,"and",j,")=",ts(i,j)) 1. ei ei NBREAD 2. read Mosel 3. readlin readln readln NBREAD, SQLreadinteger, SQLreadreal, SQLreadstring, write, writeln

119 116 4 MOSEL removedir procedure removedir(dirname: string) dirname mmsystem dirlist declarations dirlist: set of string end-declarations... forall(dir in dirlist) if(bittest(getfstat(dir),sys_typ) = SYS_DIR) then removedir(dir) end-if getfstat, getsysstat, makedir

120 round function round(r: real): integer r c -2 d 2 c := round(-1.9) d := round(1.5) ceil,floor

121 118 4 MOSEL savebasis procedure savebasis(num: integer) procedure savebasis(name: string) num name mmxprs Boolean VERBOSE / 2 declarations MinCost: linctr end-declarations savebasis(2)... loadprob(mincost) loadbasis(2) delbasis loadbasis delbasis, loadbasis, XPRSwritebasis ( )

122 setcallback procedure setcallback(cbtype: integer, cb: string) cbtype cb. XPRS CB IL XPRS CB GL XPRS CB BL XPRS CB USN XPRS CB UPN XPRS CB UON XPRS CB UIN XPRS CB UIS XPRS CB UCN XPRS CB CMI XPRS CB CMS XPRS CB CM ( ) XPRS CB TCM / function cb:boolean.. XPRS CB IL, XPRS CB GL, XPRS CB BL, XPRS CB UON, XPRS CB CM, XPRS CB TCM function cb(node:integer):integer..xprs CB USN, XPRS CB UPN procedure cb..xprs CB UIN, XPRS CB UIS, XPRS CB CMI, XPRS CB CMS procedure cb(node:integer)..xprs CB UCN mmxprs Boolean VERBOSE / procedure printsol declarations objval: real end-declarations

123 120 4 MOSEL objval := getparam("xprs_lpobjval") writeln("solution value: ",objval) end-procedure setcallback(xprs_cb_uis,"printsol") Xpress-Optimizer Mosel / getparam 5.3

124 setcoeff procedure setcoeff(c: linctr, x: mpvar, r: real) procedure setcoeff(c: linctr, r: real) c x r c declarations x,y,z: mpvar end-declarations c := 4*x + y - z <= 12 setcoeff(c,y,2) setcoeff(c,8.1) 4*x + 2*y - z getcoeff, XPRSchgcoef ( ), XPRSchgmcoef ( )

125 122 4 MOSEL sethldden procedure sethidden(c: linctr, b: boolean) c b true false declarations x,y,z: mpvar end-declarations c := 4*x + y - z <= 12 sethidden(c,true) Mosel ishiddden ishidden

126 setlb procedure setlb(x: mpvar, r: real) x r mmxprs Boolean VERBOSE / b 50 profit loadprob(profit) setlb(b,50) maximize(profit) Mosel getlb, getub, loadprob, setub, XPRSchgbounds ( )

127 124 4 MOSEL setmlpdlr procedure setmipdir(x: mpvar, t: integer, r: real) procedure setmipdir(x: mpvar, t: integer) procedure setmipdir(c: linctr, t: integer, r: real) procedure setmipdir(c: linctr, t: integer) x c r t XPRS PR r XPRS UP XPRS DN XPRS PU r XPRS PO r mmxprs Boolean VERBOSE / clearmipdir, XPRSgetdirs ( ),XPRSloaddirs ( )

128 setmodcut procedure setmodcut(c: linctr) c mmxprs Boolean VERBOSE / declarations Items: set of integer ctr: array(items) of linctr end-declarations... forall(i in Items isodd(i)) setmodcut(ctr(i)) maximize(profit) writeln("profit: ",getobjval) clearmodcut clearmodcut, XPRSloadmodelcuts ( )

129 126 4 MOSEL setparam procedure setparam(name: string, val: integer string real boolean) name val 6 6 setparam("xprs_verbose",true) Mosel ( mmxprs.xprs LOADNAMES) getparam, 7

130 setrandseed procedure setrandseed(s: integer) s i 1 10 setrandseed(round(gettime)) i := integer(round((10*random)+0.5)) random random

131 128 4 MOSEL settype procedure settype(c: linctr, type: integer) c type ctr declarations ctr: linctr end-declarations... settype(ctr,ct_eq) maximize(profit) CT EQ = CT GEQ CT LEQ CT UNB CT SOS1 CT SOS2 1 2 CT CONT CT INT CT BIN CT PINT CT SEC CT SINT gettype, XPRSchgrowtype ( )

132 setub procedure setub(x: mpvar, r: real) x r mmxprs Boolean VERBOSE / loadprob(profit) setub(a,100) maximize(profit) Mosel loadprob getlb, getub, loadprob, setlb, XPRSchgbounds ( )

133 130 4 MOSEL sin ( ) function sin(r:real): real r IVE model sine uses "mmive"; IVEinitgraph("Oscillator","x","sin x") forall(i in ) IVEaddtograph(i,sin(i*0.1)) end-model srctan,cos

134 SQLconnect procedure SQLconnect(s: string) s mmodbs Boolean SQLVERBOSE ODBC / MySQL test yve DaSH SQLconnect("DSN=mysql;DB=test;UID=yves;PWD=DaSH") SQLCONNECTION SQLdisconnect, SQLexecute, SQLreadinteger, SQLreadreal, SQLreadstring

135 132 4 MOSEL SQLdisconnect procedure SQLdisconnect mmodbs Boolean SQLVERBOSE ODBC / test yve SQLconnect("DSN=mysql;DB=test;UID=yves;PWD=DaSH") i := SQLreadinteger("select articlenum from pricelist where colour=blue") SQLdisconnect SQLCONNECTION SQLconnect, SQLexecute, SQLreadinteger, SQLreadreal, SQLreadstring

136 SQLexecute SQL procedure SQLexecute(s: string) procedure SQLexecute(s: string, a: array) procedure SQLexecute(s: string, m: set) s a m SQL integer,real,string,boolean integer,real,string,boolean mmodbs Boolean SQLNDXCOL / SQLVERBOSE ODBC / Integer SQLCOLSIZE SQLCONNECTION ODBC 4 SQLexecute colour priicelist colour prices priicelist colour prices 2 ndx prices newtab declarations prices: array( ) of real colours: array( ) of string allcolours: set of string end-declarations... SQLexecute("select colour from pricelist",allcolours) SQLexecute("select articlenum,colour,price from pricelist",[colours,prices]) SQLexecute("create table newtab (ndx integer, price double)") SQLexecute("insert into table newtab (ndx, price) value (?,?)", prices)

137 134 4 MOSEL SQLconnect, SQLdisconnect, SQLreadinteger, SQLreadreal, SQLreadstring, SQLSUCCESS

138 SQLreadinteger function SQLreadinteger(s: string): integer s SQL mmodbs Boolean SQLNDXCOL / SQLVERBOSE ODBC / Integer SQLCOLSIZE SQLCONNECTION ODBC colour blue pricelist i := SQLreadinteger("select articlenum from pricelist where colour=blue") SQL read, readln, SQLexecute, SQLreadreal, SQLreadstring

139 136 4 MOSEL SQLreadreal function SQLreadreal(s: string): real s SQL mmodbs Boolean SQLNDXCOL / SQLVERBOSE ODBC / Integer SQLCOLSIZE SQLCONNECTION ODBC newtab 2 price r := SQLreadreal("select price from newtab where ndx=2") SQL read, readln, SQLexecute, SQLreadinteger, SQLreadstring

140 SQLreadstring function SQLreadstring(s: string): string s SQL mmodbs Boolean SQLNDXCOL / SQLVERBOSE ODBC / Integer SQLCOLSIZE SQLCONNECTION ODBC pricelist 1004 colour s := SQLreadstring("select colour from pricelist where articlenum=1004") SQL read, readln, SQLexecute, SQLreadinteger, SQLreadreal

141 138 4 MOSEL sqrt function sqrt(r: real): real r function isprime(number: integer): boolean if(number < 2) then returned := false end-if i := 1 repeat i+=1 until((number mod i = 0) or i > sqrt(number)) if(i > sqrt(number)) then returned := true else returned := false end-if end-function exp,ln.log

142 storecut function storecut(nodupl: integer, cuttype: integer, type: integer, linexp: linctr): integer nodupl cuttype type linexp CT_GEQ CT_LEQ CT_EQ mmxprs Boolean VERBOSE / loadcuts addcut, addcuts, dropcuts, delcuts, loadcuts, storecuts, XPRSstorecuts ( )

143 140 4 MOSEL storecuts procedure storecuts(nodupl: integer, cuttype: array(range) of integer, type: array(range) of integer, linexp: array(range) of linctr, ndx_a: array(range) of integer) procedure storecuts(nodupl: integer, cuttype: array(range) of integer, type: array(range) of integer, linexp: array(range) of linctr, ndx_s: set of integer) nodupl cuttype type linexp ndx a ndx b CT_GEQ CT_LEQ CT_EQ mmxprs Boolean VERBOSE / loadcuts ndx a ndx b 4 addcut, addcuts, dropcuts, delcuts, loadcuts, storecut, XPRSstorecuts ( )

144 strfmt function strfmt(str: string, len: integer): string function strfmt(i: integer, len: integer): string function strfmt(r: real, len: integer): string function strfmt(r: real, len: integer, dec: integer): string str i r len dec < 0 > text1 text2text3 writeln("text1", strfmt("text2",8), "text3") r := writeln(strfmt(r,0)," ", strfmt(r,4,2), strfmt(r,8,0)) 1. (write writeln ) 2. substr, write, writeln

145 142 4 MOSEL substr function substr(str: string, i1: integer, i2: integer): string str i1 i2 ample te write(substr("example text",3,10))

146 system procedure system(command: string) command mmsystem Newdir system("mkdir Newdir") getsysstat

147 144 4 MOSEL write,writeln procedure write(e1: expr [,e2: expr ]) procedure writeln procedure writeln(e1: expr [,e2: expr ]) e1,e2,.. Boolean IOCTRL IO / Set 1 A real:7.12, a Boolean:true Set1 := {"first", "second", "fifth"} write(set1) writeln b := true writeln("a real:", strfmt(7.1234, 4, 2), ", a Boolean:",b) writeln strfmt linctr,mpvar fselect, read, readln, strfmt

148 5 Xpress-Mosel ( ) 1 Mosel (xprm rt) (xprm mc) ( XPRMcompmod ) xprm rt.h xprm mc.h 5.1 Mosel 145

149 146 5 CLOAD COMPILE DELETE DISPLAY EXAMINE EXPRTPROB FLUSHLIBS INFO LIST LOAD LSLIBS QUIT RESRT RUN SELECT SYMBOLS SYSTEM BIM BIM DSO DSO Mosel OS 5.2 Mosel 1 2

150 XPRMautounloaddso void XPRMautounloaddso(int yesno); yesno 0 XPRMmodel mod; int nreturn;... XPRMautounloaddso(0);... for(mod = XPRMgetnextmod(NULL); mod!= NULL; mod = XPRMgetnextmod(mod)) XPRMrunmod(mod,&nReturn,NULL); XPRMflushdso(); XPRMflushdso XPRMflushdso (FLUSHLIBS)

151 148 5 XRPMchkarrind int XPRMchkarrind(XPRMarray array, int indices[]); array indices array n n- (4, 4) 2 A XPRMmodel model XPRMalltypes atarr; XPRMarray A; int indices[2];... XPRMfindident(model,"A",&atarr); A = atarr.array; indices[0] = 4; indices[1] = 4; if(xprmchkarrind(a,indices)!= 1) printf("index (%d,%d) lies within the range bounds of A\n",indices[0],indices[1]); 0 1 XPRMcmpindices

152 CLOAD (.bim ) Mosel CLOAD [-options] srcfile [userc] options g s BIM m.mod M.mod p e srcfile userc e.mos Mosel myprob.mos %> mosel -c CL myprob; RUN CLOAD COMPILE LOAD XPRMcompmod (COMPILE), XPRMloadmod (LOAD), XPRMrunmod (RUN)

153 150 5 XPRMcmpindices 2 int XPRMcmpindices(int transpose, int nbdim, int ind1[],int ind2[]) transpose nbdim ind1 ind2 0 ind1 ind2 nbdim nbdim A XPRMalltypes atarr; XPRMarray A; int *indices, *trueindices;... findident(model,"a",&atarr); A = atarr.array; indices = malloc(xprmgetarrdim(a)*sizeof(int)); trueindices = malloc(xprmgetarrdim(a)*sizeof(int)); XPRMfirstarrentry(A,indices); XPRMfirstarrtruentry(A,trueindices); if(xprmcmpindices(0, XPRMgetarrdim(A), trueindices, indices)!= 0) printf("dynamic array A has not had its first entry defined\n"); 2-1 ind1 ind ind2 ind1 XPRMchkarrind

154 XPRMcompmod COMPILE (.bim ) XPRMloadmod (LOAD) int XPRMcompmod(const char *options, const char *srcfile, const char *dstfile, const char *userc); COMPILE [-options] srcfile [userc] options g s BIM m.mod M.mod p e srcfile dstfile userc e.mos NULL srcfile.bim 1( ) Mosel myprob.mos XPRMmodel model; int nreturn; XPRMinit(); XPRMcompmod("","myprob.mos",NULL,"My Problem"); model = XPRMloadmod("myprob.bim",NULL); XPRMrunmod(model,&nReturn,NULL); XPRMfree(); 2( ) myprob.mos myprob.bim

155 152 5 COMPILE myprob LOAD myprob RUN QUIT 1. XPRMcompmod Mosel xprm mc.h ( ) 3 3. srcfile NULL 4. -e Mosel.mos.bim ( ) srcfile dstfile CLOAD, XPRMloadmod (LOAD), XPRMrunmod (RUN)

156 DELETE DELETE [number name] number name model Mosel simple.mos alterd.mos alterd simple CLOAD simple RUN CLOAD altered RUN DELETE 1. BIM LIST CLOAD, LIST, XPRMloadmod (LOAD), SELECT, XPRMunloadmod

157 154 5 DISPLAY DISPLAY symbol symbol Mosel myprob.mos (profit) CLOAD myprob RUN DISPLAY profit ( 0) ( 0) getobjval, getsol, SYMBOLS, XPRMgetcsol, XPRMgetobjval, XPRMgetvsol

158 EXAMINE / / EXAMINE [-options] libname options c s / p / t libname mmodbc / / EXAMINE mmodbc XPRMgetdsoinfo, XPRMgetdsoparam, XPRMgetnextdsoconst,XPRMgetnextdsoparam, XPRMgetnextdsoproc

159 156 5 XPRMexportprob EXPORTPROB MPS LP int XPRMexportprob(XPRMmodel model, const char *options,const char *fname, XPRMlinctr obj); EXPORTPROB [-options] [filename [obj]] model options m MPS LP ( ) p (LP ) s filename obj NULL NULL 1( ) LP XPRMmodel model; int nreturn;... XPRMrunmod(model,&nReturn,NULL); XPRMexportprob(model,"p",NULL,NULL) 2( ) MPS myprob.mat RUN EXPORTPROB -m myprob.mat NULL MPS.mat LP.lp ( sp ) Mosel exportprob, XPRBexportprob BCL

160 XPRMfinddso DSO XPRMdsolib XPRMfinddso(const char *libname); libname mmxprs XPRMdsolib lib; int libv; const char *name;... if((lib = XPRMfinddso("mmxprs"))!= NULL) { XPRMgetdsoinfo(lib,&name,NULL,&libv,NULL); printf("got module: %s version %d.%d.%d\n", name, libv/ , (libv/1000)-1000*(libv/ ), libv *(libv/1000)); } NULL XPRMgetnextdso

161 158 5 XPRMfindident int XPRMfindident(XPRMmodel model, const char *text,xprmalltypes *value); model text value a b XPRMalltypes atvar; XPRMmpvar a, b; in nreturn;... XPRMrunmod(simple,&nReturn,NULL); XPRMfindident(simple,"a",&atvar); a = atvar.mpvar; XPRMfindident(simple,"b",&atvar); b = atvar.mpvar; printf("a = %g, b = %g\n",xprmgetsol(a),xprmgetsol(b)); 1. XPRMfindident 0 XPRM TYP(t) XPRM STR(t) XPRM STR CONST XPRM STR REF XPRM STR SET XPRM STR ARR XPRM STR PROC

162 XPRM TYP NOT XPRM TYP INT XPRM TYP REAL XPRM TYP STRING XPRM TYP BOOL XPRM TYP MPVAR XPRM TYP LINCTR XPRM TYP SET XPRM TYP ARR XPRMgettypename 2. XPRMalltypes XPRMfindident value.integer value.real value.string value.boolean value.mpvar value.linctr value.set value.array value.proc XPRMgetnextident ( ) ( )

163 160 5 XPRMfindmod XPRMmodel XPRMfindmod(const char *name, int number); name number NULL 1 XPRMmodel myprob; XPRMinit(); XPRMloadprob("myprob.bim","My Problem");... myprob = XPRMfindmod("My Problem",-1); 1. XPRMfindmod NULL 2. (.bim ) (number = 1) (number =NULL) name XPRMloadmod

164 XPRMfirstarrentry int XPRMfirstarrentry(XPRMarray array, int indices[]); array indices n- n array A XPRMmodel model; XPRMalltypes atarr; XPRMarray A; int i,*indices;... XPRMfindident(model,"A",&atarr); A = atarr.array; indices = malloc(xprmgetarrdim(a)*sizeof(int)); XPRMfirstarrentry(A,indices); for(i=0;i<xprmgetarrdim(a);i++) printf("index of first entry of A in dimension %d is %d\n",i+1,indices[i]); XPRMfirstarrtruentry, XPRMfirstsetndx, XPRMlastarrentry, XPRMnextarrentry

165 162 5 XPRMfirstarrtruentry int XPRMfirstarrtruentry(XPRMarray array, int indices[]); array indices n- n array A XPRMmodel model; XPRMalltypes atarr; XPRMarray A; int i,*indices;... XPRMfindident(model,"A",&atarr); A = atarr.array; indices = malloc(xprmgetarrdim(a)*sizeof(int)); XPRMfirstarrtruentry(A,indices); for(i=0;i<xprmgetarrdim(a);i++) printf("index of first true entry of A in dimension %d is %d\n",i+1,indices[i]); XPRMfirstarrentry XPRMfirstarrentry, XPRMlastarrentry, XPRMnextarrtruentry

166 XPRMfirstsetndx int XPRMfirstsetndx(XPRMset set); set Items XPRMmodel model; XPRMalltypes atset, atelt; XPRMset items;... XPRMfindident(model,"Items",&atset); items = atset.set; if(xprm_typ(xprmgetsettype(items)) == XPRM_TYP_INT) for(i=firstsetndx(items);i<=xprmlastsetndx(items);i++) { XPRMgetelsetval(items,i,&atelt); printf("items[%d] = %d\n",j,atelt.integer); } 1. string 1 XPRMgetelsetndx, XPRMgetelsetval, XPRMgetsetsize,XPRMlastsetndx

167 164 5 XPRMflushdso FLUSHLIBS void XPRMflushdso(void); FLUSHLIBS 1( ) XPRMdsolib lib; const char *name; int libv;... XPRMflushdso(); for(lib=null;(lib = XPRMgetnextdso(lib))!= NULL;) { XPRMgetdsoinfo(lib,&name,NULL,&libv,NULL); printf("model uses %s, version %d.%d.%d\n", name, libv/ , (libv/1000)-1000*(libv/ ), libv-1000*(libv/1000)); } 2( ) RUN FLUSHLIBS LSLIBS fflush, XPRMautounloaddso

XpressMemoForDash.dvi

XpressMemoForDash.dvi Xpress-MP 1 Ver 1.1 2006. 2. 16 (Ver1.0) 2006. 3. 1 (Ver1.1) 1 2006 3 Xpress-MP Xpress-MP 2006 Xpress-MP,. Dash [1]. mosel,, mosel.,,?, shokosv Xpress-MP,., 2. Example. 1 Xpress-MP 2 mosel 3 mosel 4, shakosv

More information

(B2) 序章 FICO Xpressの基礎

(B2) 序章 FICO Xpressの基礎 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

More information

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

第 5 章 Xpress の基礎 本書の全ての問題は Xpress-Mosel( 短縮して Mosel) 言語で記述されています 問題を解く場合 ユーザは Mosel コマンド文か Xpress-IVE を選択できます 本書の最適化問題を解く場合 線形問題や混合整数計画問題を Mosel 言語で記述 FICO Xpress の基礎 Application of optimization with Xpress 第 5 章の抜粋 ( 日本語訳 ) MSI 株式会社 Xpress 事業部 第 5 章 Xpress の基礎 本書の全ての問題は Xpress-Mosel( 短縮して Mosel) 言語で記述されています 問題を解く場合 ユーザは Mosel コマンド文か Xpress-IVE を選択できます

More information

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 -

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 - GLPK by GLPK http://mukun mmg.at.infoseek.co.jp/mmg/glpk/ 17 7 5 : update 1 GLPK GNU Linear Programming Kit GNU LP/MIP ILOG AMPL(A Mathematical Programming Language) 1. 2. 3. 2 (optimization problem) X

More information

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal Pascal Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS 2010 10 1 Pascal 2 1.1.......................... 2 1.2.................. 2 1.3........................ 3 2 4 2.1................................

More information

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

ストラドプロシージャの呼び出し方 Release10.5 Oracle DataServer Informix MS SQL NXJ SQL JDBC Java JDBC NXJ : NXJ JDBC / NXJ EXEC SQL [USING CONNECTION ] CALL [.][.] ([])

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

Fortran90/95 [9]! (1 ) " " 5 "Hello!"! 3. (line) Fortran Fortran 1 2 * (1 ) 132 ( ) * 2 ( Fortran ) Fortran ,6 (continuation line) 1

Fortran90/95 [9]! (1 )   5 Hello!! 3. (line) Fortran Fortran 1 2 * (1 ) 132 ( ) * 2 ( Fortran ) Fortran ,6 (continuation line) 1 Fortran90/95 2.1 Fortran 2-1 Hello! 1 program example2_01! end program 2! first test program ( ) 3 implicit none! 4 5 write(*,*) "Hello!"! write Hello! 6 7 stop! 8 end program example2_01 1 program 1!

More information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

1. A0 A B A0 A : A1,...,A5 B : B1,...,B 1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A, B Z Z m, n Z m n m, n A m, n B m=n (1) A, B (2) A B = A B = Z/ π : Z Z/ (3) A B Z/ (4) Z/ A, B (5) f : Z Z f(n) = n f = g π g : Z/ Z A, B (6)

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

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

VDM-SL VDM VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web bool VDM-SL VDM++ 23 6 28 VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web 2 1 3 1.1............................................... 3 1.1.1 bool......................................... 3 1.1.2 real rat int

More information

新・明解Java入門

新・明解Java入門 第 1 章 画面 文字 表示 Java Java Java Java Java JRE Java JDK 21 1-1 Java Java Java Java 誕生 Fig.1-1 Oak Java Sun Microsystems 2010 Oracle Java Oracle 4 Java http://www.java.com/ http://www.alice.org/ Fig.1-1Java

More information

listings-ext

listings-ext (6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

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

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.   このサンプルページの内容は, 初版 1 刷発行時のものです. Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009631 このサンプルページの内容は, 初版 1 刷発行時のものです. Excel URL http://www.morikita.co.jp/books/mid/009631 i Microsoft Windows

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

xl 1 program Othello6; 2 {$APPTYPE CONSOLE} 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasu

xl 1 program Othello6; 2 {$APPTYPE CONSOLE} 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasu xl 1 program Othello6; 2 {$APPTYPE CONSOLE 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasuNo] of TYouso; // 10 10 9 TPlayer = Kuro..Siro; // 10

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

Autumn 2005 1 9 13 14 16 16 DATA _null_; SET sashelp.class END=eof; FILE 'C: MyFiles class.txt'; /* */ PUT name sex age; IF eof THEN DO; FILE LOG; /* */ PUT '*** ' _n_ ' ***'; END; DATA _null_;

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

明解Java入門編

明解Java入門編 1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

橡ソート手順比較

橡ソート手順比較 PAGE:1 [Page] 20 1 20 20 QuickSort 21 QuickSort 21 21 22 QuickSort 22 QuickSort 22 23 0 23 QuickSort 23 QuickSort 24 Order 25 25 26 26 7 26 QuickSort 27 PAGE:2 PAGE:3 program sort; { { type item = record

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

1. A0 A B A0 A : A1,...,A5 B : B1,...,B 1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A B f : A B 4 (i) f (ii) f (iii) C 2 g, h: C A f g = f h g = h (iv) C 2 g, h: B C g f = h f g = h 4 (1) (i) (iii) (2) (iii) (i) (3) (ii) (iv) (4)

More information

Condition DAQ condition condition 2 3 XML key value

Condition DAQ condition condition 2 3 XML key value Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

all.dvi

all.dvi fortran 1996 4 18 2007 6 11 2012 11 12 1 3 1.1..................................... 3 1.2.............................. 3 2 fortran I 5 2.1 write................................ 5 2.2.................................

More information

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

2005 D Pascal CASL ( ) Pascal C 3. A A Pascal TA TA TA 2005 D 1 1.1 1.2 Pascal CASL ( ) Pascal 1. 2005 10 13 2006 1 19 12 2. C 3. A A 2 1 2 Pascal 1.3 1. 2. TA TA TA sdate@ist.osaka-u.ac.jp nakamoto@image.med.osaka-u.ac.jp h-kido@ist.osaka-u.ac.jp m-nakata@ist.osaka-u.ac.jp

More information

10-C.._241_266_.Z

10-C.._241_266_.Z Windows 10 1 2 3 4 5 Visual Studio 2008LINQ MySchedule 242 Microsoft Visual C# 2008 10 Windows 243 1 LINQIEnumerableXML LINQ to Object q Form1.cs w RefreshListBox private void RefreshListBox() schedulelistbox.items.clear();

More information

1,.,,,., RDBM, SQL. OSS,, SQL,,.

1,.,,,., RDBM, SQL. OSS,, SQL,,. 1,.,,,., RDBM, SQL. OSS,, SQL,,. 3 10 10 OSS RDBMS SQL 11 10.1 OSS RDBMS............................ 11 10.1.1 PostgreSQL................................. 11 10.1.2 MySQL...................................

More information

tkk0408nari

tkk0408nari SQLStatement Class Sql Database SQL Structured Query Language( ) ISO JIS http://www.techscore.com/tech/sql/02_02.html Database sql Perl Java SQL ( ) create table tu_data ( id integer not null, -- id aid

More information

# 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

# 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 II 4 : 2001 11 7 keywords: 1 OCaml OCaml (first-class value) (higher-order function) 1.1 1 2 + 2 2 + + n 2 sqsum 1 3 + 2 3 + + n 3 cbsum # let rec sqsum n = # if n = 0 then 0 else n * n + sqsum (n - 1)

More information

main.dvi

main.dvi 1 F77 5 hmogi-2008f@kiban.civil.saitama-u.ac.jp 2013/5/13 1 2 f77... f77.exe f77.exe CDROM (CDROM D D: setupond E E: setupone 5 C:work\T66160\20130422>f77 menseki.f -o menseki f77(.exe) f77 f77(.exe) C:work\T66160\20130422>set

More information

untitled

untitled Fortran90 ( ) 17 12 29 1 Fortran90 Fortran90 FORTRAN77 Fortran90 1 Fortran90 module 1.1 Windows Windows UNIX Cygwin (http://www.cygwin.com) C\: Install Cygwin f77 emacs latex ps2eps dvips Fortran90 Intel

More information

jssst-ocaml.mgp

jssst-ocaml.mgp Objective Caml Jacques Garrigue Kyoto University garrigue@kurims.kyoto-u.ac.jp Objective Caml? 2 Objective Caml GC() Standard MLHaskell 3 OCaml () OCaml 5 let let x = 1 + 2 ;; val x : int = 3 ;; val-:

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

2009 D Pascal CASL II ( ) Pascal C 3. A A Pascal TA TA

2009 D Pascal CASL II ( ) Pascal C 3. A A Pascal TA TA 2009 D 1 1.1 1.2 Pascal CASL II ( ) Pascal 1. 2009 10 15 2010 1 29 16 2. C 3. A A 2 1 2 Pascal 1.3 1. 2. TA enshud@image.med.osaka-u.ac.jp TA enshu-d@image.med.osaka-u.ac.jp nakamoto@image.med.osaka-u.ac.jp

More information

haskell.gby

haskell.gby Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]

More information

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

2011 D Pascal CASL II ( ) Pascal C 3. A A Pascal TA TA enshu- 2011 D 1 1.1 1.2 Pascal CASL II ( ) Pascal 1. 2011 10 6 2011 2 9 15 2. C 3. A A 2 1 2 Pascal 1.3 1. 2. TA enshud@fenrir.ics.es.osaka-u.ac.jp TA enshu-d@fenrir.ics.es.osaka-u.ac.jp higo@ist.osaka-u.ac.jp

More information

SystemC言語概論

SystemC言語概論 SystemC CPU S/W 2004/01/29 4 SystemC 1 SystemC 2.0.1 CPU S/W 3 ISS SystemC Co-Simulation 2004/01/29 4 SystemC 2 ISS SystemC Co-Simulation GenericCPU_Base ( ) GenericCPU_ISS GenericCPU_Prog GenericCPU_CoSim

More information

compiler-text.dvi

compiler-text.dvi 2018.4 1 2 2.1 1 1 1 1: 1. (source program) 2. (object code) 3. 1 2.2 C if while return C input() output() fun var ( ) main() C (C-Prime) C A B C 2.3 Pascal P 1 C LDC load constant LOD load STR store AOP

More information

# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n

# let st1 = {name = Taro Yamada; id = };; val st1 : student = {name=taro Yamada; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n II 6 / : 2001 11 21 (OCaml ) 1 (field) name id type # type student = {name : string; id : int};; type student = { name : string; id : int; } student {} type = { 1 : 1 ;...; n : n } { 1 = 1 ;...; n = n

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 5 3. 4. 5. A0 (1) A, B A B f K K A ϕ 1, ϕ 2 f ϕ 1 = f ϕ 2 ϕ 1 = ϕ 2 (2) N A 1, A 2, A 3,... N A n X N n X N, A n N n=1 1 A1 d (d 2) A (, k A k = O), A O. f

More information

Copyright c 2008 Zhenjiang Hu, All Right Reserved.

Copyright c 2008 Zhenjiang Hu, All Right Reserved. 2008 10 27 Copyright c 2008 Zhenjiang Hu, All Right Reserved. (Bool) True False data Bool = False True Remark: not :: Bool Bool not False = True not True = False (Pattern matching) (Rewriting rules) not

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 September 2016 1 Windows Cygwin Mac *1 Emacs Ruby 1 1.1 ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 ~/16:00:20> ls 2 2 ls ls -a ~/16:00:20> ls -a

More information

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

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 ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,

More information

Ver ceil floor FunctionGenerator (PTZCameraSony)

Ver ceil floor FunctionGenerator (PTZCameraSony) RT 2011 9 18 2009 11 15 1 2009 11 20 2009 12 4 1.2 Ver.1.0.2 ceil floor 3.2.1 4 FunctionGenerator 4.1 2009 12 7 4.2 2009 12 18 1.4 - - (PTZCameraSony) 2.2 - - 4.3 - - 2009 12 27 1.1 2011 9 18 OpenRTM-aist-1.0.0

More information

SystemC 2.0を用いた簡易CPUバスモデルの設計

SystemC 2.0を用いた簡易CPUバスモデルの設計 SystemC 2.0 CPU CPU CTD&SW CT-PF 2002/1/23 1 CPU BCA UTF GenericCPU IO (sc_main) 2002/1/23 2 CPU CPU CQ 1997 11 Page 207 4 Perl Verilog-HDL CPU / Verilog-HDL SystemC 2.0 (asm) ROM (test.hex) 2002/1/23

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

syspro-0405.ppt

syspro-0405.ppt 3 4, 5 1 UNIX csh 2.1 bash X Window 2 grep l POSIX * more POSIX 3 UNIX. 4 first.sh #!bin/sh #first.sh #This file looks through all the files in the current #directory for the string yamada, and then prints

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

n 第1章 章立ての部分は、書式(PC入門大見出し)を使います

n 第1章 章立ての部分は、書式(PC入門大見出し)を使います FORTRAN FORTRAN FORTRAN ) DO DO IF IF FORTRAN FORTRAN(FORmula TRANslator)1956 IBM FORTRAN IV FORTRAN77 Fortran90 FORTRAN77 FORTRAN FORTARN IF, DO C UNIX FORTRAN PASCAL COBOL PL/I BASIC Lisp PROLOG Lisp

More information

I 2 tutimura/ I 2 p.1/??

I 2   tutimura/ I 2 p.1/?? I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,

More information

exec.dvi

exec.dvi 2018 c 6, Mini-C C++ 6211 611, 61, print,,, (run ),,, (int ), 7, x, x "a" 3 "b" 4 "x" 10 (, ), x STL map 1 + 2, 1 2,, x = ;, 1, 2 x { 1 ; 2 ; ; m, if ( ) { 1 else { 2, 1,, 2 0, 1, 3 0, 2,,, main 6 1 ,,

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

BASICとVisual Basic

BASICとVisual Basic Visual Basic BASIC Visual Basic BASICBeginner's All purpose Symbolic Instruction Code Visual Basic Windows BASIC BASIC Visual Basic Visual Basic End Sub .Visual Basic Visual Basic VB 1-1.Visual Basic

More information

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 (Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 17 Fortran Formular Tranlator Lapack Fortran FORTRAN, FORTRAN66, FORTRAN77, FORTRAN90, FORTRAN95 17.1 A Z ( ) 0 9, _, =, +, -, *,

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

( ) 1 Windows HTML ( ) ( ) ( ) WWW 10 ( )

( ) 1 Windows HTML ( ) ( ) ( ) WWW 10 ( ) ( ) 1 Windows HTML ( ) ( ) ( ) 1. 2. 3. 4. WWW 10 ( ) 2 1. 2. 1 3. ( ) 4. 5. 3 Windows 2 7 8 MS Word MS Excel 1. MS Word 600 2. MS Excel 1 34 2 83 3 23 4 70 5 100 6 45 7 58 8 29 9 68 10 72 11 37 12 12

More information

( ) ( ) lex LL(1) LL(1)

( ) ( ) lex LL(1) LL(1) () () lex LL(1) LL(1) http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 29 5 14 1 1 () / (front end) (back end) (phase) (pass) 1 2 1 () () var left, right; fun int main() { left = 0; right = 10;

More information

Mosel: An Overview Y. Colombani and S. Heipcke Xpress Team, FICO, Leam House, Leamington Spa CV32 5YN, UK May 2002, last re

Mosel: An Overview Y. Colombani and S. Heipcke Xpress Team, FICO, Leam House, Leamington Spa CV32 5YN, UK   May 2002, last re 日本語訳 版 Mosel: An Overview Y. Colombani and S. Heipcke Xpress Team, FICO, Leam House, Leamington Spa CV32 5YN, UK http://www.fico.com/xpress May 2002, last rev. June 2008 概要 Msel An Overview では 基本的な Mosel

More information

2: 3: A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz A ( ( 4 ( 5 f(t = sin(2πf 1t + sin(2πf 2 t = 2 sin(2πt(f 1 + f 2 /2 cos(2πt(f 1 f

2: 3: A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz A ( ( 4 ( 5 f(t = sin(2πf 1t + sin(2πf 2 t = 2 sin(2πt(f 1 + f 2 /2 cos(2πt(f 1 f 12 ( TV TV, CATV, CS CD, DAT, DV, DVD ( 12.1 12.1.1 1 1: T (sec f (Hz T= 1 f P a = N/m 2 1.013 10 5 P a 1 10 5 1.00001 0.99999 2,3 1 2: 3: 12.1.2 A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz

More information

6-1

6-1 6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);

More information

Compatibility list: vTESTstudio/CANoe

Compatibility list: vTESTstudio/CANoe 1.0 および 1.1 で作成されたテストユニットは テスト内で使用されるコマンドに関わらず 必ず下記の最小バージョン以降の CANoe にて実行してください vteststudio 2.0 以上で作成されたテストユニット ( 新機能を使用していない場合 ) は それぞれに応じた最小バージョン以降の CANoe にて実行してください 下記の表にて 各バージョンに対応する要件をご確認ください vteststudio

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

For_Beginners_CAPL.indd

For_Beginners_CAPL.indd CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL

More information

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( data.t C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout

More information

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp 7 OCaml () 1. 2. () (compiler) (interpreter) 2 OCaml (syntax) (BNF,backus normal form ) 1 + 2; let x be 2-1 in x; ::= ; let be in ; ::= + - ::= * / ::= 7.1 ( (printable characters) (tokens) 1 (lexical

More information

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200, WEB DB PRESS Vol.1 79 3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200, http://www.postgresql.org/http://www.jp.postgresql.org/ 80 WEB DB PRESS

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

org/ghc/ Windows Linux RPM 3.2 GHCi GHC gcc javac ghc GHCi(ghci) GHCi Prelude> GHCi :load file :l file :also file :a file :reload :r :type expr :t exp

org/ghc/ Windows Linux RPM 3.2 GHCi GHC gcc javac ghc GHCi(ghci) GHCi Prelude> GHCi :load file :l file :also file :a file :reload :r :type expr :t exp 3 Haskell Haskell Haskell 1. 2. 3. 4. 5. 1. 2. 3. 4. 5. 6. C Java 3.1 Haskell Haskell GHC (Glasgow Haskell Compiler 1 ) GHC Haskell GHC http://www.haskell. 1 Guarded Horn Clauses III - 1 org/ghc/ Windows

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

2 I I / 61

2 I I / 61 2 I 2017.07.13 I 2 2017.07.13 1 / 61 I 2 2017.07.13 2 / 61 I 2 2017.07.13 3 / 61 7/13 2 7/20 I 7/27 II I 2 2017.07.13 4 / 61 π-computer gnuplot MobaXterm Wiki PC X11 DISPLAY I 2 2017.07.13 5 / 61 Mac 1.

More information

fp.gby

fp.gby 1 1 2 2 3 2 4 5 6 7 8 9 10 11 Haskell 12 13 Haskell 14 15 ( ) 16 ) 30 17 static 18 (IORef) 19 20 OK NG 21 Haskell (+) :: Num a => a -> a -> a sort :: Ord a => [a] -> [a] delete :: Eq a => a -> [a] -> [a]

More information

DiMP Users Manual Yuichi Tazaki

DiMP Users Manual Yuichi Tazaki DiMP Users Manual Yuichi Tazaki 3 1 5 2 7 2.1............................. 7 2.2........................... 7 3 DiMP 9 3.1............................... 9 3.2........................... 10 3.3...................................

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

Parametric Polymorphism

Parametric Polymorphism ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x

More information

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1 () 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack

More information

XJTAG

XJTAG LDRA/ T-VEC/ MetaEdit+ Domain Specific Modeling Ashling/Jtag ARC SmartCards LAUTERBACH /Jtag ARM PowerPC K MIPS XJTAG HW Domain-Specific Modeling Domain-Specific Modeling Software Technology 30 Copyright

More information

PBASIC 2.5 PBASIC 2.5 $PBASIC directive PIN type New DEBUG control characters DEBUGIN Line continuation for comma-delimited lists IF THEN ELSE * SELEC

PBASIC 2.5 PBASIC 2.5 $PBASIC directive PIN type New DEBUG control characters DEBUGIN Line continuation for comma-delimited lists IF THEN ELSE * SELEC PBASIC 2.5 PBASIC 2.5 BASIC Stamp Editor / Development System Version 2.0 Beta Release 2 2.0 PBASIC BASIC StampR PBASIC PBASIC PBASIC 2.5 Parallax, Inc. PBASIC 2.5 PBASIC 2.5 support@microbot-ed.com 1

More information

Copyright c 2006 Zhenjiang Hu, All Right Reserved.

Copyright c 2006 Zhenjiang Hu, All Right Reserved. 1 2006 Copyright c 2006 Zhenjiang Hu, All Right Reserved. 2 ( ) 3 (T 1, T 2 ) T 1 T 2 (17.3, 3) :: (Float, Int) (3, 6) :: (Int, Int) (True, (+)) :: (Bool, Int Int Int) 4 (, ) (, ) :: a b (a, b) (,) x y

More information

Solution Report

Solution Report CGE 3 GAMS * Date: 2018/07/24, Version 1.1 1 2 2 GAMSIDE 3 2.1 GAMS................................. 3 2.2 GAMSIDE................................ 3 2.3 GAMSIDE............................. 7 3 GAMS 11

More information