Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2011 JBoss Inc
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.drools.planner.core.solver;
A ProblemFactChange represents a change in 1 or more problem facts of a org.drools.planner.core.solution.Solution. Problem facts used by a org.drools.planner.core.Solver must not be changed while it is solving, but by scheduling this command to the org.drools.planner.core.Solver, you can change them when the time is right.

Note that the org.drools.planner.core.Solver clones a org.drools.planner.core.solution.Solution at will. So any change must be done on the problem facts and planning entities referenced by the org.drools.planner.core.solution.Solution on the org.drools.planner.core.solution.director.SolutionDirector. On each change it should also notify the org.drools.WorkingMemory accordingly.

public interface ProblemFactChange {

    
Does the change and updates the org.drools.planner.core.solution.Solution and its org.drools.WorkingMemory accordingly. When the solution is modified, the org.drools.WorkingMemory's org.drools.FactHandles must be correctly notified, otherwise the score(s) calculated will be corrupted.

Parameters:
solutionDirector never null. Contains the working org.drools.planner.core.solution.Solution which contains the planning facts (and planning entities) to change. Also contains the org.drools.WorkingMemory that needs to get notified of those changes.
    void doChange(SolutionDirector solutionDirector);
New to GrepCode? Check out our FAQ X