Package xal.extension.solver
Class Problem
java.lang.Object
xal.extension.solver.Problem
Problem is the primary class for holding the user's problem information.
- Author:
- ky6, t6p
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Constraint>
Constraints which identify unacceptable solutions.protected Evaluator
The user provided object which evaluates the trial solutions.A table of hints the algorithms may use to adjust their search.The objectives we are trying to optimize.A table of reference values keyed by variableThe variables which identify the controls for optimizing the solution. -
Constructor Summary
ConstructorsConstructorDescriptionProblem()
Construct a problem where everything is null.Construct a problem using an objective list, variable list, and an evaluator.Problem
(List<Objective> objectives, List<Variable> variables, Evaluator evaluator, List<Constraint> constraints, List<Hint> hints) Construct a problem using an objective list, variable list, constraint list, hint list, and an evaluator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstraint
(Constraint aConstraint) Add a Constraint object to constraintList.void
Add a Hint object to the hintList.void
Add to this problem, the list of hints.void
addObjective
(Objective anObjective) Adds an Objective to objectiveList.void
addVariable
(Variable variable) Adds a Variable object to variableList.boolean
Evaluate the trialEvaluate the initial point as specified by the initial values of the variablesGenerate a new trial point based on the initial values of the variables.Get the list of constraints.Get the evaluator.Get the hint corresponding to the specified type.Get the list of objectives.getValueReference
(Variable variable) Get the value reference which is mapped to a variable.Get the list of variables.void
setConstraints
(List<Constraint> constraints) Set the constraints.void
setEvaluator
(Evaluator anEvaluator) Set the evaluator to use in scoring the trial points.void
Set this problem's hints to the ones specified.void
setObjectives
(List<? extends Objective> objectives) Set the objectives.void
setVariables
(List<Variable> variables) Set the variables.protected TrialVeto
Validate the trial.
-
Field Details
-
objectives
The objectives we are trying to optimize. -
variables
The variables which identify the controls for optimizing the solution. -
constraints
Constraints which identify unacceptable solutions. -
hints
A table of hints the algorithms may use to adjust their search. -
evaluator
The user provided object which evaluates the trial solutions. -
valueRefs
A table of reference values keyed by variable
-
-
Constructor Details
-
Problem
public Problem(List<Objective> objectives, List<Variable> variables, Evaluator evaluator, List<Constraint> constraints, List<Hint> hints) Construct a problem using an objective list, variable list, constraint list, hint list, and an evaluator. -
Problem
Construct a problem using an objective list, variable list, and an evaluator. -
Problem
public Problem()Construct a problem where everything is null.
-
-
Method Details
-
addObjective
Adds an Objective to objectiveList.- Parameters:
anObjective
- The objective of the problem.
-
setObjectives
Set the objectives.- Parameters:
objectives
- The new objectives value
-
getObjectives
Get the list of objectives.- Returns:
- objectiveList.
-
addVariable
Adds a Variable object to variableList.- Parameters:
variable
- The feature to be added to the Variable attribute
-
setVariables
Set the variables.- Parameters:
variables
- The new variables value
-
getValueReference
Get the value reference which is mapped to a variable.- Parameters:
variable
- Description of the Parameter- Returns:
- A double representing the value.
-
getVariables
Get the list of variables.- Returns:
- The list of variables.
-
addConstraint
Add a Constraint object to constraintList.- Parameters:
aConstraint
- One constraint of the problem.
-
setConstraints
Set the constraints.- Parameters:
constraints
- The new constraints value
-
getConstraints
Get the list of constraints.- Returns:
- constraintList The list of constraints.
-
addHint
Add a Hint object to the hintList.- Parameters:
aHint
- One hint for the problem.
-
addHints
Add to this problem, the list of hints.- Parameters:
hints
- the list of hints to add to this problem.
-
setHints
Set this problem's hints to the ones specified.- Parameters:
hints
- The new hints to set for this problem.
-
getHint
Get the hint corresponding to the specified type.- Parameters:
type
- the type identifier for which to fetch a hint.- Returns:
- The hint corresponding to the specified type.
-
setEvaluator
Set the evaluator to use in scoring the trial points. The evaluator defines the problem we are trying to optimize.- Parameters:
anEvaluator
- The new evaluator value
-
getEvaluator
Get the evaluator.- Returns:
- The evaluator.
-
generateInitialTrialPoint
Generate a new trial point based on the initial values of the variables.- Returns:
- a new trial point
-
validate
Validate the trial.- Parameters:
trial
- The trial to be validated.- Returns:
- A trial veto if any of the constraints vetoes the trial or null if there is no veto.
-
evaluateInitialPoint
Evaluate the initial point as specified by the initial values of the variables- Returns:
- the evaluated trial
-
evaluate
Evaluate the trial- Parameters:
trial
- the trial to evaluate- Returns:
- true if the evaluation was successful and false if it was vetoed
-