Changeset 9155


Ignore:
Timestamp:
Aug 26, 2016 3:28:18 PM (3 years ago)
Author:
Christian Andersson
Message:

Applied patch for checking if there is a solution directly when entering the enhanced event iteration. Related to ticket:4411

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/20160824.x/RuntimeLibrary/src/jmi/jmi_block_solver.c

    r9082 r9155  
    546546            /* Write back the current iteration variables, needed for checking discrete variables. */
    547547            block_solver->F(block_solver->problem_data, x, NULL, JMI_BLOCK_WRITE_BACK);
     548           
     549            /* Check for convergence in first try before computing a reduced step */
     550            if (block_solver->check_discrete_variables_change(block_solver->problem_data, x_new) == JMI_EQUAL) {
     551                /* Set the correct solution */
     552                block_solver->F(block_solver->problem_data, x_new, NULL, JMI_BLOCK_WRITE_BACK);
     553                /* block_solver->update_discrete_variables(block_solver->problem_data, &non_reals_changed_flag);  Not needed, nothing changed */
     554                jmi_log_node(log, logInfo, "Found consistent solution on first try in enhanced fixed point iteration in <block:%s, iter:%I> at <t:%E>",
     555                        block_solver->label, iter, cur_time);
     556                converged = 1;
     557            }
    548558
    549559            iter = 0;
    550             while (1 && ef==0){
     560            while (ef == 0 && converged == 1){
    551561
    552562                jmi_log_node_t iter_node = jmi_log_enter_fmt(log, logInfo, "BlockIteration",
Note: See TracChangeset for help on using the changeset viewer.