| 157 | } |
| 158 | |
| 159 | void Marabou::importDebuggingSolution() |
| 160 | { |
| 161 | String fileName = Options::get()->getString( Options::IMPORT_ASSIGNMENT_FILE_PATH ); |
| 162 | AutoFile input( fileName ); |
| 163 | |
| 164 | if ( !IFile::exists( fileName ) ) |
| 165 | { |
| 166 | throw MarabouError( MarabouError::FILE_DOES_NOT_EXIST, |
| 167 | Stringf( "File %s not found.\n", fileName.ascii() ).ascii() ); |
| 168 | } |
| 169 | |
| 170 | input->open( IFile::MODE_READ ); |
| 171 | |
| 172 | unsigned numVars = atoi( input->readLine().trim().ascii() ); |
| 173 | ASSERT( numVars == _inputQuery.getNumberOfVariables() ); |
| 174 | |
| 175 | unsigned var; |
| 176 | double value; |
| 177 | String line; |
| 178 | |
| 179 | // Import each assignment |
| 180 | for ( unsigned i = 0; i < numVars; ++i ) |
| 181 | { |
| 182 | line = input->readLine(); |
| 183 | List<String> tokens = line.tokenize( "," ); |
| 184 | auto it = tokens.begin(); |
| 185 | var = atoi( it->ascii() ); |
| 186 | ASSERT( var == i ); |
| 187 | it++; |
| 188 | value = atof( it->ascii() ); |
| 189 | it++; |
| 190 | ASSERT( it == tokens.end() ); |
| 191 | _inputQuery.storeDebuggingSolution( var, value ); |
| 192 | } |
| 193 | |
| 194 | input->close(); |
| 195 | } |
| 196 | |
| 197 | void Marabou::exportAssignment() const |
| 198 | { |
nothing calls this directly
no test coverage detected