|
|
- #!/usr/bin/env python3
-
- import util.script as script
- import util.queries as queries
- import dimod
-
- def main():
- wmis_siman_results_alpha_num_of_assignments()
-
- def wmis_siman_results():
- db = script.connect_to_instance_pool()
-
- q = queries.WMIS_result_scope_query_raw(db)
- q.query("c50_v[5, 50]_1", "wmis_siman_results")
-
- for i in range(30):
- result = q.__next__()
-
- sample_set = queries.read_raw_wmis_sample_set(result["data"])
-
- data = script.analyze_wmis_sample(sample_set.first)
-
- print(data)
-
- def wmis_siman_results_alpha_num_of_assignments():
- edb = script.connect_to_experimetns_db()
- edb_cursor = edb.cursor()
-
- idb = script.connect_to_instance_pool()
-
- q = queries.WMIS_result_scope_query_raw(idb)
- q.query("c50_v[5, 50]_1", "wmis_siman_results")
-
- insert_row = ("INSERT INTO c50_v5to50_1_wmis_alpha_number_of_assignments "
- "(result_id, "
- " number_of_clauses, "
- " number_of_variables, "
- " number_of_found_assignments) "
- "VALUES (%s, %s, %s, %s) ")
-
- for result in q:
- sample_set = queries.read_raw_wmis_sample_set(result["data"])
-
- data = script.analyze_wmis_sample(sample_set.first)
-
- sat = queries.get_instance_by_id(idb["instances"], result["instance"])
-
- edb_cursor.execute(insert_row, (str(result["_id"]),
- int(sat.getNumberOfClauses()),
- int(sat.getNumberOfVariables()),
- int(data["number_of_assignments"])))
-
- print(data)
-
- edb.commit()
- edb_cursor.close()
- edb.close()
-
- if __name__ == "__main__":
- main()
|