// PlotAddFltOva adds flt-ova points to existent plot func (o *Optimiser) PlotAddFltOva(iFlt, iOva int, sols []*Solution, ovaMult float64, fmt *plt.Fmt) { nsol := len(sols) x, y := make([]float64, nsol), make([]float64, nsol) for i, sol := range sols { x[i], y[i] = sol.Flt[iFlt], sol.Ova[iOva]*ovaMult } plt.Plot(x, y, fmt.GetArgs("")) }
// PlotAddFltFlt adds flt-flt points to existent plot func (o *Optimiser) PlotAddFltFlt(iFlt, jFlt int, sols []*Solution, fmt *plt.Fmt) { nsol := len(sols) x, y := make([]float64, nsol), make([]float64, nsol) for i, sol := range sols { x[i], y[i] = sol.Flt[iFlt], sol.Flt[jFlt] } plt.Plot(x, y, fmt.GetArgs("")) }
// PlotAddOvaOva adds ova-ova points to existent plot func (o *Optimiser) PlotAddOvaOva(iOva, jOva int, sols []*Solution, feasibleOnly bool, fmt *plt.Fmt) { var x, y []float64 for _, sol := range sols { if sol.Feasible() || !feasibleOnly { x = append(x, sol.Ova[iOva]) y = append(y, sol.Ova[jOva]) } } plt.Plot(x, y, fmt.GetArgs("")) }
func Draw(V [][]float64, C [][]int, style *plt.Fmt) { if style == nil { style = &plt.Fmt{C: "b", M: "o", Ms: 2} } type edgeType struct{ A, B int } drawnEdges := make(map[edgeType]bool) for _, cell := range C { for i := 0; i < 3; i++ { a, b := cell[i], cell[(i+1)%3] edge := edgeType{a, b} if b < a { edge.A, edge.B = edge.B, edge.A } if _, found := drawnEdges[edge]; !found { x := []float64{V[a][0], V[b][0]} y := []float64{V[a][1], V[b][1]} plt.Plot(x, y, style.GetArgs("")) drawnEdges[edge] = true } } } }
// PlotAddParetoFront highlights Pareto front func (o *Optimiser) PlotAddParetoFront(iOva, jOva int, sols []*Solution, feasibleOnly bool, fmt *plt.Fmt) { x, y, _ := GetParetoFront(iOva, jOva, sols, feasibleOnly) plt.Plot(x, y, fmt.GetArgs("")) }