Skip to content
This repository was archived by the owner on Nov 23, 2018. It is now read-only.

Conversation

btracey
Copy link
Member

@btracey btracey commented Oct 13, 2016

No description provided.

@btracey
Copy link
Member Author

btracey commented Oct 13, 2016

This changes the wording somewhat from the Local documentation, I can rectify the differences when we like the Global wording.

global.go Outdated
}

// globalOperation executes the requested operation at the given location.
// Modifications to this function must keep in mind that it can be called
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Modifications to this function must keep in mind that it..."

this reads a bit funny.

perhaps:
Modifications to this function must be applied while keeping in mind that globalOperation can be...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// Done communicates to the optimization method that the optimization has
// concluded to allow for shutdown.

// Done communicates that the optimization has concluded to allow for shutdown.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps semantically relate it to the sync.WaitGroup.Done() method? (or explicitly unrelate it to that)

I was a bit thrown off tracks that it didn't return anything (not even struct{}) so it couldn't really be used like in:

for {
    select {
    case <-gm.Done(): // do clean-up
    }
}

and then I remembered that it looked a bit like sync.WaitGroup.Done().

Copy link
Member

@vladimir-ch vladimir-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've returned to this after a long time, some comments are old, some are new. Read them accordingly.

global.go Outdated
// operation, the requested fields of Problem will be evaluated at the value
// in Location.X, filling the corresponding fields of Location. These values
// can be retrieved and used upon the next call to IterateGlobal with that task id.
// The corresponding fields of Location will be filled with the results that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this line

global.go Outdated
// aside from the commanded evaluations. Thus, the type implementing Method may
// use multiple Operations to set the Location fields at a particular x value.
//
// A GlobalMethod may alternately declare MajorIteration. This updates the optimal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rewrite this paragraph to something like:

When IterateGlobal declares MajorIteration, the caller can update the optimal location
to the values in Location, and check for convergence. The type implementing
GlobalMethod must make sure that the fields of Location are valid and consistent.

global.go Outdated
// location to the values in Location, and checks for the convergence of the
// optimization. Consequently, the fields of Location must be valid and consistent.
//
// A GlobalMethod must not return InitIteration and PostIteration operations. These are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/A GlobalMethod/IterateGlobal/

// optimization. Consequently, the fields of Location must be valid and consistent.
//
// A GlobalMethod must not return InitIteration and PostIteration operations. These are
// reserved for the clients to be passed to Recorders. A Method must also not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/A Method/IterateGlobal/

global.go Outdated
// can be retrieved and used upon the next call to IterateGlobal with that task id.
// The corresponding fields of Location will be filled with the results that
// The GlobalMethod interface requires that entries of Location are not modified
// aside from the commanded evaluations. Thus, the type implementing Method may
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Method/GlobalMethod/

global.go Outdated
// It uses a mutex to protect updates where necessary.
func (g *globalStatus) globalOperation(op Operation, loc *Location, x []float64) Status {
// Do a quick check to see if one of the other workers converged in the meantime.
// globalStatus is a data struct that coordinates information between concurrently
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

globalStatus coordinates access to information shared between ...?

global.go Outdated

// updateStatus updates the status and error fields of g. This update only happens
// if status == NotTerminated, so that the first different status is the one
// maintained
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot at the end.

global.go Outdated
// globalOperation executes the requested operation at the given location.
// When modifying this function, keep in mind that it can be called concurrently.
// Uses of the internal fields should be through the methods of globalStatus and
// protected by a mux where appropriate.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutex

global.go Outdated
switch op {
case NoOperation:
case InitIteration:
panic("optimize: Method returned InitIteration")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GlobalMethod

global.go Outdated
case InitIteration:
panic("optimize: Method returned InitIteration")
case PostIteration:
panic("optimize: Method returned PostIteration")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GlobalMethod

@btracey
Copy link
Member Author

btracey commented Apr 29, 2017

Done on all requests.

@btracey
Copy link
Member Author

btracey commented Oct 17, 2017

Implemented by gonum/gonum#265

@btracey btracey closed this Oct 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants