Formulate optimization problem

Here are tips and help for formulating optimisation problems.

 

OptModelUI

Figure 1. Optimisation model box in PlanWise.

 

tog_minusAdd a parameter linked to a management program

1.Right-click on Parameters in the model tree and “Add new parameter…”
2.Select “Heureka results variables” and type an appropriate name.

OptMod_addParam_wizard1

3.Select the desired variable

OptMode_addParam_selectVar

4.Limit the number of decimals if this is not critical.
5.Click on “Complete”. Note that an index has been added automatically (1) in the model tree. mAlder[I j p] = mean age of stand i at period p under management program j. Also note ResultProperty field (2), which shows the variable the parameter is linked to. You can also change the variable by clicking (in this case) ForestData.Age Before.

OptModel_paramMeanAge

 

 

tog_minusAccount variables make it easier!

 

So-called account variables are preferred in an optimisation model to improve its readability and simplify the formulation of restrictions. An account variable has, in contrast to a decision variable, a definition that means it is a function of other variables in the model. The definition is in fact an equation of similarity in the optimisation model. An example of a useful account variable is the total harvest volume over a whole period. This variable can thereafter be used with different restrictions. To create an account variable:

 

 

1.Right-click in the optimisation model on “Variables” and select “Add new variable”.

OptModel_AddNewVariable

2.Right-click on the variable and change its name from “DefaultName…” to a better name, in the example below TotalHarvest.

OptModel_AddNewVariable_name

3.To define an indexed variable, for example for using one variable for each time period, click on “Click to add index” under Data binding, and add Index Periods.

OptModel_addNewVar_addIndex

 

4.The variable names now have a suffix ([p]). In the syntax window, you type the definition of the expression on the left side, and the name of the variable on the right side, with two equals (=) signs. For example (assuming that the parameter volAvv[j p k] has already been added):

Klicka för att förstora

 

Definition:

 

forall <p> in Periods with p >= 1 :

 

 sum <i,j,k> in TreatmentUnits * Alternatives * Treatments

 

   with altIncluded [i,j] == 1 :

 

      area[i]*volharv[i,j,p,k]*x[i,j] == TotalHarvest[p] ;

 

 

 

flag_green      

Important!

A variable is by standard set to the type non-negative (RangeType = None-negative). This means that negative values are not possible. A volume cannot be negative. However, some account variables can be negative, for example net income in a period, if costs exceed incomes. In this case, you have to change RangeType to “All”.

 

 

tog_minusAdd a restriction
1.Right-click on “Constraints” and select “Add new restriction”

OptModel_addConstraint

1.Type a name, e.g. “NonDeclineHarv” and click OK.

OptModel_ickeAvtagandeAvv

2.Select the restriction in the model tree and type the definition in the Syntax window. For example: If the harvest volume cannot decrease with time, the following restriction is designated (provided that an accounting variable has already been created for a total harvest volume per period, here called AvvVolTot):

OptModel_addConstraintMinAreaGamSkog

 

forall <p> in periods with p >= 2 :

 

TotalHarvest[p] >= TotalHarvest[p-1] ;

 

This means that for each period (p) from period 2, the harvest shall be larger or equal to the harvest of the previous period. We start with period 2 because we normally use mid-periods, p = 0 denotes the start conditions and p = 1 denotes the first harvest period (year 1-5).

 

prod_tip        Tip – use model parameters instead of “hard-coding”!

Instead of using the number 100 as a requirement for old forest, you can create a parameter that you can call, for instance, “minAge” of the type “Constant value”, assign it the value 100, and change 100 in the definition above to “minAge”. This type of parameterization makes it easier if you want to use a certain value in several places, e.g. in a model.

 

Note! In some cases there may be no solution, e.g. there may not be enough old forest. In such cases, you can add a "punishment variable".

 

tog_minusAdd a formula parameter

You can add formulas which are treated as constant values by the optimisation model. A useful example is a parameter for the sum of all stands’ areas. This differs of course for different analysis areas, but for a defined analysis area it is independent of the management program. This means that it can be treated as a constant (and converted by ZIMPI to a constant).

 

Example:

1.Right-click on Parameters in the model tree and select “Add new parameter”

 

OptModel_addNewParam

 

2.Enter a name for the parameter, for example SumArea, and select “Formula parameter”. Click on Next.

 

3.Type the definition, in this case:

sum <i> in TreatmentUnits : area[i];

A definition can be changed later.

4.Click on Complete

 

You can now use SumArea in restrictions. Assume that at most 1% of the area can be fertilized each year. Assume also that you have created an account variable FertilizedArea[p] = area fertilized in period p. A restriction will be:

forall <p> in Periods :

FertilizedArea[p] <= 0.01 * SumArea ;

 

tog_minusAdd clear cut size restriction

A unique function of Heureka is that clear cut size restrictions can be added automatically. This presumes that you have imported a forest map . You add the restriction through the menu Optimisation > Add clear cut size restriction. The restrictions that are added are relatively complex. The model element with the name “Cluster” and “HarvestCluster” belong to the clear cut size restrictions.

 

 

 

 

 

Contact support. © Sveriges Lantbruksuniversitet