Coder Social home page Coder Social logo

flasher's Introduction

FLR

General discussion, documentation and team work

flasher's People

Contributors

drfinlayscott avatar iagomosqueira avatar shfischer avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flasher's Issues

Evaluating target Catches in OM

When evaluating the target, you may need to get the total catch of a Biol. Should this be calculated using live F and N etc, or just extracted from the FLCatches that catch the biol. The catches in FLCatches may not have been updated to reflect the effort. i.e. the calced catch could be different to the current catches in the objects.

This is also true of the catches in an FLCatch, however when evaluating target catches of an FLCatch we just take it from the object, and not calculate it. This is inconsistent. At the moment the catch of a FLBiol is calculated 'live' whereas catch of a FLCatch is just extracted.

But F is always calculated live. Hmmm.

My feeling is that we just extract from OM and that project_X should always be used to update before doing this. So long as we are clear.

om::landings and om::discards methods may or may not recalculate catch

Calculating total catches, landings or discards on a biol.

In most cases the total catch on a biol is the sum of the catches in the FLCatches that catch that biol.
No recalculation is necessary.
However, if an FLCatch that catches the biol also catches another biol (e.g. a FLCatch catches from two biols), then we cannot use the total catch of the FLCatch (it comes from 2 biols).

Then what?
We can't easily split the the total catch into the constituent parts.
Recalculate the catch using F and N etc?

For now, no recalculation. If the FLCatch catches 2 biols, you cannot get the catch of one of the single biols. At least for now.

fwdControl.get_target_timestep - timing of abundance targets (SSB etc)

In what timestep should abundance targets be set? In an FLBiol abundance is at start of timestep.

Do we keep this pattern in FLasher? i.e. if we have an SSB target we need to know the effort in the previous timestep that gives us that SSB?
Or we solve for the effort in the target timestep (which really affects SSB in next timestep).

I prefer the first option because it is in line with other FLR objects

Add Fspwn calculation

Needed for SSB calculations.
Fspwn comes from 'spwn' member of fwdBiol and some timing slot in the FLCatch (not yet added)

Need some kind of Fishery / Catches / Biol map

Need some kind of Fishery / Catches / Biol map to store what Fishery / Catch combinations catch which Biols.
One idea is to use an Rcpp::IntegerMatrix with 3 columns (F, C, B). Each row is a unique Fishery / Catch catching a Biol (although the same C can catch multiple Bs, and the same B can be caught by multiple Cs).
Add this to the fwdControl class.
Need to add Constructor (probably best to build the matrix in R then easy to construct in C++)

Compilation error under linux 64 bit and R-mkl

From @poldokim on June 9, 2016 7:40

When I try to compile FLash packages I have this error:

R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

* installing *source* package ‘FLash’ ...
** libs
g++ -I/usr/include/R/ -DNDEBUG -D_FORTIFY_SOURCE=2 -I../inst/include -fpic -O3 -m64 -I/opt/intel/composerxe/linux/mkl/include -c FLCoreClasses.cpp -o FLCoreClasses.o
g++ -I/usr/include/R/ -DNDEBUG -D_FORTIFY_SOURCE=2 -I../inst/include -fpic -O3 -m64 -I/opt/intel/composerxe/linux/mkl/include -c FLashDLL.cpp -o FLashDLL.o
FLashDLL.cpp: In function ‘SEXPREC* fwd_adolc_FLBiol(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’:

FLashDLL.cpp:83:14: error: cannot convert ‘bool’ to ‘SEXP {aka SEXPREC*}’ in return
       return false;
              ^~~~~

FLashDLL.cpp: In function ‘SEXPREC* fwd_adolc_FLBiols(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’:

FLashDLL.cpp:133:14: error: cannot convert ‘bool’ to ‘SEXP {aka SEXPREC*}’ in return
       return false;
              ^~~~~
FLashDLL.cpp:139:14: error: cannot convert ‘bool’ to ‘SEXP {aka SEXPREC*}’ in return
       return false;
              ^~~~~
/usr/lib64/R/etc/Makeconf:141: recipe for target 'FLashDLL.o' failed
make: *** [FLashDLL.o] Error 1

ERROR: compilation failed for package ‘FLash’

Do you have any suggestion?

Copied from original issue: flr/FLash#3

Things to do for control object

Before dispatch to C++:
Add a 'timestep' column that translates the year / season columns to the timestep.
Check that the timesteps are consecutive
Add 'biol' column for targets that relate to biols
Add a 'target' column (integer, consecutive, starting from 1). 'target' is used to identify which targets are to be processed together, i.e. multiple rows can have the same 'target' value (they are simultaneous targets).
Add the 'FCB' integer matrix as a slot to object@target. This is a map that describes what FLFishery / FLCatch combination catches which FLBiol. It is n x 3 with colnames c('F', 'C', 'B'). The values are integer describing the positions of the FLFishery etc within the lists that are based to the C++ side. See examples for more detail.

RCpp Flasher plugin might not work in Windows

This line (R/rcpp_plugin.R, line 6) has

FLasher.so_location <- paste(.libPaths()[1], "/FLasher/libs/FLasher.so",sep="")

but this should not work in Windows, it will at least need to use

'FLasher.dll'

We need to find out how to make this cross-platform

Look into implementing SR models with covariates

We currently have one model with covariates in FLCore, rickerCA

rec ~ a * (1 - c * covar) * ssb * exp(-b * ssb)

What would we need to make it work in FLasher? The sr slot in the new FLBiol can accomodate the covariate(s) FLQuant(s), but they would have to be passed via FLBiolCpp to FLasher Rcpp.

Implement FLQuant %*% operators in Cpp

The %*%, %/%, %+% and %-% operators for FLQuant are able to extend one dimension of length one in one object to the length in the other. They could be very useful in Cpp.

To be done in the near future

ADD warning() if fwdControl sets ssb or biomass target for year 1

Setting ssb or stock targets on the first year of projection can only be done by modifying catch and F in the previous year, so that catch.n, harvest and stock.n are consistent.

Normal practice should be to have ssb/stock targets only from year 2.

A warning will be issued, at both fwdControl() and fwd()

New equation for F ~ effort + biomass

The calculation of from effort and biomass should include 3 variables, alpha, beta and epsilon, to account for scaling, and the non-linearity of F and effort and of F and biomass, respectively.

$F = \alpha \cdot E ^\epsilon \cdot sel \cdot B^\beta$

The new parameter, epsilon, should be added to the catch.q slot of FLCatch flr/FLFishery#4

Constructor for fwdControl with iters = integer

Can we have a constructorfor fwdControl that looks like:

setMethod('fwdElement', signature(element='data.frame', iters='integer'),
which builds the iter array with appropriate number of iters

minAge and maxAge in fwdControl only refer to ages of target Biol / Catch not relBiol / relCatch

We only have one minAge and maxAge per target line in fwdControl.
These are used to calculate the Fbar when evaluating get_target_value_hat and eval_om.
However, you can have targets relative to another object. e.g. F on one Biol relative to F on another Biol.
At the moment the same age range will be used to calculate Fbar for both Biols.This is not right.

Solution:
include relMinAge and relMaxAge in Control.
include minAge / maxAge information somewhere else.

How is F calculated?

Remove F member of operatingModel and replace with F() method. F can be:
'partial': F(Fishery, Catch)
'total': F(Biol). (The sum of all partial Fs fishing that Biol)

How is F calculated?
F = Sel. Q. Effort
F = alpha. Sel. Q. Effort^beta (where do alpha and beta come from?)

How is Q calculated? From Biol and Q_params? Is is age-structured?

Biomass calculation should include time of fishing

The calculation for Q is: alpha * B ^-beta

The B should be the biomass at the time of fishing. At the moment the 'biomassb method for a fwdBiol returns the Biomass at the start of the year. If there are more than one FLCatch operating on the stock and they fish at different times, the B will need to be the B at the time of fishing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.