01.07.2013 Views

Th`ese de Doctorat de l'université Paris VI Pierre et Marie Curie Mlle ...

Th`ese de Doctorat de l'université Paris VI Pierre et Marie Curie Mlle ...

Th`ese de Doctorat de l'université Paris VI Pierre et Marie Curie Mlle ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Table A.3: Java co<strong>de</strong> for calling AMPL from the Java file OBA.java<br />

cmdarray[0] = “/bin/bash”;<br />

cmdarray[1] = “-c”;<br />

cmdarray[2] = “./ampl N<strong>et</strong>workMo<strong>de</strong>l.run”;<br />

try<br />

{<br />

process p = Runtime.g<strong>et</strong>Runtime().exec(cmdarray);<br />

p.waitFor();<br />

System.out.println(“—- AMPL solver has finished —-”);<br />

}<br />

catch (Exception e )<br />

{<br />

System.out.println(“Error process”);<br />

System.exit(1); // for abnormal termination<br />

}<br />

The file N<strong>et</strong>workMo<strong>de</strong>l.run contains the following AMPL commands:<br />

mo<strong>de</strong>l N<strong>et</strong>workMo<strong>de</strong>l.mod;<br />

data N<strong>et</strong>workMo<strong>de</strong>l.dat;<br />

option solver ‘./snopt’;<br />

solve;<br />

display { k in GreedyConnections } (sum { tinIntervals}<br />

AMPL AllocatedBandwidth [ k,t ]) > AllocatedBandwidth.out;<br />

display AMPL N<strong>et</strong>workRevenue > N<strong>et</strong>workRevenue.out;<br />

quit;<br />

- N<strong>et</strong>workMo<strong>de</strong>l.mod is a file that <strong>de</strong>scribes the n<strong>et</strong>work mo<strong>de</strong>l<br />

using standard AMPL format.<br />

- N<strong>et</strong>workMo<strong>de</strong>l.dat is a file that provi<strong>de</strong>s the n<strong>et</strong>work mo<strong>de</strong>l<br />

param<strong>et</strong>ers.<br />

- AllocatedBandwidth.out and N<strong>et</strong>workRevenue.out are two output<br />

files that contain, respectively, the connections’ allocated rate and<br />

the total n<strong>et</strong>work revenue calculated by AMPL.<br />

102

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!