mirror of
				https://github.com/Brandon-Rozek/matmod.git
				synced 2025-11-03 03:11:12 +00:00 
			
		
		
		
	Updated interface
This commit is contained in:
		
							parent
							
								
									8628107704
								
							
						
					
					
						commit
						f057ba64fc
					
				
					 3 changed files with 39 additions and 26 deletions
				
			
		
							
								
								
									
										35
									
								
								vspursuer.py
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								vspursuer.py
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
#!/usr/bin/env python3
 | 
			
		||||
import argparse
 | 
			
		||||
from parse_magic import (
 | 
			
		||||
    SourceFile,
 | 
			
		||||
    parse_matrices
 | 
			
		||||
)
 | 
			
		||||
from vsp import has_vsp
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    parser = argparse.ArgumentParser(description="VSP Checker")
 | 
			
		||||
    parser.add_argument("--verbose", action='store_true', help="Print out all parsed matrices")
 | 
			
		||||
    parser.add_argument("-i", type=str, help="Path to MaGIC ugly data file")
 | 
			
		||||
    args = vars(parser.parse_args())
 | 
			
		||||
 | 
			
		||||
    data_file_path = args.get("i")
 | 
			
		||||
    if data_file_path is None:
 | 
			
		||||
        data_file_path = input("Path to MaGIC Ugly Data File: ")
 | 
			
		||||
 | 
			
		||||
    solutions = []
 | 
			
		||||
    with open(data_file_path, "r") as data_file:
 | 
			
		||||
        solutions = parse_matrices(SourceFile(data_file))
 | 
			
		||||
    print(f"Parsed {len(solutions)} matrices")
 | 
			
		||||
 | 
			
		||||
    num_has_vsp = 0
 | 
			
		||||
    for i, (model, interpretation) in enumerate(solutions):
 | 
			
		||||
        vsp_result = has_vsp(model, interpretation)
 | 
			
		||||
        print(vsp_result)
 | 
			
		||||
 | 
			
		||||
        if args['verbose'] or vsp_result.has_vsp:
 | 
			
		||||
            print(model)
 | 
			
		||||
 | 
			
		||||
        if vsp_result.has_vsp:
 | 
			
		||||
            num_has_vsp += 1
 | 
			
		||||
 | 
			
		||||
    print(f"Tested {len(solutions)} models, {num_has_vsp} of which satisfy VSP")
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue