Exemple #1
0
 def _write_discrete_sto_file(self):
     # Construct File Name
     fileName = self.pName + ".sto";
     # Contruct File in Destination Location
     stoF = open(self.outputPath+fileName, 'w');
     # Write The Sto File Head
     stoF.write('STOCH          '+self.pName+'\n');
     stoF.write('INDEP          DISCRETE\n');
     for i in range(self.rhsTotal):
         for j in range(self.rhsDist[i]):
             rhsValue = self.rhsDist[i][0];
             rhsProb = self.rhsDist[i][1];
             utility.write_space(stoF,5);
             stoF.write('RHS');
             utility._write_space(stoF,7);
             stoF.write(self.rhs[i]);
             utility._write_space(stoF,7);
             stoF.write(rhsValue);
             utility._write_space(stoF,19);
             stoF.write(rhsProb);
             stoF.write('\n');
     stoF.close()
Exemple #2
0
 def _write_block_sto_file(self):
     #Construct File Name
     fileName = self.pName + ".sto";
     stoF = open(self.outputPath+fileName,'w');
     # Write the Sto File Head
     stoF.write('STOCH           '+self.pName+'\n');
     stoF.write('BLOCKS          DISCRETE\n');
     # Write Block Sections
     for i in range(1,self.blockTotal+1):
         stoF.write(' BL '+str(self.blockName[i])+'    PERIOD03        '+str(self.blockProbs[i-1])+'\n');
         for j in range(1,self.rowsTotal+1):
             utility.write_space(stoF,5);
             stoF.write('RHS');
             utility.write_space(stoF,9);
             stoF.write(str(self.blockRowName[j]));
             utility.write_space(stoF,11);
             stoF.write(str(self.blockRowValue[i][j-1]));
             stoF.write('\n');
     stoF.write('ENDATA');