Xpress Kalis Mosel Reference Manual examples
|
| Generic binary and n-ary constraints: Mosel subroutine implementing a constraint relation
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Implementation of user-defined constraints:
- ac2001.mos: Generic binary constraint
- gac2001.mos: Generic n-ary constraints
|
| File(s): |
ac2001.mos, gac2001.mos |
|
|
| Table constraint: solving a binpacking problem: Constraint definition via value tuples, optimization
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Implementation of user-defined constraints via a table_constraint |
| File(s): |
binpacking_table_constraint.mos |
|
|
| All-different constraint: solving an assignment problem: Constraint definition, check for feasible solution
|
| |
|
| Type: |
Assignment |
| Rating: |
1 (simple) |
| Description: |
Assigning time slots to persons subject to some additional bound constraints. |
| File(s): |
alldiff.mos |
|
|
| 'abs' and 'distance' constraints: Constraint definition
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Defining absolute value and distance constraints. |
| File(s): |
distance.mos |
|
|
| 'distribute' and 'occurrence' constraints: Constraint definition, check for feasible solution, cardinality constraint
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
The 'occurrence' (=cardinality) constraint expresses a relation on the frequency with which a value occurs in a set of decision
variables. The 'distribute' constraint generalizes this constraint by extending the cardinality relation to a list of values.
- occurrence.mos: simple example of the use of occurrence constraints
- distribute.mos: using 'distribute' or 'occurrence' constraints in the formulation of a personnel planning problem.
|
| File(s): |
distribute.mos, occurrence.mos |
|
|
| One- and two-dimensional 'element' constraints: Constraint definition
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Defining one- and two-dimensional 'element' constraints. |
| File(s): |
element.mos |
|
|
| Implication and equivalence constraints: Constraint definition
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Defining logical constraints (implication, equivalence). |
| File(s): |
impequiv.mos |
|
|
| Conjunctions and disjunctions (logical 'and' and 'or'): Constraint definition
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Defining conjunctions and disjunctions (logical 'and' and 'or'). |
| File(s): |
conjdisj.mos |
|
|
| 'cycle' constraint: formulating a TSP problem: Constraint definition, solution callback, branching strategy
|
| |
|
| Type: |
Traveling Salesman Problem |
| Rating: |
3 (intermediate) |
| Description: |
'cycle' constraints can be used to formulate problems of the TSP (traveling sales person) type, including cyclic scheduling
problems with setup times. Two model versions showing definition of callbacks via subroutine references or by name.
|
| File(s): |
cycle.mos, cycle2.mos, cycle_graph.mos |
|
|
| 'cumulative' and 'disjunctive' constraints for scheduling and planning problems: Scheduling with resource constraints
|
| |
|
| Type: |
Scheduling |
| Rating: |
2 (easy-medium) |
| Description: |
- cumulative.mos: using the 'cumulative' constraint to formulate a
scheduling problem with resource constraints (renewable resource with discrete capacity)
- disjunctive.mos: using the 'disjunctive' constraint for implementing a sequencing problem (single-maching scheduling minimizing
the total weighted tardiness.
- resource_capacity.mos: using 'task' and
'resource' objects to model a cumulative resource relation (renewable resource with different capacity levels over time).
- resource_coupled_setup_times.mos: specifying setup times between pairs of tasks assigned to the same resource.
|
| File(s): |
cumulative.mos, disjunctive.mos, resource_capacity.mos, resource_coupled_setup_times.mos |
|
|
| 'producer_consumer' constraints: solving a resource-constrained project scheduling problem: Configuring resource and task objects, scheduling solver
|
| |
|
| Type: |
Resource-constrained project planning |
| Rating: |
2 (easy-medium) |
| Description: |
So-called 'producer_consumer' relations combine tasks that produce or consume quantities of the same non-renewable resource.
Such problems may be modeled in two ways, namely
- using 'producer_consumer' constraints (producer_consumer_alt.mos), or
- using 'task' and 'resource' model objects that are configured correspondingly (producer_consumer.mos)
|
| File(s): |
producer_consumer.mos, producer_consumer_alt.mos, producer_consumer_alt_graph.mos |
|
|
| Resource profiles: Alternative resources, non-constant resource usage profiles
|
| |
|
| Type: |
Scheduling |
| Rating: |
3 (intermediate) |
| Description: |
- resource_altern.mos - Alternative resources and non-constant resource usage
profiles
- resource_altern_graph.mos - Graphical repesentation of solutions as
user graph.
- resource_profile.mos - Scheduling tasks with non-constant resource usage
profiles.
- resource_profile_graph.mos - Graphical repesentation of solutions as
user graph.
|
| File(s): |
resource_altern.mos, resource_altern_graph.mos, resource_profile.mos, resource_profile_graph.mos |
|
|
| Minimum and maximum constraints: Constraint definition, constraint posting, cpvarlist
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Defining minimum and maximum constraints. |
| File(s): |
minmax.mos |
|
|
| Defining, posting and propagating linear constraints: Automated propagation, automated post, explicit post, scalar product, dot product
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
- linctr.mos - Posting and propagating linear constraints
- scalar_product.mos - Using 'dot' for the formulation of the scalar/dot product between an array of decision variables and
an array of reals or integers
|
| File(s): |
linctr.mos, scalar_product.mos |
|
|
| Non-linear constraints over real-valued decision variables: Branching strategy for cpfloatvar
|
| |
|
| Type: |
Programming |
| Rating: |
1 (simple) |
| Description: |
Non-linear constraints may be defined over discrete (finite domain) or continuous (floating point interval) variables, or
combinations of both.
|
| File(s): |
nlinctr.mos |
|
|
| Branching strategies: Branching schemes, enumeration for discrete or continuous variables, tasks, disjunctive constraints
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Branching schemes for the
enumeration of decision variables (discrete or continuous), disjunctive constraints, or tasks can be configured to use
built-in or user-defined variable / constraint / task and value selection heuristics.
- branching.mos: branching strategies using the branching schemes
'assign_and_forbid', 'assign_var', and 'split_domain';
user-defined variable and value selection heuristics.
- probeac2001.mos, probeac2001_nary.mos: branching scheme 'probe_assign_var' and definition of
generic binary or nary constraints; solving the Euler knight
tour problem.
- [probe]settledisjunction.mos: branching schemes 'probe_settle_disjunction' and 'settle_disjunction'; same
problem as in "disjunctive.mos" but modeled by pairs
of individual disjunctions (using 'or').
- groupserializer.mos: defining a task group based branching strategy for the problem of "producer_consumer.mos"
- taskserializer.mos: defining a task-based branching strategy for the problem of "producer_consumer.mos" (two versions showing
definition of callbacks via subroutine references or by name)
- altresource_scheduling.mos: defining a task-based branching strategy with user-defined resource selection criterion
- altresource_scheduling_softbreaks.mos: like altresource_scheduling.mos with additional soft breaks (pre-emptive breaks) on
resources
|
| File(s): |
branching.mos, probeac2001.mos, probeac2001_nary.mos, probesettledisjunction.mos, settledisjunction.mos, taskserializer.mos, taskserializer2.mos, altresource_scheduling.mos, altresource_scheduling_softbreaks.mos, groupserializer.mos |
|
|
| Use of callbacks to output the search tree: Definition of branching callbacks
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Use of callbacks to output the search tree; same problem
as in 'disjunctive.mos'.
- Textual output: solution.mos (two model versions showing definition of callbacks via subroutine references or by name)
- Drawing a user graph: solution_graph.mos
|
| File(s): |
solution.mos, solution2.mos, solution_graph.mos |
|
|
| Working with 'reversible' objects: Setting and retrieving reversible values, behaviour on backtracking
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Working with 'reversible' objects (scalars and arrays).
- Accessing information from arrays of reversibles
- Setting new values for reversibles
- Behavior of reversibles on backtracking
|
| File(s): |
reversibles.mos |
|
|
| Defining a linear relaxation: LP or MIP solving within a CP problem
|
| |
|
| Type: |
Programming |
| Rating: |
4 (medium-difficult) |
| Description: |
Example of defining linear relaxations (this feature requires Xpress Optimizer in addition to Xpress Kalis)
- knapsackalld_cp.mos: Integer knapsack problem with 'alldifferent' constraint
solved with standard CP search.
- knapsackalld_relax.mos: Defining a linear relaxation and corresponding search.
- customrelax.mos: Defining a customized linear relaxation
|
| File(s): |
customrelax.mos, knapsackalld_cp.mos, knapsackalld_relax.mos |
|
|
|