def write(self, filename): if self.instance is None: raise RuntimeError( "The extensive form instance has not been constructed." "Call the build_ef() method to construct it.") suf = os.path.splitext(filename)[1] if suf not in ['.nl', '.lp', '.mps']: if self._solver.problem_format() == ProblemFormat.cpxlp: filename += '.lp' elif self._solver.problem_format() == ProblemFormat.nl: filename += '.nl' elif self._solver.problem_format() == ProblemFormat.mps: filename += '.mps' else: raise ValueError("Could not determine output file format. " "No recognized ending suffix was provided " "and no format was indicated was by the " "--solver-io option.") start_time = time.time() print("Writing extensive form to file=" + filename) smap_id = write_ef(self.instance, filename, self.get_option("symbolic_solver_labels")) if self.get_option("verbose") or self.get_option("output_times"): print("Time to write output file=%.2f seconds" % (time.time() - start_time)) return filename, smap_id
def write(self, filename): if self.instance is None: raise RuntimeError( "The extensive form instance has not been constructed." "Call the build_ef() method to construct it.") suf = os.path.splitext(filename)[1] if suf not in ['.nl','.lp','.mps']: if self._solver.problem_format() == ProblemFormat.cpxlp: filename += '.lp' elif self._solver.problem_format() == ProblemFormat.nl: filename += '.nl' elif self._solver.problem_format() == ProblemFormat.mps: filename += '.mps' else: raise ValueError("Could not determine output file format. " "No recognized ending suffix was provided " "and no format was indicated was by the " "--solver-io option.") start_time = time.time() print("Writing extensive form to file="+filename) smap_id = write_ef(self.instance, filename, self.get_option("symbolic_solver_labels")) if self.get_option("verbose") or self.get_option("output_times"): print("Time to write output file=%.2f seconds" % (time.time() - start_time)) return filename, smap_id
def write(self): start_time = time.time() output_filename = os.path.expanduser(self._options.output_file) suf = os.path.splitext(output_filename)[1] if suf not in ['.nl','.lp']: if self._solver.problem_format() == ProblemFormat.cpxlp: output_filename += '.lp' elif self._solver.problem_format() == ProblemFormat.nl: output_filename += '.nl' else: raise ValueError("Could not determine output file format. " "No recognized ending suffix was provided " "and no format was indicated was by the " "--solver-io option.") start_time = time.time() if self._options.verbose: print("Starting to write extensive form") symbol_map = write_ef(self._binding_instance, output_filename, self._options.symbolic_solver_labels) print("Extensive form written to file="+output_filename) if self._options.verbose or self._options.output_times: print("Time to write output file=%.2f seconds" % (time.time() - start_time)) return output_filename, symbol_map